> If I understood correctly, we do not like code included with the Emacs
> distribution to use `defadvice'. longlines.el uses defadvice for
> `newline', `kill-region', `copy-region-as-kill', `yank' and
> `yank-pop'.
>
> Yes,it would be good to think about other mechanisms to use instead
> of that. Yidong, would you like to think about what kind of new hook
> might make it possible to do the job?
What the advice does is mainly encoding and decoding yanked text. When a
piece of text is yanked into a longlines buffer, the newlines have to be
marked as hard. Conversely, when text is killed from a longlines buffer,
the soft newlines have to be removed before it is placed in the kill ring.
As I see it, there are two ways to get around using advice:
1. If Longlines is to be merged into Emacs, lines like
(if (and (fboundp longlines-mode) longlines-mode) blahblahblah)
could be added to kill-region and the other functions. This is what
Transient mark mode does, but I doubt that Longlines mode is "important"
enough to justify it.
2. Defining two new abnormal hooks, maybe named yank-encode-functions and
kill-encode-functions, to be called by kill-region etc (or possibly the
lower-level functions like kill-new and kill-append.) Each function would
be called with one argument, the yanked or killed string, and return an
encoded string to be passed to the next function, or to the buffer/kill
ring. For example, kill-region could do something like
(mapcar '(lambda (fun) (setq string (funcall fun string)))
'kill-encode-functions)
_______________________________________________
Emacs-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/emacs-devel