When I'm in
Help-mode buffer generated from
describe-function or similar command - after placing cursor on clickable filename text I wish to open this file in the same window (ideally I wish I could also kill this help buffer the same time). How can I achieve that?
Here is a
push-button function wrapper:
(defun eab/push-button-on-file-same-window () (interactive) (let ((cwc (current-window-configuration)) (hb (current-buffer)) (file? (button-get (button-at (point)) 'help-args))) (funcall `(lambda () (defun eab/push-button-on-file-same-window-internal () (if (> (length ',file?) 1) (let ((cb (current-buffer))) (set-window-configuration ,cwc) (switch-to-buffer cb) (kill-buffer ,hb))))))) (call-interactively 'push-button) (run-with-timer 0.01 nil 'eab/push-button-on-file-same-window-internal))
It implements required behaviour.
Upd. Removed unnecessary
file-exist-p checking. Now it works for
C source files.