super-save
super-save copied to clipboard
Any workarounds for using super-save along with lv-message?
I'm running into an issue with lsp-mode
which is described in https://github.com/emacs-lsp/lsp-mode/issues/1322. lsp-mode
uses lv-message
instead of message
to print some information, and this seems to trigger saving with super-save
. I don't want to disable any super-save
triggers, so I'm wondering if there's any good way to work around this issue (i.e. is it possible to detect if certain functions resulted in the trigger and ignore it in some cases?).
I've currently worked around this issue in lsp-mode
by adding (setq lsp-signature-function 'message)
to my config file. But I'd prefer to remove this in the future so I can get the default lv-message
functionality.
I have no idea what this lv-message
is (I assume it's not a built-in) and most likely it does moves focus between buffers, otherwise it should be triggering super-save
. Seems to me that's some problem in lsp-mode
.
lv-message
is part of the lv package, which seems to come from the Hydra repository: https://github.com/abo-abo/hydra/blob/master/lv.el
If you think there's no way to fix this in super-save
itself, that's fine, you can go ahead and close this. It's true that lv-message
is probably switching buffers and so super-save
is behaving as intended, but it would be nice for both packages to be compatible with each other (and I don't think it's really possible for lv-message
to be implemented differently). I was thinking it could be possible to create a configurable function blacklist and attempt to see if the cause of the trigger is in that blacklist, possibly by checking the backtrace.
I guess we can add some extra config with ignored commands and some check for the current command here https://github.com/bbatsov/super-save/blob/master/super-save.el#L92 That should be pretty simple. #37 already proposed making the config-based predicates more modular.
@bbatsov Thanks for stearing me in the right direction, this was driving me bonkers. Here is a better solution, which keeps lv.el working:
(defun dot/super-save-disable-advice (orig-fun &rest args)
"Dont auto-save under these conditions."
(unless (equal (car args) " *LV*")
(apply orig-fun args)))
(advice-add 'super-save-command-advice :around #'dot/super-save-disable-advice)
It works by looking at the arguments of the function that super-save has advice on.
lv.el calls switch-to-buffer
with the buffer name, so we can look for that and not do the super-save call.