Bug 315261 - Kate shouldn't report error for newly created files
Summary: Kate shouldn't report error for newly created files
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 316370 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-02-16 10:04 UTC by Aaron Lewis
Modified: 2013-04-11 08:30 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.10.3


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Lewis 2013-02-16 10:04:49 UTC
I have a file to create, instead of doing this in kate, 

I run `kate file`

And kate reports an error (the close-able dialog on top of editor widget), saying the file could not be loaded, but it's a writable folder, I can save the file with CTRL + S, it's all good, just the message shouldn't be there ;-P

Reproducible: Always
Comment 1 Christoph Cullmann 2013-04-01 15:36:11 UTC
*** Bug 316370 has been marked as a duplicate of this bug. ***
Comment 2 Albert Astals Cid 2013-04-01 21:44:28 UTC
Answering the question you made me in 316370

Did you ask for any reason i should see an error when i create a new file? What is the use case?
Does any other file editor do that?
I've tried all the editors i have installed in my machine and noone of them gives me an error when creating a file from the command line. The only one that gives some info is vi that says "New file" in the status bar.

And no, i wouldn't be fine with it going away when doing Ctrl+S, i see why i should be warned that i file i specifically asked to be created does not exist with a big fat ugly error message.

I'll put it in a different way, What is the correct way (one that does not give me an error) of creating files now using kate? touch foo && kate foo?
Comment 3 Albert Astals Cid 2013-04-01 21:45:25 UTC
"i see why i should be warned " -> "i don't see why i should be warned "

Sorry :_/
Comment 4 Christoph Cullmann 2013-04-02 06:30:39 UTC
No problem ;)
In deed, you are right.
The issue was more or less: sometimes, if you load remote files, kio can't get them and we got called with non-existing temp file (I guess there are still some places where we need to handle kio errors better in katedocument, anyway).
Still, if the url is local anyway, we just skip the warning, if the file is non-existant!
I will implement that now.
Comment 5 Christoph Cullmann 2013-04-02 06:35:19 UTC
Git commit 42b281a7ab4e26d3f32a431fe3ede18a23f2685f by Christoph Cullmann.
Committed on 02/04/2013 at 08:31.
Pushed by cullmann into branch 'master'.

skip the "can't open file" error message, if the file is

1) a local file
2) it just doesn't exit

this avoids error messages for the usual case like

kate <somenewfile.txt>

on the command line or file dialog.

Still you will get errors if just permissions are not ok for file open
or if some kio problems arises with remote urls

if somebody likes to do so, I guess this could be even backported

M  +1    -7    part/buffer/katetextbuffer.cpp
M  +26   -0    part/document/katebuffer.cpp

http://commits.kde.org/kate/42b281a7ab4e26d3f32a431fe3ede18a23f2685f
Comment 6 Kåre Särs 2013-04-02 08:18:57 UTC
Hi,

I'm not sure if I should open a different bug or not...

This change means that if we open a session that contains files that have been removed we get no warning about the missing files...
Comment 7 Christoph Cullmann 2013-04-02 08:32:21 UTC
Hmm, yes, that is true :/
The problem is, the KatePart does the warning, if we want such a warning in that case, I guess Kate Application should warn?
Comment 8 Kåre Särs 2013-04-02 09:02:59 UTC
Yep,

Maybe the session loader should check and do the warning...
Comment 9 Albert Astals Cid 2013-04-02 17:44:54 UTC
To be honest i think Kåre's bug is a different one from this. If the session loader should check that all the files it is opening as part of a session still exist or not, this is part of the session loader logic, and has nothing to do with plain opening of files (IMHO) so I'd suggest marking this again as resolved and opening a new one to track the session loader behaviour (and add tests for both ;-))
Comment 10 Christoph Cullmann 2013-04-11 07:39:49 UTC
Git commit 744185e20a6562d644652b4804daa8397e0db635 by Christoph Cullmann.
Committed on 02/04/2013 at 08:31.
Pushed by cullmann into branch 'KDE/4.10'.

skip the "can't open file" error message, if the file is

1) a local file
2) it just doesn't exit

this avoids error messages for the usual case like

kate <somenewfile.txt>

on the command line or file dialog.

Still you will get errors if just permissions are not ok for file open
or if some kio problems arises with remote urls

if somebody likes to do so, I guess this could be even backported

M  +1    -7    part/buffer/katetextbuffer.cpp
M  +26   -0    part/document/katebuffer.cpp

http://commits.kde.org/kate/744185e20a6562d644652b4804daa8397e0db635
Comment 11 Dominik Haumann 2013-04-11 07:48:48 UTC
According to Kåre this means that we now should show a warning in Kate's session manager. If you agree, we should open a new report for that, right?
Comment 12 Christoph Cullmann 2013-04-11 08:30:39 UTC
Yep, would be ok with that ;)