unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Segfault after bad value for meta-prefix-char
@ 2005-01-20  0:24 Peter Heslin
  2005-01-20  1:10 ` Johan Bockgård
  2005-01-20 21:32 ` Richard Stallman
  0 siblings, 2 replies; 9+ messages in thread
From: Peter Heslin @ 2005-01-20  0:24 UTC (permalink / raw)


Since I never use the ESC key in Emacs, I was experimenting with
trying to see if I could bind it to something like
keyboard-escape-quit, which I might find useful.

Someone in the archives of the xemacs mailing list posted this code:

(setq meta-prefix-char -1)

So I tried it in GNU Emacs (very stale CVS checkout), and got a
segfault.  To reproduce it do:

emacs -q
(setq meta-prefix-char -1) C-x C-e
M-x

Apparently xemacs documents: "To disable the meta-prefix-char, set it
to a negative number."  Even if this usage is not legal in GNU Emacs,
trying it presumably should not cause a segfault.

It would be nice if it were possible to make the escape key a
non-prefix key (when running under a windowing system, not a console).

Peter

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

* Re: Segfault after bad value for meta-prefix-char
  2005-01-20  0:24 Segfault after bad value for meta-prefix-char Peter Heslin
@ 2005-01-20  1:10 ` Johan Bockgård
  2005-01-20 10:38   ` Peter Heslin
  2005-01-20 21:32 ` Richard Stallman
  1 sibling, 1 reply; 9+ messages in thread
From: Johan Bockgård @ 2005-01-20  1:10 UTC (permalink / raw)


Peter Heslin <public@heslin.eclipse.co.uk> writes:

> It would be nice if it were possible to make the escape key a
> non-prefix key (when running under a windowing system, not a
> console).

You can bind the <escape> function key, (global-set-key [escape] 'foo)
etc.

-- 
Johan Bockgård

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

* Re: Segfault after bad value for meta-prefix-char
  2005-01-20  1:10 ` Johan Bockgård
@ 2005-01-20 10:38   ` Peter Heslin
  2005-01-20 12:08     ` Andreas Schwab
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Heslin @ 2005-01-20 10:38 UTC (permalink / raw)


