Suggestion for "File not found" dialog

Paterline, David L. paterldl at westinghouse.com
Mon Jan 7 22:16:37 CET 2008


Tim Hubberstey wrote:

> Since I can't imagine that this is a common problem for very many
users, 
> the obvious solution is to create a macro something like:
> <snip>

While this is an interesting macro, my problem with the existing
behavior is that it happens automatically - when focus returns to a
window where you are editing a file which has been deleted externally -
rather than happening in response to some editing/file management action
the user initiates. 

Therefore, the user has to react to NEdit's behavior in order to
continue, and when you wish to close the file, NEdit forces you to go
through the "Save?" dialog.

My wish is that when NEdit notices the file no longer exists on disk, an
option to close the file immediately be available from the "File not
found" dialog.

Thanks.

-
David L. Paterline
Principal Engineer       
Westinghouse Electric Company
Nuclear Fuel Engineering
Engineering Computing
paterldl at westinghouse.com   
PH: 412-374-2286
FX: 412-374-2284


-----Original Message-----
From: discuss-bounces at nedit.org [mailto:discuss-bounces at nedit.org] On
Behalf Of Tim Hubberstey
Sent: Monday, January 07, 2008 3:15 PM
To: General NEdit discussion list
Subject: Re: Suggestion for "File not found" dialog

On 2008-01-07 08:28, Paterline, David L. wrote:
> Hello all -
> 
> I find this to be a minor irritant which could probably be made better
-
> when editing a file which has been deleted from disk externally, NEdit
> pops up the "File not found" dialog, which provides the user options
to
> "Re-Save", "Save As", or "Cancel". 
> 
> If you are no longer interested in the file, it would be nice to have
an
> option in this dialog to "Close" the file. As it is, you have to
select
> "Cancel", and then close the file, whereupon you are prompted to "Save
> ... before closing?". Of course, then you select "No", and the file is
> closed.
> 
> It would be nice if the "File not found" dialog would allow an option
to
> "Close" the file immediately.
> 
> Thanks all.

Since I can't imagine that this is a common problem for very many users,

the obvious solution is to create a macro something like:

------
define save_if_exists {
   if ( $modified )
   {
     # No "File Status" macro command so use the (Bourne) shell to test
     #   if file still exists using "[ -e filename ]"
     shell_command( "[", " -e "$file_path$file_name" ]" )

     if ( $shell_cmd_status == 1 )
     {
       # file no longer exists

       ...ask_what_to_do...

       ...and_then_do_it(probably_one_of)...
       # close( "nosave" )
       # save()
       # save_as( filename )
       # save_as_dialog()
     }
     else
     {
       # Save the current changes to the file
       save()
     }
   }
------

You can fill in the details of what actions you want to take if the file

doesn't exist. Note that this is UNTESTED so I don't guarantee anything!

If you want to make this transparent, un-bind the Ctrl+S key using your 
.Xdefaults (or whatever it's called on your system) and then bind this 
macro to Ctrl+S.

PS: As a side note to the developers, a macro command to "stat" a file 
would be nice since the shell_command method is slow and not very
portable.
-- 
NEdit Discuss mailing list - Discuss at nedit.org
http://www.nedit.org/mailman/listinfo/discuss


More information about the Discuss mailing list