emacs-devel
[Top][All Lists]
Advanced

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

Re: Bug in lisp indentation


From: Thien-Thi Nguyen
Subject: Re: Bug in lisp indentation
Date: Sat, 14 Jul 2007 21:53:18 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.97 (gnu/linux)

() Lennart Staflin <address@hidden>
() Thu, 31 May 2007 11:44:46 +0200

   In lisp-mode the indentation of the following expression is wrong:

   (foo
   :bar :a12
   :sie sume )

   If I press TAB at the beginning of the last line I get:

   (foo
   :bar :a12
         :sie sume )

   I think this is wrong, the indentation should be as the first example.
   This was not the behaviour in emacs 21, neither is the beaviour of
   indent-region consistent with TAB.

does the following patch give good results?
here is a description of the change:

        * emacs-lisp/lisp-mode.el (calculate-lisp-indent): Use the
        last sexp that begins a line, instead of the truly last sexp.

can someone suggest a better implementation?

thi

_______________________________________________________________________
diff -c -r1.202 lisp-mode.el
*** lisp-mode.el        6 Jul 2007 17:26:29 -0000       1.202
--- lisp-mode.el        14 Jul 2007 19:48:07 -0000
***************
*** 854,859 ****
--- 854,866 ----
                    (> (setq paren-depth (elt state 0)) 0))
          (setq retry nil)
          (setq calculate-lisp-indent-last-sexp (elt state 2))
+         ;; The last sexp may not be the first sexp on the line
+         ;; where it begins, so find that one, instead.
+         (when calculate-lisp-indent-last-sexp
+           (goto-char calculate-lisp-indent-last-sexp)
+           (beginning-of-line)
+           (skip-chars-forward " \t")
+           (setq calculate-lisp-indent-last-sexp (point)))
          (setq containing-sexp (elt state 1))
          ;; Position following last unclosed open.
          (goto-char (1+ containing-sexp))




reply via email to

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