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: Tue, 31 Jul 2018 19:20:52 +0300

> From: Tino Calancha <address@hidden>
> Cc: address@hidden,  address@hidden,  address@hidden,  address@hidden,  
> address@hidden,  address@hidden
> Date: Tue, 31 Jul 2018 13:47:30 +0900
> 
> >> +(defun dired--find-topmost-parent-dir (filename)
> >> +  "Return the topmost nonexistent parent dir of FILENAME.
> >> +FILENAME is a full file name."
> >> +  (let ((try filename) new)
> >> +    (while (and try (not (file-exists-p try)) (not (equal new try)))
> >> +      (setq new try
> >> +      try (directory-file-name (file-name-directory try))))
> >> +    new))
> >
> > What is the purpose of using this function in dired-create-empty-file?
> Same as in `dired-create-directory': to update the new entry in the Dired 
> buffer.
> I have extracted `dired--find-topmost-parent-dir' from 
> `dired-create-directory'
> to be DRY.
> > What you do with the result of this function doesn't seem to be
> > reflected in the doc string of dired-create-empty-file.
> That's because `dired--find-topmost-parent-dir' is an internal function
> (prefixed with 'dired--').  I don't think we need to detail in the docstring
> what callers can do with the return value.  Even not having a docstring could
> be OK: users don't need to know about this function.

No, that's not what I meant.  I meant to say that if we call
dired--find-topmost-parent-dir to update the new entry in the Dired
buffer, then the doc string of dired-create-empty-file should say that
it does so.  Right now, the doc string says just this:

  Create an empty file called FILE.

It says nothing about Dired entries.

> I have added the following comment:
> +;; We use this function in `dired-create-directory' and
> +;; `dired-create-empty-file'; the return value is the new entry
> +;; in the updated Dired buffer.

That's fine.  But my comment was about the doc string of
dired-create-empty-file.

Otherwise, this LGTM, thanks.





reply via email to

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