Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site mit-athena.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!mit-athena!martillo From: martillo@mit-athena.UUCP (Joaquim Martillo) Newsgroups: net.emacs Subject: Tabbing in C Mode (Gnu Emacs) Message-ID: <280@mit-athena.UUCP> Date: Mon, 8-Jul-85 08:45:05 EDT Article-I.D.: mit-athe.280 Posted: Mon Jul 8 08:45:05 1985 Date-Received: Tue, 9-Jul-85 06:39:27 EDT Organization: MIT Project Athena Lines: 30 In C-mode tabs indent the current line to the proper position according to level. If you want to get tabs anywhere else on the line, it is hard. Here is one possible function to do this. (defun insert-tab (&optional arg) (interactive "p") ; So that function can be called ; interactively with prefix ; argument. (let ((temp-tab-stop-list tab-stop-list) ; tab-stop-list is a ; global containing all ; tab-stops (nearest-tab-stop (car tab-stop-list))) (if (null arg) (setq arg 1)) (while (> arg 0) (if (null temp-tab-stop-list) (insert "\t") (progn (set-mark (dot)) ; The progn is to handle those ; who are into arbitrary tabbing (while (<= nearest-tab-stop (current-column)) (setq temp-tab-stop-list (cdr temp-tab-stop-list)) (setq nearest-tab-stop (car temp-tab-stop-list))) (while (< (current-column) nearest-tab-stop) (insert " ")) (tabify (mark) (dot)))) ; Convert spaces to tabs (setq arg (1- arg))))) (define-key esc-map "\^i" 'insert-tab) ; bind function to M-C-i or ;C-i