* bug#18009: 24.4.50; Add hooks for `rename-file' and `delete-file'
@ 2014-07-12 22:31 Drew Adams
2014-07-12 22:39 ` Drew Adams
` (2 more replies)
0 siblings, 3 replies; 15+ messages in thread
From: Drew Adams @ 2014-07-12 22:31 UTC (permalink / raw)
To: 18009
Please add a hook for each of these basic operations. It is not unusual
to want to be able to carry out some action associated with
(successfully) renaming or deleting a file. The hooks would be run at
the end of the operation, and only upon success.
One use case: Bookmark+ autofile bookmarks have the same name as their
files. (There can be multiple bookmarks with the same name,
corresponding to files with the same name in different directories.)
With a hook it would be trivial to automatically rename or delete the
associated bookmark.
Adding hooks for these two functions would automatically take care of
derivative functions, such as `dired-rename-file' and `dired-do-rename'.
In GNU Emacs 24.4.50.1 (i686-pc-mingw32)
of 2014-06-28 on ODIEONE
Bzr revision: 117431 rgm@gnu.org-20140628015517-eku6hj8mpgcvfnso
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --prefix=/c/Devel/emacs/snapshot/trunk
--enable-checking=yes,glyphs 'CFLAGS=-O0 -g3'
LDFLAGS=-Lc:/Devel/emacs/lib 'CPPFLAGS=-DGC_MCHECK=1
-Ic:/Devel/emacs/include''
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#18009: 24.4.50; Add hooks for `rename-file' and `delete-file'
2014-07-12 22:31 bug#18009: 24.4.50; Add hooks for `rename-file' and `delete-file' Drew Adams
@ 2014-07-12 22:39 ` Drew Adams
2014-07-13 1:35 ` Glenn Morris
2014-07-13 8:13 ` Andreas Schwab
2014-07-19 2:34 ` Stefan Monnier
2 siblings, 1 reply; 15+ messages in thread
From: Drew Adams @ 2014-07-12 22:39 UTC (permalink / raw)
To: 18009
> One use case: Bookmark+ autofile bookmarks have the same name as their
> files. (There can be multiple bookmarks with the same name,
> corresponding to files with the same name in different directories.)
> With a hook it would be trivial to automatically rename or delete the
> associated bookmark.
Besides that use case, which is specific to Bookmark+, it could be
useful to (optionally) automatically relocate any (i.e. vanilla)
bookmarks whose files were renamed. Currently, such relocation is
entirely manual (command `bookmark-relocate').
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#18009: 24.4.50; Add hooks for `rename-file' and `delete-file'
2014-07-12 22:39 ` Drew Adams
@ 2014-07-13 1:35 ` Glenn Morris
2014-07-13 2:32 ` Drew Adams
0 siblings, 1 reply; 15+ messages in thread
From: Glenn Morris @ 2014-07-13 1:35 UTC (permalink / raw)
To: 18009
You can use advice.
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#18009: 24.4.50; Add hooks for `rename-file' and `delete-file'
2014-07-13 1:35 ` Glenn Morris
@ 2014-07-13 2:32 ` Drew Adams
0 siblings, 0 replies; 15+ messages in thread
From: Drew Adams @ 2014-07-13 2:32 UTC (permalink / raw)
To: Glenn Morris, 18009
> You can use advice.
I can. I nevertheless request the enhancement. For Elisp users generally.
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#18009: 24.4.50; Add hooks for `rename-file' and `delete-file'
2014-07-12 22:31 bug#18009: 24.4.50; Add hooks for `rename-file' and `delete-file' Drew Adams
2014-07-12 22:39 ` Drew Adams
@ 2014-07-13 8:13 ` Andreas Schwab
2014-07-13 9:21 ` Michael Albinus
2014-07-19 2:34 ` Stefan Monnier
2 siblings, 1 reply; 15+ messages in thread
From: Andreas Schwab @ 2014-07-13 8:13 UTC (permalink / raw)
To: Drew Adams; +Cc: 18009
Drew Adams <drew.adams@oracle.com> writes:
> Please add a hook for each of these basic operations.
There's already the rename-file and delete-file file name handlers.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#18009: 24.4.50; Add hooks for `rename-file' and `delete-file'
2014-07-13 8:13 ` Andreas Schwab
@ 2014-07-13 9:21 ` Michael Albinus
2014-07-13 9:26 ` Andreas Schwab
0 siblings, 1 reply; 15+ messages in thread
From: Michael Albinus @ 2014-07-13 9:21 UTC (permalink / raw)
To: Andreas Schwab; +Cc: 18009
Andreas Schwab <schwab@linux-m68k.org> writes:
> Drew Adams <drew.adams@oracle.com> writes:
>
>> Please add a hook for each of these basic operations.
>
> There's already the rename-file and delete-file file name handlers.
That's different. Drew does not want to replace rename-file and
delete-file implementations. He wants to run something afterwards.
> Andreas.
Best regards, Michael.
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#18009: 24.4.50; Add hooks for `rename-file' and `delete-file'
2014-07-13 9:21 ` Michael Albinus
@ 2014-07-13 9:26 ` Andreas Schwab
2014-07-13 9:32 ` Michael Albinus
0 siblings, 1 reply; 15+ messages in thread
From: Andreas Schwab @ 2014-07-13 9:26 UTC (permalink / raw)
To: Michael Albinus; +Cc: 18009
Michael Albinus <michael.albinus@gmx.de> writes:
> Andreas Schwab <schwab@linux-m68k.org> writes:
>
>> Drew Adams <drew.adams@oracle.com> writes:
>>
>>> Please add a hook for each of these basic operations.
>>
>> There's already the rename-file and delete-file file name handlers.
>
> That's different. Drew does not want to replace rename-file and
> delete-file implementations. He wants to run something afterwards.
You can do that with file name handlers.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#18009: 24.4.50; Add hooks for `rename-file' and `delete-file'
2014-07-13 9:26 ` Andreas Schwab
@ 2014-07-13 9:32 ` Michael Albinus
2014-07-13 9:38 ` Andreas Schwab
0 siblings, 1 reply; 15+ messages in thread
From: Michael Albinus @ 2014-07-13 9:32 UTC (permalink / raw)
To: Andreas Schwab; +Cc: 18009
Andreas Schwab <schwab@linux-m68k.org> writes:
>>>> Please add a hook for each of these basic operations.
>>>
>>> There's already the rename-file and delete-file file name handlers.
>>
>> That's different. Drew does not want to replace rename-file and
>> delete-file implementations. He wants to run something afterwards.
>
> You can do that with file name handlers.
I'll still don't understand. File name handlers are intended to provide
a *different* implementation. Drew hasn't asked for this.
And even if he goes this way, he would loose existing file name
handlers, for example from Tramp.
> Andreas.
Best regards, Michael.
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#18009: 24.4.50; Add hooks for `rename-file' and `delete-file'
2014-07-13 9:32 ` Michael Albinus
@ 2014-07-13 9:38 ` Andreas Schwab
2014-07-13 9:46 ` Michael Albinus
0 siblings, 1 reply; 15+ messages in thread
From: Andreas Schwab @ 2014-07-13 9:38 UTC (permalink / raw)
To: Michael Albinus; +Cc: 18009
Michael Albinus <michael.albinus@gmx.de> writes:
> I'll still don't understand. File name handlers are intended to provide
> a *different* implementation.
Are they?
> And even if he goes this way, he would loose existing file name
> handlers, for example from Tramp.
There is not necessarily the case.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#18009: 24.4.50; Add hooks for `rename-file' and `delete-file'
2014-07-13 9:38 ` Andreas Schwab
@ 2014-07-13 9:46 ` Michael Albinus
2014-07-13 10:55 ` Andreas Schwab
0 siblings, 1 reply; 15+ messages in thread
From: Michael Albinus @ 2014-07-13 9:46 UTC (permalink / raw)
To: Andreas Schwab; +Cc: 18009
Andreas Schwab <schwab@linux-m68k.org> writes:
> Michael Albinus <michael.albinus@gmx.de> writes:
>
>> I'll still don't understand. File name handlers are intended to provide
>> a *different* implementation.
>
> Are they?
Yes. And they are invoked only when the file *name* matches a given
regexp. Drew hasn't mentioned this.
>> And even if he goes this way, he would loose existing file name
>> handlers, for example from Tramp.
>
> There is not necessarily the case.
Of course, you could write a file name handler which would reinvoke
other file name handlers afterwards. But the more natural approach would
be to advice rename-file and delete-file.
> Andreas.
Best regards, Michael.
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#18009: 24.4.50; Add hooks for `rename-file' and `delete-file'
2014-07-13 9:46 ` Michael Albinus
@ 2014-07-13 10:55 ` Andreas Schwab
0 siblings, 0 replies; 15+ messages in thread
From: Andreas Schwab @ 2014-07-13 10:55 UTC (permalink / raw)
To: Michael Albinus; +Cc: 18009
Michael Albinus <michael.albinus@gmx.de> writes:
> Andreas Schwab <schwab@linux-m68k.org> writes:
>
>> Michael Albinus <michael.albinus@gmx.de> writes:
>>
>>> I'll still don't understand. File name handlers are intended to provide
>>> a *different* implementation.
>>
>> Are they?
>
> Yes. And they are invoked only when the file *name* matches a given
> regexp. Drew hasn't mentioned this.
Of course, you can write regexps that match any name.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#18009: 24.4.50; Add hooks for `rename-file' and `delete-file'
2014-07-12 22:31 bug#18009: 24.4.50; Add hooks for `rename-file' and `delete-file' Drew Adams
2014-07-12 22:39 ` Drew Adams
2014-07-13 8:13 ` Andreas Schwab
@ 2014-07-19 2:34 ` Stefan Monnier
2014-07-19 16:15 ` Drew Adams
2022-02-20 13:07 ` Lars Ingebrigtsen
2 siblings, 2 replies; 15+ messages in thread
From: Stefan Monnier @ 2014-07-19 2:34 UTC (permalink / raw)
To: Drew Adams; +Cc: 18009
> Please add a hook for each of these basic operations. It is not unusual
> to want to be able to carry out some action associated with
> (successfully) renaming or deleting a file. The hooks would be run at
> the end of the operation, and only upon success.
It's not unreasonable, but these are rather low-level operations, I'm
not sure I want to run hooks from them.
> One use case: Bookmark+ autofile bookmarks have the same name as their
> files. (There can be multiple bookmarks with the same name,
> corresponding to files with the same name in different directories.)
> With a hook it would be trivial to automatically rename or delete the
> associated bookmark.
Of course you can use an `advice' in the mean time, but maybe a better
long-term answer is the file-notification API so that your code would
know about renames not only when they're performed from the same Emacs
session but also from any other process.
Stefan
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#18009: 24.4.50; Add hooks for `rename-file' and `delete-file'
2014-07-19 2:34 ` Stefan Monnier
@ 2014-07-19 16:15 ` Drew Adams
2022-02-20 13:07 ` Lars Ingebrigtsen
1 sibling, 0 replies; 15+ messages in thread
From: Drew Adams @ 2014-07-19 16:15 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 18009
> > Please add a hook for each of these basic operations. It is not
> > unusual to want to be able to carry out some action associated with
> > (successfully) renaming or deleting a file. The hooks would be run
> > at the end of the operation, and only upon success.
>
> It's not unreasonable, but these are rather low-level operations, I'm
> not sure I want to run hooks from them.
I'm curious what difference that makes. I suppose you're thinking that
if a hook does something awful then it could affect things widely. Is
that it?
I guess I don't have a good counter argument, if so. On the other
hand, the same thing would happen if someone advised the function.
Plus, there are hooks and there are hooks. Some hooks have more
potential for wreaking havoc than others. We have not created hooks
only for contexts that are benign or well isolated. We have hooks
that, if abused, can lead to data corruption or loss. I don't really
see why these hooks would be so different.
> > One use case: Bookmark+ autofile bookmarks have the same name as their
> > files. (There can be multiple bookmarks with the same name,
> > corresponding to files with the same name in different directories.)
> > With a hook it would be trivial to automatically rename or delete the
> > associated bookmark.
>
> Of course you can use an `advice' in the mean time, but maybe a better
> long-term answer is the file-notification API so that your code would
> know about renames not only when they're performed from the same Emacs
> session but also from any other process.
I will take a look at that; I'm not familiar with it. The doc speaks
of a few restrictions and caveats, but it does sound worth trying.
Why did you mention "long-term" here? I wonder if I'm missing something.
That might well be something interesting for the use case I mentioned.
But I would still like to see the hooks added. It is not the same
thing to want Emacs to do something when IT renames or deletes a file,
as opposed to hearing back from the operating system (when, exactly?)
that something was changed. Associating an action with the act of
renaming or deleting makes sense to me, a priori.
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#18009: 24.4.50; Add hooks for `rename-file' and `delete-file'
2014-07-19 2:34 ` Stefan Monnier
2014-07-19 16:15 ` Drew Adams
@ 2022-02-20 13:07 ` Lars Ingebrigtsen
2022-02-20 21:08 ` bug#18009: [External] : " Drew Adams
1 sibling, 1 reply; 15+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-20 13:07 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 18009
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> Please add a hook for each of these basic operations. It is not unusual
>> to want to be able to carry out some action associated with
>> (successfully) renaming or deleting a file. The hooks would be run at
>> the end of the operation, and only upon success.
>
> It's not unreasonable, but these are rather low-level operations, I'm
> not sure I want to run hooks from them.
(I'm going through old bug reports that unfortunately weren't resolved
at the time.)
I think the conclusion here is that we don't want to add any hooks to
these functions, and the user can use file name handlers and/or advice
to alter the behaviour if they want to.
So I'm closing this bug report.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#18009: [External] : Re: bug#18009: 24.4.50; Add hooks for `rename-file' and `delete-file'
2022-02-20 13:07 ` Lars Ingebrigtsen
@ 2022-02-20 21:08 ` Drew Adams
0 siblings, 0 replies; 15+ messages in thread
From: Drew Adams @ 2022-02-20 21:08 UTC (permalink / raw)
To: Lars Ingebrigtsen, Stefan Monnier; +Cc: 18009@debbugs.gnu.org
> I think the conclusion here is that we don't want to add any hooks to
> these functions, and the user can use file name handlers and/or advice
> to alter the behaviour if they want to.
>
> So I'm closing this bug report.
Why is that your conclusion now?
There was no conclusion, let alone
such a conclusion, in the bug thread.
Closing with no reason given.
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2022-02-20 21:08 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-12 22:31 bug#18009: 24.4.50; Add hooks for `rename-file' and `delete-file' Drew Adams
2014-07-12 22:39 ` Drew Adams
2014-07-13 1:35 ` Glenn Morris
2014-07-13 2:32 ` Drew Adams
2014-07-13 8:13 ` Andreas Schwab
2014-07-13 9:21 ` Michael Albinus
2014-07-13 9:26 ` Andreas Schwab
2014-07-13 9:32 ` Michael Albinus
2014-07-13 9:38 ` Andreas Schwab
2014-07-13 9:46 ` Michael Albinus
2014-07-13 10:55 ` Andreas Schwab
2014-07-19 2:34 ` Stefan Monnier
2014-07-19 16:15 ` Drew Adams
2022-02-20 13:07 ` Lars Ingebrigtsen
2022-02-20 21:08 ` bug#18009: [External] : " Drew Adams
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).