]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve buffer name completion annotations
authorEshel Yaron <me@eshelyaron.com>
Sun, 12 May 2024 20:03:40 +0000 (22:03 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sun, 12 May 2024 20:06:04 +0000 (22:06 +0200)
lisp/minibuffer.el

index 716875ae826bd225ac53fb4e3adfdbe91f2b8644..8c596eb6baf0459367c0a8471d0283d26d1109c2 100644 (file)
@@ -4290,20 +4290,17 @@ See `read-file-name' for the meaning of the arguments."
                                           (string-width name))
                                        ?\s)
                           mode
+                          (make-string (- (+ max-mode 2)
+                                          (string-width mode))
+                                       ?\s)
                           (if-let ((file-name (buffer-file-name buf)))
-                              (concat
-                               (make-string (- (+ max-mode 2)
-                                               (string-width mode))
-                                            ?\s)
-                               file-name)
-                            (when-let ((proc (get-buffer-process buf)))
-                              (concat
-                               (make-string (- (+ max-mode 2)
-                                               (string-width mode))
-                                            ?\s)
-                               (format "%s (%s)"
-                                       (process-name proc)
-                                       (process-status proc))))))
+                              (abbreviate-file-name file-name)
+                            (if-let ((proc (get-buffer-process buf)))
+                                (format "%s (%s)"
+                                        (process-name proc)
+                                        (process-status proc))
+                              (abbreviate-file-name
+                               (buffer-local-value 'default-directory buf)))))
                   'face 'completions-annotations))
          (list name (concat (propertize "X" 'face 'completions-annotations)
                             " ")