emacs中运行matlab,emacs之matlab配置

这两天要看matlab代码,开一个m编辑器太烦人了,还是emacs省事.

1.配置matlab,如下:

Installing EmacsLink Overview To install EmacsLink:

Register EmacsLink with MATLAB.

See Registering EmacsLink.

Configure MATLAB to use EmacsLink.

See Configuring MATLAB.

Configure Emacs to use EmacsLink.

See Configuring Emacs.

Registering EmacsLink This section describes two procedures for

registering EmacsLink:

for use by all users of a shared (network license) copy of MATLAB

for personal use by a user of a shared (network-licensed) copy of

MATLAB

You can use either procedure if you own an individually licensed copy

of MATLAB.

Registering EmacsLink for All Users To register EmacsLink for use by

all users of a network-licensed copy of MATLAB or for use by the owner

of a personal copy of MATLAB, you need only change the name of a

single file in the MATLAB installation directory. This file is named

info.xml.sample and resides in the java/extern/EmacsLink subdirectory

of the MATLAB installation directory. Rename this file to info.xml to

register EmacsLink for all users of this copy of MATLAB.

Note. This procedure assumes that you have write-access to the

installation directory of the network copy of MATLAB.

Registering EmacsLink for Personal Use Registering EmacsLink for your

use entails updating the directory that stores your MATLAB

preference. If your system is a Unix or Linux system, this directory

resides at $HOME/matlab where $HOME is the path to your home

directory. If your system is a Microsoft Windows system, your MATLAB

preferences directory resides in the system's user profile directory

(e.g., c:/WINNT/Profiles/your_user_name/Application

Data/Mathworks/MATLAB).

To register EmacsLink for personal use:

Create a subdirectory named EmacsLink in your MATLAB preferences

directory.

Copy the file named info.xml.sample in the java/extern/EmacsLink

subdirectory of the MATLAB installation directory file to the newly

created EmacsLink directory in your MATLAB preferences directory.

Change the name of the copy to info.xml.

Configuring MATLAB To configure MATLAB to use EmacsLink:

Start MATLAB.

Select Preferences from the MATLAB File menu

The MATLAB Preferences dialog box appears.

Select Editor/Debugger in the lefthand pane.

The Editor/Debugger Preferences pane appears.

Select the Integrated text editor option from the Editor preferences

group.

Note. This option appears only if you have registered EmacsLink with

MATLAB. If it does not appear, you have either not registered

EmacsLink with MATLAB or have not done so correctly. See Registering

EmacsLink for more information.

Select EmacsLink from the adjacent editor list.

MATLAB enables the adjacent Options button. This button displays a

dialog box that allows you to set various EmacsLink installation

options (see following steps and EmacsLink Options).

You need to perform the next three steps only if you want to use

XEmacs with EmacsLink or if Emacs is not in the command path on your

system.

Select the Options button next to the editor list.

The EmacsLink Options dialog box appears.

Set the Emacs path option on the dialog box to the path of Emacs or

XEmacs on your system.

Click OK to dismiss the options dialog box.

Click OK to dismiss the MATLAB Preferences dialog box.

EmacsLink Options The EmacsLink Options dialog box allows you to set

any of the following installation options:

Port The port number of the socket used by EmacsLink to connect MATLAB

with Emacs. Change this setting only if your system already uses the

default setting for another purpose.

Timeout The length of time in seconds that EmacsLink waits for Emacs

to respond when attempting to connect with Emacs. If Emacs takes

longer than the default setting to start, increase the setting.

Emacs path The path of the version of Emacs (or XEmacs) that you want

to use with EmacsLink. If the Emacs/XEmacs executable is in your

system's command path, you need enter only the name of the

executable. Note that the name of the executable of the native Windows

version of Emacs is runemacs.exe.

2.配置emacs如下:

首先将G:/R2006b/java/extern/EmacsLink/lisp下的matlab.el文件拷贝到myEmacs文夹夹中.

myEmacs文件夹在HOME目录下.

在__emacs问价中添加:

;==========================MATLAB配置=======

;;; Matlab-mode setup:

;; Add local lisp folder to load-path

(load-file "~/myEmacs/matlab.el")    ;加载matlab.el文件

;;(setq load-path (append load-path (list "~/myEmacs")))

;; Set up matlab-mode to load on .m files

(autoload 'matlab-mode "matlab" "Enter MATLAB mode." t)

(setq auto-mode-alist (cons '("//.m//'" . matlab-mode) auto-mode-alist))

(autoload 'matlab-shell "matlab" "Interactive MATLAB mode." t)

;; Customization:

(setq matlab-indent-function t) ; if you want function bodies indented

(setq matlab-verify-on-save-flag nil) ; turn off auto-verify on save

(defun my-matlab-mode-hook ()

(setq fill-column 76))  ; where auto-fill should wrap

(add-hook 'matlab-mode-hook 'my-matlab-mode-hook)

(defun my-matlab-shell-mode-hook ()

'())

(add-hook 'matlab-shell-mode-hook 'my-matlab-shell-mode-hook)

;; Turn off Matlab desktop

(setq matlab-shell-command-switches '("-nojvm"))

;==========================MATLAB配置结束=======

3.打开emacs,打开一个.m文件,即可使用matlab mode.

俺的matlab mode 是3.0. :)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值