GNU bug report logs - #14218
24.3; octave-insert-defun bad indentation since using smie

Previous Next

Package: emacs;

Reported by: Leo Liu <sdl.web <at> gmail.com>

Date: Wed, 17 Apr 2013 02:01:02 UTC

Severity: normal

Found in version 24.3

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 14218 <at> debbugs.gnu.org
Subject: bug#14218: 24.3; octave-insert-defun bad indentation since using smie
Date: Fri, 26 Apr 2013 10:34:42 -0400
> 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"





This bug report was last modified 12 years and 99 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.