emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/annotate ece50f65fe 220/372: - fixed managing return value


From: ELPA Syncer
Subject: [nongnu] elpa/annotate ece50f65fe 220/372: - fixed managing return value of "(get-text-property changed-face-pos 'face)"
Date: Fri, 4 Feb 2022 16:59:01 -0500 (EST)

branch: elpa/annotate
commit ece50f65fe74533df98b0ef40290f3de3e7b0bc7
Author: cage <cage-invalid@invalid>
Commit: cage <cage-invalid@invalid>

    - fixed managing return value of "(get-text-property changed-face-pos 
'face)"
    
      When finding  the face of a portion  of buffer, to try to  get the right
      positioning   of   the    annotation,   using:
    
      "(get-text-property changed-face-pos 'face)"
    
      the code  assumed this function returned  a symbol (the face  of the
      text) or nil: this is  incorrect according to the documentation; the
      code above can returns a symbol, a plist or even list of symbols!
    
      This patch try  to deal with the different types  of object the above
      code can returns.
---
 annotate.el | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/annotate.el b/annotate.el
index a0ecbf8c7b..5dcac38a76 100644
--- a/annotate.el
+++ b/annotate.el
@@ -1538,7 +1538,17 @@ The searched interval can be customized setting the 
variable:
                                all-faces))
                        (setf all-faces-height
                              (mapcar (lambda (face)
-                                       (face-attribute face :height nil 
'default))
+                                       (cond
+                                        ((facep face)
+                                         (face-attribute face :height nil 
'default))
+                                        ((and (consp face)
+                                              (keywordp (cl-first face))) ; a 
plist
+                                         (cl-getf face :height
+                                                  (face-attribute 'default 
:height)))
+                                        ((consp face) ; a list of named face, 
first wins
+                                         (face-attribute (cl-first face) 
:height nil 'default))
+                                        (t
+                                         (face-attribute 'default :height))))
                                      (cl-remove-if #'null all-faces)))
                        (setf force-newline-p
                              (cl-find-if (lambda (a) (/= a 
default-face-height))



reply via email to

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