emacs-diffs
[Top][All Lists]
Advanced

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

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


From: Leo Liu
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112442: * progmodes/octave.el (inferior-octave-startup-file): Change default.
Date: Fri, 03 May 2013 05:34:53 +0800
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 112442
committer: Leo Liu <address@hidden>
branch nick: trunk
timestamp: Fri 2013-05-03 05:34:53 +0800
message:
  * progmodes/octave.el (inferior-octave-startup-file): Change default.
  (inferior-octave): Remove calling comint-mode and return the buffer.
  (inferior-octave-startup): Cosmetic changes.
modified:
  lisp/ChangeLog
  lisp/progmodes/octave.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-05-02 21:27:16 +0000
+++ b/lisp/ChangeLog    2013-05-02 21:34:53 +0000
@@ -1,5 +1,11 @@
 2013-05-02  Leo Liu  <address@hidden>
 
+       * progmodes/octave.el (inferior-octave-startup-file): Change default.
+       (inferior-octave): Remove calling comint-mode and return the buffer.
+       (inferior-octave-startup): Cosmetic changes.
+
+2013-05-02  Leo Liu  <address@hidden>
+
        * progmodes/octave.el (octave-syntax-propertize-function): Include
        the case when ' is at line beginning.  (Bug#14336)
 

=== modified file 'lisp/progmodes/octave.el'
--- a/lisp/progmodes/octave.el  2013-05-02 21:27:16 +0000
+++ b/lisp/progmodes/octave.el  2013-05-02 21:34:53 +0000
@@ -553,13 +553,15 @@
   :group 'octave
   :version "24.4")
 
-(defcustom inferior-octave-startup-file nil
+(defcustom inferior-octave-startup-file
+  (convert-standard-filename
+   (concat "~/.emacs-" (file-name-nondirectory inferior-octave-program)))
   "Name of the inferior Octave startup file.
 The contents of this file are sent to the inferior Octave process on
 startup."
-  :type '(choice (const :tag "None" nil)
-                file)
-  :group 'octave)
+  :type '(choice (const :tag "None" nil) file)
+  :group 'octave
+  :version "24.4")
 
 (defcustom inferior-octave-startup-args nil
   "List of command line arguments for the inferior Octave process.
@@ -650,16 +652,14 @@
 the file specified by `inferior-octave-startup-file' or by the default
 startup file, `~/.emacs-octave'."
   (interactive "P")
-  (let ((buffer inferior-octave-buffer))
-    (get-buffer-create buffer)
-    (if (comint-check-proc buffer)
-       ()
+  (let ((buffer (get-buffer-create inferior-octave-buffer)))
+    (unless (comint-check-proc buffer)
       (with-current-buffer buffer
-       (comint-mode)
-       (inferior-octave-startup)
-       (inferior-octave-mode)))
-    (if (not arg)
-       (pop-to-buffer buffer))))
+        (inferior-octave-startup)
+        (inferior-octave-mode)))
+    (unless arg
+      (pop-to-buffer buffer))
+    buffer))
 
 ;;;###autoload
 (defalias 'run-octave 'inferior-octave)
@@ -667,17 +667,16 @@
 (defun inferior-octave-startup ()
   "Start an inferior Octave process."
   (let ((proc (comint-exec-1
-              (substring inferior-octave-buffer 1 -1)
-              inferior-octave-buffer
-              inferior-octave-program
-              (append (list "-i" "--no-line-editing")
-                      inferior-octave-startup-args))))
+               (substring inferior-octave-buffer 1 -1)
+               inferior-octave-buffer
+               inferior-octave-program
+               (append (list "-i" "--no-line-editing")
+                       inferior-octave-startup-args))))
     (set-process-filter proc 'inferior-octave-output-digest)
-    (setq comint-ptyp process-connection-type
-         inferior-octave-process proc
-         inferior-octave-output-list nil
-         inferior-octave-output-string nil
-         inferior-octave-receive-in-progress t)
+    (setq inferior-octave-process proc
+          inferior-octave-output-list nil
+          inferior-octave-output-string nil
+          inferior-octave-receive-in-progress t)
 
     ;; This may look complicated ... However, we need to make sure that
     ;; we additional startup code only AFTER Octave is ready (otherwise,
@@ -691,35 +690,32 @@
      (concat
       (if (not (bobp)) "\n")
       (if inferior-octave-output-list
-         (concat (mapconcat
-                  'identity inferior-octave-output-list "\n")
-                 "\n"))))
+          (concat (mapconcat
+                   'identity inferior-octave-output-list "\n")
+                  "\n"))))
 
     ;; An empty secondary prompt, as e.g. obtained by '--braindead',
     ;; means trouble.
     (inferior-octave-send-list-and-digest (list "PS2\n"))
-    (if (string-match "\\(PS2\\|ans\\) = *$" (car inferior-octave-output-list))
-       (inferior-octave-send-list-and-digest (list "PS2 (\"> \");\n")))
+    (when (string-match "\\(PS2\\|ans\\) = *$"
+                        (car inferior-octave-output-list))
+      (inferior-octave-send-list-and-digest (list "PS2 (\"> \");\n")))
 
-    ;; O.k., now we are ready for the Inferior Octave startup commands.
-    (let* (commands
-          (program (file-name-nondirectory inferior-octave-program))
-          (file (or inferior-octave-startup-file
-                         (concat "~/.emacs-" program))))
-      (setq commands
-           (list "more off;\n"
-                 (if (not (string-equal
-                           inferior-octave-output-string ">> "))
-                      "PS1 (\"\\\\s> \");\n")
-                 (if (file-exists-p file)
-                     (format "source (\"%s\");\n" file))))
-      (inferior-octave-send-list-and-digest commands))
+    ;; O.K., now we are ready for the Inferior Octave startup commands.
+    (inferior-octave-send-list-and-digest
+     (list "more off;\n"
+           (unless (equal inferior-octave-output-string ">> ")
+             "PS1 (\"\\\\s> \");\n")
+           (when (and inferior-octave-startup-file
+                      (file-exists-p inferior-octave-startup-file))
+             (format "source (\"%s\");\n" inferior-octave-startup-file))))
+    ;; XXX: the first prompt is incorrectly highlighted
     (insert-before-markers
      (concat
       (if inferior-octave-output-list
-         (concat (mapconcat
-                  'identity inferior-octave-output-list "\n")
-                 "\n"))
+          (concat (mapconcat
+                   'identity inferior-octave-output-list "\n")
+                  "\n"))
       inferior-octave-output-string))
 
     ;; And finally, everything is back to normal.


reply via email to

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