aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Liu2013-04-29 12:37:36 +0800
committerLeo Liu2013-04-29 12:37:36 +0800
commit2ec12cb0f025b5476b8a1d7cacac2456bd5c1115 (patch)
treee1fadca12cf0372e0539efbc3ea5512838214f2f
parent9e63b4a53403840acf3d759d8ac16475c12562e2 (diff)
downloademacs-2ec12cb0f025b5476b8a1d7cacac2456bd5c1115.tar.gz
emacs-2ec12cb0f025b5476b8a1d7cacac2456bd5c1115.zip
* progmodes/octave.el (inferior-octave-startup-hook): Obsolete.
(inferior-octave-startup): Remove inferior-octave-startup-hook. (octave-function-file-comment): Fix typo. (octave-sync-function-file-names): Use read-char-choice.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/progmodes/octave.el44
2 files changed, 36 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8055106bd31..be33eb5d085 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12013-04-29 Leo Liu <sdl.web@gmail.com>
2
3 * progmodes/octave.el (inferior-octave-startup-hook): Obsolete.
4 (inferior-octave-startup): Remove inferior-octave-startup-hook.
5 (octave-function-file-comment): Fix typo.
6 (octave-sync-function-file-names): Use read-char-choice.
7
12013-04-28 Jay Belanger <jay.p.belanger@gmail.com> 82013-04-28 Jay Belanger <jay.p.belanger@gmail.com>
2 9
3 * calc/calc.el (math-normalize): Don't set `math-normalize-error' 10 * calc/calc.el (math-normalize): Don't set `math-normalize-error'
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index b8fbe6a90a7..e171a860e8f 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -641,7 +641,8 @@ the regular expression `comint-prompt-regexp', a buffer local variable."
641(defvar inferior-octave-output-string nil) 641(defvar inferior-octave-output-string nil)
642(defvar inferior-octave-receive-in-progress nil) 642(defvar inferior-octave-receive-in-progress nil)
643 643
644(defvar inferior-octave-startup-hook nil) 644(define-obsolete-variable-alias 'inferior-octave-startup-hook
645 'inferior-octave-mode-hook "24.4")
645 646
646(defvar inferior-octave-complete-impossible nil 647(defvar inferior-octave-complete-impossible nil
647 "Non-nil means that `inferior-octave-complete' is impossible.") 648 "Non-nil means that `inferior-octave-complete' is impossible.")
@@ -785,8 +786,6 @@ startup file, `~/.emacs-octave'."
785 786
786 ;; And finally, everything is back to normal. 787 ;; And finally, everything is back to normal.
787 (set-process-filter proc 'inferior-octave-output-filter) 788 (set-process-filter proc 'inferior-octave-output-filter)
788 (run-hooks 'inferior-octave-startup-hook)
789 (run-hooks 'inferior-octave-startup-hook)
790 ;; Just in case, to be sure a cd in the startup file 789 ;; Just in case, to be sure a cd in the startup file
791 ;; won't have detrimental effects. 790 ;; won't have detrimental effects.
792 (inferior-octave-resync-dirs))) 791 (inferior-octave-resync-dirs)))
@@ -966,7 +965,7 @@ The value is (START END NAME-START NAME-END) of the function."
966 965
967;;; First non-copyright comment block 966;;; First non-copyright comment block
968(defun octave-function-file-comment () 967(defun octave-function-file-comment ()
969 "Beginnning and end positions of the function file comment." 968 "Beginning and end positions of the function file comment."
970 (save-excursion 969 (save-excursion
971 (goto-char (point-min)) 970 (goto-char (point-min))
972 (let ((bound (progn (forward-comment (point-max)) (point)))) 971 (let ((bound (progn (forward-comment (point-max)) (point))))
@@ -994,17 +993,32 @@ See Info node `(octave)Function Files'."
994 (pcase-let ((`(,start ,_end ,name-start ,name-end) 993 (pcase-let ((`(,start ,_end ,name-start ,name-end)
995 (octave-function-file-p))) 994 (octave-function-file-p)))
996 (when (and start name-start) 995 (when (and start name-start)
997 (let ((func (buffer-substring name-start name-end)) 996 (let* ((func (buffer-substring name-start name-end))
998 (file (file-name-sans-extension 997 (file (file-name-sans-extension
999 (file-name-nondirectory buffer-file-name)))) 998 (file-name-nondirectory buffer-file-name)))
1000 (save-excursion 999 (help-form (format "\
1001 (when (and (not (equal file func)) 1000a: Use function name `%s'
1002 (progn 1001b: Use file name `%s'
1003 (goto-char name-start) 1002q: Don't fix\n" func file))
1004 (yes-or-no-p 1003 (c (unless (equal file func)
1005 "Function name different from file name. Fix? "))) 1004 (save-window-excursion
1006 (delete-region name-start name-end) 1005 (help-form-show)
1007 (insert file)))))))) 1006 (read-char-choice
1007 "Which name to use? (a/b/q) " '(?a ?b ?q))))))
1008 (pcase c
1009 (`?a (let ((newname (expand-file-name
1010 (concat func (file-name-extension
1011 buffer-file-name t)))))
1012 (when (or (not (file-exists-p newname))
1013 (yes-or-no-p
1014 (format "Target file %s exists; proceed? " newname)))
1015 (when (file-exists-p buffer-file-name)
1016 (rename-file buffer-file-name newname t))
1017 (set-visited-file-name newname))))
1018 (`?b (save-excursion
1019 (goto-char name-start)
1020 (delete-region name-start name-end)
1021 (insert file)))))))))
1008 1022
1009(defun octave-update-function-file-comment (beg end) 1023(defun octave-update-function-file-comment (beg end)
1010 "Query replace function names in function file comment." 1024 "Query replace function names in function file comment."