nedit-ng icon indicating copy to clipboard operation
nedit-ng copied to clipboard

Implement a Save All feature

Open eteran opened this issue 8 years ago • 2 comments

I often do multi-file editing and there is no good solution in nedit for saving all documents quickly. The best I usually can do is to close nedit, and confirm the chain of dialog's that come.

eteran avatar Jan 26 '17 15:01 eteran

Hi,

Here is the macro I have in my .nedit/autoload.nm

define saveAll {
current = $file_path $file_name
filename = focus_window("last")
while (filename != "")
    {
    save_it = $modified
    if ($modified)
    {
    if (search_string($file_name, "^Untitled(?:_\\d+)?$", 0, "regex") == 0)
        {
        if (read_file($file_name) == "" && $read_status == 0)
        {
        # this file doesn't exist and should not (?) be saved
        save_it = 0
        }
        }
    }
    if (save_it)
    {
    raise_window()
    save()
    }

    filename = focus_window("next")
    }
focus_window(current)
raise_window()
}

In the file .nedit/nedit.rc, it is mapped to the key F1.

    saveAll:F1::: {\n\
        saveAll()\n\
    }\n\

If nedit-ng is able to read nedit macros and if it is able to map a macro to a keyboard key, then this could be a workaround as long as it is not implemented in nedit-ng.

Regards.

Xuo.

ericxuo avatar Dec 15 '17 19:12 ericxuo

This definitely should work! (If not I consider it a bug because nedit-ng is supposed to be a drop-in replacement).

I'd like to have this feature built-in natively of course, so that we can handle any corner cases smoothly.

Thanks for the macro!

eteran avatar Dec 15 '17 21:12 eteran