emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r115453: * lisp/delsel.el (delete-active-region): Le


From: Juri Linkov
Subject: [Emacs-diffs] trunk r115453: * lisp/delsel.el (delete-active-region): Let-bind `this-command'
Date: Wed, 11 Dec 2013 01:11:27 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115453
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/13312
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Wed 2013-12-11 03:11:24 +0200
message:
  * lisp/delsel.el (delete-active-region): Let-bind `this-command'
  to prevent `kill-region' from changing its original value.
  (delete-selection-helper): Handle `overwrite-mode' for the type
  `kill' exactly the same way as for the type `t'.
  (insert-char, quoted-insert, reindent-then-newline-and-indent):
  Support more commands.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/delsel.el                 delsel.el-20091113204419-o5vbwnq5f7feedwu-540
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-12-11 00:45:10 +0000
+++ b/lisp/ChangeLog    2013-12-11 01:11:24 +0000
@@ -1,5 +1,14 @@
 2013-12-11  Juri Linkov  <address@hidden>
 
+       * delsel.el (delete-active-region): Let-bind `this-command'
+       to prevent `kill-region' from changing its original value.
+       (delete-selection-helper): Handle `overwrite-mode' for the type
+       `kill' exactly the same way as for the type `t'.
+       (insert-char, quoted-insert, reindent-then-newline-and-indent):
+       Support more commands.  (Bug#13312)
+
+2013-12-11  Juri Linkov  <address@hidden>
+
        * bindings.el: Map kp keys to non-kp keys systematically
        with basic modifiers control, meta and shift.  (Bug#14397)
 

=== modified file 'lisp/delsel.el'
--- a/lisp/delsel.el    2013-12-08 04:20:50 +0000
+++ b/lisp/delsel.el    2013-12-11 01:11:24 +0000
@@ -78,7 +78,9 @@
   "Delete the active region.
 If KILLP in not-nil, the active region is killed instead of deleted."
   (if killp
-      (kill-region (point) (mark) t)
+      ;; Don't allow `kill-region' to change the value of `this-command'.
+      (let (this-command)
+       (kill-region (point) (mark) t))
     (funcall region-extract-function 'delete-only))
   t)
 
@@ -102,7 +104,13 @@
      FUNCTION should take no argument and return one of the above values or 
nil."
   (condition-case data
       (cond ((eq type 'kill)
-            (delete-active-region t))
+            (delete-active-region t)
+            (if (and overwrite-mode
+                     (eq this-command 'self-insert-command))
+                (let ((overwrite-mode nil))
+                  (self-insert-command
+                   (prefix-numeric-value current-prefix-arg))
+                  (setq this-command 'ignore))))
            ((eq type 'yank)
             ;; Before a yank command, make sure we don't yank the
             ;; head of the kill-ring that really comes from the
@@ -165,10 +173,14 @@
        (not (run-hook-with-args-until-success
              'self-insert-uses-region-functions))))
 
+(put 'insert-char 'delete-selection t)
+(put 'quoted-insert 'delete-selection t)
+
 (put 'yank 'delete-selection 'yank)
 (put 'clipboard-yank 'delete-selection 'yank)
 (put 'insert-register 'delete-selection t)
 
+(put 'reindent-then-newline-and-indent 'delete-selection t)
 (put 'newline-and-indent 'delete-selection t)
 (put 'newline 'delete-selection t)
 (put 'open-line 'delete-selection 'kill)
@@ -197,9 +209,9 @@
   (define-key minibuffer-local-completion-map "\C-g" 'abort-recursive-edit)
   (define-key minibuffer-local-must-match-map "\C-g" 'abort-recursive-edit)
   (define-key minibuffer-local-isearch-map "\C-g" 'abort-recursive-edit)
-  (dolist (sym '(self-insert-command yank clipboard-yank
+  (dolist (sym '(self-insert-command insert-char quoted-insert yank 
clipboard-yank
                 insert-register
-                 newline-and-indent newline open-line))
+                 reindent-then-newline-and-indent newline-and-indent newline 
open-line))
     (put sym 'delete-selection nil))
   ;; continue standard unloading
   nil)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]