emacsã§matlab
ä»å¾ã®äººçã«ããã¦matlabã使ãã®ã¯å¤åãã¨æ°ã«æã ãã ã¨æãã¾ããã
éã«ããã¨æ°ã«æã¯matlabã使ããªããã°ãªããªãã®ã§emacsãã便å©ã«ä½¿ããããã«é å¼µã£ã¦ã¿ã¾ããã
ç°å¢ã¯ubuntu 9.04 64bit + matlab 2009aã§ãã
ï¼. å°å
¥
http://redgecko.jp/d/?date=20070328
åºæ¬çã«ããã®ãµã¤ãã®éãããã°å¤§ä½ããæãã«ä½¿ããããã«ãªãã¾ãã
å
·ä½çã«ã¯ãmlintã«ããã¨ã©ã¼ãã§ãã¯ãã¤ã³ãã³ãã¨ãmatlabã·ã§ã«ã®å¼ã³åºãã¨ãã§ãã
ãã ããè¥å¹²æ å ±ãå¤ãã®ã§ç¾å¨ã®åã®è¨å®ãæãã¦ããã¾ãã
(autoload 'matlab-mode "matlab" "Enter MATLAB mode." t) (autoload 'matlab-shell "matlab" "Interactive MATLAB mode." t) (setq auto-mode-alist (cons '("\\.m\\'" . matlab-mode) auto-mode-alist)) ;; auto-complete-modeã®èªåèµ·å (add-to-list 'ac-modes 'matlab-mode) (setq matlab-shell-command "/usr/local/bin/matlab" matlab-shell-command-swithes '("-nodesktop -v=glnxa64") matlab-indent-level 2 matlab-indent-function-body nil matlab-highlight-cross-function-variables t matlab-return-add-semicolon t matlab-show-mlint-warnings t mlint-programs '("/usr/local/matlab2009a/bin/glnxa64/mlint") matlab-mode-install-path (list (expand-file-name "~/matlab/")) ) (autoload 'mlint-minor-mode "mlint" nil t) (add-hook 'matlab-mode-hook (lambda () (mlint-minor-mode 1))) (add-hook 'matlab-shell-mode-hook 'ansi-color-for-comint-mode-on) (add-hook 'matlab-shell-mode-hook (lambda () (setenv "LANG" "C"))) (eval-after-load "shell" '(define-key shell-mode-map [down] 'comint-next-matching-input-from-input)) (eval-after-load "shell" '(define-key shell-mode-map [up] 'comint-previous-matching-input-from-input))
ããã§ã¨ããããã¯emacsããmatlabã使ããã¨æãã¾ãã
ï¼. hideshow.elã§ã³ã¼ãã®æãããã¿
å
æ¥pythonã§å°å
¥ããhideshow.elã便å©ã ã£ãã®ã§matlabã§ã使ããããã«ãã¾ãã
(load-library "hideshow") (add-hook 'matlab-mode-hook 'hideshowvis-enable) (add-to-list 'hs-special-modes-alist '(matlab-mode "if\\|switch\\|case\\|otherwise\\|while\\|for\\|try\\|catch" "end" nil (lambda (arg) (matlab-forward-sexp)) nil))
ããã§ãã¾ããã¨æããããã§ãããã¨æãã¾ãã
ï¼. yasnippetã§å
¥åæ¯æ´
http://www.mediafire.com/?2on0q0vfucd24ll
é©å½ã§ããsnippetã®ãã¿ã¼ã³ãä½ã£ãã®ã§è§£åãã¦snippetsãã©ã«ãã«ã¶ã¡ããã§ãã ãã
ï¼. auto-completeã§å
¥åæ¯æ´
foræã¨ãé¢æ°å®ç¾©ã¨ãã®ãã¿ã¼ã³ã¯yasnippetããã§ãã¾ãããmatlab.elã«å
¥åè£å®ç¨ã®é¢æ°ãããã¾ãã
ããããããæãã«è£å®ãã¦ãããã®ã§ãããåã¯auto-complete.elã«æ £ããã£ã¦ãã¾ã£ã¦ããã®ã§ã§ããã°ãã£ã¡ããè£å®ãããã®ã§ãã
matlab.elã®è£å®é¢æ°ã¯M-TABé£æã§åè£ã次ã å¤ãã¦ããã¨ãããã¿ã¼ã³ã§ãåè£ãªã¹ãã¯ç´æ¥ã¯æ¸¡ãã¦ãããªãã£ã½ãã®ã§ãã®é¢æ°ãé©å½ã«æç´ããã¦ãã®åè£ãªã¹ãã渡ãã¦ãããé¢æ°ãæ°ãã«ä½ã£ã¦ããã®ãªã¹ãã¨yasnippetã®ãªã¹ãã使ã£ã¦auto-completeã使ããã¨ããä½æ¦ã§ãã
(defface ac-matlab-candidate-face '((t (:background "PaleGreen" :foreground "black"))) "Face for matlab candidate." :group 'auto-complete) (defface ac-matlab-selection-face '((t (:background "DarkGreen" :foreground "white"))) "Face for matlab selected candidate." :group 'auto-complete) (defun matlab-complete-symbol-list (&optional arg) (interactive "P") ;(matlab-navigation-syntax (let* ((prefix (if (and (not (eq last-command 'matlab-complete-symbol)) (member (preceding-char) '(? ?\t ?\n ?, ?\( ?\[ ?\'))) "" (buffer-substring-no-properties (save-excursion (forward-word -1) (point)) (point)))) (sem (matlab-lattr-semantics prefix))) (if (not (eq last-command 'matlab-complete-symbol)) (setq matlab-last-prefix prefix matlab-last-semantic sem matlab-completion-search-state (cond ((eq sem 'solo) '(matlab-solo-completions matlab-find-user-functions matlab-find-recent-variable)) ((eq sem 'boolean) '(matlab-find-recent-variable matlab-boolean-completions matlab-find-user-functions matlab-value-completions)) ((eq sem 'value) '(matlab-find-recent-variable matlab-find-user-functions matlab-value-completions matlab-boolean-completions)) ((eq sem 'property) '(matlab-property-completions matlab-find-user-functions matlab-find-recent-variable matlab-value-completions)) (t '(matlab-find-recent-variable matlab-find-user-functions matlab-value-completions matlab-boolean-completions))))) (let ((allsyms (apply 'append (mapcar (lambda (f) (funcall f prefix)) matlab-completion-search-state)))) (matlab-uniquafy-list allsyms)))) (defvar ac-source-matlab '((candidates . (lambda () (matlab-complete-symbol-list))) (candidate-face . ac-matlab-candidate-face) (selection-face . ac-matlab-selection-face) )) (add-hook 'matlab-mode-hook (lambda () (add-to-list 'ac-sources 'ac-source-matlab) (add-to-list 'ac-sources 'ac-source-yasnippet)))
ï¼. anythingã§ãã«ããå¼ã
ã¾ã ãã£ã¦ãªãã£ãâ¦
ã¨ãããã¨ã§ã100%ã§ã¯ããã¾ããããããããããæãã«ä½¿ããããã«ãªã£ãã¨æãã¾ãã
matlab使ããªãããªããªããã©Emacsããé¢ããããªãã£ã¦ãã人ã®åã«å°ãã§ããªããã°å¹¸ãã§ãã
ä¸å¿SSãè¼ãã¨ãã¾ãã
åºæ¬çã«EmacsLispã¯ããã¾ãããããªãã®ã§ã³ããã¨ãã©ã¤ã¢ã³ãã¨ã©ã¼ã®æã¦ã«ãã¨ããããåãã°ããã¨ãã£ãæããªã®ã§ç¡é§ãªãã¨ãå¤ãªãã¨ããã¦ãã¨æãã¾ãã
ãã£ã¨ããããæ¹ããã£ããæãã¦ãã ããã