emacs-devel
[Top][All Lists]
Advanced

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

insert-for-yank neglects yank-handlers


From: Tak Ota
Subject: insert-for-yank neglects yank-handlers
Date: Tue, 09 Dec 2003 18:34:58 -0800 (PST)

The following patch to table.el takes advantage of the new
yank-handler property and preserves active table functionality after
kill/copy and paste.  However table properties are scattered and most
likely the first character of the copied string wouldn't have that
property. Is the following patch to insert-for-yank acceptable to
correct this shortcoming?  If so could someone commit these changes
to the CVS?  Thank you.

-Tak

*** ../../../pub/emacs/emacs-21.3.50/lisp/textmodes/table.el    Mon Sep  1 
08:45:40 2003
--- textmodes/table.el  Tue Dec  9 14:36:50 2003
***************
*** 5,11 ****
  ;; Keywords: wp, convenience
  ;; Author: Takaaki Ota <address@hidden>
  ;; Created: Sat Jul 08 2000 13:28:45 (PST)
! ;; Revised: jue jun 05 2003 22:00:02 (Hora de verano romance)
  
  ;; This file is part of GNU Emacs.
  
--- 5,11 ----
  ;; Keywords: wp, convenience
  ;; Author: Takaaki Ota <address@hidden>
  ;; Created: Sat Jul 08 2000 13:28:45 (PST)
! ;; Revised: Tue Dec 09 2003 14:36:50 (PST)
  
  ;; This file is part of GNU Emacs.
  
***************
*** 837,842 ****
--- 837,845 ----
    :type 'hook
    :group 'table-hooks)
  
+ (defcustom table-yank-handler '(nil nil t nil)
+   "*yank-handler for table.")
+ 
  (setplist 'table-disable-incompatibility-warning nil)
  
  (defvar table-disable-menu (null (and (locate-library "easymenu")
***************
*** 5228,5234 ****
  
  (defun table--put-cell-indicator-property (beg end &optional object)
    "Put cell property which indicates that the location is within a table 
cell."
!   (put-text-property beg end 'table-cell t object))
  
  (defun table--put-cell-face-property (beg end &optional object)
    "Put cell face property."
--- 5231,5238 ----
  
  (defun table--put-cell-indicator-property (beg end &optional object)
    "Put cell property which indicates that the location is within a table 
cell."
!   (put-text-property beg end 'table-cell t object)
!   (put-text-property beg end 'yank-handler table-yank-handler object))
  
  (defun table--put-cell-face-property (beg end &optional object)
    "Put cell face property."





*** ../../../pub/emacs/emacs-21.3.50/lisp/subr.el       Sun Nov 30 11:03:49 2003
--- subr.el     Tue Dec  9 18:10:07 2003
***************
*** 1563,1568 ****
--- 1563,1576 ----
  (defvar yank-undo-function)
  
  (defun insert-for-yank (string)
+   "Calls `insert-for-yank-1' repetitively for each `yank-handler' segment."
+   (let (to)
+     (while (setq to (next-single-property-change 0 'yank-handler string))
+       (insert-for-yank-1 (substring string 0 to))
+       (setq string (substring string to))))
+   (insert-for-yank-1 string))
+ 
+ (defun insert-for-yank-1 (string)
    "Insert STRING at point, stripping some text properties.
  Strip text properties from the inserted text according to
  `yank-excluded-properties'.  Otherwise just like (insert STRING).




reply via email to

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