(copyright-current-gpl-version): Set to 3.
[bpt/emacs.git] / lisp / emacs-lisp / cl-indent.el
index 3bdb338..7c15af6 100644 (file)
@@ -1,6 +1,7 @@
 ;;; 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
@@ -21,8 +22,8 @@
 
 ;; 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)
@@ -132,7 +133,7 @@ If nil, indent backquoted lists as data, i.e., like quoted lists."
           (+ loop-indentation lisp-loop-keyword-indentation))
          (t
           (+ loop-indentation lisp-loop-forms-indentation)))))
-  
+
 
 ;;;###autoload
 (defun common-lisp-indent-function (indent-point state)
@@ -140,8 +141,8 @@ If nil, indent backquoted lists as data, i.e., like quoted lists."
                      (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
@@ -216,8 +217,12 @@ If nil, indent backquoted lists as data, i.e., like quoted lists."
                     (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)
@@ -368,14 +373,16 @@ If nil, indent backquoted lists as data, i.e., like quoted lists."
                      ;; 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
@@ -454,7 +461,7 @@ If nil, indent backquoted lists as data, i.e., like quoted lists."
                                            (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))
@@ -544,7 +551,7 @@ If nil, indent backquoted lists as data, i.e., like quoted lists."
            (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)
@@ -605,4 +612,5 @@ If nil, indent backquoted lists as data, i.e., like quoted lists."
 ;(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