* progmodes/octave.el (octave-indent-comment): New function.

(octave-mode): Use it in smie-indent-functions.

Fixes: debbugs:14350
This commit is contained in:
Leo Liu 2013-05-11 14:20:10 +08:00
parent 083fe0d743
commit 9dbdb67ed9
2 changed files with 10 additions and 0 deletions

View file

@ -3,6 +3,8 @@
* progmodes/octave.el (octave-beginning-of-line)
(octave-end-of-line): Check before using up-list because it jumps
out of more syntactic contructs since moving to smie.
(octave-indent-comment): New function.
(octave-mode): Use it in smie-indent-functions. (Bug#14350)
2013-05-11 Glenn Morris <rgm@gnu.org>

View file

@ -414,6 +414,13 @@ Non-nil means always go to the next Octave code line after sending."
;; (if (smie-parent-p "switch") 4)
0))))
(defun octave-indent-comment ()
"A function for `smie-indent-functions' (which see)."
(save-excursion
(back-to-indentation)
(when (and (looking-at-p "\\s<") (not (looking-at-p "\\s<\\s<")))
(comment-choose-indent))))
(defvar octave-font-lock-keywords
(list
@ -488,6 +495,7 @@ definitions can also be stored in files and used in batch mode."
:forward-token #'octave-smie-forward-token
:backward-token #'octave-smie-backward-token)
(setq-local smie-indent-basic 'octave-block-offset)
(add-hook 'smie-indent-functions #'octave-indent-comment nil t)
(setq-local smie-blink-matching-triggers
(cons ?\; smie-blink-matching-triggers))