unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alex Schroeder <alex@emacswiki.org>
Subject: don't yank keymap text properties
Date: Sun, 12 Oct 2003 15:23:12 +0200	[thread overview]
Message-ID: <87d6d2zj27.fsf@emacswiki.org> (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

             reply	other threads:[~2003-10-12 13:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-12 13:23 Alex Schroeder [this message]
2003-10-12 21:42 ` don't yank keymap text properties Kim F. Storm
2003-10-13 23:06   ` Alex Schroeder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d6d2zj27.fsf@emacswiki.org \
    --to=alex@emacswiki.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).