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

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

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


From: Clément Pit--Claudel
Subject: bug#24150: 25.1.50; New command: dired-create-empty-file
Date: Thu, 4 Aug 2016 09:54:11 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

On 2016-08-04 09:25, Tino Calancha wrote:
> Hi all,

Hi Tino,

> It might be useful having a Dired command creating
> an empty file with a name provided by the user; something
> like 'dired-create-directory' ('+') but for files.

Neat idea; that's like `touch', right?

> Following patch propose a new command 'dired-create-empty-file'
> bound to 'M-+'.

I've added comments inline below.

> +@kindex M-+ @r{(Dired)}
> +@findex dired-create-empty-file
> +  The command @kbd{M-+} (@code{dired-create-empty-file}) reads a
> +file name, and creates an empty file with that name.  It signals
> +an error if the file already exists.

Ah, so it's different from touch. Is there already a command in dired that sets 
the access and modification time of a file? If not, maybe this command could do 
it? I'm not sure it's useful to have the command fail if the file exists. If 
you go that, maybe renaming the command to eg dired-touch would be useful? 
Although I see the parallel with dired-create-directory, so maybe it's fine.

>  +++
> +*** A new command 'dired-create-empty-file' similar as
> +'dired-create-directory' but it creates a new empty file;
> +bound to 'M-+'.

I think there's a slight problem with this sentence.  Maybe

*** New command 'dired-create-empty-file' (similar to
'dired-create-directory') creates a new empty file;
bound to 'M-+'.

> +(defmacro dired--create-empty-file-or-directory (fname &optional create-file)
> +  "Create an empty file or directory called FNAME.
> +If FNAME already exists, signal an error.
> +Optional arg CREATE-FILE if non-nil, then create a file.  Otherwise create
> +a directory. "

Do you think this could be a defun instead of a macro? 

> +    (define-key map "\M-+" 'dired-create-empty-file)
Is there a convention on using (kbd "M-+") vs "\M-+"?

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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