diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2013-05-24 15:37:55 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2013-05-24 15:37:55 -0400 |
commit | 650cff3d874e68a8aa80cbdb71ff9f48e10d1cb6 (patch) | |
tree | ccd37f50a1ca75b81b3c602937d8be1a71caa0b2 /lisp/progmodes/octave.el | |
parent | 9631677d730a314f55378f5da6734db521f8130d (diff) | |
download | emacs-650cff3d874e68a8aa80cbdb71ff9f48e10d1cb6.tar.gz emacs-650cff3d874e68a8aa80cbdb71ff9f48e10d1cb6.tar.bz2 emacs-650cff3d874e68a8aa80cbdb71ff9f48e10d1cb6.zip |
* lisp/emacs-lisp/smie.el (smie-auto-fill): Rework to be more robust.
(smie-setup): Use add-function to set it.
* lisp/progmodes/octave.el (octave-smie-rules): Return nil rather than
0 after a semi-colon; it works better for smie-auto-fill.
(octave--indent-new-comment-line): New function.
(octave-indent-new-comment-line): Use it (indirectly).
(octave-mode): Don't disable smie-auto-fill. Use add-function to
modify comment-line-break-function.
Diffstat (limited to 'lisp/progmodes/octave.el')
-rw-r--r-- | lisp/progmodes/octave.el | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index 62bef6dfdea..243e3198584 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el @@ -438,7 +438,7 @@ Non-nil means always go to the next Octave code line after sending." (smie-rule-parent octave-block-offset) ;; For (invalid) code between switch and case. ;; (if (smie-parent-p "switch") 4) - 0)))) + nil)))) (defun octave-indent-comment () "A function for `smie-indent-functions' (which see)." @@ -552,11 +552,10 @@ definitions can also be stored in files and used in batch mode." (setq-local paragraph-ignore-fill-prefix t) (setq-local fill-paragraph-function 'octave-fill-paragraph) - ;; Use `smie-auto-fill' after fixing bug#14381. - (setq-local normal-auto-fill-function 'do-auto-fill) (setq-local fill-nobreak-predicate (lambda () (eq (octave-in-string-p) ?'))) - (setq-local comment-line-break-function #'octave-indent-new-comment-line) + (add-function :around (local 'comment-line-break-function) + #'octave--indent-new-comment-line) (setq font-lock-defaults '(octave-font-lock-keywords)) @@ -1112,11 +1111,16 @@ q: Don't fix\n" func file)) ;;; Indentation (defun octave-indent-new-comment-line (&optional soft) + ;; FIXME: C-M-j should probably be bound globally to a function like + ;; this one. "Break Octave line at point, continuing comment if within one. Insert `octave-continuation-string' before breaking the line unless inside a list. Signal an error if within a single-quoted string." (interactive) + (funcall comment-line-break-function soft)) + +(defun octave--indent-new-comment-line (orig &rest args) (cond ((octave-in-comment-p) nil) ((eq (octave-in-string-p) ?') @@ -1128,7 +1132,7 @@ string." (unless (and (cadr (syntax-ppss)) (eq (char-after (cadr (syntax-ppss))) ?\()) (insert " " octave-continuation-string)))) - (indent-new-comment-line soft) + (apply orig args) (indent-according-to-mode)) (define-obsolete-function-alias |