changeset 75977:2e16068bd4fb

(calculate-lisp-indent): Added indentation for the constants of Lisp.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 17 Feb 2007 11:34:22 +0000
parents 22b8991d91fe
children 28302e9da5da
files lisp/emacs-lisp/lisp-mode.el
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/lisp-mode.el	Sat Feb 17 11:28:18 2007 +0000
+++ b/lisp/emacs-lisp/lisp-mode.el	Sat Feb 17 11:34:22 2007 +0000
@@ -909,6 +909,24 @@
         (cond ((elt state 3)
                ;; Inside a string, don't change indentation.
 	       nil)
+              ((save-excursion
+                 ;; test whether current line begins with a constant
+                 (goto-char indent-point)
+                 (skip-chars-forward " \t")
+                 (looking-at ":"))
+               (let ((desired-indent
+                      (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
+                 (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)