aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2007-03-05 03:20:58 +0000
committerRichard M. Stallman2007-03-05 03:20:58 +0000
commit4252132f9a1c67c1dd48417322b73ad3da7fa644 (patch)
tree4e2af1632d1a289754f55bff7bf468bd58122b93
parentb64d66b546219d0754ac637366504c09f4c0e67b (diff)
downloademacs-4252132f9a1c67c1dd48417322b73ad3da7fa644.tar.gz
emacs-4252132f9a1c67c1dd48417322b73ad3da7fa644.zip
(calculate-lisp-indent): Redo previous change.
-rw-r--r--lisp/emacs-lisp/lisp-mode.el59
1 files changed, 36 insertions, 23 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 5576a4882b0..09cb8436c89 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -909,34 +909,47 @@ is the buffer position of the start of the containing expression."
909 (cond ((elt state 3) 909 (cond ((elt state 3)
910 ;; Inside a string, don't change indentation. 910 ;; Inside a string, don't change indentation.
911 nil) 911 nil)
912 ((save-excursion
913 ;; test whether current line begins with a constant
914 (goto-char indent-point)
915 (skip-chars-forward " \t")
916 (looking-at ":"))
917 (let ((desired-indent
918 (save-excursion
919 (goto-char (1+ containing-sexp))
920 (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
921 (point)))
922 (parse-sexp-ignore-comments t))
923 ;; Align a constant symbol under the last constant symbol
924 (goto-char calculate-lisp-indent-last-sexp)
925 (while (> (point) desired-indent)
926 (if (looking-at ":")
927 (setq desired-indent (point))
928 (backward-sexp 1))))
929 (current-column))
930 ((and (integerp lisp-indent-offset) containing-sexp) 912 ((and (integerp lisp-indent-offset) containing-sexp)
931 ;; Indent by constant offset 913 ;; Indent by constant offset
932 (goto-char containing-sexp) 914 (goto-char containing-sexp)
933 (+ (current-column) lisp-indent-offset)) 915 (+ (current-column) lisp-indent-offset))
916 ;; in this case calculate-lisp-indent-last-sexp is not nil
917 (calculate-lisp-indent-last-sexp
918 (or
919 ;; try to align the parameters of a known function
920 (and lisp-indent-function
921 (not retry)
922 (funcall lisp-indent-function indent-point state))
923 ;; If the function has no special alignment
924 ;; or it does not apply to this argument,
925 ;; try to align a constant-symbol under the last
926 ;; preceding constant symbol, if there is such one of
927 ;; the last 2 preceding symbols, in the previous
928 ;; uncommented line.
929 (and (save-excursion
930 (goto-char indent-point)
931 (skip-chars-forward " \t")
932 (looking-at ":"))
933 (> calculate-lisp-indent-last-sexp
934 (save-excursion
935 (goto-char (1+ containing-sexp))
936 (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
937 (point)))
938 (let ((parse-sexp-ignore-comments t)
939 indent)
940 (goto-char calculate-lisp-indent-last-sexp)
941 (or (and (looking-at ":")
942 (setq indent (current-column)))
943 (and (< (save-excursion (beginning-of-line) (point))
944 (prog2 (backward-sexp) (point)))
945 (looking-at ":")
946 (setq indent (current-column))))
947 indent))
948 ;; another symbols or constants not preceded by a constant
949 ;; as defined above.
950 normal-indent))
951 ;; in this case calculate-lisp-indent-last-sexp is nil
934 (desired-indent) 952 (desired-indent)
935 ((and (boundp 'lisp-indent-function)
936 lisp-indent-function
937 (not retry))
938 (or (funcall lisp-indent-function indent-point state)
939 normal-indent))
940 (t 953 (t
941 normal-indent)))))) 954 normal-indent))))))
942 955