emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r112421: * progmodes/octave.el (infer


From: Leo Liu
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112421: * progmodes/octave.el (inferior-octave-startup-hook): Obsolete.
Date: Mon, 29 Apr 2013 12:37:36 +0800
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 112421
committer: Leo Liu <address@hidden>
branch nick: trunk
timestamp: Mon 2013-04-29 12:37:36 +0800
message:
  * 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.
modified:
  lisp/ChangeLog
  lisp/progmodes/octave.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-04-28 16:39:10 +0000
+++ b/lisp/ChangeLog    2013-04-29 04:37:36 +0000
@@ -1,3 +1,10 @@
+2013-04-29  Leo Liu  <address@hidden>
+
+       * 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.
+
 2013-04-28  Jay Belanger  <address@hidden>
 
        * calc/calc.el (math-normalize): Don't set `math-normalize-error'

=== modified file 'lisp/progmodes/octave.el'
--- a/lisp/progmodes/octave.el  2013-04-27 17:07:01 +0000
+++ b/lisp/progmodes/octave.el  2013-04-29 04:37:36 +0000
@@ -641,7 +641,8 @@
 (defvar inferior-octave-output-string nil)
 (defvar inferior-octave-receive-in-progress nil)
 
-(defvar inferior-octave-startup-hook nil)
+(define-obsolete-variable-alias 'inferior-octave-startup-hook
+  'inferior-octave-mode-hook "24.4")
 
 (defvar inferior-octave-complete-impossible nil
   "Non-nil means that `inferior-octave-complete' is impossible.")
@@ -785,8 +786,6 @@
 
     ;; And finally, everything is back to normal.
     (set-process-filter proc 'inferior-octave-output-filter)
-    (run-hooks 'inferior-octave-startup-hook)
-    (run-hooks 'inferior-octave-startup-hook)
     ;; Just in case, to be sure a cd in the startup file
     ;; won't have detrimental effects.
     (inferior-octave-resync-dirs)))
@@ -966,7 +965,7 @@
 
 ;;; First non-copyright comment block
 (defun octave-function-file-comment ()
-  "Beginnning and end positions of the function file comment."
+  "Beginning and end positions of the function file comment."
   (save-excursion
     (goto-char (point-min))
     (let ((bound (progn (forward-comment (point-max)) (point))))
@@ -994,17 +993,32 @@
     (pcase-let ((`(,start ,_end ,name-start ,name-end)
                  (octave-function-file-p)))
       (when (and start name-start)
-        (let ((func (buffer-substring name-start name-end))
-              (file (file-name-sans-extension
-                     (file-name-nondirectory buffer-file-name))))
-          (save-excursion
-            (when (and (not (equal file func))
-                       (progn
-                         (goto-char name-start)
-                         (yes-or-no-p
-                          "Function name different from file name. Fix? ")))
-              (delete-region name-start name-end)
-              (insert file))))))))
+        (let* ((func (buffer-substring name-start name-end))
+               (file (file-name-sans-extension
+                      (file-name-nondirectory buffer-file-name)))
+               (help-form (format "\
+a: Use function name `%s'
+b: Use file name `%s'
+q: Don't fix\n" func file))
+               (c (unless (equal file func)
+                    (save-window-excursion
+                      (help-form-show)
+                      (read-char-choice
+                       "Which name to use? (a/b/q) " '(?a ?b ?q))))))
+          (pcase c
+            (`?a (let ((newname (expand-file-name
+                                 (concat func (file-name-extension
+                                               buffer-file-name t)))))
+                   (when (or (not (file-exists-p newname))
+                             (yes-or-no-p
+                              (format "Target file %s exists; proceed? " 
newname)))
+                     (when (file-exists-p buffer-file-name)
+                       (rename-file buffer-file-name newname t))
+                     (set-visited-file-name newname))))
+            (`?b (save-excursion
+                   (goto-char name-start)
+                   (delete-region name-start name-end)
+                   (insert file)))))))))
 
 (defun octave-update-function-file-comment (beg end)
   "Query replace function names in function file comment."


reply via email to

[Prev in Thread] Current Thread [Next in Thread]