diff options
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/delsel.el | 20 |
2 files changed, 25 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 96e2f57d6f6..186d6e154aa 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,14 @@ | |||
| 1 | 2013-12-11 Juri Linkov <juri@jurta.org> | 1 | 2013-12-11 Juri Linkov <juri@jurta.org> |
| 2 | 2 | ||
| 3 | * delsel.el (delete-active-region): Let-bind `this-command' | ||
| 4 | to prevent `kill-region' from changing its original value. | ||
| 5 | (delete-selection-helper): Handle `overwrite-mode' for the type | ||
| 6 | `kill' exactly the same way as for the type `t'. | ||
| 7 | (insert-char, quoted-insert, reindent-then-newline-and-indent): | ||
| 8 | Support more commands. (Bug#13312) | ||
| 9 | |||
| 10 | 2013-12-11 Juri Linkov <juri@jurta.org> | ||
| 11 | |||
| 3 | * bindings.el: Map kp keys to non-kp keys systematically | 12 | * bindings.el: Map kp keys to non-kp keys systematically |
| 4 | with basic modifiers control, meta and shift. (Bug#14397) | 13 | with basic modifiers control, meta and shift. (Bug#14397) |
| 5 | 14 | ||
diff --git a/lisp/delsel.el b/lisp/delsel.el index 3c9a6561cde..f0c6996834b 100644 --- a/lisp/delsel.el +++ b/lisp/delsel.el | |||
| @@ -78,7 +78,9 @@ any selection." | |||
| 78 | "Delete the active region. | 78 | "Delete the active region. |
| 79 | If KILLP in not-nil, the active region is killed instead of deleted." | 79 | If KILLP in not-nil, the active region is killed instead of deleted." |
| 80 | (if killp | 80 | (if killp |
| 81 | (kill-region (point) (mark) t) | 81 | ;; Don't allow `kill-region' to change the value of `this-command'. |
| 82 | (let (this-command) | ||
| 83 | (kill-region (point) (mark) t)) | ||
| 82 | (funcall region-extract-function 'delete-only)) | 84 | (funcall region-extract-function 'delete-only)) |
| 83 | t) | 85 | t) |
| 84 | 86 | ||
| @@ -102,7 +104,13 @@ If KILLP in not-nil, the active region is killed instead of deleted." | |||
| 102 | FUNCTION should take no argument and return one of the above values or nil." | 104 | FUNCTION should take no argument and return one of the above values or nil." |
| 103 | (condition-case data | 105 | (condition-case data |
| 104 | (cond ((eq type 'kill) | 106 | (cond ((eq type 'kill) |
| 105 | (delete-active-region t)) | 107 | (delete-active-region t) |
| 108 | (if (and overwrite-mode | ||
| 109 | (eq this-command 'self-insert-command)) | ||
| 110 | (let ((overwrite-mode nil)) | ||
| 111 | (self-insert-command | ||
| 112 | (prefix-numeric-value current-prefix-arg)) | ||
| 113 | (setq this-command 'ignore)))) | ||
| 106 | ((eq type 'yank) | 114 | ((eq type 'yank) |
| 107 | ;; Before a yank command, make sure we don't yank the | 115 | ;; Before a yank command, make sure we don't yank the |
| 108 | ;; head of the kill-ring that really comes from the | 116 | ;; head of the kill-ring that really comes from the |
| @@ -165,10 +173,14 @@ See `delete-selection-helper'." | |||
| 165 | (not (run-hook-with-args-until-success | 173 | (not (run-hook-with-args-until-success |
| 166 | 'self-insert-uses-region-functions)))) | 174 | 'self-insert-uses-region-functions)))) |
| 167 | 175 | ||
| 176 | (put 'insert-char 'delete-selection t) | ||
| 177 | (put 'quoted-insert 'delete-selection t) | ||
| 178 | |||
| 168 | (put 'yank 'delete-selection 'yank) | 179 | (put 'yank 'delete-selection 'yank) |
| 169 | (put 'clipboard-yank 'delete-selection 'yank) | 180 | (put 'clipboard-yank 'delete-selection 'yank) |
| 170 | (put 'insert-register 'delete-selection t) | 181 | (put 'insert-register 'delete-selection t) |
| 171 | 182 | ||
| 183 | (put 'reindent-then-newline-and-indent 'delete-selection t) | ||
| 172 | (put 'newline-and-indent 'delete-selection t) | 184 | (put 'newline-and-indent 'delete-selection t) |
| 173 | (put 'newline 'delete-selection t) | 185 | (put 'newline 'delete-selection t) |
| 174 | (put 'open-line 'delete-selection 'kill) | 186 | (put 'open-line 'delete-selection 'kill) |
| @@ -197,9 +209,9 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." | |||
| 197 | (define-key minibuffer-local-completion-map "\C-g" 'abort-recursive-edit) | 209 | (define-key minibuffer-local-completion-map "\C-g" 'abort-recursive-edit) |
| 198 | (define-key minibuffer-local-must-match-map "\C-g" 'abort-recursive-edit) | 210 | (define-key minibuffer-local-must-match-map "\C-g" 'abort-recursive-edit) |
| 199 | (define-key minibuffer-local-isearch-map "\C-g" 'abort-recursive-edit) | 211 | (define-key minibuffer-local-isearch-map "\C-g" 'abort-recursive-edit) |
| 200 | (dolist (sym '(self-insert-command yank clipboard-yank | 212 | (dolist (sym '(self-insert-command insert-char quoted-insert yank clipboard-yank |
| 201 | insert-register | 213 | insert-register |
| 202 | newline-and-indent newline open-line)) | 214 | reindent-then-newline-and-indent newline-and-indent newline open-line)) |
| 203 | (put sym 'delete-selection nil)) | 215 | (put sym 'delete-selection nil)) |
| 204 | ;; continue standard unloading | 216 | ;; continue standard unloading |
| 205 | nil) | 217 | nil) |