By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release.
Bug 1744 - Kate "save all" doesn't save newly created *untouched* empty documents
Summary: Kate "save all" doesn't save newly created *untouched* empty documents
Status: RESOLVED WONTFIX
Alias: None
Product: TDE
Classification: Unclassified
Component: tdebase (show other bugs)
Version: R14.0.0 [Trinity]
Hardware: All Linux
: P5 minor
Assignee: Michele Calgaro
URL:
Depends on:
Blocks:
 
Reported: 2013-11-29 02:59 CST by Michele Calgaro
Modified: 2014-09-21 07:40 CDT (History)
5 users (show)

See Also:
Compiler Version:
TDE Version String:
Application Version:
Application Name:


Attachments
tdebase patch (1.04 KB, patch)
2013-12-05 01:06 CST, Michele Calgaro
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michele Calgaro 2013-11-29 02:59:14 CST
Open Kate, create 2 new documents, click "File -> Save all".
Nothing happens and the files are not saved.
Comment 1 Darrell 2013-11-29 23:56:47 CST
Hmm. I get two file picker dialogs.
Comment 2 Timothy Pearson 2013-11-30 01:44:11 CST
(In reply to comment #0)
> Open Kate, create 2 new documents, click "File -> Save all".
> Nothing happens and the files are not saved.

Are you using the R14 nightly builds?  If so, what platform (Ubuntu or Debian) and version?
Comment 3 Michele Calgaro 2013-11-30 10:16:38 CST
> Are you using the R14 nightly builds?  If so, what platform (Ubuntu or Debian)
> and version?
I build TDE from GIT on Debian/Jessie.

Anyhow I found the problem. 
1) If I just create the file and don't type anything, clicking "File -> Save all" nothing happens.
2) If I create a new document and type something in it, then "File -> Save all" displays a file picker dialog for saving the file.
3) If I create a new document, type something and delete all (so the file is empty again), then clicking "File -> Save all" again displays a file picker dialog for saving the file. This is inconsistent with 1)

In the 'Documents' list, notice that when a new file is created the 'floppy disk' icon indicating 'file modified' is not present. When we type something, the icon appears.

Point 1) and 3) are inconsistent. IMO a newly created document should have the 'floppy disk' icon from the beginning to indicate that its content has not been saved yet (even though the file is empty)
I have updated the bug summary.
Comment 4 Michele Calgaro 2013-11-30 10:18:37 CST
Also notice that clicking "Save" for point 1) does open the file picker dialog.
Comment 5 Darrell 2013-11-30 13:21:02 CST
I'm using the latest GIT.

Perhaps "inconsistent" is perspective. :-)

Item 1 makes sense to me because there have been no actions and the document is not yet "dirty."

Item 3 makes sense to me because, despite deleting all typed text, the document is still "dirty." The document has been touched. How is the software to discern the user's intentions?

Despite opening kate and not typing anything at all and the Save/Save As options still function makes sense to me. Having used personal desktop PCs almost as soon as they were available, I well remember the days when saving the document almost after typing every sentence was a common habit because software crashed a lot back then. Yet even with stable software, that the Save/Save As options are available for a document that is not yet dirty makes sense to me in that many people want to create a document before they start adding content. For example, I save a blank not-dirty document as "project to-do list.txt." I am called away from my computer for several hours. I return. The document is blank. What was I doing? Oh, yes, I was creating a project to-do list.

Being able to save a not-dirty document is kind of like writing "reminder" text on a Post-It note and attaching the note to the side of the computer monitor.
Comment 6 Michele Calgaro 2013-12-05 01:06:03 CST
Created attachment 1700 [details]
tdebase patch

Attached proposed patch. If a file is untitled (new file), it will be saved as well.
Comment 7 Darrell 2013-12-05 09:08:36 CST
I was unsure about this, but I guess the patch works as intended. My doubt was whether kate would require users to save empty non-dirty documents. That is not the case. I created several New documents, did not touch them, and I could quit kate with no problem. Conversely, when I created new documents, or just use the single default blank document, seleting Save All prompts the File Save dialog for each open document. That is really no different than selecting Save or Save As with a new non-dirty document.

One observation is Save All is enabled even when first opening kate and the only open document is the default blank document. Not a big deal, but seems to me Save All should not appear until at least two documents have been open.
Comment 8 Michele Calgaro 2013-12-05 21:21:40 CST
>That is really no different than selecting Save or Save As with a new non-dirty >document.
Correct, before "Save" would save a new non-dirty document while "Save all" wouldn't. IMO this was a little weird, so the patch make both actions behave similarly.

