josior · 2022-05-07 19:52
I tried to customize the mode-line-buffer-id face and add the `:box` property, then removing the `:box` property from the mode-line face, but it does not show a border on all sides: https://i.imgur.com/2NLcgvO.png
What is making the border show like that?
Thanks!
eli-zaretskii · 2022-05-08 06:30
Show your code.
josior · 2022-05-08 12:14
Here it is:
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(mode-line ((t (:background "grey75" :foreground "black"))))
'(mode-line-buffer-id ((t (:box (:line-width 2 :color "red") :weight bold))))
'(mode-line-inactive ((t (:inherit mode-line :background "grey90" :foreground "grey20" :weight light)))))
Same result with emacs -Q.
Danrobi1 · 2022-05-08 15:01
You can have it boxed like this: (Recommend testing in the scratch buffer)
(setq mode-line-format (propertize " %b " 'face '(:box (:line-width 2 :color "red") :weight bold)))
[customizing the mode-line](https://emacs-fu.blogspot.com/2011/08/customizing-mode-line.html)
00-11 · 2022-05-08 16:28
Library [Mode-Line Selected Window](https://www.emacswiki.org/emacs/ModeLineSelectedWindow) ([`modeline-win.el`](https://www.emacswiki.org/emacs/download/modeline-win.el)) does this for you. It uses face `mlw-mode-line-buffer-id-selected-window` for the `mode-line-buffer-identification`. The face is boxed by default:
(defface mlw-mode-line-buffer-id-selected-window
'((t (:box (:line-width 1 :color "green") :background "#EF47FFFFC847")))
"Face for `mode-line-buffer-identification' of selected window."
:group 'mode-line-faces :group 'basic-faces)
It's a very tiny library.
You can turn this highlighting on/off with minor mode
`mlw-mode-line-buf-id-sel-win-mode`.
----
And if you use library [Narrow Indirect](https://www.emacswiki.org/emacs/NarrowIndirect) ([`narrow-indirect.el`](https://www.emacswiki.org/emacs/download/narrow-indirect.el)) then [indirect buffers](https://www.emacswiki.org/emacs/IndirectBuffers) that are cloned from a buffer have similar names, by default, and their `mode-line-buffer-identification` is indicated with a different face, `ni-mode-line-buffer-id` (which is also boxed by default, but with a different border color):
(defface ni-mode-line-buffer-id '((t (:box (:line-width 1 :color "green"))))
"Like `mode-line-buffer-id', but for a narrowed indirect clone buffer."
:group 'Narrow-Indirect :group 'mode-line-faces :group 'basic-faces)
josior · 2022-05-08 17:51
When you do this you see the border on the sides? I just see on top/bottom, no borders on left/right sides.
josior · 2022-05-08 17:54
I tried with the `modeline-win` but the borders appear only on top/bottom, not on the sides, like this: https://i.imgur.com/2nk5TJg.png
00-11 · 2022-05-08 19:14
You'll need to upgrade Emacs to release 18. What you see is a bug prior that release:
* https://debbugs.gnu.org/cgi/bugreport.cgi?bug=40124
josior · 2022-05-08 19:46
That explains it. Thanks!