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 1680

Summary: [Regression] Kate does not add newly created documents to the MRU list
Product: TDE Reporter: Darrell <darrella>
Component: tdebaseAssignee: Michele Calgaro <michele.calgaro>
Status: RESOLVED FIXED    
Severity: normal CC: bugwatch, darrella, michele.calgaro, slavek.banko
Priority: P5    
Version: R14.0.0 [Trinity]   
Hardware: Other   
OS: Linux   
Compiler Version: TDE Version String:
Application Version: Application Name:
Attachments: tdebase patch for Kate MRU

Description Darrell 2013-10-16 14:30:29 CDT
Start Kate. Create and save a new text document. Close the document.

Immediately check the MRU list. The document was not added.

Close and open kate and again verify the document is not in the MRU list.
Comment 1 Michele Calgaro 2013-11-27 05:47:40 CST
Darrell,
I see a similar problem with existing documents. 
Open a file, the file in included in the MRU correctly. 
Close the file, exit and re launch Kate. The file is not in the MRU anymore.

Can you confirm this in your system as well?
Comment 2 Darrell 2013-11-27 10:07:55 CST
>Can you confirm this in your system as well?
I can't confirm. Works here. :-) Have you tried purging the MRU? I believe two files are involved: $TDEHOME/share/apps/kate/metainfos and $TDEHOME/share/config/katerc ([Recentfiles]). I use kedit or a console editor to purge kate rc files.
Comment 3 Michele Calgaro 2013-11-28 01:48:04 CST
After a lot of testing I think I found the problem.
Whenever a kate plugin is enabled, the MRU is not correctly saved and restored when closing and launching Kate again.
If all plugins are disabled, everything works fine.

Most likely these is due to inconsistencies between the installed version of tdebase and tdeaddons on my system. I usually do a full rebuild once every month or two, but in the meanwhile I also do single package rebuild and reinstall when testing patches. As of today, tdeaddons is about 1 months older than tdebase, so probably this creates the problem. 
When I have enough time I will rebuild tdelibs, tdebase and tdeaddons and check if the problem disappeard.
Comment 4 Michele Calgaro 2013-11-28 01:52:20 CST
Darrell,
I don't think there is an obvious way for the user to clear the MRU (or if there is, I missed that). Can you confirm that? If so, I suggest we open a new bug report for adding a "clear MRU" button in Configure Kate -> General -> Behavior.
What do you think?
Comment 5 Michele Calgaro 2013-11-28 08:22:21 CST
> After a lot of testing I think I found the problem.
> Whenever a kate plugin is enabled, the MRU is not correctly saved and restored
> when closing and launching Kate again.
> If all plugins are disabled, everything works fine.
> Most likely these is due to inconsistencies between the installed version of

Darrell, I rebuild tdelibs, tdebase, tdeutils and tdeaddons (but I skipped some of the packages I usually build in between) and I still observe the same problem/behavior.
I still believe that the problem is due to inconsistencies in different version of what I have install, but I would appreciate if you could let me know if you use any kate plugin at all.
If not, could you also try to enable one plugin and see if your MRU is still updated correctly when you exit and reenter Kate? 
Thanks :)
Comment 6 Darrell 2013-11-28 12:08:44 CST
I have no plugins enabled and the MRU doesn't update. Another way to have test would be to remove the tdeaddons package.

Regarding a GUI method for clearing the MRU, there is an indirect method: set the MRU number to zero (Settings->General->Behavior).

I used that exact method to verify this bug report:

* I set the number of MRU files to zero
* Closed kate
* Opened kate
* Created and saved a new text file
* The MRU does not update (remains empty)
Comment 7 Michele Calgaro 2013-11-28 19:27:34 CST
> I have no plugins enabled and the MRU doesn't update. Another way to have test
> would be to remove the tdeaddons package.
I am confused now... Wasn't your MRU updating correctly when you open an existing file? My understanding was that you only had problems with newly created files. Correct?

What I am also trying to understand is if there is a second bug. Does enabling Kate plugins stop the MRU to be updated correctly when opening an existing file? Or put it in another way: is the problem I see on my computer a real problem or is it only due to different versions of some packages? I start to doubt the second, since I have recompiled almost all and I still see this happening.
Could you enable one plugin (for example the tabbarextension) and do a quick test as follow:
1) enable plugin. exit and relaunch Kate
2) open and close an existing file
3) exit and relaunch Kate. Has the MRU been updated correctly or not?

On my system:
1) no plugins enabled -> MRU updates correctly when opening existing files 
2) any plugin enabled -> MRU does not updates correctly when opening existing files 

Perhaps in previous posts I didn't explain very clearly.
After I can make this clear, I will work on this bug :)
Comment 8 Darrell 2013-11-28 20:03:21 CST
>My understanding was that you only had problems with newly created files.
>Correct?
Correct.

>What I am also trying to understand is if there is a second bug. Does enabling
>Kate plugins stop the MRU to be updated correctly when opening an existing
>file?
Oh, I see. I misunderstood you that you thought plugins were causing the original problem. Now that I understand, yes, there seems to be a second bug. I fiddled with this for a while. Seems that enabling a plugin causes kate to forget the most recent file.

We have two distinct bugs.

I'm updating the bug report summary.
Comment 9 Michele Calgaro 2013-11-29 00:19:36 CST
> We have two distinct bugs.
> I'm updating the bug report summary.

I think it is better to have to separate bug reports since they are different problems.
I have filed bug 1743 for the plugin problem.
Comment 10 Michele Calgaro 2013-11-29 06:25:34 CST
Half way through this patch, but probably won't be able to work on this during the weekend :(
Comment 11 Michele Calgaro 2013-12-04 03:50:31 CST
Created attachment 1698 [details]
tdebase patch for Kate MRU

After almost completing a first version of a patch, I found a much better and cleaner way to fix this bug (as you can see this patch is very small). Please test.
Comment 12 Darrell 2013-12-04 09:58:44 CST
> Please test.
Yay!! New files are added immediately to the MRU and survive a restart of kate.

Good job!
Comment 13 Slávek Banko 2013-12-04 16:13:51 CST
Pushed to GIT in hash b88d1a9c.
Comment 14 Michele Calgaro 2013-12-04 20:43:46 CST
> Yay!! New files are added immediately to the MRU and survive a restart of kate.
To be precise, files are added any time they are saved with a new name, so either when a new file is saved or an existing file is saved with a different name.