emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r101526: * lisp/emacs-lisp/smie.el (s


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r101526: * lisp/emacs-lisp/smie.el (smie-debug--describe-cycle): Fix typo.
Date: Tue, 21 Sep 2010 23:18:08 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 101526
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Tue 2010-09-21 23:18:08 +0200
message:
  * lisp/emacs-lisp/smie.el (smie-debug--describe-cycle): Fix typo.
  (smie-indent-comment): Be more careful with comment-start-skip.
  (smie-indent-comment-close, smie-indent-comment-inside): New funs.
  (smie-indent-functions): Use them.
modified:
  lisp/ChangeLog
  lisp/emacs-lisp/smie.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-09-21 08:35:18 +0000
+++ b/lisp/ChangeLog    2010-09-21 21:18:08 +0000
@@ -1,3 +1,10 @@
+2010-09-21  Stefan Monnier  <address@hidden>
+
+       * emacs-lisp/smie.el (smie-debug--describe-cycle): Fix typo.
+       (smie-indent-comment): Be more careful with comment-start-skip.
+       (smie-indent-comment-close, smie-indent-comment-inside): New funs.
+       (smie-indent-functions): Use them.
+
 2010-09-21  Michael Albinus  <address@hidden>
 
        * net/ange-ftp.el (ange-ftp-skip-msgs): Add "^504 ..." message.

=== modified file 'lisp/emacs-lisp/smie.el'
--- a/lisp/emacs-lisp/smie.el   2010-09-20 00:26:22 +0000
+++ b/lisp/emacs-lisp/smie.el   2010-09-21 21:18:08 +0000
@@ -338,7 +338,7 @@
                      res))
                  cycle)))
     (mapconcat
-     (lambda (elems) (mapconcat 'indentity elems "="))
+     (lambda (elems) (mapconcat 'identity elems "="))
      (append names (list (car names)))
      " < ")))
 
@@ -1173,7 +1173,11 @@
   ;; front of a comment" when doing virtual-indentation anyway.  And if we are
   ;; (as can happen in octave-mode), moving forward can lead to inf-loops.
   (and (smie-indent--bolp)
-       (looking-at comment-start-skip)
+       (let ((pos (point)))
+         (save-excursion
+           (beginning-of-line)
+           (and (re-search-forward comment-start-skip (line-end-position) t)
+                (eq pos (or (match-end 1) (match-beginning 0))))))
        (save-excursion
          (forward-comment (point-max))
          (skip-chars-forward " \t\r\n")
@@ -1194,6 +1198,20 @@
                (if (looking-at (regexp-quote continue))
                    (current-column))))))))
 
+(defun smie-indent-comment-close ()
+  (and (boundp 'comment-end-skip)
+       comment-end-skip
+       (not (looking-at " \t*$"))       ;Not just a \n comment-closer.
+       (looking-at comment-end-skip)
+       (nth 4 (syntax-ppss))
+       (save-excursion
+         (goto-char (nth 8 (syntax-ppss)))
+         (current-column))))
+
+(defun smie-indent-comment-inside ()
+  (and (nth 4 (syntax-ppss))
+       'noindent))
+
 (defun smie-indent-after-keyword ()
   ;; Indentation right after a special keyword.
   (save-excursion
@@ -1275,9 +1293,10 @@
            (current-column)))))))
 
 (defvar smie-indent-functions
-  '(smie-indent-fixindent smie-indent-bob smie-indent-close smie-indent-comment
-   smie-indent-comment-continue smie-indent-keyword smie-indent-after-keyword
-   smie-indent-exps)
+  '(smie-indent-fixindent smie-indent-bob smie-indent-close
+    smie-indent-comment smie-indent-comment-continue smie-indent-comment-close
+    smie-indent-comment-inside smie-indent-keyword smie-indent-after-keyword
+    smie-indent-exps)
   "Functions to compute the indentation.
 Each function is called with no argument, shouldn't move point, and should
 return either nil if it has no opinion, or an integer representing the column


reply via email to

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