How do undo for damage done by accidental decipher-mode? reddit / emacs ---------------------------------------------------------------------- [deleted] · 2022-08-22 14:38 [deleted] ---------------------------------------------------------------------- Illiamen · 2022-08-22 16:24 Try the command `debug-on-entry`. https://www.gnu.org/software/emacs/manual/html_node/elisp/Debugger.htm l ---------------------------------------------------------------------- [deleted] · 2022-08-22 16:44 [deleted] ---------------------------------------------------------------------- ieure · 2022-08-22 17:48 You can also hit`C-h v l`, which will display a log of recent keystrokes and what commands they invoked. I've never even heard of this mode before, I have no idea how this is happening. ---------------------------------------------------------------------- 7890yuiop · 2022-08-22 22:12 I certainly can't guess how it's getting triggered, but after a brief look at the code I can tell you that: * `decipher-mode` is a major mode, and it does indeed kill the undo list for the buffer (it also makes the buffer read-only), so yeah... not ideal to *accidentally* invoke that while editing. * Being a major mode, you should be able to replace it by invoking any *other* major mode, or by calling `M-x normal-mode`. It looks like doing so should re-enable undo (but is not going to restore the original clobbered undo list). Also, `(advice-add 'decipher-mode :override #'ignore)` is a good way to disable a function, as (a) it will survive the original function getting redefined (if for some strange reason something explicitly reloaded `decipher.el`), and (b) it's possible to remove the advice to restore the original function (probably not wanted here, but useful in the general case). ---------------------------------------------------------------------- Gangsir · 2022-08-23 03:10 Yep. If OP can't figure out what's triggering it via `debug-on-entry` they could just block it by advicing it to a no-op. ---------------------------------------------------------------------- [deleted] · 2022-08-23 22:36 [deleted]