landolt@yunexus.UUCP (Paul Landolt) (07/26/89)
I wasn't sure of where to post this article, so, if it's in the wrong place, please forgive me. 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). 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. Is there anyway of setting up the environment to handle this? (preferably through the .emacs file) Thanks in adviance. -- J. Paul Landolt | It'll be done in another week, so Computing Services | GET OFF MY BACK! York University - Toronto, Canadia | --------------------------------- InterNet: landolt@nexus.YorkU.CA | My opinions. All mine. So sue me.
vail@tegra.UUCP (Johnathan Vail) (07/29/89)
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- -----
raulmill@usc.edu (Raul) (07/31/89)
Paul Landolt writes:
-> 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).
-> 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.
-> Is there anyway of setting up the environment to handle this?
-> (preferably through the .emacs file)
(define-key c-mode-map ?\C-? 'delete-backward-char)
(define-key c-mode-map ?\C-i 'self-insert-command)
--
Raul Rockwell |
INTERNET: raulmill@usc.edu |
UUCP: ...uunet!usc!raulmill | 55 mph = 82 nc
U.S.SNAIL: 721 E Windsor #4, GLENDALE CA 91205 |
Raul Rockwell |
INTERNET: raulmill@usc.edu |
UUCP: ...uunet!usc!raulmill | 55 mph = 82 nc
U.S.SNAIL: 721 E Windsor #4, GLENDALE CA 91205 |