emacs-devel
[Top][All Lists]
Advanced

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

Re: Incorrect indentation after :name


From: Stefan Monnier
Subject: Re: Incorrect indentation after :name
Date: Mon, 04 Jul 2005 10:48:54 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>>>>> "Lennart" == Lennart Borgman <address@hidden> writes:

> This gets incorrectly indented after :background.

>           (put-text-property 0 (length s)
>                              'face '(:background "red"
>                                                  :foreground "black"
>                                                  :height 1.5) s)

I've been using the patch below for several years now quite happily.
If people like it, I'll glad it install it,


        Stefan


--- orig/lisp/emacs-lisp/lisp-mode.el
+++ mod/lisp/emacs-lisp/lisp-mode.el
@@ -895,12 +887,18 @@
   (let ((normal-indent (current-column)))
     (goto-char (1+ (elt state 1)))
     (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
-    (if (and (elt state 2)
-             (not (looking-at "\\sw\\|\\s_")))
-        ;; car of form doesn't seem to be a symbol
-        (progn
-          (if (not (> (save-excursion (forward-line 1) (point))
-                      calculate-lisp-indent-last-sexp))
+    (let ((function (and (or (not (elt state 2))
+                            (looking-at "\\(\\sw\\|\\s_\\)+"))
+                        (match-string 0))))
+      (if (or (not function)
+             (and (> (point) (1+ (point-min)))
+                  (or (save-excursion (backward-char 2) (looking-at "'("))
+                      (keywordp (intern-soft function)))
+                  (not (fboundp (intern-soft function)))))
+         ;; car of form doesn't seem to be a function
+         (progn
+           (if (not (> (save-excursion (forward-line 1) (point))
+                       calculate-lisp-indent-last-sexp))
                (progn (goto-char calculate-lisp-indent-last-sexp)
                       (beginning-of-line)
                       (parse-partial-sexp (point)




reply via email to

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