# HG changeset patch # User Rik # Date 1381190816 25200 # Node ID 28eb00d3edf449abb39c0253f93cd6fb2a0f15cb # Parent 7c479b7d3aab423713e88fba2d169e3956799a98 edit.m: Work correctly for file names with '~'. * scripts/miscellaneous/edit.m: Use tilde_expand() on base filename immediately before proceeding to make a search list based off that filename. diff -r 7c479b7d3aab -r 28eb00d3edf4 scripts/miscellaneous/edit.m --- a/scripts/miscellaneous/edit.m Mon Oct 07 15:16:36 2013 -0700 +++ b/scripts/miscellaneous/edit.m Mon Oct 07 17:06:56 2013 -0700 @@ -229,8 +229,8 @@ endif return; otherwise - ## If none of the states match, assume both inputs are - ## actually both file names to be opened + ## If none of the states match, assume both inputs are actually + ## file names to be opened. editfilelist = varargin; endswitch elseif (nargin > 2) @@ -267,7 +267,7 @@ else ## Only one file name was supplied, get it from the cell array - file = editfilelist{1}; + file = tilde_expand (editfilelist{1}); ## Check whether the user is trying to edit a builtin or compiled function. switch (exist (file)) @@ -300,20 +300,21 @@ if (idx == 0) if (isempty (regexp (file, '\.m$'))) ## No ".m" at the end of the file, add to the list. - filelist{end+1} = [file ".m"]; + filelist(end+1) = [file ".m"]; endif if (isempty (regexp (file, '\.cc$'))) ## No ".cc" at the end of the file, add to the list. - filelist{end+1} = [file ".cc"]; + filelist(end+1) = [file ".cc"]; endif endif + keyboard; ## If the file includes a path, it may be an overloaded function. - if (! strcmp (file, "@") && index (file, filesep)) + if (! index (file, "@") && index (file, filesep)) ## No "@" at the beginning of the file, add to the list. numfiles = numel (filelist); for n = 1:numfiles - filelist{n+numfiles} = ["@" filelist{n}]; + filelist(n+numfiles) = ["@" filelist{n}]; endfor endif @@ -353,7 +354,7 @@ endif endif - ## If editing a new file that is neither a m-file or an oct-file, + ## If editing a new file that is neither an m-file or an oct-file, ## just edit it. fileandpath = file; idx = rindex (file, ".");