emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] scratch/flymake-refactor 9d93d46 5/6: New flymake fringe b


From: João Távora
Subject: [Emacs-diffs] scratch/flymake-refactor 9d93d46 5/6: New flymake fringe bitmaps
Date: Thu, 28 Sep 2017 10:28:23 -0400 (EDT)

branch: scratch/flymake-refactor
commit 9d93d466b9bebed984268fa493f1a11c6b4fb803
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>

    New flymake 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.
    (flymake--fringe-overlay-spec): Bitmap property can be a
    variable symbol.
---
 lisp/progmodes/flymake-ui.el | 68 +++++++++++++++++++++++++++++++++++---------
 1 file changed, 54 insertions(+), 14 deletions(-)

diff --git a/lisp/progmodes/flymake-ui.el b/lisp/progmodes/flymake-ui.el
index 14c5d02..7eb2791 100644
--- a/lisp/progmodes/flymake-ui.el
+++ b/lisp/progmodes/flymake-ui.el
@@ -44,7 +44,8 @@
   :link '(custom-manual "(flymake) Top")
   :group 'tools)
 
-(defcustom flymake-error-bitmap '(exclamation-mark error)
+(defcustom flymake-error-bitmap '(flymake-double-exclamation-mark
+                                  compilation-error)
   "Bitmap (a symbol) used in the fringe for indicating errors.
 The value may also be a list of two elements where the second
 element specifies the face for the bitmap.  For possible bitmap
@@ -59,7 +60,7 @@ this is used."
                        (symbol :tag "Bitmap")
                        (face :tag "Face"))))
 
-(defcustom flymake-warning-bitmap 'question-mark
+(defcustom flymake-warning-bitmap '(exclamation-mark compilation-warning)
   "Bitmap (a symbol) used in the fringe for indicating warnings.
 The value may also be a list of two elements where the second
 element specifies the face for the bitmap.  For possible bitmap
@@ -74,6 +75,21 @@ this is used."
                        (symbol :tag "Bitmap")
                        (face :tag "Face"))))
 
+(defcustom flymake-note-bitmap '(exclamation-mark compilation-info)
+  "Bitmap (a symbol) used in the fringe for indicating info notes.
+The value may also be a list of two elements where the second
+element specifies the face for the bitmap.  For possible bitmap
+symbols, see `fringe-bitmaps'.  See also `flymake-error-bitmap'.
+
+The option `flymake-fringe-indicator-position' controls how and where
+this is used."
+  :group 'flymake
+  :version "26.1"
+  :type '(choice (symbol :tag "Bitmap")
+                 (list :tag "Bitmap and face"
+                       (symbol :tag "Bitmap")
+                       (face :tag "Face"))))
+
 (defcustom flymake-fringe-indicator-position 'left-fringe
   "The position to put flymake fringe indicator.
 The value can be nil (do not use indicators), `left-fringe' or `right-fringe'.
@@ -119,6 +135,25 @@ See `flymake-error-bitmap' and `flymake-warning-bitmap'."
   "If non-nil, moving to errors wraps around buffer boundaries."
   :group 'flymake :type 'boolean)
 
+(define-fringe-bitmap 'flymake-double-exclamation-mark
+  (vector #b00000000
+          #b00000000
+          #b00000000
+          #b00000000
+          #b01100110
+          #b01100110
+          #b01100110
+          #b01100110
+          #b01100110
+          #b01100110
+          #b01100110
+          #b01100110
+          #b00000000
+          #b01100110
+          #b00000000
+          #b00000000
+          #b00000000))
+
 (defvar-local flymake-timer nil
   "Timer for starting syntax check.")
 
@@ -348,15 +383,15 @@ with flymake-specific meaning can also be used.
   help sort overlapping overlays.")
 
 (put 'flymake-error 'face 'flymake-error)
-(put 'flymake-error 'bitmap flymake-error-bitmap)
+(put 'flymake-error 'bitmap 'flymake-error-bitmap)
 (put 'flymake-error 'severity (warning-numeric-level :error))
 
 (put 'flymake-warning 'face 'flymake-warning)
-(put 'flymake-warning 'bitmap flymake-warning-bitmap)
+(put 'flymake-warning 'bitmap 'flymake-warning-bitmap)
 (put 'flymake-warning 'severity (warning-numeric-level :warning))
 
 (put 'flymake-note 'face 'flymake-note)
-(put 'flymake-note 'bitmap nil)
+(put 'flymake-note 'bitmap 'flymake-note-bitmap)
 (put 'flymake-note 'severity (warning-numeric-level :debug))
 
 (defun flymake--lookup-type-property (type prop &optional default)
@@ -379,14 +414,19 @@ return DEFAULT."
           (t
            default))))
 
-(defun flymake--fringe-overlay-spec (bitmap)
-  (and flymake-fringe-indicator-position
-       bitmap
-       (propertize "!" 'display
-                   (cons flymake-fringe-indicator-position
-                         (if (listp bitmap)
-                             bitmap
-                           (list bitmap))))))
+(defun flymake--fringe-overlay-spec (bitmap &optional recursed)
+  (if (and (symbolp bitmap)
+           (boundp bitmap)
+           (not recursed))
+      (flymake--fringe-overlay-spec
+       (symbol-value bitmap) t)
+    (and flymake-fringe-indicator-position
+         bitmap
+         (propertize "!" 'display
+                     (cons flymake-fringe-indicator-position
+                           (if (listp bitmap)
+                               bitmap
+                             (list bitmap)))))))
 
 (defun flymake--highlight-line (diagnostic)
   "Highlight buffer with info in DIAGNOSTIC."
@@ -408,7 +448,7 @@ return DEFAULT."
                               (and cat
                                    (plist-member (symbol-plist cat) prop))))
                   (overlay-put ov prop value))))
-      (default-maybe 'bitmap flymake-error-bitmap)
+      (default-maybe 'bitmap 'flymake-error-bitmap)
       (default-maybe 'before-string
         (flymake--fringe-overlay-spec
          (overlay-get ov 'bitmap)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]