> One observation is Save All is enabled even when first opening kate and the
> only open document is the default blank document. Not a big deal, but seems to
> me Save All should not appear until at least two documents have been open.
At first I agreed with you, but on second thought we can think of "save all" as "save whatever document is open", which includes also the case there is only one document open.
All this is unrelated to this patch and anyhow I think it's not a big deal overall, IMO.
Comment 9 Slávek Banko 2013-12-12 13:03:57 CST
I hesitate above sense.

Existing code corresponds to "Save all documents that need it." I understand the meaning of this items in this way - and it seems logical to me. The new code introduces an exemption for documents that not need to be saved (are empty, untouched).

In contrast, item Save mean "Save regardless of whether it needs for the document." In this sense, the behavior will be differed again. For existing unchanged documents will SaveAll do nothing => file remains unchanged, while Save will rewrite document => file is updated (backup file may be created).

Personally, I am inclined to keep the current behavior.
Comment 10 Michele Calgaro 2013-12-12 22:49:37 CST
> Personally, I am inclined to keep the current behavior.
I am ok if you (and I think also Darrell) prefer to keep the existing behavior, I will just use the patch locally when I build.

My point of view is different: IMO SaveAll is just a shortcut to avoid having to click Save on each single document and so the behavior of Save and SaveAll should be the same. In such regard, also Save should be modified so that it only saves a document if it has been modified or if it is new. Just my 2 cents
Comment 11 Darrell 2013-12-12 23:43:24 CST
I see both sides of the argument. I'm fine with either.
Comment 12 Michele Calgaro 2013-12-14 23:15:30 CST
How about we had an option in Configure Kate -> Editor -> Open/Save to allow the user to choose is favorite behavior?
For example: "Save All behavior" group box and inside it a "Save All also saves new untouched files" option?
Comment 13 Darrell 2013-12-15 10:42:29 CST
Letting the user decide is always a good answer. :-)
Comment 14 Slávek Banko 2013-12-15 11:32:15 CST
Yes, add configuration option is good solution.

However, it is questionable whether the option should be "Save All Also saves new untouched files" or "Save All saves also unmodified documents".

Configuration option could be added to tab Application / Common / Behaviour.
Comment 15 Michele Calgaro 2013-12-17 19:06:27 CST
> However, it is questionable whether the option should be "Save All Also saves
> new untouched files" or "Save All saves also unmodified documents".

Ok, I will add a config option.

IMO both Save and SaveAll should only save a file if
1) it has been modified or
2) it is a new file and it has not yet been saved to disk (regardless of its content, if any)

Forcing to save unmodified files creates unnecessary additional disk/network operations.

The original patch (even though missing the config option) makes SaveAll works as described.

If you also agree, after adding the config option for SaveAll, I can work on a second patch to make Save works as described as well. At the moment Save force the file to be saved even if it has not been modified (don't know if this is a bug or intentional).


> Configuration option could be added to tab Application / Common / Behaviour.

As for the config option location, initially I also thought about this location, but after I saw that under Editor there is a specific Open/Save section, I think it is more consistent to add the option there. Anyhow I can put it in Application / Common / Behaviour if you think is better
Comment 16 Slávek Banko 2013-12-22 12:53:05 CST
Truth be told - I still can not find the reason why force to save unmodified empty documents.

Therefore, for me, I saw it to three options:
1) On Save save regardless of whether it is necessary (default on)
2) On Save All save regardless of whether it is necessary (default off)
3) Empty untouched documents allways regarded as modified (default off)
Comment 17 Michele Calgaro 2013-12-23 07:39:44 CST
> Truth be told - I still can not find the reason why force to save unmodified
> empty documents.
> Therefore, for me, I saw it to three options:
> 1) On Save save regardless of whether it is necessary (default on)
> 2) On Save All save regardless of whether it is necessary (default off)
> 3) Empty untouched documents allways regarded as modified (default off)

Slavek, if you want let's close this bug without further actions. I keep the patch local to my environment. No problem at all :)

Otherwise, with regard to the list of options that you proposed, the patch that I have already submitted is equivalent to option 3). If a file is unnamed it will be saved, which is basically saying that an empty untouched document is regarded as modified.

I am fine with whatever decision you make.
Comment 18 Michele Calgaro 2014-09-21 07:40:23 CDT
After long thinking about this bug, I think the current software is fine as it is. No need for patches or additional user options.
I am closing the bug. I leave the patch mark as non-obsolete for reference only.