emacs-devel
[Top][All Lists]
Advanced

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

Re: keymap in yank-excluded-properties


From: Tak Ota
Subject: Re: keymap in yank-excluded-properties
Date: Fri, 23 Aug 2002 15:21:21 -0700 (PDT)

23 Aug 2002 10:55:47 +0900: Miles Bader <address@hidden> 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.




reply via email to

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