emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/emacs-24 r111334: * lisp/emacs-lisp/smie.el


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-24 r111334: * lisp/emacs-lisp/smie.el (smie-auto-fill): Don't inf-loop if there's no
Date: Thu, 14 Mar 2013 10:48:03 -0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111334
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13942
committer: Stefan Monnier <address@hidden>
branch nick: emacs-24
timestamp: Thu 2013-03-14 10:48:03 -0400
message:
  * lisp/emacs-lisp/smie.el (smie-auto-fill): Don't inf-loop if there's no
  token before point.
modified:
  lisp/ChangeLog
  lisp/emacs-lisp/smie.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-03-14 14:16:00 +0000
+++ b/lisp/ChangeLog    2013-03-14 14:48:03 +0000
@@ -1,3 +1,8 @@
+2013-03-14  Stefan Monnier  <address@hidden>
+
+       * emacs-lisp/smie.el (smie-auto-fill): Don't inf-loop if there's no
+       token before point (bug#13942).
+
 2013-03-14  Leo Liu  <address@hidden>
 
        * thingatpt.el (end-of-sexp): Fix bug#13952.  Use syntax-after.
@@ -25,8 +30,8 @@
 
 2013-02-20  Fabián Ezequiel Gallina  <address@hidden>
 
-       * progmodes/python.el (python-info-current-defun): Enhance
-       match-data cluttering prevention.
+       * progmodes/python.el (python-info-current-defun):
+       Enhance match-data cluttering prevention.
 
 2013-02-19  Glenn Morris  <address@hidden>
 
@@ -40,8 +45,8 @@
 
 2013-02-19  Fabián Ezequiel Gallina  <address@hidden>
 
-       * progmodes/python.el (python-indent-context): Fix
-       python-info-line-ends-backslash-p call.
+       * progmodes/python.el (python-indent-context):
+       Fix python-info-line-ends-backslash-p call.
        (python-info-line-ends-backslash-p)
        (python-info-beginning-of-backslash): Respect line-number
        argument.
@@ -119,8 +124,8 @@
        searching for its match.
        (c-invalidate-state-cache-1): Add HERE parameter to function call.
        (c-parse-state-1): Don't narrow here for 'forward strategy,
-       instead passing extra parameter HERE to several functions.  Remove
-       'BOD strategy.
+       instead passing extra parameter HERE to several functions.
+       Remove 'BOD strategy.
 
 2013-02-01  Stefan Monnier  <address@hidden>
 

=== modified file 'lisp/emacs-lisp/smie.el'
--- a/lisp/emacs-lisp/smie.el   2013-01-01 09:11:05 +0000
+++ b/lisp/emacs-lisp/smie.el   2013-03-14 14:48:03 +0000
@@ -1631,31 +1631,34 @@
 (defun smie-auto-fill ()
   (let ((fc (current-fill-column)))
     (while (and fc (> (current-column) fc))
-      (cond
-       ((not (or (nth 8 (save-excursion
-                          (syntax-ppss (line-beginning-position))))
-                 (nth 8 (syntax-ppss))))
-        (save-excursion
-          (beginning-of-line)
-          (smie-indent-forward-token)
-          (let ((bsf (point))
-                (gain 0)
-                curcol)
-            (while (<= (setq curcol (current-column)) fc)
-              ;; FIXME?  `smie-indent-calculate' can (and often will)
-              ;; return a result that actually depends on the presence/absence
-              ;; of a newline, so the gain computed here may not be accurate,
-              ;; but in practice it seems to works well enough.
-              (let* ((newcol (smie-indent-calculate))
-                     (newgain (- curcol newcol)))
-                (when (> newgain gain)
-                  (setq gain newgain)
-                  (setq bsf (point))))
-              (smie-indent-forward-token))
-            (when (> gain 0)
-              (goto-char bsf)
-              (newline-and-indent)))))
-       (t (do-auto-fill))))))
+      (or (unless (or (nth 8 (save-excursion
+                               (syntax-ppss (line-beginning-position))))
+                      (nth 8 (syntax-ppss)))
+            (save-excursion
+              (let ((end (point))
+                    (bsf (progn (beginning-of-line)
+                                (smie-indent-forward-token)
+                                (point)))
+                    (gain 0)
+                    curcol)
+                (while (and (<= (point) end)
+                            (<= (setq curcol (current-column)) fc))
+                  ;; FIXME?  `smie-indent-calculate' can (and often will)
+                  ;; return a result that actually depends on the
+                  ;; presence/absence of a newline, so the gain computed here
+                  ;; may not be accurate, but in practice it seems to works
+                  ;; well enough.
+                  (let* ((newcol (smie-indent-calculate))
+                         (newgain (- curcol newcol)))
+                    (when (> newgain gain)
+                      (setq gain newgain)
+                      (setq bsf (point))))
+                  (smie-indent-forward-token))
+                (when (> gain 0)
+                  (goto-char bsf)
+                  (newline-and-indent)
+                  'done))))
+          (do-auto-fill)))))
 
 
 (defun smie-setup (grammar rules-function &rest keywords)


reply via email to

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