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.ARPA Path: utzoo!watmath!clyde!cbosgd!ihnp4!zehntel!hplabs!hao!seismo!harvard!godot!mit-eddie!genrad!decvax!mit-athena!martillo From: martillo@mit-athena.ARPA (Joaquim Martillo) Newsgroups: net.emacs,net.sources Subject: CCA EMACS Useful ELISP Example Message-ID: <21@mit-athena.ARPA> Date: Fri, 11-Jan-85 10:53:05 EST Article-I.D.: mit-athe.21 Posted: Fri Jan 11 10:53:05 1985 Date-Received: Mon, 14-Jan-85 04:28:05 EST Organization: MIT, Project Athena, Cambridge, Ma. Lines: 31 Xref: watmath net.emacs:731 net.sources:2366 CCA EMACS does not backtab before a "}" in C-Mode. One can write a function in elisp to do this. Here is one possibility ; Begin ELISP function definition (defconstant close-brace (char-code #\})) (defconstant tab (char-code #\tab)) (edefun |Close Squiggle Brace| (arg1 arg2 &optional op1 op2 op3) (cond ((and (eql 'c (read-from-string (#f"& get major mode" #v"& current buffer"))) ; The string equality function does not seem to work (eql 1 #v"indent using tabs") ; For simplicity (eql 8 #v"c indent")) ;Generalizing to more ;complex to C tabbing is ; not hard (cond ((not (#f"& begin line")) ; Handles beginning of buffer problem (#f"backward character" numarg 1) (cond ((eql tab (char-code (emacs-get-char))) ; Seems to move point 1 char to the right (#f"backward character" numarg 1) (#f"delete character" noarg 0)) (t nil))) (t nil))) (t nil)) (emacs-insert-char #\})) ; That's the function Unfortionately & bind local does not seem to work properly with changing modes. Therefore I suggest binding this to "}" using a keyboard macro.