bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#14218: 24.3; octave-insert-defun bad indentation since using smie


From: Stefan Monnier
Subject: bug#14218: 24.3; octave-insert-defun bad indentation since using smie
Date: Fri, 26 Apr 2013 10:34:42 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> Thank you for the fix. However with this change: prog-indent-sexp with
> point on the first letter of 'function' gives me this funny indentation
> and extra whitespace:

>   function A = dox (n)
           
>     ## usage: A = dox (n)
>     ## 
>   ## 
           
>   endfunction

Duh, thanks.  I've installed the additional patch below which should fix
it right this time.


        Stefan


=== modified file 'lisp/progmodes/octave.el'
--- lisp/progmodes/octave.el    2013-04-26 04:16:37 +0000
+++ lisp/progmodes/octave.el    2013-04-26 14:25:15 +0000
@@ -461,11 +461,12 @@
     (forward-comment 1))
   (cond
    ((and (looking-at "$\\|[%#]")
-         (not (smie-rule-bolp))
-         ;; Ignore it if it's within parentheses.
-         (prog1 (let ((ppss (syntax-ppss)))
+         ;; Ignore it if it's within parentheses or if the newline does not end
+         ;; some preceding text.
+         (prog1 (and (not (smie-rule-bolp))
+                    (let ((ppss (syntax-ppss)))
                   (not (and (nth 1 ppss)
-                            (eq ?\( (char-after (nth 1 ppss))))))
+                                (eq ?\( (char-after (nth 1 ppss)))))))
            (forward-comment (point-max))))
     ;; Why bother distinguishing \n and ;?
     ";") ;;"\n"






reply via email to

[Prev in Thread] Current Thread [Next in Thread]