aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-05-17 21:52:21 +0000
committerRichard M. Stallman1993-05-17 21:52:21 +0000
commit66050f1032c6371333e6f0303de01c7022f908ef (patch)
tree9ec489ec7e17a8e5cf9176de7832ac96ea562cfe
parent7492a21ec20088e1e3c55dc9eca09ab267e04478 (diff)
downloademacs-66050f1032c6371333e6f0303de01c7022f908ef.tar.gz
emacs-66050f1032c6371333e6f0303de01c7022f908ef.zip
(keyboard-quit): Run deactivate-mark-hook.
(kill-ring-save): If quit happens while cursor is bounced,
-rw-r--r--lisp/simple.el50
1 files changed, 33 insertions, 17 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 3b2f28b6e33..550357f9c9b 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1059,21 +1059,35 @@ system cut and paste."
1059 (interactive "r") 1059 (interactive "r")
1060 (copy-region-as-kill beg end) 1060 (copy-region-as-kill beg end)
1061 (if (interactive-p) 1061 (if (interactive-p)
1062 (save-excursion 1062 (let ((other-end (if (= (point) beg) end beg))
1063 (let ((other-end (if (= (point) beg) end beg))) 1063 (opoint (point))
1064 (if (pos-visible-in-window-p other-end (selected-window)) 1064 ;; Inhibit quitting so we can make a quit here
1065 (let ((omark (mark t))) 1065 ;; look like a C-g typed as a command.
1066 (set-marker (mark-marker) (point) (current-buffer)) 1066 (inhibit-quit t))
1067 (goto-char other-end) 1067 (if (pos-visible-in-window-p other-end (selected-window))
1068 (sit-for 1)) 1068 (progn
1069 (let* ((killed-text (current-kill 0)) 1069 ;; Swap point and mark.
1070 (message-len (min (length killed-text) 40))) 1070 (set-marker (mark-marker) (point) (current-buffer))
1071 (if (= (point) beg) 1071 (goto-char other-end)
1072 ;; Don't say "killed"; that is misleading. 1072 (sit-for 1)
1073 (message "Saved text until \"%s\"" 1073 ;; Swap back.
1074 (substring killed-text (- message-len))) 1074 (set-marker (mark-marker) other-end (current-buffer))
1075 (message "Saved text from \"%s\"" 1075 (goto-char opoint)
1076 (substring killed-text 0 message-len))))))))) 1076 ;; If user quit, deactivate the mark
1077 ;; as C-g would as a command.
1078 (and quit-flag transient-mark-mode mark-active
1079 (progn
1080 (message "foo")
1081 (setq mark-active nil)
1082 (run-hooks 'deactivate-mark-hook))))
1083 (let* ((killed-text (current-kill 0))
1084 (message-len (min (length killed-text) 40)))
1085 (if (= (point) beg)
1086 ;; Don't say "killed"; that is misleading.
1087 (message "Saved text until \"%s\""
1088 (substring killed-text (- message-len)))
1089 (message "Saved text from \"%s\""
1090 (substring killed-text 0 message-len))))))))
1077 1091
1078(defun append-next-kill () 1092(defun append-next-kill ()
1079 "Cause following command, if it kills, to append to previous kill." 1093 "Cause following command, if it kills, to append to previous kill."
@@ -2092,8 +2106,10 @@ in the mode line."
2092During execution of Lisp code, this character causes a quit directly. 2106During execution of Lisp code, this character causes a quit directly.
2093At top-level, as an editor command, this simply beeps." 2107At top-level, as an editor command, this simply beeps."
2094 (interactive) 2108 (interactive)
2095 (if transient-mark-mode 2109 (and transient-mark-mode mark-active
2096 (setq mark-active nil)) 2110 (progn
2111 (setq mark-active nil)
2112 (run-hooks 'deactivate-mark-hook)))
2097 (signal 'quit nil)) 2113 (signal 'quit nil))
2098 2114
2099(define-key global-map "\C-g" 'keyboard-quit) 2115(define-key global-map "\C-g" 'keyboard-quit)