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: Tue, 14 Nov 2006 16:36:56 +0800

Please wait a moment, let me find if there are other
sulotions, just as Stefan said.

Regards,
Guanpeng Xu


From: "Herbert Euler" <address@hidden>
To: address@hidden
Subject: Patch: Syntax and Hard Newlines
Date: Mon, 13 Nov 2006 13:24:59 +0800

Emacs provides a hard newline mode.  If you type M-x use-hard-newlines
RET, you turn on the hard newline mode.  In this mode, all newlines in
a buffer are re-scanned and marked as either a ``hard'' one or a
``soft'' one.  The behavior of commands inserting a newline character
is also altered: `newline' and `open-line' will add the text property
`hard' (value set to t) to newlines that they insert.

As documented in the doc string of the command `use-hard-newlines',
newlines not marked hard are internal to paragraphs.  However,
currently the syntax feature does not work well with this.  For
example, if you turn on long-lines mode with M-x longlines-mode RET in
the *scratch* buffer, you will see the word `evaluation' in the first
line is wrapped into the second line, but not recognized as a part of
the comment.

To fix this, we can let the function `forw_comment' in syntax.c skip
the soft newlines when possible.  Below is the patch.

Regards,
Guanpeng Xu

Index: syntax.c
===================================================================
RCS file: /sources/emacs/emacs/src/syntax.c,v
retrieving revision 1.166.4.20
diff -r1.166.4.20 syntax.c
2126a2127
  register int skip_soft_newlines;
2129a2131,2137
  /* If `use-hard-newlines' is t, only newlines with the `hard'
     property set to t are real newlines.  Other newlines are soft and
     should be skipped. */
  skip_soft_newlines = !NILP (Fsymbol_value
                              (intern
                               ("use-hard-newlines")));

2145a2154,2163
      if (skip_soft_newlines
          && c == '\n'
          && NILP (Fget_text_property (make_number (from_byte),
                                       intern ("hard"),
                                       Qnil)))
        {
          INC_BOTH (from, from_byte);
          UPDATE_SYNTAX_TABLE_FORWARD (from);
          continue;
        }

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



_______________________________________________
Emacs-devel mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-devel

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/





reply via email to

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