* custom backspace
@ 2014-04-22 23:00 Sam Halliday
2014-04-22 23:15 ` Sam Halliday
0 siblings, 1 reply; 5+ messages in thread
From: Sam Halliday @ 2014-04-22 23:00 UTC (permalink / raw)
To: help-gnu-emacs
Hi all,
I'd really like an emacs configuration whereby backspace will go back one layer of indentation if the previous character is an indented whitespace, for all programming language modes.
Also, I'd really like control-backspace to be contextual so that it will eat up all the whitespace if the previous character is whitespace, or delete a word (which I think is the default) if the previous character is a non-whitespace character.
Can anybody please help me to get this set up?
Best regards,
Sam
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: custom backspace
2014-04-22 23:00 custom backspace Sam Halliday
@ 2014-04-22 23:15 ` Sam Halliday
2014-04-22 23:27 ` Sam Halliday
2014-04-23 1:45 ` Drew Adams
0 siblings, 2 replies; 5+ messages in thread
From: Sam Halliday @ 2014-04-22 23:15 UTC (permalink / raw)
To: help-gnu-emacs
On Wednesday, 23 April 2014 00:00:46 UTC+1, Sam Halliday wrote:
> I'd really like an emacs configuration whereby backspace will go back one layer of indentation if the previous character is an indented whitespace, for all programming language modes.
>
>
> Also, I'd really like control-backspace to be contextual so that it will eat up all the whitespace if the previous character is whitespace, or delete a word (which I think is the default) if the previous character is a non-whitespace character.
I should add some information to this to explain why I need some help:
1. "m-x describe-key" tells me that my "backspace" or DEL is bound to
(backward-delete-char-untabify ARG &optional KILLP)
with value untabify. But if type lots of spaces (e.g. in the scratch or my .emacs) and then press backspace, it only goes back one character at a time... not untabbing.
2. describe on my control-backspace reveals that this is bound to C-backspace. But when I try to create any form of binding for C-backspace in my .emacs I get an error that control must be followed by a single character... so I don't have a clue how to rebind this.
Help greatly appreciated :-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: custom backspace
2014-04-22 23:15 ` Sam Halliday
@ 2014-04-22 23:27 ` Sam Halliday
2014-04-22 23:51 ` Paul Smith
2014-04-23 1:45 ` Drew Adams
1 sibling, 1 reply; 5+ messages in thread
From: Sam Halliday @ 2014-04-22 23:27 UTC (permalink / raw)
To: help-gnu-emacs
On Wednesday, 23 April 2014 00:15:38 UTC+1, Sam Halliday wrote:
> But when I try to create any form of binding for C-backspace in my .emacs I get an error that control must be followed by a single character.
I've solved this small part of the problem at least: "<C-backspace>", not "C-backspace" when defining the global key. I guess now I need a little lambda that checks to see the value of the previous character and acts accordingly.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: custom backspace
2014-04-22 23:27 ` Sam Halliday
@ 2014-04-22 23:51 ` Paul Smith
0 siblings, 0 replies; 5+ messages in thread
From: Paul Smith @ 2014-04-22 23:51 UTC (permalink / raw)
To: Sam Halliday; +Cc: help-gnu-emacs
Not sure what "all programming modes" means to you, but you can check
out the hungry delete commands and mode in CC-mode, which covers a
number of different programming modes. It might be interesting to see
how it works, if nothing else.
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: custom backspace
2014-04-22 23:15 ` Sam Halliday
2014-04-22 23:27 ` Sam Halliday
@ 2014-04-23 1:45 ` Drew Adams
1 sibling, 0 replies; 5+ messages in thread
From: Drew Adams @ 2014-04-23 1:45 UTC (permalink / raw)
To: Sam Halliday, help-gnu-emacs
> 1. "m-x describe-key" tells me that my "backspace" or DEL is bound to
> (backward-delete-char-untabify ARG &optional KILLP)
>
> with value untabify. But if type lots of spaces (e.g. in the scratch or my
> .emacs) and then press backspace, it only goes back one character at a
> time... not untabbing.
It *is* untabifying. If the char before point is a tab character,
then without untabifying behavior that char is removed. With
untabifying, the tab char is converted to SPC chars and then one of
those SPC chars is removed, instead.
> 2. describe on my control-backspace reveals that this is bound to C-
> backspace. But when I try to create any form of binding for C-backspace in
> my .emacs I get an error that control must be followed by a single
> character... so I don't have a clue how to rebind this.
Use `C-h k', then hit the `C-backspace' key. It tells you something
like this:
<C-backspace> runs the command backward-kill-paragraph...
Now you know how Emacs prints the name of that key sequence: <C-backspace>.
So do this:
(global-set-key (kbd "<C-backspace>") 'your-command)
See the Emacs manual, node `Init Rebinding'.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-04-23 1:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-22 23:00 custom backspace Sam Halliday
2014-04-22 23:15 ` Sam Halliday
2014-04-22 23:27 ` Sam Halliday
2014-04-22 23:51 ` Paul Smith
2014-04-23 1:45 ` Drew Adams
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.