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

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

bug#56229: title: add a function to move a file from one place to anothe


From: Zachary Kanfer
Subject: bug#56229: title: add a function to move a file from one place to another
Date: Mon, 27 Jun 2022 23:24:29 -0400

> > +** New command 'move-file'.
> > +This command moves a file to a new location.

> Should be updated.

+1

> > +  (let ((old-location (buffer-file-name)))
> > +    (write-file new-location t)
> > +    (when (and old-location
> > +               (file-exists-p new-location))
> > +      (delete-file old-location))))
>
> Probably want to check whether old-location exists?

I was checking whether the new locations exists to ensure the write succeeded. If the write fails, I think we should leave the old file in place.

#'delete-file does not error when given a nonexistent location, but I suppose it could do so in the future. So I don't think we *need* to check whether old-location exists, but it's certainly safer to do so. I'll add it!

Attached is a patch with the changes.

> Anyway, apparently there's something up with the copyright
> assignment/disclaimer?  Your entry in the file says "**NEEDS New
> DISCLAIMER**" -- do you know what that's about?

I had moved jobs, and was attempting to get my new company to sign the disclaimer. (My manager had not wanted it to get signed). I've since changed teams inside the company, and got the disclaimer signed. After sending the signed disclaimer a week or two ago, Craig Topham confirmed I was good to go -- perhaps something didn't get updated here?

On Mon, Jun 27, 2022 at 3:55 AM Lars Ingebrigtsen <larsi@gnus.org> wrote:
Zachary Kanfer <zkanfer@gmail.com> writes:

>  I think `rename-visited-file' would fit in better especially since we
>  already have `rename-file'; it also parallels dired's R command.

Thanks.  A couple of things:

[...]

> +** New command 'move-file'.
> +This command moves a file to a new location.

Should be updated.


[...]

> +  (let ((old-location (buffer-file-name)))
> +    (write-file new-location t)
> +    (when (and old-location
> +               (file-exists-p new-location))
> +      (delete-file old-location))))

Probably want to check whether old-location exists?

Anyway, apparently there's something up with the copyright
assignment/disclaimer?  Your entry in the file says "**NEEDS New
DISCLAIMER**" -- do you know what that's about?

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

Attachment: 0001-Add-a-function-to-rename-the-file-visited-by-the-cur.patch
Description: Source code patch


reply via email to

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