emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r112379: * lisp/progmodes/octave-mod.


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112379: * lisp/progmodes/octave-mod.el (octave-smie-forward-token): Only emit
Date: Wed, 24 Apr 2013 23:25:34 -0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 112379
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14218
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2013-04-24 23:25:34 -0400
message:
  * lisp/progmodes/octave-mod.el (octave-smie-forward-token): Only emit
  semi-colons if the line is not otherwise empty.
  * lisp/emacs-lisp/smie.el (smie-indent--hanging-p): Don't burp at EOB.
  (smie-indent-keyword): Improve the check to ensure that the next
  comment is really on the same line.
  (smie-indent-comment): Don't align with a subsequent closer (or eob).
modified:
  lisp/ChangeLog
  lisp/emacs-lisp/smie.el
  lisp/progmodes/octave-mod.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-04-25 00:53:18 +0000
+++ b/lisp/ChangeLog    2013-04-25 03:25:34 +0000
@@ -1,3 +1,13 @@
+2013-04-25  Stefan Monnier  <address@hidden>
+
+       * emacs-lisp/smie.el (smie-indent--hanging-p): Don't burp at EOB.
+       (smie-indent-keyword): Improve the check to ensure that the next
+       comment is really on the same line.
+       (smie-indent-comment): Don't align with a subsequent closer (or eob).
+
+       * progmodes/octave-mod.el (octave-smie-forward-token): Only emit
+       semi-colons if the line is not otherwise empty (bug#14218).
+
 2013-04-25  Glenn Morris  <address@hidden>
 
        * vc/vc-bzr.el (vc-bzr-print-log): Tweak LIMIT = 1 case.

=== modified file 'lisp/emacs-lisp/smie.el'
--- a/lisp/emacs-lisp/smie.el   2013-03-14 14:48:03 +0000
+++ b/lisp/emacs-lisp/smie.el   2013-04-25 03:25:34 +0000
@@ -1067,9 +1067,10 @@
        (save-excursion
          (<= (line-end-position)
              (progn
-               (when (zerop (length (funcall smie-forward-token-function)))
-                 ;; Could be an open-paren.
-                 (forward-char 1))
+               (and (zerop (length (funcall smie-forward-token-function)))
+                   (not (eobp))
+                   ;; Could be an open-paren.
+                   (forward-char 1))
                (skip-chars-forward " \t")
                (or (eolp)
                    (and (looking-at comment-start-skip)
@@ -1350,8 +1351,11 @@
                 (if (and (< pos (line-beginning-position))
                          ;; Make sure `token' also *starts* on another line.
                          (save-excursion
-                           (smie-indent-backward-token)
-                           (< pos (line-beginning-position))))
+                           (let ((endpos (point)))
+                             (goto-char pos)
+                             (forward-line 1)
+                             (and (equal res (smie-indent-forward-token))
+                                  (eq (point) endpos)))))
                     nil
                   (goto-char pos)
                   res)))))
@@ -1473,13 +1477,21 @@
        (save-excursion
          (forward-comment (point-max))
          (skip-chars-forward " \t\r\n")
-         ;; FIXME: We assume here that smie-indent-calculate will compute the
-         ;; indentation of the next token based on text before the comment, but
-         ;; this is not guaranteed, so maybe we should let
-         ;; smie-indent-calculate return some info about which buffer position
-         ;; was used as the "indentation base" and check that this base is
-         ;; before `pos'.
-         (smie-indent-calculate))))
+         (unless
+             ;; Don't align with a closer, since the comment is "within" the
+             ;; closed element.  Don't align with EOB either.
+             (save-excursion
+               (let ((next (funcall smie-forward-token-function)))
+                 (or (if (zerop (length next))
+                         (or (eobp) (eq (car (syntax-after (point))) 5)))
+                     (rassoc next smie-closer-alist))))
+          ;; FIXME: We assume here that smie-indent-calculate will compute the
+           ;; indentation of the next token based on text before the comment,
+           ;; but this is not guaranteed, so maybe we should let
+           ;; smie-indent-calculate return some info about which buffer
+           ;; position was used as the "indentation base" and check that this
+           ;; base is before `pos'.
+           (smie-indent-calculate)))))
 
 (defun smie-indent-comment-continue ()
   ;; indentation of comment-continue lines.

=== modified file 'lisp/progmodes/octave-mod.el'
--- a/lisp/progmodes/octave-mod.el      2013-04-17 01:49:22 +0000
+++ b/lisp/progmodes/octave-mod.el      2013-04-25 03:25:34 +0000
@@ -482,6 +482,7 @@
     (forward-comment 1))
   (cond
    ((and (looking-at "$\\|[%#]")
+         (not (smie-rule-bolp))
          ;; Ignore it if it's within parentheses.
          (prog1 (let ((ppss (syntax-ppss)))
                   (not (and (nth 1 ppss)


reply via email to

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