emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

keymap in yank-excluded-properties


From: Tak Ota
Subject: keymap in yank-excluded-properties
Date: Thu, 22 Aug 2002 17:31:29 -0700 (PDT)

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  <address@hidden>

        * 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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]