unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#7006: Reader oddity after ?\^ --- should signal error if invalid instead of being garbage
@ 2010-09-09 21:25 Daniel Colascione
  2010-09-10  2:51 ` MON KEY
  2011-07-14 13:57 ` Lars Magne Ingebrigtsen
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Colascione @ 2010-09-09 21:25 UTC (permalink / raw)
  To: 7006

?\^ is supposed to be the prefix for a control character --- for
example, ?\^g. However, the character following the ^ can be a
non-existent control character like ' ' or ')'. Currently, the reader
outputs a nonsense value in this case. Instead, the reader ought to
signal an error.





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

* bug#7006: Reader oddity after ?\^ --- should signal error if invalid instead of being garbage
  2010-09-09 21:25 bug#7006: Reader oddity after ?\^ --- should signal error if invalid instead of being garbage Daniel Colascione
@ 2010-09-10  2:51 ` MON KEY
  2011-07-14 13:57 ` Lars Magne Ingebrigtsen
  1 sibling, 0 replies; 5+ messages in thread
From: MON KEY @ 2010-09-10  2:51 UTC (permalink / raw)
  To: 7006

,----
| Currently, the reader outputs a nonsense value in this case.
| Instead, the reader ought to signal an error.
`----

Not entirely nonsensical.

 (let ((^5 (get-buffer-create "#^")))
   (with-current-buffer (get-buffer ^5)
     (save-excursion
       (erase-buffer)
       (princ "#@4    ?\\^5" (current-buffer))))
   (unwind-protect
       (char-to-string
        (- (read (get-buffer ^5)) (expt 2 26)))
     (with-current-buffer (get-buffer ^5)
       (kill-buffer (current-buffer)))))
 ;=> "5"

:NOTE :bit 27 :byte 4 :2^ 26 :bit-weight 67108864
      :bit-oct #o400000000   :bit-hex #x4000000

--
/s_P\





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

* bug#7006: Reader oddity after ?\^ --- should signal error if invalid instead of being garbage
  2010-09-09 21:25 bug#7006: Reader oddity after ?\^ --- should signal error if invalid instead of being garbage Daniel Colascione
  2010-09-10  2:51 ` MON KEY
@ 2011-07-14 13:57 ` Lars Magne Ingebrigtsen
  2011-07-14 14:50   ` Andreas Schwab
  2011-07-17  2:16   ` Stefan Monnier
  1 sibling, 2 replies; 5+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-14 13:57 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: 7006

Daniel Colascione <dan.colascione@gmail.com> writes:

> ?\^ is supposed to be the prefix for a control character --- for
> example, ?\^g. However, the character following the ^ can be a
> non-existent control character like ' ' or ')'. Currently, the reader
> outputs a nonsense value in this case. Instead, the reader ought to
> signal an error.

Hm, yes:

?\^9
=> 67108921

That seems awfully confusing.  

(format "%x" 67108921)
=> "4000039"

Does anybody know whether this a feature or a bug?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





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

* bug#7006: Reader oddity after ?\^ --- should signal error if invalid instead of being garbage
  2011-07-14 13:57 ` Lars Magne Ingebrigtsen
@ 2011-07-14 14:50   ` Andreas Schwab
  2011-07-17  2:16   ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2011-07-14 14:50 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: Daniel Colascione, 7006

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> ?\^9
> => 67108921
>
> That seems awfully confusing.  
>
> (format "%x" 67108921)
> => "4000039"
>
> Does anybody know whether this a feature or a bug?

That's the same as ?\C-9, so not a bug.

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

* bug#7006: Reader oddity after ?\^ --- should signal error if invalid instead of being garbage
  2011-07-14 13:57 ` Lars Magne Ingebrigtsen
  2011-07-14 14:50   ` Andreas Schwab
@ 2011-07-17  2:16   ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2011-07-17  2:16 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: Daniel Colascione, 7006

>> ?\^ is supposed to be the prefix for a control character --- for
>> example, ?\^g. However, the character following the ^ can be a
>> non-existent control character like ' ' or ')'. Currently, the reader
>> outputs a nonsense value in this case. Instead, the reader ought to
>> signal an error.

It's not "nonsense".

> ?\^9
> => 67108921
> That seems awfully confusing.
> (format "%x" 67108921)
> => "4000039"
> Does anybody know whether this a feature or a bug?

It's a feature.  The ?<something> syntax can be used for more than
chars: it can be used for any char and any combination of modifiers
(such as the control modifier above), where the modifiers are stored in
the upper bits of the number.

An exception is made for those few chars whose combination which control
exists in ASCII, where the ?\C-<char> is then represented by the
corresponding ASCII char rather than use the "control" modifier bit.


        Stefan





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

end of thread, other threads:[~2011-07-17  2:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-09 21:25 bug#7006: Reader oddity after ?\^ --- should signal error if invalid instead of being garbage Daniel Colascione
2010-09-10  2:51 ` MON KEY
2011-07-14 13:57 ` Lars Magne Ingebrigtsen
2011-07-14 14:50   ` Andreas Schwab
2011-07-17  2:16   ` 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).