all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* character syntax of linefeed?
@ 2009-11-24 10:45 Tobias C. Rittweiler
  2009-11-24 10:58 ` Andreas Schwab
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tobias C. Rittweiler @ 2009-11-24 10:45 UTC (permalink / raw)
  To: emacs-devel


Quoting 35.2.1 Table of Syntax Classes:

  -- Syntax class: whitespace character
     "Whitespace characters" (designated by ` ' or `-') separate symbols
     and words from each other.  [...]  Space, tab, newline and formfeed
     are classified as whitespace in almost all major modes.

However, if I open, say, an empty foo.el or foo.c file, press RET
and then M-: (list (string (char-before))
                   (string (char-syntax (char-before))))

I get ("
       " ">"), i.e. a syntax of type 'endcomment'.

This behaviour seems to go through 23,22, and 21, so it's definitively
not new. :-)

My question is, is the above paragraph just wrong? Can I count on it
being ">"? 

Additionally: It seems that CR has a syntax type of `symbol' since
version 22, but it was ">" on 21.

  -T.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: character syntax of linefeed?
  2009-11-24 10:45 character syntax of linefeed? Tobias C. Rittweiler
@ 2009-11-24 10:58 ` Andreas Schwab
  2009-11-24 12:09   ` Tobias C. Rittweiler
  2009-11-24 14:12 ` Stefan Monnier
  2009-11-25 10:45 ` A Soare
  2 siblings, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2009-11-24 10:58 UTC (permalink / raw)
  To: Tobias C. Rittweiler; +Cc: emacs-devel

"Tobias C. Rittweiler" <tcr@freebits.de> writes:

> Quoting 35.2.1 Table of Syntax Classes:
>
>   -- Syntax class: whitespace character
>      "Whitespace characters" (designated by ` ' or `-') separate symbols
>      and words from each other.  [...]  Space, tab, newline and formfeed
>      are classified as whitespace in almost all major modes.
>
> However, if I open, say, an empty foo.el or foo.c file, press RET
> and then M-: (list (string (char-before))
>                    (string (char-syntax (char-before))))
>
> I get ("
>        " ">"), i.e. a syntax of type 'endcomment'.
>
> This behaviour seems to go through 23,22, and 21, so it's definitively
> not new. :-)
>
> My question is, is the above paragraph just wrong?

In which way does that contradict "almost all major modes"?

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: character syntax of linefeed?
  2009-11-24 10:58 ` Andreas Schwab
@ 2009-11-24 12:09   ` Tobias C. Rittweiler
  0 siblings, 0 replies; 5+ messages in thread
From: Tobias C. Rittweiler @ 2009-11-24 12:09 UTC (permalink / raw)
  To: emacs-devel

Andreas Schwab <schwab@linux-m68k.org> writes:

> "Tobias C. Rittweiler" <tcr@freebits.de> writes:
>
>> Quoting 35.2.1 Table of Syntax Classes:
>>
>>   -- Syntax class: whitespace character
>>      "Whitespace characters" (designated by ` ' or `-') separate symbols
>>      and words from each other.  [...]  Space, tab, newline and formfeed
>>      are classified as whitespace in almost all major modes.
>>
>> However, if I open, say, an empty foo.el or foo.c file, press RET
>> and then M-: (list (string (char-before))
>>                    (string (char-syntax (char-before))))
>>
>> I get ("
>>        " ">"), i.e. a syntax of type 'endcomment'.
>>
>> This behaviour seems to go through 23,22, and 21, so it's definitively
>> not new. :-)
>>
>> My question is, is the above paragraph just wrong?
>
> In which way does that contradict "almost all major modes"?

It seems to exclude most programming modes. If you can speak of "almost
all major modes" even though it excludes almost all programming modes,
probably depends on what you use Emacs for. Though I agree that "just
wrong" in my OP was worded too strong.

  -T.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: character syntax of linefeed?
  2009-11-24 10:45 character syntax of linefeed? Tobias C. Rittweiler
  2009-11-24 10:58 ` Andreas Schwab
@ 2009-11-24 14:12 ` Stefan Monnier
  2009-11-25 10:45 ` A Soare
  2 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2009-11-24 14:12 UTC (permalink / raw)
  To: Tobias C. Rittweiler; +Cc: emacs-devel

> However, if I open, say, an empty foo.el or foo.c file, press RET
> and then M-: (list (string (char-before))
>                    (string (char-syntax (char-before))))
> I get ("
>        " ">"), i.e. a syntax of type 'endcomment'.

Elisp has comments of the form ;...\n, so clearly LF needs to be an
end-comment marker.  The same will hold for any major mode where there
are comments that end at LF.

> Can I count on it being ">"? 

In Elisp mode, yes.  In general of course not: that's why we have
syntax-tables: so that its contents can be different in
different situations.


        Stefan




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: character syntax of linefeed?
  2009-11-24 10:45 character syntax of linefeed? Tobias C. Rittweiler
  2009-11-24 10:58 ` Andreas Schwab
  2009-11-24 14:12 ` Stefan Monnier
@ 2009-11-25 10:45 ` A Soare
  2 siblings, 0 replies; 5+ messages in thread
From: A Soare @ 2009-11-25 10:45 UTC (permalink / raw)
  To: emacs-devel


> I get ("
>        " ">"), i.e. a syntax of type 'endcomment'.
> 
> This behaviour seems to go through 23,22, and 21, so it's definitively
> not new. 
> 
> My question is, is the above paragraph just wrong? Can I count on it
> being ">"? 

Emacs was conceived first of all to be convenient for lisp, and in lisp newline
means also end of comment.



Alin











^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-11-25 10:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-24 10:45 character syntax of linefeed? Tobias C. Rittweiler
2009-11-24 10:58 ` Andreas Schwab
2009-11-24 12:09   ` Tobias C. Rittweiler
2009-11-24 14:12 ` Stefan Monnier
2009-11-25 10:45 ` A Soare

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.