* Hungry delete in any mode
@ 2008-01-21 17:32 Nordlöw
2008-01-22 2:36 ` Kevin Rodgers
[not found] ` <mailman.6393.1200969426.18990.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 5+ messages in thread
From: Nordlöw @ 2008-01-21 17:32 UTC (permalink / raw)
To: help-gnu-emacs
Hi!
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.
nil
;; The indicator for the mode line.
" Hungry"
;; The minor mode bindings.
'(([backspace]. c-hungry-delete-backwards) ;backspace
("\d" . 'c-hungry-delete-forward) ;???
))
Thanks in advance,
Nordlöw
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Hungry delete in any mode
2008-01-21 17:32 Hungry delete in any mode Nordlöw
@ 2008-01-22 2:36 ` Kevin Rodgers
[not found] ` <mailman.6393.1200969426.18990.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 5+ messages in thread
From: Kevin Rodgers @ 2008-01-22 2:36 UTC (permalink / raw)
To: help-gnu-emacs
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.
> nil
> ;; 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
^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <mailman.6393.1200969426.18990.help-gnu-emacs@gnu.org>]
* Re: Hungry delete in any mode
[not found] ` <mailman.6393.1200969426.18990.help-gnu-emacs@gnu.org>
@ 2008-01-22 8:42 ` Nordlöw
2008-01-22 11:37 ` Nordlöw
0 siblings, 1 reply; 5+ messages in thread
From: Nordlöw @ 2008-01-22 8:42 UTC (permalink / raw)
To: help-gnu-emacs
On 22 Jan, 03:36, Kevin Rodgers <kevin.d.rodg...@gmail.com> wrote:
> 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.
> > nil
> > ;; 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
Neither [delete] nor "\C-d" works for me.
/Nordlöw
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Hungry delete in any mode
2008-01-22 8:42 ` Nordlöw
@ 2008-01-22 11:37 ` Nordlöw
2008-01-23 15:35 ` Stefan Monnier
0 siblings, 1 reply; 5+ messages in thread
From: Nordlöw @ 2008-01-22 11:37 UTC (permalink / raw)
To: help-gnu-emacs
I needed to restart Emacs in order for the changes to have effect.
This following code does it:
(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.
nil
;; The indicator for the mode line.
" Hungry"
;; The minor mode bindings.
'(([backspace]. c-hungry-delete-backwards) ;backspace
([delete] . c-hungry-delete-forward) ;delete
))
Thanks,
Nordlöw
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-01-23 15:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-21 17:32 Hungry delete in any mode Nordlöw
2008-01-22 2:36 ` Kevin Rodgers
[not found] ` <mailman.6393.1200969426.18990.help-gnu-emacs@gnu.org>
2008-01-22 8:42 ` Nordlöw
2008-01-22 11:37 ` Nordlöw
2008-01-23 15:35 ` Stefan Monnier
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.