# HG changeset patch # User Mike Miller # Date 1334752148 14400 # Node ID 7ad0762b0f6b8f0abe183591c751ed98ddc9e4fb # Parent 3a9a56999ce5138e4fb0732021a5b1ffe18735e4 edit.m: Create new files in edit's HOME path as documented * edit.m: New files without a path component are created in HOME. diff --git a/scripts/miscellaneous/edit.m b/scripts/miscellaneous/edit.m --- a/scripts/miscellaneous/edit.m +++ b/scripts/miscellaneous/edit.m @@ -304,9 +304,17 @@ endif endif + ## If the new file includes a path, take it as given. Otherwise, create + ## the file in HOME and edit it. + idx = rindex (file, filesep); + if (idx != 0) + fileandpath = file; + else + fileandpath = fullfile (FUNCTION.HOME, file); + endif + ## If editing a new file that is neither a m-file or an oct-file, ## just edit it. - fileandpath = file; idx = rindex (file, "."); name = file(1:idx-1); ext = file(idx+1:end);