emacs-devel
[Top][All Lists]
Advanced

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

Re: Longlines and insert


From: Richard M. Stallman
Subject: Re: Longlines and insert
Date: Wed, 16 Nov 2005 17:01:31 -0500

    > Maybe longlines-mode could provide a variable
    > "longlines-inserted-LF-are-hard" and then use it in an
    > after-change-functions hook to mark all inserted LF as hard when that
    > variable is non-nil.
    >
    > I'd guess that the variable should be non-nil by default and only bound to
    > nil at a few specific spots, hopefully all of them in longlines.el.

    The problem with using an after-change-function is that the function
    is only told that the text was changed in a particular region, not
    what the change was.  There is no way to tell whether a soft newline
    encountered in that region is a legit soft newline, or one produced by
    an (insert "foo\n") call.

A before-change-function can record the old text, and the
after-change-function can compare the new text with it.  That way it can
see whether newlines were inserted.

However, if we really want a feature that makes all inserted newlines hard,
it would be easier to implement that within `insert' itself.

    Let me be a little more specific: this would be a variable
    `insert-string-filters', normally bound to nil.  insert_string (in
    insdel.c) checks the value of insert-string-filters passed to it.  If
    non-nil, it makes use of it as follows:

I think the added generality of that feature would, in this case, be
a mistake.  It would make things slower and harder to use.

If the hard-newline variable is enough to do the job,
I would rather stick to that idea.  It is simpler and less risky.




reply via email to

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