Closed lebensterben closed 2 years ago
I don't understand: nothing is moving the point or mark in the initial buffer as far as I can see. When does this happen?
@Wilfred
This happens when I was invoking helpful-function when the point is on a symbol within a defun-like macro. It happens consistently.
Say I have
(define-macro symbol-name ...)
And the point is on the symbol-name. M-x helpful-function correctly shows the desired helpful buffer with the function's information.
After closing the helpful buffer, it returns to the original buffer where helpful-function was first invoked. But the point is moved to the beginning of the line.
(If I had an active region selecting the symbol, it also disappear.)
@Wilfred
Update, I'm able to reproduce this on regular defcustom
form:
defcustom
Thanks for the repro! I think the problem here is actually in helpful--definition
, so anyone doing M-x helpful-update
would still point move. I've added a different fix plus a test.
This commit wraps
helpful--update-and-switch-buffer
inside asave-buffer-and-excursion
form.This make sure that the point and mark of the original buffer (where
helpful-*
commands are invoked) are saved, before updating and showing the helpful buffer.