From: Eshel Yaron Date: Sun, 12 May 2024 20:03:40 +0000 (+0200) Subject: Improve buffer name completion annotations X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=99b2e5239b2e403fd3419365b2d864f31b6b2082;p=emacs.git Improve buffer name completion annotations --- diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 716875ae826..8c596eb6baf 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -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) " ")