From 99b2e5239b2e403fd3419365b2d864f31b6b2082 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sun, 12 May 2024 22:03:40 +0200 Subject: [PATCH] Improve buffer name completion annotations --- lisp/minibuffer.el | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) 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) " ") -- 2.39.5