Function: mh-do-at-event-location
mh-do-at-event-location is an autoloaded macro defined in mh-acros.el.
Signature
(mh-do-at-event-location EVENT &rest BODY)
Documentation
Switch to the location of EVENT and execute BODY.
After BODY has been executed return to original window. The modification flag of the buffer in the event window is preserved.
Source Code
;; Defined in /usr/src/emacs/lisp/mh-e/mh-acros.el
;;;###mh-autoload
(defmacro mh-do-at-event-location (event &rest body)
"Switch to the location of EVENT and execute BODY.
After BODY has been executed return to original window.
The modification flag of the buffer in the event window is
preserved."
(declare (debug t) (indent defun))
(let ((event-window (make-symbol "event-window"))
(event-position (make-symbol "event-position"))
(original-window (make-symbol "original-window"))
(original-position (make-symbol "original-position"))
(modified-flag (make-symbol "modified-flag")))
`(save-excursion
(let* ((,event-window
(or (mh-funcall-if-exists posn-window (event-start ,event))
(mh-funcall-if-exists event-window ,event)))
(,event-position
(or (mh-funcall-if-exists posn-point (event-start ,event))
(mh-funcall-if-exists event-closest-point ,event)))
(,original-window (selected-window))
(,original-position (progn
(set-buffer (window-buffer ,event-window))
(point-marker)))
(,modified-flag (buffer-modified-p))
(buffer-read-only nil))
(unwind-protect (progn
(select-window ,event-window)
(goto-char ,event-position)
,@body)
(set-buffer-modified-p ,modified-flag)
(goto-char ,original-position)
(set-marker ,original-position nil)
(select-window ,original-window))))))