From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Bob Proulx Newsgroups: gmane.emacs.help Subject: Re: Make real tabs that stay tabs Date: Wed, 14 Feb 2018 18:50:16 -0700 Message-ID: <20180214183306074037926@bob.proulx.com> References: <87a7wc33od.fsf@local.lan> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1518659338 21737 195.159.176.226 (15 Feb 2018 01:48:58 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 15 Feb 2018 01:48:58 +0000 (UTC) User-Agent: Mutt/1.9.3 (2018-01-21) Cc: help-gnu-emacs@gnu.org To: Harry Putnam Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Feb 15 02:48:54 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1em8fN-0005KW-42 for geh-help-gnu-emacs@m.gmane.org; Thu, 15 Feb 2018 02:48:53 +0100 Original-Received: from localhost ([::1]:53964 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1em8hP-0001ai-26 for geh-help-gnu-emacs@m.gmane.org; Wed, 14 Feb 2018 20:50:59 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58194) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1em8gn-0001VR-TT for help-gnu-emacs@gnu.org; Wed, 14 Feb 2018 20:50:23 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1em8gk-0005Bo-Ro for help-gnu-emacs@gnu.org; Wed, 14 Feb 2018 20:50:21 -0500 Original-Received: from havoc.proulx.com ([96.88.95.61]:34743) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1em8gk-0005BM-Hn for help-gnu-emacs@gnu.org; Wed, 14 Feb 2018 20:50:18 -0500 Original-Received: from joseki.proulx.com (localhost [127.0.0.1]) by havoc.proulx.com (Postfix) with ESMTP id 331831792; Wed, 14 Feb 2018 18:50:17 -0700 (MST) Original-Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id E399521257; Wed, 14 Feb 2018 18:50:16 -0700 (MST) Original-Received: by hysteria.proulx.com (Postfix, from userid 1000) id D883D2DC6B; Wed, 14 Feb 2018 18:50:16 -0700 (MST) Mail-Followup-To: Harry Putnam , help-gnu-emacs@gnu.org Content-Disposition: inline In-Reply-To: <87a7wc33od.fsf@local.lan> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 96.88.95.61 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:116013 Archived-At: 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, runs the command =E2=80=98delete-backward-char=E2=80= =99 by default (some modes bind it to a different command); it does not insert a literal =E2=80=98DEL=E2=80=99 character (ASCII character code 127). ... =E2=80=98=E2=80=99 =E2=80=98=E2=80=99 Delete the character before point, or the region if it is active (=E2=80=98delete-backward-char=E2=80=99). 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 updates the indentation of the current line (*note Program Indent::). Furthermore, is usually bound to =E2=80=98backward-delete-char-untabify=E2=80=99, which deletes= backward treating each tab as if it were the equivalent number of spaces, so tha= t 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 =E2=80=98prog-mode-hook=E2=80=99, follow= ed by those specified in the mode=E2=80=99s 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