help-octave
[Top][All Lists]
Advanced

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

Question / suggestion on octave - mode for emacs


From: Dr. Ing. Dieter Jurzitza
Subject: Question / suggestion on octave - mode for emacs
Date: Sun, 3 Feb 2013 09:17:25 +0100
User-agent: KMail/1.13.6 (Linux/3.6.10-1-desktop; KDE/4.7.2; x86_64; ; )

Dear listmembers,
I have been searching a while for a command from within octave - mode in emacs 
to simply send the current buffer to octave - but did not find it.

So I created an addition - based on octave-mode of emacs 24.2.1:

*****************************************************************************
--- octave-mod.el.original      2013-02-02 11:05:39.109674945 +0100
+++ octave-mod.el       2013-02-02 11:05:07.588289641 +0100
@@ -213,7 +213,7 @@
     (define-key map "`" 'octave-abbrev-start)
     (define-key map "\e\n" 'octave-indent-new-comment-line)
     (define-key map "\M-\C-q" 'octave-indent-defun)
-    (define-key map "\C-c\C-b" 'octave-submit-bug-report)
+    (define-key map "\C-c\C-s" 'octave-submit-bug-report)
     (define-key map "\C-c\C-p" 'octave-previous-code-line)
     (define-key map "\C-c\C-n" 'octave-next-code-line)
     (define-key map "\C-c\C-a" 'octave-beginning-of-line)
@@ -229,6 +229,7 @@
     (define-key map "\C-c\C-ib" 'octave-send-block)
     (define-key map "\C-c\C-if" 'octave-send-defun)
     (define-key map "\C-c\C-ir" 'octave-send-region)
+    (define-key map "\C-c\C-b" 'octave-send-buffer)
     (define-key map "\C-c\C-is" 'octave-show-process-buffer)
     (define-key map "\C-c\C-ih" 'octave-hide-process-buffer)
     (define-key map "\C-c\C-ik" 'octave-kill-process)
@@ -269,6 +270,8 @@
       ["Show Process Buffer"   octave-show-process-buffer t]
       ["Hide Process Buffer"   octave-hide-process-buffer t]
       ["Kill Process"          octave-kill-process t])
+     "-"
+     ["Send Buffer"            octave-send-buffer t]
     "-"
     ["Indent Line"             indent-according-to-mode t]
     ["Complete Symbol"         completion-at-point t]
@@ -1147,6 +1150,13 @@
      'octave-send-line-auto-forward
      'octave-send-show-buffer))))
 
+(defun octave-send-buffer ()
+  "Sends the entire buffer to the octave program."
+  (interactive)
+  (if (equal major-mode 'octave-mode)
+      (octave-send-region (point-min) (point-max))
+    (message "You can only send octave-mode buffers to octave.")))
+
 ;; provide ourself
 
 (provide 'octave-mod)
*****************************************************************************
You may like or dislike the key-bindings - however, this is a fast command 
interface to send commands to octave, I made it compliant to gnuplot-mode as 
Ctrl-b sends the current buffer to gnuplot.

Take care





Dieter Jurzitza

-- 
-----------------------------------------------------------

                               |
                                \
                 /\_/\           |
                | ~x~ |/-----\   /
                 \   /-       \_/
  ^^__   _        /  _  ____   /
 <°°__ \- \_/     |  |/    |  |
  ||  ||         _| _|    _| _|

if you really want to see the pictures above - use some font
with constant spacing like courier! :-)
-----------------------------------------------------------


reply via email to

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