[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] master 255a011: Add `save-mark-and-excursion', which h
Re: [Emacs-diffs] master 255a011: Add `save-mark-and-excursion', which has the old `save-excursion' behavior
Mon, 04 May 2015 18:16:30 -0400
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)
> + (let ((mark (mark-marker)))
> + (and mark (marker-position mark) (copy-marker mark)))
Here you consider that (mark-marker) can return nil.
> +(defun save-mark-and-excursion--restore (saved-mark-info)
> + (let ((saved-mark (car saved-mark-info))
> + (omark (marker-position (mark-marker)))
But here you assume it's always a marker.
> + (setf nmark (marker-position saved-mark))
Old habits die hard.
> + (let ((cur-mark-active mark-active))
> + (setf mark-active saved-mark-active)
> + ;; If mark is active now, and either was not active or was at a
> + ;; different place, run the activate hook.
> + (if saved-mark-active
> + (unless (eq omark nmark)
> + (run-hooks 'activate-mark-hook))
IIUC activate-mark-hook should also be run when (eq omark nmark) but
cur-mark-active was nil.
- Re: [Emacs-diffs] master 255a011: Add `save-mark-and-excursion', which has the old `save-excursion' behavior,
Stefan Monnier <=