]> code.delx.au - gnu-emacs/commitdiff
* progmodes/octave.el (octave-indent-comment): New function.
authorLeo Liu <sdl.web@gmail.com>
Sat, 11 May 2013 06:20:10 +0000 (14:20 +0800)
committerLeo Liu <sdl.web@gmail.com>
Sat, 11 May 2013 06:20:10 +0000 (14:20 +0800)
(octave-mode): Use it in smie-indent-functions.

Fixes: debbugs:14350
lisp/ChangeLog
lisp/progmodes/octave.el

index 6fba2016bb230972ea5b046f942e20785636daa7..ed9726de79707ac3093a2ca0fdd76453235ed8b9 100644 (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>
 
index a2b076c4f8ea894fa472504b3343e8350e9c7b3d..b8f72182d22c13f6ca78c521ffa77ab258b23f24 100644 (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))))
+
 \f
 (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))