From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: keymap in yank-excluded-properties Date: 23 Aug 2002 11:52:15 +0200 Sender: emacs-devel-admin@gnu.org Message-ID: <5xd6s9c374.fsf@kfs2.cua.dk> References: <20020822.173129.01368056.Takaaki.Ota@am.sony.com> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1030092752 3456 127.0.0.1 (23 Aug 2002 08:52:32 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 23 Aug 2002 08:52:32 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17iABC-0000td-00 for ; Fri, 23 Aug 2002 10:52:30 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17iAeU-0005NU-00 for ; Fri, 23 Aug 2002 11:22:47 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17iACL-0000OD-00; Fri, 23 Aug 2002 04:53:41 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17iAAg-0000Lc-00 for emacs-devel@gnu.org; Fri, 23 Aug 2002 04:51:58 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17iAAe-0000LN-00 for emacs-devel@gnu.org; Fri, 23 Aug 2002 04:51:58 -0400 Original-Received: from mail.filanet.dk ([195.215.206.179]) by monty-python.gnu.org with esmtp (Exim 4.10) id 17iAAe-0000L3-00 for emacs-devel@gnu.org; Fri, 23 Aug 2002 04:51:56 -0400 Original-Received: from kfs2.cua.dk.cua.dk (kfs2.local.filanet.dk [192.168.1.182]) by mail.filanet.dk (Postfix) with SMTP id 4097B7C01F; Fri, 23 Aug 2002 08:51:49 +0000 (GMT) Original-To: Tak Ota In-Reply-To: <20020822.173129.01368056.Takaaki.Ota@am.sony.com> Original-Lines: 71 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:6785 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:6785 Tak Ota writes: > Since the following change was made to yank's underpinning, a table > created by `table.el' becomes dead after copying because keymap text > property is stripped off at yank. > > 2002-04-29 Kim F. Storm > > * subr.el (remove-yank-excluded-properties): New helper function. > (insert-for-yank, insert-buffer-substring-as-yank): Use it. > > * simple.el (yank-excluded-properties): Added help-echo to list. I cannot take all the credit for this :-) It was actually Richard who added the yank-excluded-properties feature in the first place. > Is it generally a good idea not to copy keymap text property? Definitely! Depending on the target, keeping a keymap text property is like burying a landmine waiting for someone to step on it. > If > majority of you agree that yank normally should not copy keymap > property, is the following modification to the function > `remove-yank-excluded-properties' acceptable? The idea is if a > special text property `yank-preserve-all-properties' exists in the > region and its value is non-nil then yank will not strip any text > properties off. Again, it depends on what the target is. I would say that if the source and target buffers are the same, or have the same major-mode, then probably keeping (more) text properties when yanking might be acceptable. But doing that requires saving some context info with each kill, so its not trivial to do. An alternative would be to have a simple function: (defun yank-with-properties (&optional arg) "Like `yank', but does not remove text properties from inserted text." (interactive "*P") (let ((yank-excluded-properties nil)) (yank arg))) Then you can make an alias if you like. (defalias 'yank-table 'yank-with-properties) Of course, the problem is how to put this functionality on C-y ... Maybe something like this could be used: (defun yank-keep-tables (&optional arg) "Like `yank' but knows about tables." (interactive ...) (let ((start (point)) end) (let ((yank-excluded-properties nil)) (yank nil) (setq end (point))) (unless (table-recognize-table start end) ;; <--- new function (remove-yank-excluded-properties start end)) (if arg (goto-char start)))) -- Kim F. Storm http://www.cua.dk