[Top][All Lists]

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

[elpa] master af3a1a9: Improve previous fix (which didn't fix all cases)

From: Tassilo Horn
Subject: [elpa] master af3a1a9: Improve previous fix (which didn't fix all cases)
Date: Sat, 9 Mar 2019 02:32:01 -0500 (EST)

branch: master
commit af3a1a963e7184649d6358939d1f1e35a2e9fd56
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>

    Improve previous fix (which didn't fix all cases)
 packages/visual-filename-abbrev/visual-filename-abbrev.el | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/packages/visual-filename-abbrev/visual-filename-abbrev.el 
index 26706f3..30b7d8a 100644
--- a/packages/visual-filename-abbrev/visual-filename-abbrev.el
+++ b/packages/visual-filename-abbrev/visual-filename-abbrev.el
@@ -109,15 +109,12 @@ This takes the font into account."
   ;; When activated from a hook, this function may run before the current
   ;; buffer is shown in a window.  In that case, `font-at' would error with
   ;; "Specified window is not displaying the current buffer".
-  (when (eq buffer (current-buffer))
-    ;; NOTE: The docs say that object in an conditional display spec is always
-    ;; a buffer, but actually it sometimes is a window.  See the already fixed
-    ;; bug#34771.
-    (let ((font (font-at pos (if (windowp buffer)
-                                buffer
-                              (get-buffer-window buffer)))))
-      (< (visual-filename-abbrev--get-visual-width abbrev font)
-        (visual-filename-abbrev--get-visual-width filename font)))))
+  (let ((window (selected-window)))
+    (when (and window
+              (eq (window-buffer window) (current-buffer)))
+      (let ((font (font-at pos window)))
+       (< (visual-filename-abbrev--get-visual-width abbrev font)
+          (visual-filename-abbrev--get-visual-width filename font))))))
 (defcustom visual-filename-abbrev-predicates
   (list #'visual-filename-abbrev--abbrev-visually-shorter-p)

reply via email to

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