I find this helpful when replicating documents since you wouldn't have to browse through the original directory when renaming the document when it's untitled. You also get to have a pattern from the original filename. It becomes very convenient along with in-place renaming.
I'm happy with how it is but perhaps people would want it to be configurable so that it can be disabled, or given with a different naming format. The latter wouldn't sound easy though.
Reasons for choosing `.copy-xx:`
- Lowercase because it's less noisy. - A dash to make it more distinguishable with the numbers. - 2 digits because it's good enough. 1-digit is a little conservative. 3-digits is overkill. - Prefixed with '.copy' because `.xx` files could exist and could confuse the user; and '.copy' over '.clone' because it's shorter, and it's also common among some file managers, I think.
You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/1191
-- Commit Summary --
* Give '.copy-xx' filenames to cloned documents * Do not set cloned documents as readonly
-- File Changes --
M src/document.c (36)
-- Patch Links --
https://github.com/geany/geany/pull/1191.patch https://github.com/geany/geany/pull/1191.diff
@konsolebox pushed 2 commits.
9dc463e g_free(new_filename); 0c86099 Usa another gchar* parameter and simplify it a bit
My filemanager names copies you paste in the same directory as "filename(copy).ext" "filename(another copy).ext" "filename(3rd copy).ext" and there I got too bored to see what it did at 10 :)
I'm not sure this is really enough of a problem to need code added for it, do a lot of users clone files all the time? Just not sure it is needed.
Two comments on the implementation:
1) it is touching the filesystem to check the existence of the selected filename, which is fine if its a fast local SSD, but not so much for a remote SSHFS directory.
2) AFAICT it also changes the readonly behaviour, please do not include extra things in an implementation not described in the PR.
PS and extra :)
3) probably needs user documentation :)
@konsolebox pushed 2 commits.
b59ad1c Revert "Do not set cloned documents as readonly" 5721731 Add documentation
My filemanager names copies you paste in the same directory as "filename(copy).ext" "filename(another copy).ext" "filename(3rd copy).ext" and there I got too bored to see what it did at 10 :)
It's all about making cloning of documents easier and faster.
I'm not sure this is really enough of a problem to need code added for it, do a lot of users clone files all the time?
I do. Most of the time, when creating versions, or using a document as a template for another, and also when creating temporary copies; one of the reasons is to differentiate versions among branches in git, or just use as reference for copying code; another is simply for immediate backup.
This is pretty much very helpful to developers, especially if combined with in-place renaming.
- it is touching the filesystem to check the existence of the selected filename, which is fine if its a fast local SSD, but not so much for a remote SSHFS directory.
I'm not sure if that's a concern with a one-time command. The loop may run up to 99 but it would never always go that far. `g_file_test()` is also pretty much commonly used around Geany.
An option to disable this can be added if that's really a concern.
- AFAICT it also changes the readonly behaviour, please do not include extra things in an implementation not described in the PR.
Ok, reverted.
- probably needs user documentation :)
Done.
@konsolebox pushed 1 commit.
edf267b Revert "Do not set cloned documents as readonly" for good
It turns out I like `.clone[X]` better since it's simpler and more "intuitive" with respect to the command. I was so concerned with *uniformity*, but it's not really necessary if you're just cloning documents. Something natural is better in this case.
Please merge [this](https://github.com/konsolebox/geany/tree/clone_filename_v2) instead if this feature is wanted.
If you want to propose an alternative implementation please make it a PR so it will get tested by Travis. Thats the first line of review.
@konsolebox pushed 1 commit.
aa14bbc Use locale-encoded string when testing if file exists
I'm done creating the other PR. Please consider closing this, thanks.
@konsolebox as the originator you should be able to close the PR.
Closed #1191.
@elextr I guess that means this version really isn't wanted. Ok I'll close this.
@konsolebox sorry I read your post as saying you didn't want to proceed with this PR because you had a new implementation instead. If you think its a choice between the two just re-open and say so.
@elextr It's ok. It's better closed anyway.
github-comments@lists.geany.org