0

The built-in help system reuses the same *Help* buffer for each help "page" you look at.

Help buffers have their own limited analog to undo: "back" and "forward" links in the buffer (and their underlying functions: help-go-back and help-go-forward).

However, this is weaker than the standard Emacs undo system, because it loses "forward" information. For example (assuming default help keybinds), if I do

  1. C-h k C-h v (help for describe-variable),
  2. C-h k C-h f (help for describe-function),
  3. I use the "back" functionality once (back on help for describe-variable), and
  4. C-h k C-h k (help for describe-key)

then I can no longer navigate to the describe-function help using back/forward.

Contrast this with

  • Emacs' built-in buffer history functionality, which stores undos as history steps which can themselves be undone, or
  • packages like undo-tree, which post-processes the built-in buffer history into a more intuitive structure and UI+UX.

I would like to make *Help* buffer navigations log themselves into the undo history for that buffer, so that I can use native undo/redo (and thus, for free, undo-tree) instead of the special partial reinvention of help-go-{forward,back}.

What's a good way to do that?

(My first thought was wrapping or advising the relevant functions to add entries to buffer-undo-list (probably of the form (apply FUNCTION-NAME . ARGUMENTS, see buffer-undo-list docs)), but I noticed that the functions which create help pages like describe-variable also set buffer-undo-list to t, so something more invasive would be required.)

3
  • My suggestion, if you really want this: M-x report-emacs-bug. That's for enhancement requests, as well as bugs.
    – Drew
    Commented Feb 14 at 22:55
  • @Drew, thanks, but alas, I feel huge priority for making my UX/UI exactly how I want it, and low priority on the inherently less reliable, probably slower, somewhat tedious, and frequently viscerally unpleasant to me process of conveying to others what I want and why it's good to have and then waiting for it to roll into a release. Even if I did all that, I would then still want a solution in my current installed official release Emacs instances. I have also found that often the best way to get a feature or fix to happen upstream starts with me just implementing it myself anyway.
    – mtraceur
    Commented Feb 14 at 23:21
  • For others with similar wants to mine, I've moved on to an even better (for me) solution: I put advice around the function help-buffer to use a distinct buffer name for each help page. Couple examples: *Help (function: help-buffer)*, *Help (variable: undo-limit)*. This lets me keep multiple help pages open for reference at once, and buffer switching with narrowing search is even better than a history tree for revisiting help pages.
    – mtraceur
    Commented Feb 17 at 22:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.