unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6334: 24.0.50; both examples in (elisp) Defining Minor Modes raise an error
@ 2010-06-02 21:42 ` Drew Adams
  2010-07-27  1:38   ` Juanma Barranquero
  0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2010-06-02 21:42 UTC (permalink / raw)
  To: 6334

emacs -Q
 
Try evaluating either of these examples from (elisp) Defining Minor
Modes:
 
(define-minor-mode hungry-mode
       "Toggle Hungry mode.
     With no argument, this command toggles the mode.
     Non-null prefix argument turns on the mode.
     Null prefix argument turns off the mode.
 
     When Hungry mode is enabled, the control delete key
     gobbles all preceding whitespace except the last.
     See the command \\[hungry-electric-delete]."
      ;; The initial value.
      nil
      ;; The indicator for the mode line.
      " Hungry"
      ;; The minor mode bindings.
      '(("\C-\^?" . hungry-electric-delete))
      :group 'hunger)
 
(define-minor-mode hungry-mode
       "Toggle Hungry mode.
     With no argument, this command toggles the mode.
     Non-null prefix argument turns on the mode.
     Null prefix argument turns off the mode.
 
     When Hungry mode is enabled, the control delete key
     gobbles all preceding whitespace except the last.
     See the command \\[hungry-electric-delete]."
      ;; The initial value.
      :init-value nil
      ;; The indicator for the mode line.
      :lighter " Hungry"
      ;; The minor mode bindings.
      :keymap
      '(("\C-\^?" . hungry-electric-delete)
        ("\C-\M-\^?"
         . (lambda ()
             (interactive)
             (hungry-electric-delete t))))
      :group 'hunger)
 
Both raise this error:
 
Debugger entered--Lisp error: (error "Invalid modifier in string")
 

In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
 of 2010-05-23 on G41R2F1
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --no-opt --cflags -Ic:/xpm/include'
 






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

* bug#6334: 24.0.50; both examples in (elisp) Defining Minor Modes  raise an error
  2010-06-02 21:42 ` bug#6334: 24.0.50; both examples in (elisp) Defining Minor Modes raise an error Drew Adams
@ 2010-07-27  1:38   ` Juanma Barranquero
  2010-07-27  4:44     ` Sven Joachim
  2010-07-27 11:26     ` Štěpán Němec
  0 siblings, 2 replies; 10+ messages in thread
From: Juanma Barranquero @ 2010-07-27  1:38 UTC (permalink / raw)
  To: Drew Adams; +Cc: 6334-done

On Wed, Jun 2, 2010 at 23:42, Drew Adams <drew.adams@oracle.com> wrote:

> Debugger entered--Lisp error: (error "Invalid modifier in string")

I've fixed it using C-delete and C-M-delete (which are clearer anyway)
in the examples.

    Juanma





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

* bug#6334: 24.0.50; both examples in (elisp) Defining Minor Modes  raise an error
  2010-07-27  1:38   ` Juanma Barranquero
@ 2010-07-27  4:44     ` Sven Joachim
  2010-07-27 16:15       ` Juanma Barranquero
  2010-07-27 11:26     ` Štěpán Němec
  1 sibling, 1 reply; 10+ messages in thread
From: Sven Joachim @ 2010-07-27  4:44 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 6334

On 2010-07-27 03:38 +0200, Juanma Barranquero wrote:

> On Wed, Jun 2, 2010 at 23:42, Drew Adams <drew.adams@oracle.com> wrote:
>
>> Debugger entered--Lisp error: (error "Invalid modifier in string")
>
> I've fixed it using C-delete and C-M-delete (which are clearer anyway)
> in the examples.

C-M-delete is not the most fortunate choice since it can induce a reboot
on some systems (e.g. on the GNU/Linux console or on MS-DOS).  On
Windows, it invokes the task manager IIRC.

Sven





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

* bug#6334: 24.0.50; both examples in (elisp) Defining Minor Modes  raise an error
  2010-07-27  1:38   ` Juanma Barranquero
  2010-07-27  4:44     ` Sven Joachim
@ 2010-07-27 11:26     ` Štěpán Němec
  2010-07-27 16:18       ` Juanma Barranquero
  1 sibling, 1 reply; 10+ messages in thread
From: Štěpán Němec @ 2010-07-27 11:26 UTC (permalink / raw)
  To: 6334; +Cc: lekktu

Juanma Barranquero <lekktu@gmail.com> writes:

> On Wed, Jun 2, 2010 at 23:42, Drew Adams <drew.adams@oracle.com> wrote:
>
>> Debugger entered--Lisp error: (error "Invalid modifier in string")
>
> I've fixed it using C-delete and C-M-delete (which are clearer anyway)
> in the examples.

I'm not sure if you intended to preserve the key binding, let me just
point out that ^? (which was in the original example) is (ASCII) DEL,
i.e. usually [backspace], not [delete] on (modern?) text terminals.

Štěpán





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

* bug#6334: 24.0.50; both examples in (elisp) Defining Minor Modes  raise an error
  2010-07-27  4:44     ` Sven Joachim
@ 2010-07-27 16:15       ` Juanma Barranquero
  0 siblings, 0 replies; 10+ messages in thread
From: Juanma Barranquero @ 2010-07-27 16:15 UTC (permalink / raw)
  To: Sven Joachim; +Cc: 6334

On Tue, Jul 27, 2010 at 06:44, Sven Joachim <svenjoac@gmx.de> wrote:

> C-M-delete is not the most fortunate choice since it can induce a reboot
> on some systems (e.g. on the GNU/Linux console or on MS-DOS).  On
> Windows, it invokes the task manager IIRC.

I agree. I didn't want to change the documentation, just fix the bug.

    Juanma





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

* bug#6334: 24.0.50; both examples in (elisp) Defining Minor Modes  raise an error
  2010-07-27 11:26     ` Štěpán Němec
@ 2010-07-27 16:18       ` Juanma Barranquero
  2010-07-27 17:00         ` Štěpán Němec
  0 siblings, 1 reply; 10+ messages in thread
From: Juanma Barranquero @ 2010-07-27 16:18 UTC (permalink / raw)
  To: Štěpán Němec; +Cc: 6334

On Tue, Jul 27, 2010 at 13:26, Štěpán Němec <stepnem@gmail.com> wrote:

> I'm not sure if you intended to preserve the key binding, let me just
> point out that ^? (which was in the original example) is (ASCII) DEL,
> i.e. usually [backspace], not [delete] on (modern?) text terminals.

The docstring for the sample minor mode says "the control delete key",
and my DEL key returns delete. If there's a more apropriate key
binding that does not reproduce the bug, it's fine by me.

    Juanma





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

* bug#6334: 24.0.50; both examples in (elisp) Defining Minor Modes  raise an error
  2010-07-27 16:18       ` Juanma Barranquero
@ 2010-07-27 17:00         ` Štěpán Němec
  2010-07-27 17:08           ` Juanma Barranquero
  0 siblings, 1 reply; 10+ messages in thread
From: Štěpán Němec @ 2010-07-27 17:00 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 6334

Juanma Barranquero <lekktu@gmail.com> writes:

> On Tue, Jul 27, 2010 at 13:26, Štěpán Němec <stepnem@gmail.com> wrote:
>
>> I'm not sure if you intended to preserve the key binding, let me just
>> point out that ^? (which was in the original example) is (ASCII) DEL,
>> i.e. usually [backspace], not [delete] on (modern?) text terminals.
>
> The docstring for the sample minor mode says "the control delete key",
> and my DEL key returns delete. If there's a more apropriate key
> binding that does not reproduce the bug, it's fine by me.

That'd be [C-backspace], if you're using the vector notation. Note we're
talking about the DEL _character_, not the key labeled Del(ete). It's
the Backspace key that usually sends DEL in the terminal (also note that
the example speaks about deleting all _preceding_ whitespace). I suspect
"the control delete key" wording comes from times when the keyboards
were somewhat different from those of today.

But it's only an example, so all this perhaps doesn't matter. I just
thought I'd mention the semantic shift introduced by the change, sorry.

  Štěpán





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

* bug#6334: 24.0.50; both examples in (elisp) Defining Minor Modes  raise an error
  2010-07-27 17:00         ` Štěpán Němec
@ 2010-07-27 17:08           ` Juanma Barranquero
  2010-07-27 20:22             ` David De La Harpe Golden
  0 siblings, 1 reply; 10+ messages in thread
From: Juanma Barranquero @ 2010-07-27 17:08 UTC (permalink / raw)
  To: Štěpán Němec; +Cc: 6334

On Tue, Jul 27, 2010 at 19:00, Štěpán Němec <stepnem@gmail.com> wrote:

> Note we're
> talking about the DEL _character_, not the key labeled Del(ete).

The "control delete" bit on the docstring makes me think of pressing
the keys labeled Ctrl and Del, not Ctrl + Backspace...

> (also note that
> the example speaks about deleting all _preceding_ whitespace).

...but I suspect you're right. I'll change it to C-backspace /
C-M-backspace, if everybody thinks these are the right keybindings.

> But it's only an example, so all this perhaps doesn't matter. I just
> thought I'd mention the semantic shift introduced by the change, sorry.

No, thanks for bringing this up.

    Juanma





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

* bug#6334: 24.0.50; both examples in (elisp) Defining Minor Modes raise an error
  2010-07-27 17:08           ` Juanma Barranquero
@ 2010-07-27 20:22             ` David De La Harpe Golden
  2010-07-27 22:41               ` Juanma Barranquero
  0 siblings, 1 reply; 10+ messages in thread
From: David De La Harpe Golden @ 2010-07-27 20:22 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 6334, Štěpán Němec

On 27/07/10 18:08, Juanma Barranquero wrote:


> ...but I suspect you're right. I'll change it to C-backspace /
> C-M-backspace, if everybody thinks these are the right keybindings.
>

Just noting: C-M-backspace traditionally kills an x11 server, usually 
dumping you back at a login screen when the login manager (x/g/k)dm 
respawns the server. Sometimes it's disabled these days.








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

* bug#6334: 24.0.50; both examples in (elisp) Defining Minor Modes  raise an error
  2010-07-27 20:22             ` David De La Harpe Golden
@ 2010-07-27 22:41               ` Juanma Barranquero
  0 siblings, 0 replies; 10+ messages in thread
From: Juanma Barranquero @ 2010-07-27 22:41 UTC (permalink / raw)
  To: David De La Harpe Golden; +Cc: 6334, Štěpán Němec

On Tue, Jul 27, 2010 at 22:22, David De La Harpe Golden
<david@harpegolden.net> wrote:

> Just noting: C-M-backspace traditionally kills an x11 server,

"\C-\M-\^?" is what the original example used.

    Juanma





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

end of thread, other threads:[~2010-07-27 22:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <AcsCnIknca5GRt4nT1+ZpSXlweHjjg==>
2010-06-02 21:42 ` bug#6334: 24.0.50; both examples in (elisp) Defining Minor Modes raise an error Drew Adams
2010-07-27  1:38   ` Juanma Barranquero
2010-07-27  4:44     ` Sven Joachim
2010-07-27 16:15       ` Juanma Barranquero
2010-07-27 11:26     ` Štěpán Němec
2010-07-27 16:18       ` Juanma Barranquero
2010-07-27 17:00         ` Štěpán Němec
2010-07-27 17:08           ` Juanma Barranquero
2010-07-27 20:22             ` David De La Harpe Golden
2010-07-27 22:41               ` Juanma Barranquero

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