On 2005-01-20, Johan Bockgård <bojohan+news@dd.chalmers.se> wrote:
>  Peter Heslin <public@heslin.eclipse.co.uk> writes:
> 
> > It would be nice if it were possible to make the escape key a
> > non-prefix key (when running under a windowing system, not a
> > console).
> 
>  You can bind the <escape> function key, (global-set-key [escape] 'foo)
>  etc.

Ah.  Thanks, that works.  I had tried this:

(global-set-key (kbd "<ESC>")   'keyboard-escape-quit)

but that seems to disable the Meta key, which is why I started mucking
around with meta-prefix-char.  Is it expected behavior that binding
[escape] works while binding (kbd "<ESC>") doesn't?

Peter

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

* Re: Segfault after bad value for meta-prefix-char
  2005-01-20 10:38   ` Peter Heslin
@ 2005-01-20 12:08     ` Andreas Schwab
  0 siblings, 0 replies; 9+ messages in thread
From: Andreas Schwab @ 2005-01-20 12:08 UTC (permalink / raw)
  Cc: emacs-devel

Peter Heslin <public@heslin.eclipse.co.uk> writes:

> Ah.  Thanks, that works.  I had tried this:
>
> (global-set-key (kbd "<ESC>")   'keyboard-escape-quit)
>
> but that seems to disable the Meta key, which is why I started mucking
> around with meta-prefix-char.  Is it expected behavior that binding
> [escape] works while binding (kbd "<ESC>") doesn't?

Normally, [escape] is translated to "\e" via function-key-map, and the
latter is used for looking up meta keys (except function keys), thus if
you rebind "\e" they won't work any more.  Binding [escape] overrides the
entry in function-key-map, but "\e" still goes through the normal lookup,
thus it wouldn't change anything for a tty frame.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: Segfault after bad value for meta-prefix-char
  2005-01-20  0:24 Segfault after bad value for meta-prefix-char Peter Heslin
  2005-01-20  1:10 ` Johan Bockgård
@ 2005-01-20 21:32 ` Richard Stallman
  2005-01-20 23:28   ` Error while compiling; was " Peter Heslin
  2005-01-21 12:34   ` Peter Heslin
  1 sibling, 2 replies; 9+ messages in thread
From: Richard Stallman @ 2005-01-20 21:32 UTC (permalink / raw)
  Cc: emacs-devel

Does this patch fix the problem?

*** keymap.c	13 Jan 2005 14:48:46 -0500	1.299
--- keymap.c	20 Jan 2005 10:44:16 -0500	
***************
*** 528,533 ****
--- 528,537 ----
        struct gcpro gcpro1;
        Lisp_Object meta_map;
        GCPRO1 (map);
+       /* A strange value in which Meta is set would cause
+ 	 infinite recursion.  Protect against that.  */
+       if (meta_prefix_char & CHAR_META)
+ 	meta_prefix_char = make_number (27);
        meta_map = get_keymap (access_keymap (map, meta_prefix_char,
  					    t_ok, noinherit, autoload),
  			     0, autoload);

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

* Error while compiling; was Segfault after bad value for meta-prefix-char
  2005-01-20 21:32 ` Richard Stallman
@ 2005-01-20 23:28   ` Peter Heslin
  2005-01-21  6:01     ` Jan D.
  2005-01-21 12:34   ` Peter Heslin
  1 sibling, 1 reply; 9+ messages in thread
From: Peter Heslin @ 2005-01-20 23:28 UTC (permalink / raw)


On 2005-01-20, Richard Stallman <rms@gnu.org> wrote:
>  Does this patch fix the problem?

Before trying the patch, I thought I should do cvs update, since I
hadn't done it in quite a while, and now I get an error while
compiling Emacs:

gtkutil.c: In function `xg_get_file_name':
gtkutil.c:1324: parse error before `extern'
gtkutil.c:1326: `x_use_old_gtk_file_dialog' undeclared (first use in
this function)
gtkutil.c:1326: (Each undeclared identifier is reported only once
gtkutil.c:1326: for each function it appears in.)
gtkutil.c: In function `xg_tool_bar_detach_callback':
gtkutil.c:3164: parse error before `int'
make[1]: *** [gtkutil.o] Error 1
make[1]: Leaving directory `/usr/src/emacs/src'
make: *** [bootstrap-build] Error 2

I tried a clean CVS checkout and ./configure --with-x-toolkit=gtk,
make bootstrap, with the same result.

Peter

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

* Re: Error while compiling; was Segfault after bad value for meta-prefix-char
  2005-01-20 23:28   ` Error while compiling; was " Peter Heslin
@ 2005-01-21  6:01     ` Jan D.
  2005-01-21 12:02       ` Peter Heslin
  0 siblings, 1 reply; 9+ messages in thread
From: Jan D. @ 2005-01-21  6:01 UTC (permalink / raw)
  Cc: emacs-devel

> On 2005-01-20, Richard Stallman <rms@gnu.org> wrote:
>>  Does this patch fix the problem?
>
> Before trying the patch, I thought I should do cvs update, since I
> hadn't done it in quite a while, and now I get an error while
> compiling Emacs:
>
> gtkutil.c: In function `xg_get_file_name':
> gtkutil.c:1324: parse error before `extern'
> gtkutil.c:1326: `x_use_old_gtk_file_dialog' undeclared (first use in
> this function)
> gtkutil.c:1326: (Each undeclared identifier is reported only once
> gtkutil.c:1326: for each function it appears in.)
> gtkutil.c: In function `xg_tool_bar_detach_callback':
> gtkutil.c:3164: parse error before `int'
> make[1]: *** [gtkutil.o] Error 1
> make[1]: Leaving directory `/usr/src/emacs/src'
> make: *** [bootstrap-build] Error 2
>
> I tried a clean CVS checkout and ./configure --with-x-toolkit=gtk,
> make bootstrap, with the same result.

You are probably using a non-ANSI (1999) C compiler. I've fixed those 
places
so they compile for old compilers also.

	Jan D.

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

* Re: Error while compiling; was Segfault after bad value for meta-prefix-char
  2005-01-21  6:01     ` Jan D.
@ 2005-01-21 12:02       ` Peter Heslin
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Heslin @ 2005-01-21 12:02 UTC (permalink / raw)


On 2005-01-21, Jan D. <jan.h.d@swipnet.se> wrote:
> > I tried a clean CVS checkout and ./configure --with-x-toolkit=gtk,
> > make bootstrap, with the same result.
> 
>  You are probably using a non-ANSI (1999) C compiler. I've fixed those 
>  places
>  so they compile for old compilers also.

Sorry, I should have said.  This is gcc on a (not too old) Debian
GNU/Linux installation for i386: gcc version 2.95.4 20011002 (Debian
prerelease).

Anyway, the error's gone now -- thanks!

Peter

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

* Re: Segfault after bad value for meta-prefix-char
  2005-01-20 21:32 ` Richard Stallman
  2005-01-20 23:28   ` Error while compiling; was " Peter Heslin
@ 2005-01-21 12:34   ` Peter Heslin
  1 sibling, 0 replies; 9+ messages in thread
From: Peter Heslin @ 2005-01-21 12:34 UTC (permalink / raw)


On 2005-01-20, Richard Stallman <rms@gnu.org> wrote:
>  Does this patch fix the problem?

Yes, it does.  Thanks.

>  *** keymap.c	13 Jan 2005 14:48:46 -0500	1.299
>  ***************
>  *** 528,533 ****
>          struct gcpro gcpro1;
>          Lisp_Object meta_map;
>          GCPRO1 (map);
>  +       /* A strange value in which Meta is set would cause
>  + 	 infinite recursion.  Protect against that.  */
>  +       if (meta_prefix_char & CHAR_META)
>  + 	meta_prefix_char = make_number (27);
>          meta_map = get_keymap (access_keymap (map, meta_prefix_char,
>    					    t_ok, noinherit, autoload),
>    			     0, autoload);

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

end of thread, other threads:[~2005-01-21 12:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-20  0:24 Segfault after bad value for meta-prefix-char Peter Heslin
2005-01-20  1:10 ` Johan Bockgård
2005-01-20 10:38   ` Peter Heslin
2005-01-20 12:08     ` Andreas Schwab
2005-01-20 21:32 ` Richard Stallman
2005-01-20 23:28   ` Error while compiling; was " Peter Heslin
2005-01-21  6:01     ` Jan D.
2005-01-21 12:02       ` Peter Heslin
2005-01-21 12:34   ` Peter Heslin

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