emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/emacs-lisp/lisp-mode.el,v


From: Richard M. Stallman
Subject: [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/lisp-mode.el,v
Date: Mon, 05 Mar 2007 03:20:59 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Richard M. Stallman <rms>       07/03/05 03:20:58

Index: lisp-mode.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/emacs-lisp/lisp-mode.el,v
retrieving revision 1.199
retrieving revision 1.200
diff -u -b -r1.199 -r1.200
--- lisp-mode.el        17 Feb 2007 11:34:22 -0000      1.199
+++ lisp-mode.el        5 Mar 2007 03:20:58 -0000       1.200
@@ -909,34 +909,47 @@
         (cond ((elt state 3)
                ;; Inside a string, don't change indentation.
               nil)
-              ((save-excursion
-                 ;; test whether current line begins with a constant
+              ((and (integerp lisp-indent-offset) containing-sexp)
+               ;; Indent by constant offset
+               (goto-char containing-sexp)
+               (+ (current-column) lisp-indent-offset))
+              ;; in this case calculate-lisp-indent-last-sexp is not nil
+              (calculate-lisp-indent-last-sexp
+               (or
+                ;; try to align the parameters of a known function
+                (and lisp-indent-function
+                     (not retry)
+                     (funcall lisp-indent-function indent-point state))
+                ;; If the function has no special alignment
+               ;; or it does not apply to this argument,
+               ;; try to align a constant-symbol under the last
+                ;; preceding constant symbol, if there is such one of
+                ;; the last 2 preceding symbols, in the previous
+                ;; uncommented line.
+                (and (save-excursion
                  (goto-char indent-point)
                  (skip-chars-forward " \t")
                  (looking-at ":"))
-               (let ((desired-indent
+                     (> calculate-lisp-indent-last-sexp
                       (save-excursion
                         (goto-char (1+ containing-sexp))
                         (parse-partial-sexp (point) 
calculate-lisp-indent-last-sexp 0 t)
                         (point)))
-                     (parse-sexp-ignore-comments t))
-                 ;; Align a constant symbol under the last constant symbol
+                     (let ((parse-sexp-ignore-comments t)
+                           indent)
                  (goto-char calculate-lisp-indent-last-sexp)
-                 (while (> (point) desired-indent)
-                   (if (looking-at ":")
-                       (setq desired-indent (point))
-                     (backward-sexp 1))))
-                 (current-column))
-              ((and (integerp lisp-indent-offset) containing-sexp)
-               ;; Indent by constant offset
-               (goto-char containing-sexp)
-               (+ (current-column) lisp-indent-offset))
-              (desired-indent)
-              ((and (boundp 'lisp-indent-function)
-                    lisp-indent-function
-                    (not retry))
-               (or (funcall lisp-indent-function indent-point state)
+                       (or (and (looking-at ":")
+                                (setq indent (current-column)))
+                           (and (< (save-excursion (beginning-of-line) (point))
+                                   (prog2 (backward-sexp) (point)))
+                                (looking-at ":")
+                                (setq indent (current-column))))
+                       indent))
+                ;; another symbols or constants not preceded by a constant
+                ;; as defined above.
                    normal-indent))
+              ;; in this case calculate-lisp-indent-last-sexp is nil
+              (desired-indent)
               (t
                normal-indent))))))
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]