From: Leo Liu Date: Sat, 11 May 2013 06:20:10 +0000 (+0800) Subject: * progmodes/octave.el (octave-indent-comment): New function. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2026^2~229^2~118 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9dbdb67ed927e75a5b890e57e9b756e424274395;p=emacs.git * progmodes/octave.el (octave-indent-comment): New function. (octave-mode): Use it in smie-indent-functions. Fixes: debbugs:14350 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6fba2016bb2..ed9726de797 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -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 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." ;; (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))