unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* keymap in yank-excluded-properties
@ 2002-08-23  0:31 Tak Ota
  2002-08-23  1:55 ` Miles Bader
                   ` (2 more replies)
  0 siblings, 3 replies; 38+ messages in thread
From: Tak Ota @ 2002-08-23  0:31 UTC (permalink / raw)


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  <storm@cua.dk>

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

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2002-10-24 20:27 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-23  0:31 keymap in yank-excluded-properties Tak Ota
2002-08-23  1:55 ` Miles Bader
2002-08-23 22:21   ` Tak Ota
2002-08-23 22:29     ` Stefan Monnier
2002-08-23 23:04       ` Tak Ota
2002-08-23  9:52 ` Kim F. Storm
2002-08-25  5:25 ` Richard Stallman
2002-08-25 22:49   ` Kim F. Storm
2002-08-30 19:43     ` Tak Ota
2002-09-01 13:14       ` Richard Stallman
2002-09-02 15:02         ` Kim F. Storm
2002-09-03 13:26           ` Richard Stallman
2002-09-03 20:36             ` Tak Ota
2002-10-23 13:53               ` Kim F. Storm
2002-10-24 20:27                 ` Tak Ota
2002-09-04  1:11           ` Miles Bader
2002-09-04  6:32             ` Juanma Barranquero
2002-09-04  8:45               ` Kim F. Storm
2002-09-04  8:02                 ` Miles Bader
2002-09-04  8:50                   ` Juanma Barranquero
2002-09-04  8:49                 ` Juanma Barranquero
2002-09-04 12:48                   ` Kim F. Storm
2002-09-04 14:10                     ` Juanma Barranquero
2002-09-04 10:34                 ` Per Abrahamsen
2002-09-04 12:35                   ` Kim F. Storm
2002-09-05  1:10                     ` Miles Bader
2002-09-05 13:18                       ` Robert J. Chassell
2002-09-05 15:00                         ` Kim F. Storm
2002-09-05 14:34                           ` Per Abrahamsen
2002-09-05 15:15                           ` Robert J. Chassell
2002-09-06  1:09                           ` Miles Bader
2002-09-05  2:46             ` Richard Stallman
2002-09-05 14:48               ` Robert J. Chassell
2002-09-06  1:05                 ` Miles Bader
2002-09-06 11:30                   ` Andreas Schwab
2002-09-06 11:57                   ` Modes: major, minor, context specific Robert J. Chassell
2002-09-06 20:03                   ` keymap in yank-excluded-properties Richard Stallman
2002-09-01 13:15     ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).