From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Tak Ota Newsgroups: gmane.emacs.devel Subject: Re: keymap in yank-excluded-properties Date: Fri, 23 Aug 2002 15:21:21 -0700 (PDT) Organization: Sony Electronics Inc. Sender: emacs-devel-admin@gnu.org Message-ID: <20020823.152121.01367723.Takaaki.Ota@am.sony.com> 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 Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1030141336 12537 127.0.0.1 (23 Aug 2002 22:22:16 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 23 Aug 2002 22:22:16 +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 17iMop-0003G6-00 for ; Sat, 24 Aug 2002 00:22:15 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17iNIN-0007PP-00 for ; Sat, 24 Aug 2002 00:52: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 17iMq2-0008Sp-00; Fri, 23 Aug 2002 18:23:30 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17iMo6-0008Mf-00 for emacs-devel@gnu.org; Fri, 23 Aug 2002 18:21:30 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17iMo3-0008KH-00 for emacs-devel@gnu.org; Fri, 23 Aug 2002 18:21:29 -0400 Original-Received: from mail6.fw-bc.sony.com ([160.33.98.73]) by monty-python.gnu.org with esmtp (Exim 4.10) id 17iMo1-0008JV-00; Fri, 23 Aug 2002 18:21:25 -0400 Original-Received: from mail1.bc.in.sel.sony.com (mail1.bc.in.sel.sony.com [43.144.65.11]) by mail6.fw-bc.sony.com (8.8.8/8.8.8) with ESMTP id WAA24032; Fri, 23 Aug 2002 22:21:24 GMT Original-Received: by mail1.bc.in.sel.sony.com id WAA14531; Fri, 23 Aug 2002 22:21:23 GMT Original-To: miles@gnu.org, miles@lsi.nec.co.jp In-Reply-To: X-Telephone: +1-858-942-3239 X-Fax------: +1-858-942-9142 X-SnailMail: 16450 West Bernardo Drive MZ7205, San Diego, CA 92127-1804 X-Mailer: Mew-3.0.63 on Emacs-21.3.50.1 (i386-msvc-nt5.0.2195) of 2002-08-22 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:6815 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:6815 23 Aug 2002 10:55:47 +0900: Miles Bader wrote: > I think a better question is `Should tables (and more importantly, > _parts_ of tables) really remain "active" after yanking?'. It sounds > rather annoying to me for the same reason that yanked keymap properties > usually are. Table mode does not use global map or local map. Its special behavior solely depends on keymap text property. It does not provide copying and pasting of table cells/rows/columns because it depends on standard emacs features to accomplish those tasks provided keymap properties are intact with the copied text. > [BTW, if it's decided that this _is_ a good feature, please call the > property something like `yank-preserved-properties' (actually I'm rather > fond of `yankable-properties') and make it a list of property names or t.] Sorry that the diff makes the change look complicated but what I proposed was an introduction of a new text property `yank-preserve-all-properties' instead of a new variable `yankable-properties' that holds properties to preserve. The actual proposed change is an insertion of the following single line with a corresponding closing parenthesis at the end. (unless (text-property-any start end 'yank-preserve-all-properties t) Introduction of a new variable that holds what properties to preserve is effective globally or at least across the entire buffer. I want to avoid this. Instead, what I am proposing is if the subject region contains a special text property let yank allow preserving all text properties. That is the intention of the naming of the new property. -Tak *** ../../pure/emacs-21.3.50/lisp/subr.el Fri Aug 2 21:26:30 2002 --- subr.el Thu Aug 22 15:59:53 2002 *************** *** 1415,1441 **** (defun remove-yank-excluded-properties (start end) "Remove `yank-excluded-properties' between START and END positions. Replaces `category' properties with their defined properties." ! (let ((inhibit-read-only t)) ! ;; Replace any `category' property with the properties it stands for. ! (unless (memq yank-excluded-properties '(t nil)) ! (save-excursion ! (goto-char start) ! (while (< (point) end) ! (let ((cat (get-text-property (point) 'category)) ! run-end) ! (when cat (setq run-end (next-single-property-change (point) 'category nil end)) ! (remove-list-of-text-properties (point) run-end '(category)) ! (add-text-properties (point) run-end (symbol-plist cat)) ! (goto-char (or run-end end))) ! (setq run-end ! (next-single-property-change (point) 'category nil end)) ! (goto-char (or run-end end)))))) ! (if (eq yank-excluded-properties t) ! (set-text-properties start end nil) ! (remove-list-of-text-properties start end ! yank-excluded-properties)))) (defun insert-for-yank (&rest strings) "Insert STRINGS at point, stripping some text properties. --- 1415,1442 ---- (defun remove-yank-excluded-properties (start end) "Remove `yank-excluded-properties' between START and END positions. Replaces `category' properties with their defined properties." ! (unless (text-property-any start end 'yank-preserve-all-properties t) ! (let ((inhibit-read-only t)) ! ;; Replace any `category' property with the properties it stands for. ! (unless (memq yank-excluded-properties '(t nil)) ! (save-excursion ! (goto-char start) ! (while (< (point) end) ! (let ((cat (get-text-property (point) 'category)) ! run-end) ! (when cat ! (setq run-end ! (next-single-property-change (point) 'category nil end)) ! (remove-list-of-text-properties (point) run-end '(category)) ! (add-text-properties (point) run-end (symbol-plist cat)) ! (goto-char (or run-end end))) (setq run-end (next-single-property-change (point) 'category nil end)) ! (goto-char (or run-end end)))))) ! (if (eq yank-excluded-properties t) ! (set-text-properties start end nil) ! (remove-list-of-text-properties start end ! yank-excluded-properties))))) (defun insert-for-yank (&rest strings) "Insert STRINGS at point, stripping some text properties.