all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Juri Linkov'" <juri@jurta.org>
Cc: 13177@debbugs.gnu.org
Subject: bug#13177: 24.3.50; doc of `read-char-by-name'
Date: Sat, 15 Dec 2012 07:52:51 -0800	[thread overview]
Message-ID: <CEF104F28C6C4704A2317C00AC024116@us.oracle.com> (raw)
In-Reply-To: <8762431shy.fsf@mail.jurta.org>

> > 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').
> 
> As its docstring says, it also accepts a hexadecimal number
> of Unicode code whose input can't use completion.

Yes, I know.  But the doc string also says that the hex numbers accepted are
those corresponding to Unicode code points.  And it mentions hash notation for
numbers, but in that case it does not say that those numbers too must correspond
to Unicode code points.

The question I posed is whether the intention was to always return a recognized
Unicode char.  If that is the case then the function should never return nil or
anything else (e.g. a non code-point number) other than a Unicode char.  It's an
open question.

If you are answering for the design intention, stating that the intention is not
to do what the doc currently says (always return a Unicode char), then fine.  In
that case, all that's needed is a doc-string patch, to point out that exception
to its general statement.

However (see below), that exception needs to be clarified in the case of hash
notation input that does not correspond to a Unicode char.

> +When input is neither a known Unicode name nor a hex number string,
> +return nil."

It is not enough, according to the existing doc string, for input to be  any old
hex number - it must be a "hexadecimal number of Unicode code point" - or
presumably we return nil (?).  The additional info should say this (or
equivalent):

"Return nil if the input does not correspond to a Unicode character."

The doc string should also be corrected to not give the impression that hash
notation input somehow escapes this need for the number to represent a
character, i.e., to be numerically equivalent to "a hexadecimal number of
Unicode code point".

So we should replace the last paragraph of the doc string with something like
this:

"Besides a Unicode character name, input can represent a Unicode character
numerically.  It can be a hexadecimal number or a number in hash notation, e.g.
#o21430 for octal, #x2318 for hex, or #10r8984 for decimal."

Follow that with the statement above that _any other_ input, i.e., any input
that does not correspond to a recognized Unicode char, means return nil.  Then
things will be clear.

Otherwise, we are not saying anything about what is returned if the input hash
notation does not correspond to a Unicode char - a doc bug.

If, on the other hand, it is not the case that the function returns nil for hash
notation input that does not correspond to a known character, then the doc
should say that clearly.

In that case, the function has two exceptions to returning a Unicode character:

1. Return nil if a name is entered that is not a recognized name.

2. Return a number if hash notation is entered that does not match a Unicode
code point.

I cannot speak for what the function is supposed to do (design), so I cannot say
whether there is a code bug or a doc bug here.  I can only outline the
possibilities.






  parent reply	other threads:[~2012-12-15 15:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2012-12-15 16:08     ` Eli Zaretskii
2012-12-15 16:23       ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CEF104F28C6C4704A2317C00AC024116@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=13177@debbugs.gnu.org \
    --cc=juri@jurta.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.