"Face used to highlight changed lines."\r
:group 'diff-hl)\r
\r
-(defface diff-hl-unknown\r
- '((default :inherit diff-header))\r
- "Face used to highlight unregistered files.")\r
-\r
(defcustom diff-hl-command-prefix (kbd "C-x v")\r
"The prefix for all `diff-hl' commands."\r
:group 'diff-hl\r
(const diff-hl-fringe-bmp-from-type)\r
function))\r
\r
+(defcustom diff-hl-fringe-face-function 'diff-hl-fringe-face-from-type\r
+ "Function to choose the fringe face for a given change type\r
+ and position within a hunk. Should accept two arguments."\r
+ :group 'diff-hl\r
+ :type 'function)\r
+\r
(defvar diff-hl-reference-revision nil\r
"Revision to diff against. nil means the most recent one.")\r
\r
(numberp text-scale-mode-amount))\r
(expt text-scale-mode-step text-scale-mode-amount)\r
1))\r
- (spacing (or (default-value 'line-spacing) 0))\r
- (h (round (+ (* (frame-char-height) scale)\r
- (if (floatp spacing)\r
- (* (frame-char-height) spacing)\r
- spacing))))\r
+ (spacing (or (and (display-graphic-p) (default-value 'line-spacing)) 0))\r
+ (h (+ (ceiling (* (frame-char-height) scale))\r
+ (if (floatp spacing)\r
+ (truncate (* (frame-char-height) spacing))\r
+ spacing)))\r
(w (frame-parameter nil 'left-fringe))\r
(middle (make-vector h (expt 2 (1- w))))\r
(ones (1- (expt 2 w)))\r
(aset insert-bmp (1+ middle-pos) delete-row)\r
(aset insert-bmp (1- w2) 0)\r
(define-fringe-bitmap 'diff-hl-bmp-insert insert-bmp w2 w2)\r
- (define-fringe-bitmap 'diff-hl-bmp-change (make-vector\r
- w2 (* 3 middle-bit)) w2 w2))))\r
+ )))\r
\r
(defun diff-hl-maybe-define-bitmaps ()\r
(when (window-system) ;; No fringes in the console.\r
(let* ((key (list type pos diff-hl-fringe-bmp-function))\r
(val (gethash key diff-hl-spec-cache)))\r
(unless val\r
- (let* ((face-sym (intern (format "diff-hl-%s" type)))\r
+ (let* ((face-sym (funcall diff-hl-fringe-face-function type pos))\r
(bmp-sym (funcall diff-hl-fringe-bmp-function type pos)))\r
(setq val (propertize " " 'display `((left-fringe ,bmp-sym ,face-sym))))\r
(puthash key val diff-hl-spec-cache)))\r
val))\r
\r
+(defun diff-hl-fringe-face-from-type (type _pos)\r
+ (intern (format "diff-hl-%s" type)))\r
+\r
(defun diff-hl-fringe-bmp-from-pos (_type pos)\r
(intern (format "diff-hl-bmp-%s" pos)))\r
\r
(defun diff-hl-fringe-bmp-from-type (type _pos)\r
- (if (eq type 'unknown)\r
- 'question-mark\r
- (intern (format "diff-hl-bmp-%s" type))))\r
+ (cl-case type\r
+ (unknown 'question-mark)\r
+ (change 'exclamation-mark)\r
+ (t (intern (format "diff-hl-bmp-%s" type)))))\r
\r
(defvar vc-svn-diff-switches)\r
\r