Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!bbn!ulowell!tegra!vail From: vail@tegra.UUCP (Johnathan Vail) Newsgroups: gnu.emacs Subject: Re: Use of Tabs in GNU emacs Message-ID: <581@atlas.tegra.UUCP> Date: 28 Jul 89 21:13:24 GMT References: <2939@yunexus.UUCP> Organization: Tegra-Varityper, Inc., Billerica, MA Lines: 66 In-reply-to: landolt@yunexus.UUCP's message of 26 Jul 89 15:12:00 GMT In article <2939@yunexus.UUCP> landolt@yunexus.UUCP (Paul Landolt) writes: I am currently using GNU emacs on a BSD 4.3 system (if this matters). In C-mode, the TAB key performs a lisp-indent command, rather than something similar to tab-to-tab-stop (I looked up the names). In C mode it should be bound to c-indent-command. Then, depending on how your C mode variables are set this can be every 8 characters. Emacs seems to be real smart on figuring out the right amount of tabs and spaces for a particular tab stop. For some lines, with comments, you can *always* insert a real tab with C-Q TAB. Here is the code I use for configuring my C mode: ----------------8<----------------8<----------------8<---------------- ; ; This makes the TAB key be a tab except when in the left margin or ; leftmost whitespace. (setq c-tab-always-indent nil) ; If you prefer an indenting of 8 columns (1 TAB) you can put this ; line in your .emacs: ; (c-set-new-indent 8) ; or type `C-U 8 M-x c-set-new-indent RET' while running gmacs (setq c-indent-level (setq c-continued-statement-offset 4)) (setq c-argdecl-indent (setq c-label-offset 0)) ; Set the C indenting to whatever the arg is. ; This is useful when hacking someone else's code (defun c-set-new-indent (arg) "Set the C indenting variables to arg set with C-U" (interactive "P") (setq c-indent-level (setq c-continued-statement-offset (car arg)))) ----------------8<----------------8<----------------8<---------------- All I really want is for my tab key to insert a TAB into the file, and, for the delete key to erase the tab (not just a space or two) in the file. Try this: on my kbd this rebinds the Delete key to delete characters, rather than trying to be clever about deleting tabs: ----------------8<----------------8<----------------8<---------------- ; ; Are we DELeting yet? ; (setq c-mode-hook '(lambda() (local-set-key "\177" 'delete-backward-char))) ----------------8<----------------8<----------------8<---------------- Is there anyway of setting up the environment to handle this? (preferably through the .emacs file) You can put this in your .emacs or in site-init. I had mine in .emacs until it looked good and then put it in site-init since it matches the company style. Hope this helps... "....say you're thinking about a plate of shrimp... ..and someone says to you `plate,' or `shrimp'......" _____ | | Johnathan Vail | tegra!N1DXG@ulowell.edu |Tegra| (508) 663-7435 | N1DXG@145.110-,145.270-,444.2+,448.625- -----