unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* don't yank keymap text properties
@ 2003-10-12 13:23 Alex Schroeder
  2003-10-12 21:42 ` Kim F. Storm
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Schroeder @ 2003-10-12 13:23 UTC (permalink / raw)


I can't remember whether Kim Storm implemented something like this or
not.  Jorgen Schaefer <forcer@forcix.cx> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: don't yank keymap text properties
  2003-10-12 13:23 don't yank keymap text properties Alex Schroeder
@ 2003-10-12 21:42 ` Kim F. Storm
  2003-10-13 23:06   ` Alex Schroeder
  0 siblings, 1 reply; 3+ messages in thread
From: Kim F. Storm @ 2003-10-12 21:42 UTC (permalink / raw)
  Cc: emacs-devel

Alex Schroeder <alex@emacswiki.org> writes:

> I can't remember whether Kim Storm implemented something like this or
> not.  

RMS did the initial work, I made some extensions...

>       Jorgen Schaefer <forcer@forcix.cx> 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.

There is already a defcustom named `yank-excluded-properties' which 
includes read-only, keymap, and local-map properties. 

So I don't see why the proposed patch is needed...


> 
> 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
> 
> 
> 
> _______________________________________________
> Emacs-devel mailing list
> Emacs-devel@gnu.org
> http://mail.gnu.org/mailman/listinfo/emacs-devel
> 
> 

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: don't yank keymap text properties
  2003-10-12 21:42 ` Kim F. Storm
@ 2003-10-13 23:06   ` Alex Schroeder
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Schroeder @ 2003-10-13 23:06 UTC (permalink / raw)
  Cc: emacs-devel

storm@cua.dk (Kim F. Storm) writes:

> There is already a defcustom named `yank-excluded-properties' which 
> includes read-only, keymap, and local-map properties. 
> So I don't see why the proposed patch is needed...

You are right.  My cvs copy must have been rather old...  :)

Alex.
-- 
http://www.emacswiki.org/alex/
There is no substitute for experience.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-10-13 23:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-12 13:23 don't yank keymap text properties Alex Schroeder
2003-10-12 21:42 ` Kim F. Storm
2003-10-13 23:06   ` Alex Schroeder

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).