unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Zachary Kanfer <zkanfer@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 56229@debbugs.gnu.org, Visuwesh <visuweshm@gmail.com>
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	[thread overview]
Message-ID: <CAFXT+RO5-Be_sVz3GarYLvfQduVDqJEY2vjdamwqbJ_Vh1iPyw@mail.gmail.com> (raw)
In-Reply-To: <87ilom8rrh.fsf@gnus.org>


[-- Attachment #1.1: Type: text/plain, Size: 2299 bytes --]

> > +** 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 #1.2: Type: text/html, Size: 3298 bytes --]

[-- Attachment #2: 0001-Add-a-function-to-rename-the-file-visited-by-the-cur.patch --]
[-- Type: application/x-patch, Size: 2156 bytes --]

  reply	other threads:[~2022-06-28  3:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-26  4:49 bug#56229: title: add a function to move a file from one place to another Zachary Kanfer
2022-06-26 14:50 ` Lars Ingebrigtsen
2022-06-26 15:16   ` Zachary Kanfer
2022-06-26 15:31     ` Lars Ingebrigtsen
2022-06-26 15:41       ` Visuwesh
2022-06-27  4:42         ` Zachary Kanfer
2022-06-27  7:55           ` Lars Ingebrigtsen
2022-06-28  3:24             ` Zachary Kanfer [this message]
2022-06-28 11:10               ` Eli Zaretskii
2022-06-28  3:24             ` Richard Stallman
2022-06-28  4:23               ` Zachary Kanfer
2022-06-28 12:15                 ` Lars Ingebrigtsen
2022-06-29  1:17                   ` Zachary Kanfer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFXT+RO5-Be_sVz3GarYLvfQduVDqJEY2vjdamwqbJ_Vh1iPyw@mail.gmail.com \
    --to=zkanfer@gmail.com \
    --cc=56229@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=visuweshm@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).