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: keymap in yank-excluded-properties Date: Thu, 22 Aug 2002 17:31:29 -0700 (PDT) Organization: Sony Electronics Inc. Sender: emacs-devel-admin@gnu.org Message-ID: <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 1030062741 12221 127.0.0.1 (23 Aug 2002 00:32:21 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 23 Aug 2002 00:32:21 +0000 (UTC) Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17i2NA-0003B0-00 for ; Fri, 23 Aug 2002 02:32:20 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17i2qH-0002Fg-00 for ; Fri, 23 Aug 2002 03:02:26 +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 17i2OK-0000kA-00; Thu, 22 Aug 2002 20:33:32 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17i2MS-000097-00 for emacs-devel@gnu.org; Thu, 22 Aug 2002 20:31:36 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17i2MP-000055-00 for emacs-devel@gnu.org; Thu, 22 Aug 2002 20:31:35 -0400 Original-Received: from mail2.fw-sj.sony.com ([160.33.82.69]) by monty-python.gnu.org with esmtp (Exim 4.10) id 17i2MP-0008Ua-00 for emacs-devel@gnu.org; Thu, 22 Aug 2002 20:31:33 -0400 Original-Received: from mail1.bc.in.sel.sony.com (mail1.bc.in.sel.sony.com [43.144.65.11]) by mail2.fw-sj.sony.com (8.8.8/8.8.8) with ESMTP id AAA18375 for ; Fri, 23 Aug 2002 00:31:31 GMT Original-Received: by mail1.bc.in.sel.sony.com id AAA28551; Fri, 23 Aug 2002 00:31:30 GMT Original-To: emacs-devel@gnu.org 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:6774 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:6774 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. Is it generally a good idea not to copy keymap text property? 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. -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.