diff options
| author | Joakim Verona | 2013-04-27 08:32:21 +0200 |
|---|---|---|
| committer | Joakim Verona | 2013-04-27 08:32:21 +0200 |
| commit | 06f6571ea6d9f795859cbd2591b1ea5bdfe8abe0 (patch) | |
| tree | ded64c4fdde64481d6242689d68cf8884c03ce04 /lisp/progmodes | |
| parent | cf77a595ef52891ad675121b52ca15ebf71de095 (diff) | |
| parent | f6bfc06324c0e9671e5fa843c96702ff84452087 (diff) | |
| download | emacs-06f6571ea6d9f795859cbd2591b1ea5bdfe8abe0.tar.gz emacs-06f6571ea6d9f795859cbd2591b1ea5bdfe8abe0.zip | |
auto upstream
Diffstat (limited to 'lisp/progmodes')
| -rw-r--r-- | lisp/progmodes/octave.el | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index 640775bfe8b..f8b9e4f6fab 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el | |||
| @@ -461,11 +461,12 @@ Non-nil means always go to the next Octave code line after sending." | |||
| 461 | (forward-comment 1)) | 461 | (forward-comment 1)) |
| 462 | (cond | 462 | (cond |
| 463 | ((and (looking-at "$\\|[%#]") | 463 | ((and (looking-at "$\\|[%#]") |
| 464 | (not (smie-rule-bolp)) | 464 | ;; Ignore it if it's within parentheses or if the newline does not end |
| 465 | ;; Ignore it if it's within parentheses. | 465 | ;; some preceding text. |
| 466 | (prog1 (let ((ppss (syntax-ppss))) | 466 | (prog1 (and (not (smie-rule-bolp)) |
| 467 | (not (and (nth 1 ppss) | 467 | (let ((ppss (syntax-ppss))) |
| 468 | (eq ?\( (char-after (nth 1 ppss)))))) | 468 | (not (and (nth 1 ppss) |
| 469 | (eq ?\( (char-after (nth 1 ppss))))))) | ||
| 469 | (forward-comment (point-max)))) | 470 | (forward-comment (point-max)))) |
| 470 | ;; Why bother distinguishing \n and ;? | 471 | ;; Why bother distinguishing \n and ;? |
| 471 | ";") ;;"\n" | 472 | ";") ;;"\n" |
| @@ -625,6 +626,7 @@ including a reproducible test case and send the message." | |||
| 625 | 626 | ||
| 626 | (add-hook 'completion-at-point-functions | 627 | (add-hook 'completion-at-point-functions |
| 627 | 'octave-completion-at-point-function nil t) | 628 | 'octave-completion-at-point-function nil t) |
| 629 | (add-hook 'before-save-hook 'octave-sync-function-file-names nil t) | ||
| 628 | (setq-local beginning-of-defun-function 'octave-beginning-of-defun) | 630 | (setq-local beginning-of-defun-function 'octave-beginning-of-defun) |
| 629 | 631 | ||
| 630 | (easy-menu-add octave-mode-menu)) | 632 | (easy-menu-add octave-mode-menu)) |
| @@ -1007,6 +1009,27 @@ directory and makes this the current buffer's default directory." | |||
| 1007 | nil | 1009 | nil |
| 1008 | (delete-horizontal-space) | 1010 | (delete-horizontal-space) |
| 1009 | (insert (concat " " octave-continuation-string)))) | 1011 | (insert (concat " " octave-continuation-string)))) |
| 1012 | |||
| 1013 | (defun octave-sync-function-file-names () | ||
| 1014 | "Ensure function name agree with function file name. | ||
| 1015 | See Info node `(octave)Function Files'." | ||
| 1016 | (interactive) | ||
| 1017 | (save-excursion | ||
| 1018 | (when (and buffer-file-name | ||
| 1019 | (prog2 | ||
| 1020 | (goto-char (point-min)) | ||
| 1021 | (equal (funcall smie-forward-token-function) "function") | ||
| 1022 | (forward-word -1))) | ||
| 1023 | (let ((file (file-name-sans-extension | ||
| 1024 | (file-name-nondirectory buffer-file-name))) | ||
| 1025 | (func (and (re-search-forward octave-function-header-regexp nil t) | ||
| 1026 | (match-string 3)))) | ||
| 1027 | (when (and func | ||
| 1028 | (not (equal file func)) | ||
| 1029 | (yes-or-no-p | ||
| 1030 | "Function name different from file name. Fix? ")) | ||
| 1031 | (replace-match file nil nil nil 3)))))) | ||
| 1032 | |||
| 1010 | 1033 | ||
| 1011 | ;;; Indentation | 1034 | ;;; Indentation |
| 1012 | 1035 | ||