unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] master 8764544: Treat control characters in JSON strings as invalid
       [not found] ` <20170818000544.84B5E2052C@vcs0.savannah.gnu.org>
@ 2017-08-18  7:51   ` Stefan Monnier
  2017-08-18 14:13     ` Mark Oteiza
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2017-08-18  7:51 UTC (permalink / raw)
  To: emacs-devel; +Cc: Mark Oteiza

> -  (or (char-after (point)) :json-eof))

I wonder why it used :json-eof instead of using nil ?
Any idea?


        Stefan



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

* Re: [Emacs-diffs] master 8764544: Treat control characters in JSON strings as invalid
  2017-08-18  7:51   ` [Emacs-diffs] master 8764544: Treat control characters in JSON strings as invalid Stefan Monnier
@ 2017-08-18 14:13     ` Mark Oteiza
  2017-08-18 20:24       ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Oteiza @ 2017-08-18 14:13 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

On 18/08/17 at 03:51am, Stefan Monnier wrote:
>> -  (or (char-after (point)) :json-eof))
>
>I wonder why it used :json-eof instead of using nil ?
>Any idea?

Not sure--it has been there since json.el was added to Emacs.



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

* Re: [Emacs-diffs] master 8764544: Treat control characters in JSON strings as invalid
  2017-08-18 14:13     ` Mark Oteiza
@ 2017-08-18 20:24       ` Stefan Monnier
  2017-09-28 20:19         ` Philipp Stephani
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2017-08-18 20:24 UTC (permalink / raw)
  To: emacs-devel

>>> -  (or (char-after (point)) :json-eof))
>> I wonder why it used :json-eof instead of using nil ?
>> Any idea?
> Not sure--it has been there since json.el was added to Emacs.

Then why use 0 now instead of nil?


        Stefan




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

* Re: [Emacs-diffs] master 8764544: Treat control characters in JSON strings as invalid
  2017-08-18 20:24       ` Stefan Monnier
@ 2017-09-28 20:19         ` Philipp Stephani
  2017-09-28 21:22           ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Philipp Stephani @ 2017-09-28 20:19 UTC (permalink / raw)
  To: Stefan Monnier, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 418 bytes --]

Stefan Monnier <monnier@iro.umontreal.ca> schrieb am Fr., 18. Aug. 2017 um
22:25 Uhr:

> >>> -  (or (char-after (point)) :json-eof))
> >> I wonder why it used :json-eof instead of using nil ?
> >> Any idea?
> > Not sure--it has been there since json.el was added to Emacs.
>
> Then why use 0 now instead of nil?
>
>
Because `following-char' returns 0 at EOB. "At the end of the buffer or
accessible region, return 0."

[-- Attachment #2: Type: text/html, Size: 756 bytes --]

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

* Re: [Emacs-diffs] master 8764544: Treat control characters in JSON strings as invalid
  2017-09-28 20:19         ` Philipp Stephani
@ 2017-09-28 21:22           ` Stefan Monnier
  2017-09-29 20:50             ` Philipp Stephani
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2017-09-28 21:22 UTC (permalink / raw)
  To: Philipp Stephani; +Cc: emacs-devel

>> >>> -  (or (char-after (point)) :json-eof))
>> >> I wonder why it used :json-eof instead of using nil ?
>> >> Any idea?
>> > Not sure--it has been there since json.el was added to Emacs.
>> Then why use 0 now instead of nil?
> Because `following-char' returns 0 at EOB. "At the end of the buffer or
> accessible region, return 0."

But it also returns 0 in other cases.  E.g. if you had changed

    (or (char-after (point)) :json-eof)
to
    (char-after)

it would give you nil at EOB (instead of 0).


        Stefan



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

* Re: [Emacs-diffs] master 8764544: Treat control characters in JSON strings as invalid
  2017-09-28 21:22           ` Stefan Monnier
@ 2017-09-29 20:50             ` Philipp Stephani
  2017-09-29 20:59               ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Philipp Stephani @ 2017-09-29 20:50 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 830 bytes --]

Stefan Monnier <monnier@iro.umontreal.ca> schrieb am Do., 28. Sep. 2017 um
23:22 Uhr:

> >> >>> -  (or (char-after (point)) :json-eof))
> >> >> I wonder why it used :json-eof instead of using nil ?
> >> >> Any idea?
> >> > Not sure--it has been there since json.el was added to Emacs.
> >> Then why use 0 now instead of nil?
> > Because `following-char' returns 0 at EOB. "At the end of the buffer or
> > accessible region, return 0."
>
> But it also returns 0 in other cases.  E.g. if you had changed
>
>     (or (char-after (point)) :json-eof)
> to
>     (char-after)
>
> it would give you nil at EOB (instead of 0).
>
>
Agreed.
I'm wondering what the purpose of `following-char' is. Even in the rare
cases where you want to treat EOB and a following null character
identically it would be cleaner to write (or (char-after) 0).

[-- Attachment #2: Type: text/html, Size: 1254 bytes --]

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

* Re: [Emacs-diffs] master 8764544: Treat control characters in JSON strings as invalid
  2017-09-29 20:50             ` Philipp Stephani
@ 2017-09-29 20:59               ` Stefan Monnier
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2017-09-29 20:59 UTC (permalink / raw)
  To: emacs-devel

> I'm wondering what the purpose of `following-char' is.

I think it's a historical accident,


        Stefan




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

end of thread, other threads:[~2017-09-29 20:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20170818000543.9841.93700@vcs0.savannah.gnu.org>
     [not found] ` <20170818000544.84B5E2052C@vcs0.savannah.gnu.org>
2017-08-18  7:51   ` [Emacs-diffs] master 8764544: Treat control characters in JSON strings as invalid Stefan Monnier
2017-08-18 14:13     ` Mark Oteiza
2017-08-18 20:24       ` Stefan Monnier
2017-09-28 20:19         ` Philipp Stephani
2017-09-28 21:22           ` Stefan Monnier
2017-09-29 20:50             ` Philipp Stephani
2017-09-29 20:59               ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).