;;; cl-indent.el --- enhanced lisp-indent mode
-;; Copyright (C) 1987, 2000, 2001, 2002 Free Software Foundation, Inc.
+;; Copyright (C) 1987, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: Richard Mlynarik <mly@eddie.mit.edu>
;; Created: July 1987
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Commentary:
;;; Code:
(defgroup lisp-indent nil
- "Indentation in Lisp"
+ "Indentation in Lisp."
:group 'lisp)
(defcustom lisp-indent-maximum-backtracking 3
"*Maximum depth to backtrack out from a sublist for structured indentation.
-If this variable is 0, no backtracking will occur and forms such as flet
+If this variable is 0, no backtracking will occur and forms such as `flet'
may not be correctly indented."
:type 'integer
:group 'lisp-indent)
(+ loop-indentation lisp-loop-keyword-indentation))
(t
(+ loop-indentation lisp-loop-forms-indentation)))))
-
+
;;;###autoload
(defun common-lisp-indent-function (indent-point state)
(looking-at "([Ll][Oo][Oo][Pp]"))
(common-lisp-loop-part-indentation indent-point state)
(common-lisp-indent-function-1 indent-point state)))
-
-
+
+
(defun common-lisp-indent-function-1 (indent-point state)
(let ((normal-indent (current-column)))
;; Walk up list levels until we see something
(cond ((string-match "\\`def"
function)
(setq tentative-defun t))
- ((string-match "\\`\\(with\\|do\\)-"
- function)
+ ((string-match
+ (eval-when-compile
+ (concat "\\`\\("
+ (regexp-opt '("with" "without" "do"))
+ "\\)-"))
+ function)
(setq method '(&lambda &body))))))
;; backwards compatibility. Bletch.
((eq method 'defun)
;; Too few elements in pattern.
(throw 'exit normal-indent)))
((eq tem 'nil)
- (throw 'exit (list normal-indent containing-form-start)))
- ((eq tem '&lambda)
- (throw 'exit
- (cond ((null p)
- (list (+ sexp-column 4) containing-form-start))
- ((null (cdr p))
- (+ sexp-column 1))
- (t normal-indent))))
+ (throw 'exit (if (consp normal-indent)
+ normal-indent
+ (list normal-indent containing-form-start))))
+ ((eq tem '&lambda)
+ (throw 'exit
+ (cond ((null p)
+ (list (+ sexp-column 4) containing-form-start))
+ ((null (cdr p))
+ (+ sexp-column 1))
+ (t normal-indent))))
((integerp tem)
(throw 'exit
(if (null p) ;not in subforms
(forward-char 1)
(forward-sexp 3)
(backward-sexp)
- (looking-at ":")))
+ (looking-at ":\\|\\sw+")))
'(4 4 (&whole 4 &rest 4) &body)
(get 'defun 'common-lisp-indent-function))
path state indent-point sexp-column normal-indent))
(progv (4 4 &body))
(return 0)
(return-from (nil &body))
- (symbol-macrolet . multiple-value-bind)
+ (symbol-macrolet . let)
(tagbody lisp-indent-tagbody)
(throw 1)
(unless 1)
;(put 'defclass 'common-lisp-indent-function '((&whole 2 &rest (&whole 2 &rest 1) &rest (&whole 2 &rest 1)))
;(put 'defgeneric 'common-lisp-indent-function 'defun)
+;;; arch-tag: 7914d50f-92ec-4476-93fc-0f043a380e03
;;; cl-indent.el ends here