GNU bug report logs - #15935
[PATCH] octave.el: Add `octave-source-file'.

Previous Next

Package: emacs;

Reported by: Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>

Date: Wed, 20 Nov 2013 19:48:02 UTC

Severity: wishlist

Tags: patch

Done: Leo Liu <sdl.web <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15935 in the body.
You can then email your comments to 15935 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#15935; Package emacs. (Wed, 20 Nov 2013 19:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 20 Nov 2013 19:48:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>
To: bug-gnu-emacs <at> gnu.org
Cc: Leo Liu <sdl.web <at> gmail.com>
Subject: [PATCH] octave.el: Add `octave-source-file'.
Date: Wed, 20 Nov 2013 20:46:35 +0100
* 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 <at> 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 <at> 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 <at> 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 sent to Leo Liu <sdl.web <at> gmail.com>:
You have taken responsibility. (Thu, 21 Nov 2013 17:21:02 GMT) Full text and rfc822 format available.

Notification sent to Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>:
bug acknowledged by developer. (Thu, 21 Nov 2013 17:21:03 GMT) Full text and rfc822 format available.

Message #10 received at 15935-done <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>
Cc: 15935-done <at> debbugs.gnu.org
Subject: Re: bug#15935: [PATCH] octave.el: Add `octave-source-file'.
Date: Fri, 22 Nov 2013 01:20:25 +0800
On 2013-11-21 03:46 +0800, Rüdiger Sonderfeld wrote:
> * progmodes/octave.el (octave-mode-map, octave-mode-menu): Add
>   `octave-source-file'.
>   (octave-source-file): New function.

Merged with some tweaks. Please check if it works as expected.

Thanks,
Leo




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 20 Dec 2013 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 137 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.