bug-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Indentation bug in function INDENT-SEXP (from CVS sources)


From: Richard Stallman
Subject: Re: Indentation bug in function INDENT-SEXP (from CVS sources)
Date: Sat, 03 Feb 2007 06:20:15 -0500

Thanks for fixing this bug.  I will install a variant of your fix.

This is a cleaned up version, and seems to work.  Does it work well for you?

*** lisp-mode.el        21 Jan 2007 01:36:10 -0500      1.196
--- lisp-mode.el        03 Feb 2007 06:10:11 -0500      
***************
*** 1128,1146 ****
                                         (make-list (- next-depth) nil))
                     last-depth (- last-depth next-depth)
                     next-depth 0)))
!       (or outer-loop-done endpos
!           (setq outer-loop-done (<= next-depth 0)))
!       (if outer-loop-done
!           (forward-line 1)
          (while (> last-depth next-depth)
            (setq indent-stack (cdr indent-stack)
                  last-depth (1- last-depth)))
          (while (< last-depth next-depth)
            (setq indent-stack (cons nil indent-stack)
                  last-depth (1+ last-depth)))
!         ;; Now go to the next line and indent it according
          ;; to what we learned from parsing the previous one.
-         (forward-line 1)
          (setq bol (point))
          (skip-chars-forward " \t")
          ;; But not if the line is blank, or just a comment
--- 1128,1152 ----
                                         (make-list (- next-depth) nil))
                     last-depth (- last-depth next-depth)
                     next-depth 0)))
!       (forward-line 1)
!       ;; Decide whether to exit.
!       (if endpos
!           ;; If we have already reached the specified end,
!           ;; give up and do not reindent this line.
!           (if (<= endpos (point))
!               (setq outer-loop-done t))
!         ;; If no specified end, we are done if we have finished one sexp.
!         (if (<= next-depth 0)
!             (setq outer-loop-done t)))
!       (unless outer-loop-done
          (while (> last-depth next-depth)
            (setq indent-stack (cdr indent-stack)
                  last-depth (1- last-depth)))
          (while (< last-depth next-depth)
            (setq indent-stack (cons nil indent-stack)
                  last-depth (1+ last-depth)))
!         ;; Now indent the next line according
          ;; to what we learned from parsing the previous one.
          (setq bol (point))
          (skip-chars-forward " \t")
          ;; But not if the line is blank, or just a comment




reply via email to

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