The matlab setup for Emacs sets the editor preference to “emacsclient –n”. Emacsclient itself depends on the EDITOR command to be set so it can find your emacs. Thus if emacsclient can’t find Emacs already running (because you didn’t setup emacs client) it will try to start Emacs via EDITOR.
You may only need (server-start) in your .emacs file. Try using emacsclient by itself, and when that works, your Matlab shell should be good too. Eric From: Yuval A. [mailto:yuval....@gmail.com] Sent: Thursday, September 17, 2015 12:05 AM To: Dennis Ogbe <do...@purdue.edu> Cc: matlab-emacs-discuss@lists.sourceforge.net Subject: Re: [Matlab-emacs-discuss] matlab-emacs fails to open a file for edit (2014a) Thanks! I managed to isolate the issue. On both machines, when I connect with ssh with no X forwarding then I get the error Error: Environment variable EDITOR is not set. Error using edit (line 61) "Unknown service" However, if I connect with X forwarding then everything is ok (editing / debugging works). Since I would like to use tmux, and keep the session alive even when I disconnect from the ssh, then I cannot use X forwarding, because otherwise, matlab will crash. So anyone has any idea why I get "Error: Environment variable EDITOR is not set." when I don't use X fwding? and how to fix it? Many Thanks! Yuval PS: that's my .emacs file contents: ;; default to better frame titles (setq frame-title-format (concat "%b - emacs@" (system-name))) ;; default to unified diffs (setq diff-switches "-u") ;; always end a file with a newline ;(setq require-final-newline 'query) ;; map C-h to backspace since thats what the terminal prog. sends ;; and then map help to f1 (define-key key-translation-map [?\C-h] [?\C-?]) (global-set-key (kbd "<f1>") 'help-command) ;; change window sizes (global-set-key (kbd "<M-down>") 'shrink-window) (global-set-key (kbd "<M-up>") 'enlarge-window) (global-set-key (kbd "<M-left>") 'shrink-window-horizontally) (global-set-key (kbd "<M-right>") 'enlarge-window-horizontally) ;; for GDB/debugging in general (global-set-key (kbd "<f10>") 'gud-cont) (global-set-key (kbd "<f9>") 'gud-step);; equiv matlab step in (global-set-key (kbd "<f8>") 'gud-next) ;; equiv matlab step 1 (global-set-key (kbd "<f7>") 'gud-finish) ;; equiv matlab step out ;; Setting up matlab-mode (server-start) (add-to-list 'load-path "~/externals/matlab-emacs") (load-library "matlab-load") (add-to-list 'auto-mode-alist '("\\.m$<file:///\\.m$>" . matlab-mode)) (custom-set-variables '(matlab-shell-command-switches '("-nodesktop -nosplash"))) (add-hook 'matlab-mode-hook 'auto-complete-mode) ;;(setq auto-mode-alist ;; (cons ;; '("\\.m$<file:///\\.m$>" . matlab-mode) ;; auto-mode-alist)) ;; Enable CEDET feature support for MATLAB code. (Optional) (matlab-cedet-setup) On Wed, Sep 16, 2015 at 8:28 PM, Dennis Ogbe <do...@purdue.edu<mailto:do...@purdue.edu>> wrote: Do you have (add-to-list 'auto-mode-alist '("\\.m$<file:///\\.m$>" . matlab-mode)) in your init.el? Best, Dennis Yuval A. <yuval....@gmail.com<mailto:yuval....@gmail.com>> writes: > I downloaded and installed the matlab-emacs project from > http://matlab-emacs.sourceforge.net/ using the dl_emacs_support.m script > and edited my .emacs file according to the instructions. > > When I run > > M-x matlab-shell > > The matlab shell runs successfully, and the following line is shown: > > >> addpath('/home/lab/yuvval/externals/matlab-emacs/toolbox','-begin'); > rehash; emacsinit('emacsclient -n'); > > > However when I try to edit a file ( edit tmp.m), nothing happens. Even no > error messages.. > > > I have access to a linux machine in a different university. When I tried > the same there I got the following error message: > > Error: Environment variable EDITOR is not set. > Error using edit (line 61) > "Unknown service" > > > > Does anyone know how to solve it? I would love to be able to edit and debug > matlab code from emacs. > > Thanks! > ------------------------------------------------------------------------------ > Monitor Your Dynamic Infrastructure at Any Scale With Datadog! > Get real-time metrics from all of your servers, apps and tools > in one place. > SourceForge users - Click here to start your Free Trial of Datadog now! > http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140_______________________________________________ > Matlab-emacs-discuss mailing list > Matlab-emacs-discuss@lists.sourceforge.net<mailto:Matlab-emacs-discuss@lists.sourceforge.net> > https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss
------------------------------------------------------------------------------
_______________________________________________ Matlab-emacs-discuss mailing list Matlab-emacs-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss