From 8e1ac0634abc10422d0739b078a096e381447786 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 17 Feb 2007 11:35:22 +0000 Subject: [PATCH] (calculate-lisp-indent): Added indentation for the constants of Lisp. --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/lisp-mode.el | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 832d921c20a..234030a9a7b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2007-02-17 Alin C. Soare (tiny change) + + * emacs-lisp/lisp-mode.el (calculate-lisp-indent): Added + indentation for the constants of Lisp. + 2007-02-17 David Hansen (tiny change) * font-lock.el (font-lock-extend-region-wholelines): Test for EOB diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 8c1cf918b36..5576a4882b0 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -909,6 +909,24 @@ is the buffer position of the start of the containing expression." (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) -- 2.39.2