--- emacs-24.3/lisp/simple.el +++ emacs-24.3/lisp/simple.el @@ -4018,12 +4018,14 @@ (unless transient-mark-mode (setq transient-mark-mode 'lambda)))) -(defun set-mark (pos) +(defun set-mark (pos &optional dont-activate) "Set this buffer's mark to POS. Don't use this function! That is to say, don't use this function unless you want the user to see that the mark has moved, and you want the previous mark position to be lost. +Activate the mark unless optional DONT-ACTIVATE is non-nil. + Normally, when a new mark is set, the old one should go on the stack. This is why most applications should use `push-mark', not `set-mark'. @@ -4037,9 +4039,8 @@ (if pos (progn - (setq mark-active t) - (run-hooks 'activate-mark-hook) - (set-marker (mark-marker) pos (current-buffer))) + (set-marker (mark-marker) pos (current-buffer)) + (unless dont-activate (activate-mark))) ;; Normally we never clear mark-active except in Transient Mark mode. ;; But when we actually clear out the mark value too, we must ;; clear mark-active in any mode. --- emacs-24.3/lisp/desktop.el +++ emacs-24.3/lisp/desktop.el @@ -1218,10 +1218,9 @@ (error (message "%s" (error-message-string err)) 1)))) (when desktop-buffer-mark (if (consp desktop-buffer-mark) - (progn - (set-mark (car desktop-buffer-mark)) - (setq mark-active (car (cdr desktop-buffer-mark)))) - (set-mark desktop-buffer-mark))) + (set-mark (car desktop-buffer-mark) + (not (car (cdr desktop-buffer-mark)))) + (set-mark desktop-buffer-mark t))) ;; Never override file system if the file really is read-only marked. (when desktop-buffer-read-only (setq buffer-read-only desktop-buffer-read-only)) (while desktop-buffer-locals