emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/simple.el


From: Kim F. Storm
Subject: [Emacs-diffs] Changes to emacs/lisp/simple.el
Date: Sat, 18 Jan 2003 18:34:14 -0500

Index: emacs/lisp/simple.el
diff -c emacs/lisp/simple.el:1.585 emacs/lisp/simple.el:1.586
*** emacs/lisp/simple.el:1.585  Tue Jan 14 05:16:00 2003
--- emacs/lisp/simple.el        Sat Jan 18 18:34:14 2003
***************
*** 1756,1767 ****
  (defvar kill-ring-yank-pointer nil
    "The tail of the kill ring whose car is the last thing yanked.")
  
! (defun kill-new (string &optional replace)
    "Make STRING the latest kill in the kill ring.
  Set `kill-ring-yank-pointer' to point to it.
  If `interprogram-cut-function' is non-nil, apply it to STRING.
  Optional second argument REPLACE non-nil means that STRING will replace
! the front of the kill ring, rather than being added to the list."
    (and (fboundp 'menu-bar-update-yank-menu)
         (menu-bar-update-yank-menu string (and replace (car kill-ring))))
    (if (and replace kill-ring)
--- 1756,1774 ----
  (defvar kill-ring-yank-pointer nil
    "The tail of the kill ring whose car is the last thing yanked.")
  
! (defun kill-new (string &optional replace yank-handler)
    "Make STRING the latest kill in the kill ring.
  Set `kill-ring-yank-pointer' to point to it.
  If `interprogram-cut-function' is non-nil, apply it to STRING.
  Optional second argument REPLACE non-nil means that STRING will replace
! the front of the kill ring, rather than being added to the list.
! 
! Optional third arguments YANK-HANDLER controls how the STRING is later
! inserted into a buffer; see `insert-for-yank' for details."
!   (when (> (length string) 0)
!     (if yank-handler 
!       (put-text-property 0 1 'yank-handler yank-handler string)
!       (remove-text-properties 0 1 '(yank-handler nil) string)))
    (and (fboundp 'menu-bar-update-yank-menu)
         (menu-bar-update-yank-menu string (and replace (car kill-ring))))
    (if (and replace kill-ring)
***************
*** 1773,1787 ****
    (if interprogram-cut-function
        (funcall interprogram-cut-function string (not replace))))
  
! (defun kill-append (string before-p)
    "Append STRING to the end of the latest kill in the kill ring.
  If BEFORE-P is non-nil, prepend STRING to the kill.
! If `interprogram-cut-function' is set, pass the resulting kill to
! it."
!   (kill-new (if before-p
!               (concat string (car kill-ring))
!             (concat (car kill-ring) string))
!           t))
  
  (defun current-kill (n &optional do-not-move)
    "Rotate the yanking point by N places, and then return that kill.
--- 1780,1799 ----
    (if interprogram-cut-function
        (funcall interprogram-cut-function string (not replace))))
  
! (defun kill-append (string before-p &optional yank-handler)
    "Append STRING to the end of the latest kill in the kill ring.
  If BEFORE-P is non-nil, prepend STRING to the kill.
! Optional third argument YANK-HANDLER specifies the yank-handler text
! property to be set on the combined kill ring string.  If the specified
! yank-handler arg differs from the yank-handler property of the latest
! kill string, STRING is added as a new kill ring element instead of
! being appending to the last kill. 
! If `interprogram-cut-function' is set, pass the resulting kill to it."
!   (let* ((cur (car kill-ring)))
!     (kill-new (if before-p (concat string cur) (concat cur string))
!             (or (= (length cur) 0)
!                 (equal yank-handler (get-text-property 0 'yank-handler cur)))
!             yank-handler)))
  
  (defun current-kill (n &optional do-not-move)
    "Rotate the yanking point by N places, and then return that kill.
***************
*** 1823,1829 ****
       '(text-read-only buffer-read-only error))
  (put 'text-read-only 'error-message "Text is read-only")
  
! (defun kill-region (beg end)
    "Kill between point and mark.
  The text is deleted but saved in the kill ring.
  The command \\[yank] can retrieve it from there.
--- 1835,1841 ----
       '(text-read-only buffer-read-only error))
  (put 'text-read-only 'error-message "Text is read-only")
  
! (defun kill-region (beg end &optional yank-handler)
    "Kill between point and mark.
  The text is deleted but saved in the kill ring.
  The command \\[yank] can retrieve it from there.
***************
*** 1842,1856 ****
  Any command that calls this function is a \"kill command\".
  If the previous command was also a kill command,
  the text killed this time appends to the text killed last time
! to make one entry in the kill ring."
    (interactive "r")
    (condition-case nil
        (let ((string (delete-and-extract-region beg end)))
        (when string                    ;STRING is nil if BEG = END
          ;; Add that string to the kill ring, one way or another.
          (if (eq last-command 'kill-region)
!             (kill-append string (< end beg))
!           (kill-new string)))
        (setq this-command 'kill-region))
      ((buffer-read-only text-read-only)
       ;; The code above failed because the buffer, or some of the characters
--- 1854,1871 ----
  Any command that calls this function is a \"kill command\".
  If the previous command was also a kill command,
  the text killed this time appends to the text killed last time
! to make one entry in the kill ring.
! 
! In lisp code, optional third arg YANK-HANDLER specifies the yank-handler
! text property to be set on the killed text.  See `insert-for-yank'." 
    (interactive "r")
    (condition-case nil
        (let ((string (delete-and-extract-region beg end)))
        (when string                    ;STRING is nil if BEG = END
          ;; Add that string to the kill ring, one way or another.
          (if (eq last-command 'kill-region)
!             (kill-append string (< end beg) yank-handler)
!           (kill-new string nil yank-handler)))
        (setq this-command 'kill-region))
      ((buffer-read-only text-read-only)
       ;; The code above failed because the buffer, or some of the characters
***************
*** 1941,1953 ****
  
  ;; This is actually used in subr.el but defcustom does not work there.
  (defcustom yank-excluded-properties
!   '(read-only invisible intangible field mouse-face help-echo local-map 
keymap)
    "*Text properties to discard when yanking."
    :type '(choice (const :tag "All" t) (repeat symbol))
    :group 'editing
    :version "21.4")
  
  (defvar yank-window-start nil)
  
  (defun yank-pop (arg)
    "Replace just-yanked stretch of killed text with a different stretch.
--- 1956,1971 ----
  
  ;; This is actually used in subr.el but defcustom does not work there.
  (defcustom yank-excluded-properties
!   '(read-only invisible intangible field mouse-face help-echo local-map keymap
!     yank-handler)
    "*Text properties to discard when yanking."
    :type '(choice (const :tag "All" t) (repeat symbol))
    :group 'editing
    :version "21.4")
  
  (defvar yank-window-start nil)
+ (defvar yank-undo-function nil
+   "If non-nil, function used by `yank-pop' to delete last stretch of yanked 
text.")
  
  (defun yank-pop (arg)
    "Replace just-yanked stretch of killed text with a different stretch.
***************
*** 1968,1974 ****
    (setq this-command 'yank)
    (let ((inhibit-read-only t)
        (before (< (point) (mark t))))
!     (delete-region (point) (mark t))
      (set-marker (mark-marker) (point) (current-buffer))
      (insert-for-yank (current-kill arg))
      ;; Set the window start back where it was in the yank command,
--- 1986,1993 ----
    (setq this-command 'yank)
    (let ((inhibit-read-only t)
        (before (< (point) (mark t))))
!     (funcall (or yank-undo-function 'delete-region) (point) (mark t))
!     (setq yank-undo-function nil)
      (set-marker (mark-marker) (point) (current-buffer))
      (insert-for-yank (current-kill arg))
      ;; Set the window start back where it was in the yank command,
***************
*** 2007,2013 ****
        (goto-char (prog1 (mark t)
                   (set-marker (mark-marker) (point) (current-buffer)))))
    ;; If we do get all the way thru, make this-command indicate that.
!   (setq this-command 'yank)
    nil)
  
  (defun rotate-yank-pointer (arg)
--- 2026,2033 ----
        (goto-char (prog1 (mark t)
                   (set-marker (mark-marker) (point) (current-buffer)))))
    ;; If we do get all the way thru, make this-command indicate that.
!   (if (eq this-command t)
!       (setq this-command 'yank))
    nil)
  
  (defun rotate-yank-pointer (arg)




reply via email to

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