From: Paul K. <pki...@us...> - 2004-03-05 06:05:52
|
On Mar 4, 2004, at 4:51 AM, Per Persson wrote: > Hi, > on Mac OS X edit.m breaks when issuing 'edit' without any parameters. > The cause seems to be a difference in how whitespace is treated (on OS > X spaces are allowed in file- & pathnames). > The [EDITOR %s] part comes out as 'emacs ' (trailing space) instead of > 'emacs'. > > A potentital fix is pasted below. I don't have any other system to > test it on so I won't commit it just yet. I prefer the following fix. In the rest of the function I am not protecting the editor command with quotes, so why should I if no file name is given? If the user needs quotes, they can put them on themselves using edit editor "'path with spaces/editor' %s" A more awkward issue is whether edit.m should put quotes around %s. The user can't do it because that will break edit without any parameters. edit.m shouldn't do it because some editor commands won't what single quotes surrounding the file name. Suggestions? diff -c -p -r1.12 edit.m *** edit.m 16 Dec 2003 21:53:46 -0000 1.12 --- edit.m 5 Mar 2004 05:42:54 -0000 *************** function edit(file,state) *** 100,106 **** ## start the editor without a file if no file is given if nargin < 1 ! system(['cd "',FUNCTION_HOME,'" ; "',sprintf(FUNCTION_EDITOR,""), '"']); return endif --- 100,106 ---- ## start the editor without a file if no file is given if nargin < 1 ! system(['cd "',FUNCTION_HOME,'" ; ',sprintf(FUNCTION_EDITOR,"")]); return endif > > /Per > > Index: edit.m > =================================================================== > RCS file: /cvsroot/octave/octave-forge/main/miscellaneous/edit.m,v > retrieving revision 1.12 > diff -u -d -b -w -r1.12 edit.m > --- edit.m 16 Dec 2003 21:53:46 -0000 1.12 > +++ edit.m 1 Mar 2004 10:23:41 -0000 > @@ -100,7 +100,7 @@ > > ## start the editor without a file if no file is given > if nargin < 1 > - system(['cd "',FUNCTION_HOME,'" ; "',sprintf(FUNCTION_EDITOR,""), > '"']); > + system(['cd "',FUNCTION_HOME,'" ; "',strtok(FUNCTION_EDITOR, " > "),'"']); > return > endif > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Octave-dev mailing list > Oct...@li... > https://lists.sourceforge.net/lists/listinfo/octave-dev > |