From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#18009: 24.4.50; Add hooks for `rename-file' and `delete-file' Date: Sat, 19 Jul 2014 09:15:23 -0700 (PDT) Message-ID: <42eb878e-b5f3-4fbe-a5c6-95eacf5f038e@default> References: <16c1eba0-7848-497c-8aef-cf3d02f2decd@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1405786595 13220 80.91.229.3 (19 Jul 2014 16:16:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 19 Jul 2014 16:16:35 +0000 (UTC) Cc: 18009@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jul 19 18:16:27 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1X8XJB-00083M-0n for geb-bug-gnu-emacs@m.gmane.org; Sat, 19 Jul 2014 18:16:25 +0200 Original-Received: from localhost ([::1]:54953 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X8XJA-0002Qk-Ht for geb-bug-gnu-emacs@m.gmane.org; Sat, 19 Jul 2014 12:16:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X8XIy-0002O2-Jc for bug-gnu-emacs@gnu.org; Sat, 19 Jul 2014 12:16:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X8XIp-0003kQ-8V for bug-gnu-emacs@gnu.org; Sat, 19 Jul 2014 12:16:12 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36084) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X8XIp-0003kJ-5K for bug-gnu-emacs@gnu.org; Sat, 19 Jul 2014 12:16:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1X8XIo-0005BI-H2 for bug-gnu-emacs@gnu.org; Sat, 19 Jul 2014 12:16:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Jul 2014 16:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18009 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18009-submit@debbugs.gnu.org id=B18009.140578653519876 (code B ref 18009); Sat, 19 Jul 2014 16:16:02 +0000 Original-Received: (at 18009) by debbugs.gnu.org; 19 Jul 2014 16:15:35 +0000 Original-Received: from localhost ([127.0.0.1]:59583 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X8XIM-0005AW-Jt for submit@debbugs.gnu.org; Sat, 19 Jul 2014 12:15:34 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:32742) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X8XIK-0005AJ-G9 for 18009@debbugs.gnu.org; Sat, 19 Jul 2014 12:15:33 -0400 Original-Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s6JGFP01007287 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 19 Jul 2014 16:15:26 GMT Original-Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s6JGFOi8007977 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Sat, 19 Jul 2014 16:15:25 GMT Original-Received: from ubhmt120.oracle.com (ubhmt120.oracle.com [156.151.24.25]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s6JGFO6i024370; Sat, 19 Jul 2014 16:15:24 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8 (707110) [OL 12.0.6691.5000 (x86)] X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:91664 Archived-At: > > 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. >=20 > 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. >=20 > 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.