diff options
| author | Stefan Monnier | 2013-04-24 23:25:34 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2013-04-24 23:25:34 -0400 |
| commit | ced3fc5d2f65236af6595db93b064b77a5cdedfd (patch) | |
| tree | 5561e1ba6f887b733499a1b4c1650158332cf1e4 | |
| parent | 1c141dad8705e27c311a1c86436131c47f49dcc9 (diff) | |
| download | emacs-ced3fc5d2f65236af6595db93b064b77a5cdedfd.tar.gz emacs-ced3fc5d2f65236af6595db93b064b77a5cdedfd.zip | |
* 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).
Fixes: debbugs:14218
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/emacs-lisp/smie.el | 36 | ||||
| -rw-r--r-- | lisp/progmodes/octave-mod.el | 1 |
3 files changed, 35 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d6d96545165..7bce53d7caf 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2013-04-25 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * emacs-lisp/smie.el (smie-indent--hanging-p): Don't burp at EOB. | ||
| 4 | (smie-indent-keyword): Improve the check to ensure that the next | ||
| 5 | comment is really on the same line. | ||
| 6 | (smie-indent-comment): Don't align with a subsequent closer (or eob). | ||
| 7 | |||
| 8 | * progmodes/octave-mod.el (octave-smie-forward-token): Only emit | ||
| 9 | semi-colons if the line is not otherwise empty (bug#14218). | ||
| 10 | |||
| 1 | 2013-04-25 Glenn Morris <rgm@gnu.org> | 11 | 2013-04-25 Glenn Morris <rgm@gnu.org> |
| 2 | 12 | ||
| 3 | * vc/vc-bzr.el (vc-bzr-print-log): Tweak LIMIT = 1 case. | 13 | * vc/vc-bzr.el (vc-bzr-print-log): Tweak LIMIT = 1 case. |
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el index 18cc0e811ce..c59076974e0 100644 --- a/lisp/emacs-lisp/smie.el +++ b/lisp/emacs-lisp/smie.el | |||
| @@ -1067,9 +1067,10 @@ the beginning of a line." | |||
| 1067 | (save-excursion | 1067 | (save-excursion |
| 1068 | (<= (line-end-position) | 1068 | (<= (line-end-position) |
| 1069 | (progn | 1069 | (progn |
| 1070 | (when (zerop (length (funcall smie-forward-token-function))) | 1070 | (and (zerop (length (funcall smie-forward-token-function))) |
| 1071 | ;; Could be an open-paren. | 1071 | (not (eobp)) |
| 1072 | (forward-char 1)) | 1072 | ;; Could be an open-paren. |
| 1073 | (forward-char 1)) | ||
| 1073 | (skip-chars-forward " \t") | 1074 | (skip-chars-forward " \t") |
| 1074 | (or (eolp) | 1075 | (or (eolp) |
| 1075 | (and (looking-at comment-start-skip) | 1076 | (and (looking-at comment-start-skip) |
| @@ -1350,8 +1351,11 @@ should not be computed on the basis of the following token." | |||
| 1350 | (if (and (< pos (line-beginning-position)) | 1351 | (if (and (< pos (line-beginning-position)) |
| 1351 | ;; Make sure `token' also *starts* on another line. | 1352 | ;; Make sure `token' also *starts* on another line. |
| 1352 | (save-excursion | 1353 | (save-excursion |
| 1353 | (smie-indent-backward-token) | 1354 | (let ((endpos (point))) |
| 1354 | (< pos (line-beginning-position)))) | 1355 | (goto-char pos) |
| 1356 | (forward-line 1) | ||
| 1357 | (and (equal res (smie-indent-forward-token)) | ||
| 1358 | (eq (point) endpos))))) | ||
| 1355 | nil | 1359 | nil |
| 1356 | (goto-char pos) | 1360 | (goto-char pos) |
| 1357 | res))))) | 1361 | res))))) |
| @@ -1473,13 +1477,21 @@ should not be computed on the basis of the following token." | |||
| 1473 | (save-excursion | 1477 | (save-excursion |
| 1474 | (forward-comment (point-max)) | 1478 | (forward-comment (point-max)) |
| 1475 | (skip-chars-forward " \t\r\n") | 1479 | (skip-chars-forward " \t\r\n") |
| 1476 | ;; FIXME: We assume here that smie-indent-calculate will compute the | 1480 | (unless |
| 1477 | ;; indentation of the next token based on text before the comment, but | 1481 | ;; Don't align with a closer, since the comment is "within" the |
| 1478 | ;; this is not guaranteed, so maybe we should let | 1482 | ;; closed element. Don't align with EOB either. |
| 1479 | ;; smie-indent-calculate return some info about which buffer position | 1483 | (save-excursion |
| 1480 | ;; was used as the "indentation base" and check that this base is | 1484 | (let ((next (funcall smie-forward-token-function))) |
| 1481 | ;; before `pos'. | 1485 | (or (if (zerop (length next)) |
| 1482 | (smie-indent-calculate)))) | 1486 | (or (eobp) (eq (car (syntax-after (point))) 5))) |
| 1487 | (rassoc next smie-closer-alist)))) | ||
| 1488 | ;; FIXME: We assume here that smie-indent-calculate will compute the | ||
| 1489 | ;; indentation of the next token based on text before the comment, | ||
| 1490 | ;; but this is not guaranteed, so maybe we should let | ||
| 1491 | ;; smie-indent-calculate return some info about which buffer | ||
| 1492 | ;; position was used as the "indentation base" and check that this | ||
| 1493 | ;; base is before `pos'. | ||
| 1494 | (smie-indent-calculate))))) | ||
| 1483 | 1495 | ||
| 1484 | (defun smie-indent-comment-continue () | 1496 | (defun smie-indent-comment-continue () |
| 1485 | ;; indentation of comment-continue lines. | 1497 | ;; indentation of comment-continue lines. |
diff --git a/lisp/progmodes/octave-mod.el b/lisp/progmodes/octave-mod.el index 4683186e603..d161754cad9 100644 --- a/lisp/progmodes/octave-mod.el +++ b/lisp/progmodes/octave-mod.el | |||
| @@ -482,6 +482,7 @@ Non-nil means always go to the next Octave code line after sending." | |||
| 482 | (forward-comment 1)) | 482 | (forward-comment 1)) |
| 483 | (cond | 483 | (cond |
| 484 | ((and (looking-at "$\\|[%#]") | 484 | ((and (looking-at "$\\|[%#]") |
| 485 | (not (smie-rule-bolp)) | ||
| 485 | ;; Ignore it if it's within parentheses. | 486 | ;; Ignore it if it's within parentheses. |
| 486 | (prog1 (let ((ppss (syntax-ppss))) | 487 | (prog1 (let ((ppss (syntax-ppss))) |
| 487 | (not (and (nth 1 ppss) | 488 | (not (and (nth 1 ppss) |