diff options
| author | Roland McGrath | 1993-07-08 22:37:42 +0000 |
|---|---|---|
| committer | Roland McGrath | 1993-07-08 22:37:42 +0000 |
| commit | 19d353745fd01b621b6deaadccfdae4030cd01be (patch) | |
| tree | b12623d594c5ee30008f465a81365c88a5a54095 | |
| parent | 67cbb73ffd3e335ce67286b3c26bfc80ad3e8517 (diff) | |
| download | emacs-19d353745fd01b621b6deaadccfdae4030cd01be.tar.gz emacs-19d353745fd01b621b6deaadccfdae4030cd01be.zip | |
(deactivate-mark): New function.
(kill-ring-save, pop-mark, keyboard-quit): Call it.
| -rw-r--r-- | lisp/simple.el | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index b6b3b362f46..f69efad6872 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -1096,9 +1096,8 @@ system cut and paste." | |||
| 1096 | ;; as C-g would as a command. | 1096 | ;; as C-g would as a command. |
| 1097 | (and quit-flag transient-mark-mode mark-active | 1097 | (and quit-flag transient-mark-mode mark-active |
| 1098 | (progn | 1098 | (progn |
| 1099 | (message "foo") | 1099 | (message "foo") ;XXX what is this here for? --roland |
| 1100 | (setq mark-active nil) | 1100 | (deactivate-mark)))) |
| 1101 | (run-hooks 'deactivate-mark-hook)))) | ||
| 1102 | (let* ((killed-text (current-kill 0)) | 1101 | (let* ((killed-text (current-kill 0)) |
| 1103 | (message-len (min (length killed-text) 40))) | 1102 | (message-len (min (length killed-text) 40))) |
| 1104 | (if (= (point) beg) | 1103 | (if (= (point) beg) |
| @@ -1259,6 +1258,14 @@ a mistake; see the documentation of `set-mark'." | |||
| 1259 | (marker-position (mark-marker)) | 1258 | (marker-position (mark-marker)) |
| 1260 | (signal 'mark-inactive nil))) | 1259 | (signal 'mark-inactive nil))) |
| 1261 | 1260 | ||
| 1261 | ;; Many places set mark-active directly, and several of them failed to also | ||
| 1262 | ;; run deactivate-mark-hook. This shorthand should simplify. | ||
| 1263 | (defsubst deactivate-mark () | ||
| 1264 | "Deactivate the mark by setting `mark-active' to nil. | ||
| 1265 | Also runs the hook `deactivate-mark-hook'." | ||
| 1266 | (setq mark-active nil) | ||
| 1267 | (run-hooks 'deactivate-mark-hook)) | ||
| 1268 | |||
| 1262 | (defun set-mark (pos) | 1269 | (defun set-mark (pos) |
| 1263 | "Set this buffer's mark to POS. Don't use this function! | 1270 | "Set this buffer's mark to POS. Don't use this function! |
| 1264 | That is to say, don't use this function unless you want | 1271 | That is to say, don't use this function unless you want |
| @@ -1334,8 +1341,7 @@ Does not set point. Does nothing if mark ring is empty." | |||
| 1334 | (progn | 1341 | (progn |
| 1335 | (setq mark-ring (nconc mark-ring (list (copy-marker (mark-marker))))) | 1342 | (setq mark-ring (nconc mark-ring (list (copy-marker (mark-marker))))) |
| 1336 | (set-marker (mark-marker) (+ 0 (car mark-ring)) (current-buffer)) | 1343 | (set-marker (mark-marker) (+ 0 (car mark-ring)) (current-buffer)) |
| 1337 | (if transient-mark-mode | 1344 | (deactivate-mark) |
| 1338 | (setq mark-active nil)) | ||
| 1339 | (move-marker (car mark-ring) nil) | 1345 | (move-marker (car mark-ring) nil) |
| 1340 | (if (null (mark t)) (ding)) | 1346 | (if (null (mark t)) (ding)) |
| 1341 | (setq mark-ring (cdr mark-ring))))) | 1347 | (setq mark-ring (cdr mark-ring))))) |
| @@ -2149,10 +2155,7 @@ in the mode line." | |||
| 2149 | During execution of Lisp code, this character causes a quit directly. | 2155 | During execution of Lisp code, this character causes a quit directly. |
| 2150 | At top-level, as an editor command, this simply beeps." | 2156 | At top-level, as an editor command, this simply beeps." |
| 2151 | (interactive) | 2157 | (interactive) |
| 2152 | (and transient-mark-mode mark-active | 2158 | (deactivate-mark) |
| 2153 | (progn | ||
| 2154 | (setq mark-active nil) | ||
| 2155 | (run-hooks 'deactivate-mark-hook))) | ||
| 2156 | (signal 'quit nil)) | 2159 | (signal 'quit nil)) |
| 2157 | 2160 | ||
| 2158 | (define-key global-map "\C-g" 'keyboard-quit) | 2161 | (define-key global-map "\C-g" 'keyboard-quit) |