* Make real tabs that stay tabs
@ 2018-02-13 22:50 Harry Putnam
[not found] ` <CANc-5UxbB-kOxz6edFdT7Zfht3bAAC-5+_oH5zH_HzhCoQ9QsA@mail.gmail.com>
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Harry Putnam @ 2018-02-13 22:50 UTC (permalink / raw)
To: help-gnu-emacs
I know how to insert tabs in emacs I thought.
C-q <tab>
And sure enough the cursor jumps like a tab was inserted.
So insert 2 or three but OOPS If I decide to back one out with
backspace I'm backing by spaces not by tabs.
Seems like if I take care to insert a real tab then it ought to act
like a real tab when I backspace over it too.
Recently I found myself correcting an rsnapshot.conf file where things
MUST be separated by tabs.. one way to test is to back over what is
there and see if your cursor jumps a tabs worth. But apparently that
cannot be done with emacs.
I seem to recall being able to do that in the past.
Can someone explain this to me.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Make real tabs that stay tabs
[not found] ` <CANc-5UyVM5Bxi-ebCaZ0Ktc5EYCi0nboLqpgOtTiWwWhOSoGMw@mail.gmail.com>
@ 2018-02-13 23:04 ` Skip Montanaro
[not found] ` <CANc-5UxbZnxgQtsFKVCdJ3DX_M5fd-jUkfMD-up=uV8JfxP5FQ@mail.gmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Skip Montanaro @ 2018-02-13 23:04 UTC (permalink / raw)
To: Harry Putnam; +Cc: Help GNU Emacs
It's been a long time since I cared about such things (I'm a Python
developer, so tabs are anathema unless I'm editing a makefile), but I'm
pretty sure there's a delete-backward-using-spaces variable, or something
similar. Poke around with M-x apropos. I'd hunt myself, but only have my
smarty-pants Android phone at the ready. I don't think it has GNU Emacs
installed. :-)
Skip
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Make real tabs that stay tabs
[not found] ` <CANc-5UxbZnxgQtsFKVCdJ3DX_M5fd-jUkfMD-up=uV8JfxP5FQ@mail.gmail.com>
@ 2018-02-13 23:10 ` Skip Montanaro
0 siblings, 0 replies; 6+ messages in thread
From: Skip Montanaro @ 2018-02-13 23:10 UTC (permalink / raw)
To: Harry Putnam; +Cc: Help GNU Emacs
Maybe this page in the Lisp ref manual will help.
https://www.gnu.org/software/emacs/manual/html_node/elisp/Deletion.html
Skip
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Make real tabs that stay tabs
[not found] <mailman.9064.1518562304.27995.help-gnu-emacs@gnu.org>
@ 2018-02-13 23:19 ` Ben Bacarisse
0 siblings, 0 replies; 6+ messages in thread
From: Ben Bacarisse @ 2018-02-13 23:19 UTC (permalink / raw)
To: help-gnu-emacs
Harry Putnam <reader@newsguy.com> writes:
> I know how to insert tabs in emacs I thought.
>
> C-q <tab>
>
> And sure enough the cursor jumps like a tab was inserted.
>
> So insert 2 or three but OOPS If I decide to back one out with
> backspace I'm backing by spaces not by tabs.
>
> Seems like if I take care to insert a real tab then it ought to act
> like a real tab when I backspace over it too.
In recent Emacs, there's a custom option "Backward Delete Char Untabify
Method" (there's a variable backward-delete-char-untabify-method too, of
course) in the "Killing" group.
--
Ben.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Make real tabs that stay tabs
2018-02-13 22:50 Make real tabs that stay tabs Harry Putnam
[not found] ` <CANc-5UxbB-kOxz6edFdT7Zfht3bAAC-5+_oH5zH_HzhCoQ9QsA@mail.gmail.com>
@ 2018-02-15 1:50 ` Bob Proulx
2018-02-15 7:41 ` Bastian Beischer
2 siblings, 0 replies; 6+ messages in thread
From: Bob Proulx @ 2018-02-15 1:50 UTC (permalink / raw)
To: Harry Putnam; +Cc: help-gnu-emacs
Harry Putnam wrote:
> So insert 2 or three but OOPS If I decide to back one out with
> backspace I'm backing by spaces not by tabs.
That behavior is the behavior of backward-delete-char-untabify.
As I look at things now the keybinding appears to be changed in some
mode specific ways. For example in fundamental mode DEL is bound to
backward-delete-char-untabify but in a mail composition mode DEL is
bound to delete-backward-char. I double checked this just now using
'emacs -Q'.
> Seems like if I take care to insert a real tab then it ought to act
> like a real tab when I backspace over it too.
Emacs doesn't keep track of how you inserted the character. It
doens't know about quoting a key with C-q to insert it. But emacs
does know about the buffer mode.
Next time you have this problem try this experiment. Convert back to
funamental mode. It should work as you want.
M-x fundamental-mode
> Recently I found myself correcting an rsnapshot.conf file where things
> MUST be separated by tabs.. one way to test is to back over what is
> there and see if your cursor jumps a tabs worth. But apparently that
> cannot be done with emacs.
I think that apparently the .conf mode which was triggered by the file
name or local variable caused emacs to switch keymaps to bind the
Backspace key DEL to backward-delete-char-untabify .
> I seem to recall being able to do that in the past.
The emacs documentation says:
For instance, <DEL> runs the command ‘delete-backward-char’ by default
(some modes bind it to a different command); it does not insert a
literal ‘DEL’ character (ASCII character code 127).
...
‘<DEL>’
‘<BACKSPACE>’
Delete the character before point, or the region if it is active
(‘delete-backward-char’).
The default behavior is as you like it deleting the TAB character.
However the manual also says:
In most programming languages, indentation should vary from line to
line to illustrate the structure of the program. Therefore, in most
programming language modes, typing <TAB> updates the indentation of the
current line (*note Program Indent::). Furthermore, <DEL> is usually
bound to ‘backward-delete-char-untabify’, which deletes backward
treating each tab as if it were the equivalent number of spaces, so that
you can delete one column of indentation without worrying whether the
whitespace consists of spaces or tabs.
Therefore the .conf mode you were in must be doing the above. What
mode is displayed in the mode line when you are editing that file?
When I edit a file named rsnapshot.conf here I see "Conf[Unix]" as the
mode and here DEL is mapped to delete-backward-char so I don't know
why your mode was different. However I see this in other modes such
as in C program modes. The manual also says:
Entering a programming language mode runs the custom Lisp functions
specified in the hook variable ‘prog-mode-hook’, followed by those
specified in the mode’s own mode hook (*note Major Modes::).
If the .conf file mode you are using is derived from a programming
mode then perhaps the best answer is one of two possibilities. Either
change to a different mode such as fundamental-mode or configure
programming modes and their children using prog-mode-hook to rebind
the DEL key as you like overriding the mode keymap.
> Can someone explain this to me.
Hopefully this makes sense of what is happening.
Bob
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Make real tabs that stay tabs
2018-02-13 22:50 Make real tabs that stay tabs Harry Putnam
[not found] ` <CANc-5UxbB-kOxz6edFdT7Zfht3bAAC-5+_oH5zH_HzhCoQ9QsA@mail.gmail.com>
2018-02-15 1:50 ` Bob Proulx
@ 2018-02-15 7:41 ` Bastian Beischer
2 siblings, 0 replies; 6+ messages in thread
From: Bastian Beischer @ 2018-02-15 7:41 UTC (permalink / raw)
To: Harry Putnam; +Cc: Help-Gnu-Emacs
On Tue, Feb 13, 2018 at 11:50 PM, Harry Putnam <reader@newsguy.com> wrote:
> I know how to insert tabs in emacs I thought.
>
> C-q <tab>
>
> And sure enough the cursor jumps like a tab was inserted.
>
> So insert 2 or three but OOPS If I decide to back one out with
> backspace I'm backing by spaces not by tabs.
>
> Seems like if I take care to insert a real tab then it ought to act
> like a real tab when I backspace over it too.
>
> Recently I found myself correcting an rsnapshot.conf file where things
> MUST be separated by tabs.. one way to test is to back over what is
> there and see if your cursor jumps a tabs worth.
Do you know about "whitespace-mode"? It will highlight tabs with a
different face (at least if you configure it to), so you don't need to
fallback to such workarounds. It has many other nice features as well.
> But apparently that
> cannot be done with emacs.
>
> I seem to recall being able to do that in the past.
>
> Can someone explain this to me.
>
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-02-15 7:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-13 22:50 Make real tabs that stay tabs Harry Putnam
[not found] ` <CANc-5UxbB-kOxz6edFdT7Zfht3bAAC-5+_oH5zH_HzhCoQ9QsA@mail.gmail.com>
[not found] ` <CANc-5Uw7WwgipT7iXjm09sKa4Uumuk9i5gP0eB-9pPeszfTdwA@mail.gmail.com>
[not found] ` <CANc-5UxrJdwDRH=OMHTZVpVpyNKMD+mnm08r9MaL1V6LgKoYFw@mail.gmail.com>
[not found] ` <CANc-5UyVM5Bxi-ebCaZ0Ktc5EYCi0nboLqpgOtTiWwWhOSoGMw@mail.gmail.com>
2018-02-13 23:04 ` Skip Montanaro
[not found] ` <CANc-5UxbZnxgQtsFKVCdJ3DX_M5fd-jUkfMD-up=uV8JfxP5FQ@mail.gmail.com>
2018-02-13 23:10 ` Skip Montanaro
2018-02-15 1:50 ` Bob Proulx
2018-02-15 7:41 ` Bastian Beischer
[not found] <mailman.9064.1518562304.27995.help-gnu-emacs@gnu.org>
2018-02-13 23:19 ` Ben Bacarisse
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).