Bug#296376: [Pkg-octave-devel] Bug#296376: octave2.1-emacsen: Emacs indents the comments immediately under a function too much

John W. Eaton "John W. Eaton" <jwe@bevo.che.wisc.edu>, 296376@bugs.debian.org
Tue, 22 Feb 2005 00:06:33 -0500


On 21-Feb-2005, Dirk Eddelbuettel <edd@debian.org> wrote:

| Designed that way, as I recall. Try ## to enfore beginning-of-line.

Yes, it's similar to the Emacs mode for editing Lisp:

  #     in line comment aligned to the same column at the left of the code

  ##    code level indented comment

  ###   comments that start at the left margin, used occasionally for
        comments within functions that should start at the margin

I don't think the Octave mode has the fourth level, which in the Lisp
mode is

  ;;;;  comments aligned to the left margin and used for headings
        of major sections of a program


If you want to customize this behavior, I think the function to look
at is

  (defun octave-comment-indent ()
    (if (or (looking-at "\\s<\\s<\\s<")
	    (octave-before-magic-comment-p))
	0
      (if (looking-at "\\s<\\s<")
	  (calculate-octave-indent)
	(skip-syntax-backward " ")
	(max (if (bolp) 0 (+ 1 (current-column)))
	     comment-column))))

jwe