[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hungry delete in any mode

From: Kevin Rodgers
Subject: Re: Hungry delete in any mode
Date: Mon, 21 Jan 2008 19:36:50 -0700
User-agent: Thunderbird (Macintosh/20071210)

Nordlöw wrote:
I trying to create a general hungry-mode that can be used in alla
programming modes. Everything works except that I the following code
only rebinds <backspace> but not <delete> (nor C-d). What have I
missed? Has perhaps someone already solved the problem?

(define-minor-mode any-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.
  ;; The indicator for the mode line.
  " Hungry"
  ;; The minor mode bindings.
  '(([backspace]. c-hungry-delete-backwards) ;backspace
    ("\d" . 'c-hungry-delete-forward)        ;???

You have bound the backspace function key and the DEL ASCII character
(by default, backspace is automatically translated to DEL).

Try also binding [delete] and "\C-d" (likewise, the ASCII character
to which delete is translated).

I wonder if an alternative implementaton would work: instead of binding
any keys at all, make backward-delete-char-untabify-method buffer local
and toggle its value between `hungry' and the global value.

Kevin Rodgers
Denver, Colorado, USA

reply via email to

[Prev in Thread] Current Thread [Next in Thread]