From 9dbdb67ed927e75a5b890e57e9b756e424274395 Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Sat, 11 May 2013 14:20:10 +0800 Subject: [PATCH] * progmodes/octave.el (octave-indent-comment): New function. (octave-mode): Use it in smie-indent-functions. Fixes: debbugs:14350 --- lisp/ChangeLog | 2 ++ lisp/progmodes/octave.el | 8 ++++++++ 2 files changed, 10 insertions(+) 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)) -- 2.39.2