all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Rüdiger Sonderfeld" <ruediger@c-plusplus.de>
To: 15935@debbugs.gnu.org
Cc: Leo Liu <sdl.web@gmail.com>
Subject: bug#15935: [PATCH] octave.el: Add `octave-source-file'.
Date: Wed, 20 Nov 2013 20:46:35 +0100	[thread overview]
Message-ID: <2139766.JCPkKN2uLn@descartes> (raw)

* progmodes/octave.el (octave-mode-map, octave-mode-menu): Add
  `octave-source-file'.
  (octave-source-file): New function.

Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
---
 lisp/ChangeLog           |  6 ++++++
 lisp/progmodes/octave.el | 18 ++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 357087d..4b3416d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2013-11-20  Rüdiger Sonderfeld  <ruediger@c-plusplus.de>
+
+	* progmodes/octave.el (octave-mode-map, octave-mode-menu): Add
+	`octave-source-file'.
+	(octave-source-file): New function.
+
 2013-11-20  era eriksson  <era+emacsbugs@iki.fi>
 
 	* ses.el (ses-mode): Doc fix.  (Bug#14748)
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index f128441..b4af1be 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -110,6 +110,7 @@ (defvar octave-mode-map
     (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 @@ (easy-menu-define octave-mode-menu octave-mode-map
      ["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,22 @@ (defun octave-hide-process-buffer ()
       (delete-windows-on inferior-octave-buffer)
     (message "No buffer named %s" inferior-octave-buffer)))
 
+(defun octave-source-file (&optional file)
+  "Parse and execute FILE in the inferior Octave process.
+This is done using Octave's source function.  If FILE is nil then
+the variable `buffer-file-name' is used instead."
+  (interactive)
+  (unless file
+    (setq file buffer-file-name))
+  (unless file
+    (user-error "Current buffer has no file"))
+  (setq file (expand-file-name file))
+  (inferior-octave t)
+  (with-current-buffer inferior-octave-buffer
+    (setq file (file-relative-name file))
+    (comint-send-string inferior-octave-process
+                        (concat "source '" file  "'\n"))))
+
 (defun octave-send-region (beg end)
   "Send current region to the inferior Octave process."
   (interactive "r")
-- 
1.8.4.3






             reply	other threads:[~2013-11-20 19:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-20 19:46 Rüdiger Sonderfeld [this message]
2013-11-21 17:20 ` bug#15935: [PATCH] octave.el: Add `octave-source-file' Leo Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2139766.JCPkKN2uLn@descartes \
    --to=ruediger@c-plusplus.de \
    --cc=15935@debbugs.gnu.org \
    --cc=sdl.web@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.