aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2010-09-21 23:18:08 +0200
committerStefan Monnier2010-09-21 23:18:08 +0200
commit4ddea91b84a1947e027a2996e92e3d9c32e337a3 (patch)
treecfe86f5c7a78587146fb02420f9c2b6020aa3033
parent840b985a766f76b61aaa353cba71ce90cb0fc9ed (diff)
downloademacs-4ddea91b84a1947e027a2996e92e3d9c32e337a3.tar.gz
emacs-4ddea91b84a1947e027a2996e92e3d9c32e337a3.zip
* 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.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/emacs-lisp/smie.el29
2 files changed, 31 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e293d7612ba..9900472a59d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12010-09-21 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * emacs-lisp/smie.el (smie-debug--describe-cycle): Fix typo.
4 (smie-indent-comment): Be more careful with comment-start-skip.
5 (smie-indent-comment-close, smie-indent-comment-inside): New funs.
6 (smie-indent-functions): Use them.
7
12010-09-21 Michael Albinus <michael.albinus@gmx.de> 82010-09-21 Michael Albinus <michael.albinus@gmx.de>
2 9
3 * net/ange-ftp.el (ange-ftp-skip-msgs): Add "^504 ..." message. 10 * net/ange-ftp.el (ange-ftp-skip-msgs): Add "^504 ..." message.
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index 0267e9771f5..55516d276da 100644
--- a/lisp/emacs-lisp/smie.el
+++ b/lisp/emacs-lisp/smie.el
@@ -338,7 +338,7 @@ CSTS is a list of pairs representing arcs in a graph."
338 res)) 338 res))
339 cycle))) 339 cycle)))
340 (mapconcat 340 (mapconcat
341 (lambda (elems) (mapconcat 'indentity elems "=")) 341 (lambda (elems) (mapconcat 'identity elems "="))
342 (append names (list (car names))) 342 (append names (list (car names)))
343 " < "))) 343 " < ")))
344 344
@@ -1173,7 +1173,11 @@ in order to figure out the indentation of some other (further down) point."
1173 ;; front of a comment" when doing virtual-indentation anyway. And if we are 1173 ;; front of a comment" when doing virtual-indentation anyway. And if we are
1174 ;; (as can happen in octave-mode), moving forward can lead to inf-loops. 1174 ;; (as can happen in octave-mode), moving forward can lead to inf-loops.
1175 (and (smie-indent--bolp) 1175 (and (smie-indent--bolp)
1176 (looking-at comment-start-skip) 1176 (let ((pos (point)))
1177 (save-excursion
1178 (beginning-of-line)
1179 (and (re-search-forward comment-start-skip (line-end-position) t)
1180 (eq pos (or (match-end 1) (match-beginning 0))))))
1177 (save-excursion 1181 (save-excursion
1178 (forward-comment (point-max)) 1182 (forward-comment (point-max))
1179 (skip-chars-forward " \t\r\n") 1183 (skip-chars-forward " \t\r\n")
@@ -1194,6 +1198,20 @@ in order to figure out the indentation of some other (further down) point."
1194 (if (looking-at (regexp-quote continue)) 1198 (if (looking-at (regexp-quote continue))
1195 (current-column)))))))) 1199 (current-column))))))))
1196 1200
1201(defun smie-indent-comment-close ()
1202 (and (boundp 'comment-end-skip)
1203 comment-end-skip
1204 (not (looking-at " \t*$")) ;Not just a \n comment-closer.
1205 (looking-at comment-end-skip)
1206 (nth 4 (syntax-ppss))
1207 (save-excursion
1208 (goto-char (nth 8 (syntax-ppss)))
1209 (current-column))))
1210
1211(defun smie-indent-comment-inside ()
1212 (and (nth 4 (syntax-ppss))
1213 'noindent))
1214
1197(defun smie-indent-after-keyword () 1215(defun smie-indent-after-keyword ()
1198 ;; Indentation right after a special keyword. 1216 ;; Indentation right after a special keyword.
1199 (save-excursion 1217 (save-excursion
@@ -1275,9 +1293,10 @@ in order to figure out the indentation of some other (further down) point."
1275 (current-column))))))) 1293 (current-column)))))))
1276 1294
1277(defvar smie-indent-functions 1295(defvar smie-indent-functions
1278 '(smie-indent-fixindent smie-indent-bob smie-indent-close smie-indent-comment 1296 '(smie-indent-fixindent smie-indent-bob smie-indent-close
1279 smie-indent-comment-continue smie-indent-keyword smie-indent-after-keyword 1297 smie-indent-comment smie-indent-comment-continue smie-indent-comment-close
1280 smie-indent-exps) 1298 smie-indent-comment-inside smie-indent-keyword smie-indent-after-keyword
1299 smie-indent-exps)
1281 "Functions to compute the indentation. 1300 "Functions to compute the indentation.
1282Each function is called with no argument, shouldn't move point, and should 1301Each function is called with no argument, shouldn't move point, and should
1283return either nil if it has no opinion, or an integer representing the column 1302return either nil if it has no opinion, or an integer representing the column