From 06e752b48f12b914c55bbb51842dbed45080e0bd Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=BCdiger=20Sonderfeld?= Date: Fri, 22 Nov 2013 01:18:25 +0800 Subject: [PATCH] * progmodes/octave.el (octave-mode-map, octave-mode-menu): Add `octave-source-file'. (octave-source-file): New function. Fixes: debbugs:15935 --- lisp/ChangeLog | 6 ++++++ lisp/progmodes/octave.el | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ce530e898a0..014dbea7b51 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2013-11-21 Rüdiger Sonderfeld + + * progmodes/octave.el (octave-mode-map, octave-mode-menu): Add + `octave-source-file'. + (octave-source-file): New function. (Bug#15935) + 2013-11-21 Kenjiro Nakayama (tiny change) * net/eww.el (eww-local-regex): New variable. 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") -- 2.39.2