aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Távora2017-09-28 14:17:27 +0100
committerJoão Távora2017-10-03 14:18:55 +0100
commit1b271ad76eff4bd570c292dd7a8c696c19361056 (patch)
treec487339a06846c52223557a14b79ba6b63469442
parentcd39edb5d641f82accad21cd85ff26b3995f1c85 (diff)
downloademacs-1b271ad76eff4bd570c292dd7a8c696c19361056.tar.gz
emacs-1b271ad76eff4bd570c292dd7a8c696c19361056.zip
Flymake uses some new fringe bitmaps
Also fix behaviour whereby flymake wouldn't react to a change in the variable. * lisp/progmodes/flymake-ui.el (flymake-error-bitmap) (flymake-warning-bitmap): Update bitmaps. (flymake-note-bitmap): New defcustom. (flymake-double-exclamation-mark): New bitmap. (flymake-error, flymake-warning, flymake-note) (flymake--highlight-line): 'bitmap property must be a symbol. Also set default face to flymake-error. (flymake--fringe-overlay-spec): Bitmap property can be a variable symbol.
-rw-r--r--lisp/progmodes/flymake.el69
1 files changed, 55 insertions, 14 deletions
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 20c94d20d8b..00bea3f55bd 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -44,7 +44,8 @@
44 :link '(custom-manual "(flymake) Top") 44 :link '(custom-manual "(flymake) Top")
45 :group 'tools) 45 :group 'tools)
46 46
47(defcustom flymake-error-bitmap '(exclamation-mark error) 47(defcustom flymake-error-bitmap '(flymake-double-exclamation-mark
48 compilation-error)
48 "Bitmap (a symbol) used in the fringe for indicating errors. 49 "Bitmap (a symbol) used in the fringe for indicating errors.
49The value may also be a list of two elements where the second 50The value may also be a list of two elements where the second
50element specifies the face for the bitmap. For possible bitmap 51element specifies the face for the bitmap. For possible bitmap
@@ -59,7 +60,7 @@ this is used."
59 (symbol :tag "Bitmap") 60 (symbol :tag "Bitmap")
60 (face :tag "Face")))) 61 (face :tag "Face"))))
61 62
62(defcustom flymake-warning-bitmap 'question-mark 63(defcustom flymake-warning-bitmap '(exclamation-mark compilation-warning)
63 "Bitmap (a symbol) used in the fringe for indicating warnings. 64 "Bitmap (a symbol) used in the fringe for indicating warnings.
64The value may also be a list of two elements where the second 65The value may also be a list of two elements where the second
65element specifies the face for the bitmap. For possible bitmap 66element specifies the face for the bitmap. For possible bitmap
@@ -74,6 +75,21 @@ this is used."
74 (symbol :tag "Bitmap") 75 (symbol :tag "Bitmap")
75 (face :tag "Face")))) 76 (face :tag "Face"))))
76 77
78(defcustom flymake-note-bitmap '(exclamation-mark compilation-info)
79 "Bitmap (a symbol) used in the fringe for indicating info notes.
80The value may also be a list of two elements where the second
81element specifies the face for the bitmap. For possible bitmap
82symbols, see `fringe-bitmaps'. See also `flymake-error-bitmap'.
83
84The option `flymake-fringe-indicator-position' controls how and where
85this is used."
86 :group 'flymake
87 :version "26.1"
88 :type '(choice (symbol :tag "Bitmap")
89 (list :tag "Bitmap and face"
90 (symbol :tag "Bitmap")
91 (face :tag "Face"))))
92
77(defcustom flymake-fringe-indicator-position 'left-fringe 93(defcustom flymake-fringe-indicator-position 'left-fringe
78 "The position to put flymake fringe indicator. 94 "The position to put flymake fringe indicator.
79The value can be nil (do not use indicators), `left-fringe' or `right-fringe'. 95The value can be nil (do not use indicators), `left-fringe' or `right-fringe'.
@@ -117,6 +133,25 @@ See `flymake-error-bitmap' and `flymake-warning-bitmap'."
117 "If non-nil, moving to errors wraps around buffer boundaries." 133 "If non-nil, moving to errors wraps around buffer boundaries."
118 :group 'flymake :type 'boolean) 134 :group 'flymake :type 'boolean)
119 135
136(define-fringe-bitmap 'flymake-double-exclamation-mark
137 (vector #b00000000
138 #b00000000
139 #b00000000
140 #b00000000
141 #b01100110
142 #b01100110
143 #b01100110
144 #b01100110
145 #b01100110
146 #b01100110
147 #b01100110
148 #b01100110
149 #b00000000
150 #b01100110
151 #b00000000
152 #b00000000
153 #b00000000))
154
120(defvar-local flymake-timer nil 155(defvar-local flymake-timer nil
121 "Timer for starting syntax check.") 156 "Timer for starting syntax check.")
122 157
@@ -367,17 +402,17 @@ the diagnostics of each type. The recognized properties are:
367 that differ from an existing type by only a few properties.") 402 that differ from an existing type by only a few properties.")
368 403
369(put 'flymake-error 'face 'flymake-error) 404(put 'flymake-error 'face 'flymake-error)
370(put 'flymake-error 'bitmap flymake-error-bitmap) 405(put 'flymake-error 'bitmap 'flymake-error-bitmap)
371(put 'flymake-error 'severity (warning-numeric-level :error)) 406(put 'flymake-error 'severity (warning-numeric-level :error))
372(put 'flymake-error 'mode-line-face 'compilation-error) 407(put 'flymake-error 'mode-line-face 'compilation-error)
373 408
374(put 'flymake-warning 'face 'flymake-warning) 409(put 'flymake-warning 'face 'flymake-warning)
375(put 'flymake-warning 'bitmap flymake-warning-bitmap) 410(put 'flymake-warning 'bitmap 'flymake-warning-bitmap)
376(put 'flymake-warning 'severity (warning-numeric-level :warning)) 411(put 'flymake-warning 'severity (warning-numeric-level :warning))
377(put 'flymake-warning 'mode-line-face 'compilation-warning) 412(put 'flymake-warning 'mode-line-face 'compilation-warning)
378 413
379(put 'flymake-note 'face 'flymake-note) 414(put 'flymake-note 'face 'flymake-note)
380(put 'flymake-note 'bitmap nil) 415(put 'flymake-note 'bitmap 'flymake-note-bitmap)
381(put 'flymake-note 'severity (warning-numeric-level :debug)) 416(put 'flymake-note 'severity (warning-numeric-level :debug))
382(put 'flymake-note 'mode-line-face 'compilation-info) 417(put 'flymake-note 'mode-line-face 'compilation-info)
383 418
@@ -401,14 +436,19 @@ associated `flymake-category' return DEFAULT."
401 (t 436 (t
402 default)))) 437 default))))
403 438
404(defun flymake--fringe-overlay-spec (bitmap) 439(defun flymake--fringe-overlay-spec (bitmap &optional recursed)
405 (and flymake-fringe-indicator-position 440 (if (and (symbolp bitmap)
406 bitmap 441 (boundp bitmap)
407 (propertize "!" 'display 442 (not recursed))
408 (cons flymake-fringe-indicator-position 443 (flymake--fringe-overlay-spec
409 (if (listp bitmap) 444 (symbol-value bitmap) t)
410 bitmap 445 (and flymake-fringe-indicator-position
411 (list bitmap)))))) 446 bitmap
447 (propertize "!" 'display
448 (cons flymake-fringe-indicator-position
449 (if (listp bitmap)
450 bitmap
451 (list bitmap)))))))
412 452
413(defun flymake--highlight-line (diagnostic) 453(defun flymake--highlight-line (diagnostic)
414 "Highlight buffer with info in DIAGNOSTIC." 454 "Highlight buffer with info in DIAGNOSTIC."
@@ -434,7 +474,8 @@ associated `flymake-category' return DEFAULT."
434 (and cat 474 (and cat
435 (plist-member (symbol-plist cat) prop)))) 475 (plist-member (symbol-plist cat) prop))))
436 (overlay-put ov prop value)))) 476 (overlay-put ov prop value))))
437 (default-maybe 'bitmap flymake-error-bitmap) 477 (default-maybe 'bitmap 'flymake-error-bitmap)
478 (default-maybe 'face 'flymake-error)
438 (default-maybe 'before-string 479 (default-maybe 'before-string
439 (flymake--fringe-overlay-spec 480 (flymake--fringe-overlay-spec
440 (overlay-get ov 'bitmap))) 481 (overlay-get ov 'bitmap)))