summaryrefslogtreecommitdiff
path: root/lisp/progmodes/octave.el
diff options
context:
space:
mode:
authorRĂ¼diger Sonderfeld <ruediger@c-plusplus.de>2013-11-22 01:18:25 +0800
committerLeo Liu <sdl.web@gmail.com>2013-11-22 01:18:25 +0800
commit06e752b48f12b914c55bbb51842dbed45080e0bd (patch)
treeac5130949900dadd49ff8c7c720be60a3136d689 /lisp/progmodes/octave.el
parent604ede6c0722816ff54a72644ccd73fdc18530ed (diff)
downloademacs-06e752b48f12b914c55bbb51842dbed45080e0bd.tar.gz
emacs-06e752b48f12b914c55bbb51842dbed45080e0bd.tar.bz2
emacs-06e752b48f12b914c55bbb51842dbed45080e0bd.zip
* progmodes/octave.el (octave-mode-map, octave-mode-menu): Add
`octave-source-file'. (octave-source-file): New function. Fixes: debbugs:15935
Diffstat (limited to 'lisp/progmodes/octave.el')
-rw-r--r--lisp/progmodes/octave.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index f128441a54e..c09dea59c27 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -110,6 +110,7 @@ parenthetical grouping.")
(define-key map "\C-c;" 'octave-update-function-file-comment)
(define-key map "\C-hd" 'octave-help)
(define-key map "\C-ha" 'octave-lookfor)
+ (define-key map "\C-c\C-l" 'octave-source-file)
(define-key map "\C-c\C-f" 'octave-insert-defun)
(define-key map "\C-c\C-il" 'octave-send-line)
(define-key map "\C-c\C-ib" 'octave-send-block)
@@ -174,6 +175,7 @@ parenthetical grouping.")
["Send Current Function" octave-send-defun t]
["Send Region" octave-send-region t]
["Send Buffer" octave-send-buffer t]
+ ["Source Current File" octave-source-file t]
["Show Process Buffer" octave-show-process-buffer t]
["Hide Process Buffer" octave-hide-process-buffer t]
["Kill Process" octave-kill-process t])
@@ -1463,6 +1465,19 @@ entered without parens)."
(delete-windows-on inferior-octave-buffer)
(message "No buffer named %s" inferior-octave-buffer)))
+(defun octave-source-file (file)
+ "Execute FILE in the inferior Octave process.
+This is done using Octave's source function. FILE defaults to
+current buffer file unless called with a prefix arg \\[universal-argument]."
+ (interactive (list (or (and (not current-prefix-arg) buffer-file-name)
+ (read-file-name "File: " nil nil t))))
+ (or (stringp file)
+ (signal 'wrong-type-argument (list 'stringp file)))
+ (inferior-octave t)
+ (with-current-buffer inferior-octave-buffer
+ (comint-send-string inferior-octave-process
+ (format "source '%s'\n" file))))
+
(defun octave-send-region (beg end)
"Send current region to the inferior Octave process."
(interactive "r")