Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any workarounds for using super-save along with lv-message? #38

Open
gsingh93 opened this issue Apr 18, 2022 · 4 comments
Open

Any workarounds for using super-save along with lv-message? #38

gsingh93 opened this issue Apr 18, 2022 · 4 comments

Comments

@gsingh93
Copy link

I'm running into an issue with lsp-mode which is described in emacs-lsp/lsp-mode#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.

@bbatsov
Copy link
Owner

bbatsov commented Apr 18, 2022

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.

@gsingh93
Copy link
Author

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.

@bbatsov
Copy link
Owner

bbatsov commented Apr 26, 2022

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.

@Riyyi
Copy link

Riyyi commented Aug 28, 2022

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants