reddit / emacs

Any idea on the formatting of buffer-menu?

StrangeAstronomer · 2022-06-12 06:46
&#x200B; https://preview.redd.it/ozm8ieeyy4591.png?width=945&format=png&auto=webp&s=c4c2c12180b634eee67f0994053681921267b8c6 ... why are some buffer names highlighted/enboldened and others not? Function help (C-h f buffer-menu) does not explain this. I'm using the modus themes. **PARTIALLY SOLVED:** it was my customisation of iflipb that caused the formatting changes. I had the following in order to not ignore \*elfeed-search\* buffers: (defun bh:iflipb-ignore-buffers (buf) "what buffers to ignore in iflipb" (cond ((equal "*elfeed-search*" buf) nil) ((string-match "^[*]" buf) t) (:otherwise nil))) (use-package iflipb :config (setq-default iflipb-ignore-buffers 'bh:iflipb-ignore-buffers) :bind ("<C-tab>" . iflipb-next-buffer) ("<C-S-iso-lefttab>" . iflipb-previous-buffer)) Removing that 'setq-default' line resolved the problem - I can live without seeing the \*elfeed-search\* buffers in iflipb!! I'm not sure if this is worth reporting to the iflipb author. **SOLVED:** a recent update to iflipb fixed the problem - it wasn't a mistake in my customisation after all - see [https://github.com/jrosdahl/iflipb/issues/14](https://github.com/jrosdahl/iflipb/issues/14)
flexibeast · 2022-06-12 07:00
Move point over a bolded and a non-bolded entry, doing `M-x describe-char` each time. This should result in a buffer with a section "There are text properties here". What's the value of font-lock-face in each instance?
StrangeAstronomer · 2022-06-12 07:17
They all have: font-lock-face buffer-menu-buffer In full: the highlighted one (elfeed-dashboard-org) has: There are text properties here: face iflipb-current-buffer-face font-lock-face buffer-menu-buffer fontified t help-echo [Show] mouse-face highlight tabulated-list-column-name "Buffer" tabulated-list-entry [Show] tabulated-list-id #<buffer elfeed-dashboard.org> The plain text has: There are text properties here: face iflipb-other-buffer-face font-lock-face buffer-menu-buffer fontified t help-echo [Show] mouse-face highlight tabulated-list-column-name "Buffer" tabulated-list-entry [Show] tabulated-list-id #<buffer bh.org> The emboldened buffer names have: There are text properties here: font-lock-face buffer-menu-buffer fontified t help-echo [Show] mouse-face highlight tabulated-list-column-name "Buffer" tabulated-list-entry [Show] tabulated-list-id #<buffer process-photos>
flexibeast · 2022-06-12 07:21
So some package/extension called `iflipb` is modifying the display of `buffer-menu`. On my system, all buffer names in the list produced by `buffer-menu` are bolded. But on your system, `iflipb` is overriding some buffer names with `iflipb-current-buffer-face` and `iflipb-other-buffer-face`.
StrangeAstronomer · 2022-06-12 07:38
Yes - I use iflipb. Weird that it should modify some buffer names in buffer-menu!!! ``` iflipb-next-buffer is an autoloaded and interactive function defined in iflipb.el. Signature (iflipb-next-buffer ARG) Documentation Flip to the next buffer in the buffer list. Consecutive invocations switch to less recent buffers in the buffer list. Buffers matching iflipb-always-ignore-buffers are always ignored. Without a prefix argument, buffers matching iflipb-ignore-buffers are also ignored. Key Bindings global-map C-<tab> References iflipb-next-buffer is unused in iflipb.el. ```
flexibeast · 2022-06-12 07:42
How has your setup installed / enabled /activated `iflipb`? Manually, via a package management system, something else?
StrangeAstronomer · 2022-06-12 08:32
It's from elpa: ``` (defun bh:iflipb-ignore-buffers (buf) "what buffers to ignore in iflipb" (cond ((equal "*elfeed-search*" buf) nil) ((string-match "^[*]" buf) t) (:otherwise nil))) (use-package iflipb :config (setq-default iflipb-ignore-buffers 'bh:iflipb-ignore-buffers) :bind ("<C-tab>" . iflipb-next-buffer) ("<C-S-iso-lefttab>" . iflipb-previous-buffer)) ```
flexibeast · 2022-06-12 08:35
Okay, and how are you calling `buffer-menu`? Directly with `M-x buffer-menu`, or something else?
StrangeAstronomer · 2022-06-12 08:46
M-x buffer-menu works fine but I normally use C-x C-b like this: ``` (defun bh:buffer-menu (&optional arg) "runs buffer-menu but with the sense of C-u inverted (ie files only unless C-u is given)" (interactive "P") (setq arg (not arg)) (buffer-menu arg)) (global-set-key (kbd "C-x C-b") 'bh:buffer-menu) ```
flexibeast · 2022-06-12 09:22
Okay. My inexpert *guess* \- as in, i'm not familiar with Emacs internals in a sufficient amount of depth - had been that, when `iflipb` [sets the `face` property of the string representing the buffer-name](https://github.com/jrosdahl/iflipb/blob/67e33073b4f42de9fc4df76bc04ec8b31aca02ea/iflipb.el#L361), which eventually calls `validate-interval range` (`src/textprop.c`), that string-and-property might actually be represented internally as a pointer to an Emacs 'interval' (`src/interval.c`) which gets used (for efficiency reasons) whenever the buffer-name is requested by Emacs internals. But then i'm not sure why `bh:buffer-menu` exhibits the behaviour in the OP but `buffer-menu` doesn't. i'm going to bow out at this point, sorry - perhaps someone with more knowledge of Emacs internals in this regard can help further.
StrangeAstronomer · 2022-06-12 09:30
OK - thanks for taking it that far. It seems that it's some kind of bug rather than a feature!! I had supposed (hoped) that there was some semantic meaning to the enhancements that I just couldn't track down.
misbug · 2022-06-12 13:15
Not an answer to your question, but I just want to remind everyone about `ibuffer-mode`.
StrangeAstronomer · 2022-06-12 22:24
I also have `ibuffer-mode` installed but it also appears to be affected by the random face changes: https://postimg.cc/Fk0SpGgx
E3D3redit · 2022-06-13 15:44
I use & recommend also using `ibuffer`. 'info Emacs' described the cripple `buffer-menu` & `list-buffers` but only spend a few lines to the much more usefull `ibuffer` !?`ibuffer` is easy to use & to customize to your likings with different custom filters, formats, colors and more. You can find a little info about ibuffer at [https://www.emacswiki.org/emacs/IbufferMode](https://www.emacswiki.org/emacs/IbufferMode) As a little example, below my current ibuffer configuration. Beside this I also have a hydra for use only in ibuffer and custom key bindings for switching views, sorting etc. but rarely use/need these extra's. ;; Automatically update the ibuffer (add-hook 'ibuffer-hook 'ibuffer-auto-mode ;; Case-senstive searching by default (setq ibuffer-case-fold-search nil) ;; Don't show emtpy filter groups (setq ibuffer-show-empty-filter-groups nil) ;; Faces for specific buffers (read the docstring of this variable) (setq ibuffer-fontification-alist '((5 buffer-read-only font-lock-constant-face) (15 (and buffer-file-name (string-match ibuffer-compressed-file-name-regexp buffer-file-name)) font-lock-doc-face) (20 (string-match "^\\*" (buffer-name)) font-lock-variable-name-face) (22 (string-match "^\\*scratch\\*" (buffer-name)) font-lock-keyword-face) (25 (and (string-match "^ " (buffer-name)) (null buffer-file-name)) italic) (30 (equal major-mode 'shell-mode) hydra-face-teal) === part of this list is not copied here === (65 (and (boundp 'emacs-lock-mode) emacs-lock-mode) ibuffer-locked-buffer))) ;; Different layouts for displaying buffers (cycle with the ` key) setq ibuffer-formats '((mark modified read-only locked " " (name 30 30 :left :elide) " " (mode 16 16 :left :elide) " " filename-and-process) (mark modified read-only locked " " (name 28 28 :left :elide) " " (size 9 -1 :right) " " (mode 16 16 :left :elide) " " filename-and-process) (mark " " (name 33 33) " " filename))) ;; Default sorting order (cycle with , key) (setq variant gave me trouble) (customize-set-value 'ibuffer-default-sorting-mode (quote filename/process)) ;; Don't summarize columns (setq ibuffer-display-summary nil) ;; Don't open in another window but use the current one (setq ibuffer-use-other-window nil) ;; Don't minimize the ibuffer window by default (setq ibuffer-default-shrink-to-minimum-size nil)
StrangeAstronomer · 2022-06-15 08:31
Yeah - I also use ibuffer from time to time but it also suffers from the random formatting problems documented above. It's not earth shattering and I can live with it, it's just that I thought that it would have some semantic meaning - plus it's a bit worrying that this sort of cross contamination should occur. If i can narrow things down I might be able to send in a bug report to the 'guilty' party.
E3D3redit · 2022-06-15 16:23
Does iflipb also overrides faces set with `ibuffer-fontification-alist` ?
StrangeAstronomer · 2022-06-16 01:29
Partially solved above - the reason I don't use ibuffer is that it's pretty slow.
StrangeAstronomer · 2022-06-16 01:29
Partially solved above.
StrangeAstronomer · 2022-06-16 01:30
I don't know about `ibuffer-fontification-alist` but `ibuffer` itself suffers from my problem. Partially solved above...
E3D3redit · 2022-06-16 15:00
With `ibuffer-fontification-alist` you can specify precisely how to fontify buffers *for ibuffer*, according to mode, name, regular expression or whatever criteria. Too bad that it seems that only the docstring provides a little information about it, but you can find some examples online. You can also set it via customizations. [Here](https://pasteboard.co/WppVF5il4p1F.jpg) a screenshot of my ibuffer with different faces for buffers that are readonly, org-mode, plain text, lisp buffers and unimportant buffers (colored brown), and I have some more not-showed filters. Again, I have no idea if this can solve your problem 100%.
StrangeAstronomer · 2022-06-16 22:29
Thanks for the info. I'm back to trying to characterise the problem - I'm a bit confused as to what exactly is causing it. I need to do some more work to narrow it down as it seems my 'Partial Solution' above is not correct after all. I'll shut up now until I've had a chance to work at it. Am I yak-shaving yet? Maybe not.
StrangeAstronomer · 2022-06-23 00:23
Thanks again for tracking this down. A recent update to iflipb fixed the problem.