unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#13177: 24.3.50; doc of `read-char-by-name'
@ 2012-12-14  4:01 Drew Adams
  2012-12-15 11:09 ` Juri Linkov
  0 siblings, 1 reply; 18+ messages in thread
From: Drew Adams @ 2012-12-14  4:01 UTC (permalink / raw)
  To: 13177

Emacs-Lisp `read*' functions generally return what they say
they read.  This function does not necessarily return a character,
which is what its doc says it does.  It can return nil.  The doc
needs to mention this behavior, especially as it is pretty
exceptional.
 
There's nothing wrong with such behavior, but I wonder a bit whether
this function shouldn't perhaps use `completing-read' with a non-nil
REQUIRE-MATCH argument.  IOW, perhaps it should ignore names that
are unknown.  In that case it would always do what the doc currently
says it does: return a character (by name).  At least it's another
possibility.

Dunno just what the intention was for this function.  If it really
was to return a recognized Unicode character then this is a product
bug and reading should not end until the user enters matching input
(or hits `C-g').  If the intention was really to do what the
function does now, then this is a doc bug: mention a possible nil
return value and what it means.
 
Alternatively, we might add another function, say
`read-char-by-name-exclusive', that always returns a named char.
That would be somewhat analogous to how `read-char-exclusive'
ignores non-chars, while `read-char' signals an error for them.
(Note though that neither of those functions simply accepts and
returns a non-char event.)
 
Anyway, for this bug report and for my part, it would be enough
to correct the doc to say that if the user enters a name that
is unknown then nil is returned.
 
In GNU Emacs 24.3.50.1 (i386-mingw-nt5.1.2600)
 of 2012-12-13 on ODIEONE
Bzr revision: 111211 eggert@cs.ucla.edu-20121213021749-eyqqen0ewhn2hogq
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (4.7) --no-opt --enable-checking --cflags
 -IC:/Devel/emacs/build/include -Wall -Wextra -Wno-sign-compare
 -Wno-type-limits -Wno-missing-field-initializers -Wno-pointer-sign
 -Wdeclaration-after-statement --ldflags -LC:/Devel/emacs/build/lib'
 






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

end of thread, other threads:[~2012-12-21  8:04 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-14  4:01 bug#13177: 24.3.50; doc of `read-char-by-name' Drew Adams
2012-12-15 11:09 ` Juri Linkov
2012-12-15 14:54   ` Stefan Monnier
2012-12-15 15:18     ` Juri Linkov
2012-12-15 15:47       ` Stefan Monnier
2012-12-15 16:08     ` Drew Adams
2012-12-15 23:20       ` Stefan Monnier
2012-12-15 23:39         ` Drew Adams
2012-12-16  9:12           ` Juri Linkov
2012-12-16 10:18             ` Andreas Schwab
2012-12-16 10:49               ` Juri Linkov
2012-12-16 16:34                 ` Drew Adams
2012-12-16 16:31             ` Drew Adams
2012-12-21  7:53         ` Chong Yidong
2012-12-21  8:04           ` Drew Adams
2012-12-15 15:52   ` Drew Adams
2012-12-15 16:08     ` Eli Zaretskii
2012-12-15 16:23       ` Drew Adams

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).