emacs-devel
[Top][All Lists]
Advanced

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

don't yank keymap text properties


From: Alex Schroeder
Subject: don't yank keymap text properties
Date: Sun, 12 Oct 2003 15:23:12 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

I can't remember whether Kim Storm implemented something like this or
not.  Jorgen Schaefer <address@hidden> sent me the following patch
to simple.el.  What do you think?  I think it makes sense.  Having
keymap properties yanked has bothered me on several occasions.

The patch is small, should I apply it?  I don't think we need papers
for it.

Alex.




A little patch to allow me to do

(setq yank-remove-text-properties '(read-only nil
                                    keymap nil
                                    local-map nil))

to get rid of all those pasted buttons :) Might even be a more
sensible default.

Greetings,
        -- Jorgen

P.S. You might want to change the :version in the defcustom.


--- simple.el.old       2003-10-11 15:31:16.000000000 +0200
+++ simple.el   2003-10-11 15:33:36.000000000 +0200
@@ -1881,6 +1881,12 @@
 
 ;; Yanking.
 
+(defcustom yank-remove-text-properties '(read-only nil) 
+  "*Which text properties to remove on a `yank'."
+  :group 'killing
+  :type 'plist
+  :version "21.3")
+
 (defun yank-pop (arg)
   "Replace just-yanked stretch of killed text with a different stretch.
 This command is allowed only immediately after a `yank' or a `yank-pop'.
@@ -1905,7 +1911,7 @@
     (let ((opoint (point)))
       (insert (current-kill arg))
       (let ((inhibit-read-only t))
-       (remove-text-properties opoint (point) '(read-only nil))))
+       (remove-text-properties opoint (point) yank-remove-text-properties)))
     (if before
        ;; This is like exchange-point-and-mark, but doesn't activate the mark.
        ;; It is cleaner to avoid activation, even though the command
@@ -1933,7 +1939,7 @@
                           ((eq arg '-) -1)
                           (t (1- arg)))))
     (let ((inhibit-read-only t))
-      (remove-text-properties opoint (point) '(read-only nil))))
+      (remove-text-properties opoint (point) yank-remove-text-properties)))
   (if (consp arg)
       ;; This is like exchange-point-and-mark, but doesn't activate the mark.
       ;; It is cleaner to avoid activation, even though the command





reply via email to

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