(mapcar #'symbol-name
(mapcar (apply-partially #'buffer-local-value
'major-mode)
- (mapcar #'get-buffer names))))))))
+ (delete nil (mapcar #'get-buffer names)))))))))
(mapcar
(lambda (name)
- (let* ((buf (get-buffer name))
- (mode (capitalize
- (string-replace
- "-mode" ""
- (symbol-name (buffer-local-value 'major-mode buf))))))
- (list name
- (concat (if (and (buffer-modified-p buf)
- (buffer-file-name buf))
- (propertize "*" 'face 'completions-annotations) " ")
- " ")
- (propertize
- (concat (make-string (- (+ max-name 2)
- (string-width name))
- ?\s)
- mode
- (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))))))
- 'face 'completions-annotations))))
+ (if-let* ((buf (get-buffer name))
+ (mode (capitalize
+ (string-replace
+ "-mode" ""
+ (symbol-name (buffer-local-value 'major-mode buf))))))
+ (list name
+ (concat (if (and (buffer-modified-p buf)
+ (buffer-file-name buf))
+ (propertize "*" 'face 'completions-annotations) " ")
+ " ")
+ (propertize
+ (concat (make-string (- (+ max-name 2)
+ (string-width name))
+ ?\s)
+ mode
+ (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))))))
+ 'face 'completions-annotations))
+ (list name (concat (propertize "X" 'face 'completions-annotations)
+ " ")
+ "")))
names)))
(defun completion-buffer-name-normal-predicate (buffer-name)
buffer, the completion table excludles that buffer from the list of
possible completions."
(completion-table-with-metadata
- (mapcar #'buffer-name
- (remove read-buffer-to-switch-current-buffer (buffer-list)))
+ (completion-table-dynamic
+ (lambda (&rest _)
+ (mapcar #'buffer-name
+ (remove read-buffer-to-switch-current-buffer (buffer-list)))))
`((category . buffer)
(sort-function . identity)
(narrow-completions-function . minibuffer-narrow-buffer-completions)