Latest Update seemed to have killed switching buffer with mouse-1 click on buffer name on default theme
technician77 opened this issue · comments
I use the settings below. System is cygwin64 emacs-w32 (Gui-Version). Before the update I could click on the buffer name with mouse-1 (left) and it switched to the next buffer and mouse-3 (right) it switched to the previous buffer. This does not work anymore when default theme is enabled. Without setting the powerline-default-theme it does work.
Umm, by the way is there a way to move the mule-info to the right? I'd like to see that information, but I often accidently click the mule info, causing the coding to be switched, instead of the buffer name therefore I removed it. On the right side this wouldn't be a problem.
(require 'powerline)
(powerline-default-theme)
(setq powerline-display-mule-info nil)
(setq powerline-display-buffer-size nil)
Just checked, you are right I broke it.
I'm on it, should be fixed soon.
Apparently it is not that simple.
I can set new faces if I remove all previous face properties (which I currently do), but removing text properties also removes the mouse click events.
But if I do not remove the text properties all the ones that I try to apply are ignored by format-mode-line
.
I read in the doc that (format-mode-line FORMAT &optional FACE WINDOW BUFFER)
uses mode-line-format
for FORMAT
, and that
unless the symbol has a non-nil
`risky-local-variable' property, all properties in any strings, as
well as all :eval and :propertize forms in the value, are ignored.
(the FACE argument is actually not a face but either nil, t, or an integer)
I tried this to set that risky property but I can't seem to get it right.
Any help ?
My non working code so far:
;;;###autoload (autoload 'powerline-buffer-id "powerline")
(defun powerline-buffer-id (&optional face pad)
(put 'mode-line-buffer-identification 'risky-local-variable t)
(powerline-raw (powerline-trim (format-mode-line mode-line-buffer-identification))
face pad))
Two questions:
- Isn't there already a face for customizing the buffer ID? I thought the builtin mode line has one?
- I think what you should do is when you re-format the text, just add back the mouse properties. I.e., find out what they are by default, and then set them in the new format. I think you can see an example if you look at the powerline-major-mode function.
and by 're-format' i mean 're-properterize'
-
There is a face called mode-line-buffer-id, but emacs does not have a built-in mode-line-buffer-id-inactive.
-
Good idea, I think I will take that approach.
format-mode-line
is written in C and that's why I was not really sure of how it did it or if I could add that property myself, so thanks for the example I will try something like this.
Apparently I am not the only one who has been struggling on this.
Done, thanks for the advice !