bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#24150: 26.0.50; New command: dired-create-empty-file


From: Eli Zaretskii
Subject: bug#24150: 26.0.50; New command: dired-create-empty-file
Date: Mon, 03 Jul 2017 17:24:35 +0300

> From: Tino Calancha <address@hidden>
> Date: Mon, 03 Jul 2017 13:51:25 +0900
> Cc: Ted Zlatanov <address@hidden>, address@hidden,
>       Clément Pit--Claudel <address@hidden>,
>       Leo Liu <address@hidden>
> 
> After i found the following threads:
> 
> https://stackoverflow.com/questions/20300137/how-to-create-new-file-from-dired-mode
> https://stackoverflow.com/questions/2592095/how-do-i-create-an-empty-file-in-emacs
> 
> and considering the significant number of views they have, i'd like to
> reopen this issue.
> 
> 1. In my config i've bound the new command to 'M-+'.
> 
> 2. In the threads above they suggest the keybindings 'c' and '_'.
> 
> 'c' is already bound to `dired-do-compress-to', so i propose to bind
> the new command to '_' (unless you have a better proposal).
> 
> If there are no objections, i would like to apply the following patch
> in a few days:

Thanks for working on this, Tino.

I have a few concerns that I'd like to raise before we agree on adding
this.

First, I think this might be mixing two separate requests: one is the
desire to start a new file from Dired, the other is to create an empty
file on disk.  I think these should be kept separate because they
serve 2 different needs; in particular, the latter is not related to
Dired in any way.

I have no issues with adding a Dired keybinding that would call
find-file without much ado.  I'm not sure whether it should be bound
to M-+ or to "C-u +", but I will defer to opinions of others on that.

But I don't think M-+ or whatever we bind that command to should
actually _create_ an empty file on disk.  This is not how Emacs works
with files; "C-x C-f" will not create a file until you save the
buffer.  That "+" actually creates a directory is IMO an exception
rather than the rule: nothing else makes sense with directories, since
users cannot type directory contents into a buffer and then save it,
at least not easily.

I do recognize a possible need for a function, or maybe even a
command, to create an empty disk file.  AFAIK, we don't have such a
function, although it's not hard to write.  But I think the use cases
for such a command are quite rare and niche cases, so I think we
shouldn't have a keybinding for it, not even in Dired.  Let users who
need this command frequently bind it to a key; with time, if it turns
out I'm wrong and these use cases are much more frequent, we can
decide on providing a binding by default.

So, to summarize my POV: (a) it's okay to add a Dired keybinding for
find-file; (b) let's add a command with no binding for creating an
empty file.

Thanks.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]