diff options
| author | Leo Liu | 2013-05-11 14:20:10 +0800 |
|---|---|---|
| committer | Leo Liu | 2013-05-11 14:20:10 +0800 |
| commit | 9dbdb67ed927e75a5b890e57e9b756e424274395 (patch) | |
| tree | fd3863f2fb9ba1b83d04b1720e5850686937c789 | |
| parent | 083fe0d743d138c948e5a9bfe008a602b71c62ba (diff) | |
| download | emacs-9dbdb67ed927e75a5b890e57e9b756e424274395.tar.gz emacs-9dbdb67ed927e75a5b890e57e9b756e424274395.zip | |
* progmodes/octave.el (octave-indent-comment): New function.
(octave-mode): Use it in smie-indent-functions.
Fixes: debbugs:14350
| -rw-r--r-- | lisp/ChangeLog | 2 | ||||
| -rw-r--r-- | lisp/progmodes/octave.el | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6fba2016bb2..ed9726de797 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -3,6 +3,8 @@ | |||
| 3 | * progmodes/octave.el (octave-beginning-of-line) | 3 | * progmodes/octave.el (octave-beginning-of-line) |
| 4 | (octave-end-of-line): Check before using up-list because it jumps | 4 | (octave-end-of-line): Check before using up-list because it jumps |
| 5 | out of more syntactic contructs since moving to smie. | 5 | out of more syntactic contructs since moving to smie. |
| 6 | (octave-indent-comment): New function. | ||
| 7 | (octave-mode): Use it in smie-indent-functions. (Bug#14350) | ||
| 6 | 8 | ||
| 7 | 2013-05-11 Glenn Morris <rgm@gnu.org> | 9 | 2013-05-11 Glenn Morris <rgm@gnu.org> |
| 8 | 10 | ||
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index a2b076c4f8e..b8f72182d22 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el | |||
| @@ -414,6 +414,13 @@ Non-nil means always go to the next Octave code line after sending." | |||
| 414 | ;; (if (smie-parent-p "switch") 4) | 414 | ;; (if (smie-parent-p "switch") 4) |
| 415 | 0)))) | 415 | 0)))) |
| 416 | 416 | ||
| 417 | (defun octave-indent-comment () | ||
| 418 | "A function for `smie-indent-functions' (which see)." | ||
| 419 | (save-excursion | ||
| 420 | (back-to-indentation) | ||
| 421 | (when (and (looking-at-p "\\s<") (not (looking-at-p "\\s<\\s<"))) | ||
| 422 | (comment-choose-indent)))) | ||
| 423 | |||
| 417 | 424 | ||
| 418 | (defvar octave-font-lock-keywords | 425 | (defvar octave-font-lock-keywords |
| 419 | (list | 426 | (list |
| @@ -488,6 +495,7 @@ definitions can also be stored in files and used in batch mode." | |||
| 488 | :forward-token #'octave-smie-forward-token | 495 | :forward-token #'octave-smie-forward-token |
| 489 | :backward-token #'octave-smie-backward-token) | 496 | :backward-token #'octave-smie-backward-token) |
| 490 | (setq-local smie-indent-basic 'octave-block-offset) | 497 | (setq-local smie-indent-basic 'octave-block-offset) |
| 498 | (add-hook 'smie-indent-functions #'octave-indent-comment nil t) | ||
| 491 | 499 | ||
| 492 | (setq-local smie-blink-matching-triggers | 500 | (setq-local smie-blink-matching-triggers |
| 493 | (cons ?\; smie-blink-matching-triggers)) | 501 | (cons ?\; smie-blink-matching-triggers)) |