unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16677: 24.3.50; Wrong type argument: char-or-string-p, 67108923
@ 2014-02-07  2:57 Drew Adams
  2014-02-07  3:55 ` Juanma Barranquero
  0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2014-02-07  2:57 UTC (permalink / raw)
  To: 16677

emacs -Q

C-q C-;

Gives the cited error message.  It should give a more user
interface-level error, saying something to the effect that the key
sequence you used does not correspond to a character.

Note: in Emacs 20, this just inserts the escape character (^[), which is
wrong.  In Emacs 22, it just inserts the semicolon character (;), which
is also wrong.

Emacs 23 got it right, but it did not make the extra effort to give the
user an error message that s?he deserves: something more helpful than a
low-level barf message (even if that message might be comprehensible to
a knowledgable Emacs user).

Emacs can do better than that - this is, after all, a command, i.e.,
something that users use directly.

(I discovered this by accident, when my fingers slipped.)

In GNU Emacs 24.3.50.1 (i686-pc-mingw32)
 of 2014-02-02 on ODIEONE
Bzr revision: 116242 rudalics@gmx.at-20140202130041-n967dw77nw7ztvy9
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/Devel/emacs/binary --enable-checking=yes,glyphs
 'CFLAGS=-O0 -g3' LDFLAGS=-Lc:/Devel/emacs/lib
 CPPFLAGS=-Ic:/Devel/emacs/include'





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

* bug#16677: 24.3.50; Wrong type argument: char-or-string-p, 67108923
  2014-02-07  2:57 Drew Adams
@ 2014-02-07  3:55 ` Juanma Barranquero
  2014-02-07  8:01   ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Juanma Barranquero @ 2014-02-07  3:55 UTC (permalink / raw)
  To: Drew Adams; +Cc: 16677

On Fri, Feb 7, 2014 at 3:57 AM, Drew Adams <drew.adams@oracle.com> wrote:

> Emacs 23 got it right, but it did not make the extra effort to give the
> user an error message that s?he deserves: something more helpful than a
> low-level barf message (even if that message might be comprehensible to
> a knowledgable Emacs user).

It's not just an UI issue. If you type that in a buffer with binary
overwrite mode enabled, quoted-insert will delete a char and then
barf.

So I'd suggest this:

=== modified file 'lisp/simple.el'
--- lisp/simple.el 2014-02-07 03:22:34 +0000
+++ lisp/simple.el 2014-02-07 03:54:27 +0000
@@ -739,4 +739,7 @@
     ;;          (<= char ?\377))
     ;;     (setq char (unibyte-char-to-multibyte char)))
+    (unless (characterp char)
+      (user-error "%s is not a character"
+                  (help-key-description (vector char) nil)))
     (if (> arg 0)
  (if (eq overwrite-mode 'overwrite-mode-binary)





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

* bug#16677: 24.3.50; Wrong type argument: char-or-string-p, 67108923
  2014-02-07  3:55 ` Juanma Barranquero
@ 2014-02-07  8:01   ` Eli Zaretskii
  2014-02-07 10:52     ` Juanma Barranquero
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2014-02-07  8:01 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 16677

> From: Juanma Barranquero <lekktu@gmail.com>
> Date: Fri, 7 Feb 2014 04:55:04 +0100
> Cc: 16677@debbugs.gnu.org
> 
> +    (unless (characterp char)
> +      (user-error "%s is not a character"
> +                  (help-key-description (vector char) nil)))

"%s is not a valid character" is a better error message, IMO.





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

* bug#16677: 24.3.50; Wrong type argument: char-or-string-p, 67108923
  2014-02-07  8:01   ` Eli Zaretskii
@ 2014-02-07 10:52     ` Juanma Barranquero
  2014-02-07 11:15       ` Juanma Barranquero
  2014-02-08 10:20       ` Juri Linkov
  0 siblings, 2 replies; 7+ messages in thread
From: Juanma Barranquero @ 2014-02-07 10:52 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 16677

On Fri, Feb 7, 2014 at 9:01 AM, Eli Zaretskii <eliz@gnu.org> wrote:

> "%s is not a valid character" is a better error message, IMO.

You're right. Thanks.





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

* bug#16677: 24.3.50; Wrong type argument: char-or-string-p, 67108923
  2014-02-07 10:52     ` Juanma Barranquero
@ 2014-02-07 11:15       ` Juanma Barranquero
  2014-02-08 10:20       ` Juri Linkov
  1 sibling, 0 replies; 7+ messages in thread
From: Juanma Barranquero @ 2014-02-07 11:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 16677-done

Committed (using key-description instead of help-key-description).





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

* bug#16677: 24.3.50; Wrong type argument: char-or-string-p, 67108923
       [not found]   ` <<83ppmzxseg.fsf@gnu.org>
@ 2014-02-07 17:02     ` Drew Adams
  0 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2014-02-07 17:02 UTC (permalink / raw)
  To: Eli Zaretskii, Juanma Barranquero; +Cc: 16677

> > +    (unless (characterp char)
> > +      (user-error "%s is not a character"
> > +                  (help-key-description (vector char) nil)))
> 
> "%s is not a valid character" is a better error message, IMO.

Yes; thanks to both of you for such a fix.





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

* bug#16677: 24.3.50; Wrong type argument: char-or-string-p, 67108923
  2014-02-07 10:52     ` Juanma Barranquero
  2014-02-07 11:15       ` Juanma Barranquero
@ 2014-02-08 10:20       ` Juri Linkov
  1 sibling, 0 replies; 7+ messages in thread
From: Juri Linkov @ 2014-02-08 10:20 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 16677

>> "%s is not a valid character" is a better error message, IMO.
>
> You're right. Thanks.

I installed the same change to `isearch-quote-char' as well.





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

end of thread, other threads:[~2014-02-08 10:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <<2ba9d857-f8b1-4f0b-8640-41229d998838@default>
     [not found] ` <<CAAeL0STsVYYLN+AVaGkA-NAcV5WKyHevGrcdMjBntVWC5Oy=Eg@mail.gmail.com>
     [not found]   ` <<83ppmzxseg.fsf@gnu.org>
2014-02-07 17:02     ` bug#16677: 24.3.50; Wrong type argument: char-or-string-p, 67108923 Drew Adams
2014-02-07  2:57 Drew Adams
2014-02-07  3:55 ` Juanma Barranquero
2014-02-07  8:01   ` Eli Zaretskii
2014-02-07 10:52     ` Juanma Barranquero
2014-02-07 11:15       ` Juanma Barranquero
2014-02-08 10:20       ` Juri Linkov

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