[Top][All Lists]

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

bug#17818: 24.3.91; sh-learn-buffer-indent doesn't learn current indent

From: Stefan Monnier
Subject: bug#17818: 24.3.91; sh-learn-buffer-indent doesn't learn current indent anymore
Date: Fri, 20 Jun 2014 17:10:44 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

> if true; do
>   echo "My sh-basic-offset offset should be 2."
> fi

The above "do" should be "then", right?

I installed the patch below which fixes some of the problem (the first
hunk fixes an incorrect guess and the second fixes the code so the guess
is actually activated).

Please confirm that the result is OK for your use case.


=== modified file 'lisp/emacs-lisp/smie.el'
--- lisp/emacs-lisp/smie.el     2014-06-20 01:05:40 +0000
+++ lisp/emacs-lisp/smie.el     2014-06-20 21:07:06 +0000
@@ -2138,7 +2138,7 @@
                 (push (cons (+ offset (nth 2 sig)) sig) rules)
                 ;; Adjust the rest of the data.
-                (pcase-dolist ((and cotrace `(,count ,toffset ,trace))
+                (pcase-dolist ((and cotrace `(,count ,toffset . ,trace))
                   (setf (nth 1 cotrace) (- toffset offset))
                   (dolist (sig trace)
@@ -2167,15 +2167,14 @@
      ((null config) (message "Nothing to change"))
      ((null smie-config--buffer-local)
-      (message "Local rules set")
-      (setq smie-config--buffer-local config))
+      (smie-config-local config)
+      (message "Local rules set"))
      ((y-or-n-p "Replace existing local config? ")
       (message "Local rules replaced")
-      (setq smie-config--buffer-local config))
+      (smie-config-local config))
      ((y-or-n-p "Merge with existing local config? ")
       (message "Local rules adjusted")
-      (setq smie-config--buffer-local
-            (append config smie-config--buffer-local)))
+      (smie-config-local (append config smie-config--buffer-local)))
       (message "Rules guessed: %S" config)))))

reply via email to

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