emacs-devel
[Top][All Lists]
Advanced

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

Re: Patch: Syntax and Hard Newlines


From: Herbert Euler
Subject: Re: Patch: Syntax and Hard Newlines
Date: Wed, 15 Nov 2006 12:24:27 +0800

> *************** (defun longlines-wrap-line ()
> *** 243,248 ****
> --- 245,257 ----
>        (progn (insert-before-markers ?\n)
>             (backward-char 1)
>               (delete-char -1)
> +            (let* ((point (point))
> +                   (state (syntax-ppss point)))
> +              (if (nth 4 state)
> +                  ;; We are in a comment context.
> +                  (add-text-properties point
> +                                       (1+ point)
> +                                       '(syntax-table (14)))))
>             (forward-char 1)
>               nil)
>      (if (longlines-merge-lines-p)

Why not just unconditionally do

                  (put-text-property (point)
                                     (1+ (point))
                                     'syntax-table '(0))

Or even just:

      (progn (insert-before-markers (propertize "\n" 'syntax-table '(0)))
             ...)

Yes, that works.

Now the thing that should be considered is whether
soft newlines should be regarded the same as blank
characters.

From the syntax's point of view, it should not.  Moreover,
since there exists the syntax text property feature, it seems
that doing something in the Lisp level will be more flexible
than doing in the C level.

I'd ever used some editors for editing formatted text.  In
such editors, the idea of soft newlines is indeed that soft
newlines and blank characters are interchangeable.
`longlines' mode also means this: it substitutes soft newlines
with spaces when saving files or quiting.  From this point
of view, the fix should be done in the C level to avoid
each code that uses soft newlines takes care of this problem.

Or in the Lisp level, perhaps we can make adding a
`syntax-table' text property default when inserting soft
newlines.

Regards,
Guanpeng Xu

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! http://search.msn.com/





reply via email to

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