[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Kim F. Storm
Fri, 22 Jul 2005 14:41:18 +0200
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)
diff-mode.el contains the following which isn't used anywhere.
I suppose this is due to the "FIXME" comment below.
What need to be done to complete this?
(defconst diff-yank-handler '(diff-yank-function))
(defun diff-yank-function (text)
;; FIXME: the yank-handler is now called separately on each piece of text
;; with a yank-handler property, so the next-single-property-change call
;; below will always return nil :-( --stef
(let ((mixed (next-single-property-change 0 'yank-handler text))
;; First insert the text.
;; If the text does not include any diff markers and if we're not
;; yanking back into a diff-mode buffer, get rid of the prefixes.
(unless (or mixed (derived-mode-p 'diff-mode))
(undo-boundary) ; Just in case the user wanted the prefixes.
(let ((re (save-excursion
(if (re-search-backward "^[><!][ \t]" start t)
(if (eq (char-after) ?!)
"^[!+- ][ \t]" "^[<>][ \t]")
(while (re-search-backward re start t)
(replace-match "" t t)))))))
I would suggest that we could add a 5th element to the yank-handler
indicating that the string covered by this yank-handler should
be combined with the next yank-handler.
We could then "FIXIT" with:
(defconst diff-yank-handler '(diff-yank-function nil nil nil t))
Kim F. Storm <address@hidden> http://www.cua.dk
Kim F. Storm <=