GNU bug report logs - #14377
24.3.50; patch: run a hook after `bookmark-write'

Previous Next

Package: emacs;

Reported by: Eduard Wiebe <usenet <at> pusto.de>

Date: Thu, 9 May 2013 20:33:01 UTC

Severity: wishlist

Tags: patch

Found in version 24.3.50

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 14377 in the body.
You can then email your comments to 14377 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#14377; Package emacs. (Thu, 09 May 2013 20:33:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Eduard Wiebe <usenet <at> pusto.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 09 May 2013 20:33:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Eduard Wiebe <usenet <at> pusto.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; patch: run a hook after `bookmark-write'
Date: Thu, 09 May 2013 22:22:20 +0200
[Message part 1 (text/plain, inline)]
 
   Hello,

i want always to export my bookmarks when bookmark file is saved.
Consider this simple patch.
[bookmark.after.save.hook.patch (text/x-diff, inline)]
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 482cdf9..ee561db 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -1311,6 +1311,9 @@ Don't use this in Lisp programs; use `bookmark-save' instead."
   (bookmark-save t))


+(defvar bookmark-after-save-hook nil
+  "Hook run after bookmark file was saved.")
+
 ;;;###autoload
 (defun bookmark-save (&optional parg file)
   "Save currently defined bookmarks.
@@ -1380,5 +1383,6 @@ for a file, defaulting to the file defined by variable
             (write-region (point-min) (point-max) file)
           (file-error (message "Can't write %s" file)))
         (kill-buffer (current-buffer))
+        (run-hooks 'bookmark-after-save-hook)
         (bookmark-maybe-message
          "Saving bookmarks to file %s...done" file)))))

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14377; Package emacs. (Fri, 10 May 2013 21:10:02 GMT) Full text and rfc822 format available.

Message #8 received at 14377 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Eduard Wiebe <usenet <at> pusto.de>
Cc: 14377 <at> debbugs.gnu.org
Subject: Re: bug#14377: 24.3.50; patch: run a hook after `bookmark-write'
Date: Fri, 10 May 2013 17:09:34 -0400
> I want always to export my bookmarks when bookmark file is saved.
> Consider this simple patch.

You could use

  (defadvice bookmark-write-file (after export activate)
    (do what I want))

Of course, we could also install something like your patch, but the hook
functions will probably need access to the file name (which might turn into
a lexically scoped var any time).


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14377; Package emacs. (Sat, 11 May 2013 19:31:02 GMT) Full text and rfc822 format available.

Message #11 received at 14377 <at> debbugs.gnu.org (full text, mbox):

From: Eduard Wiebe <ew <at> pusto.de>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: Eduard Wiebe <usenet <at> pusto.de>, 14377 <at> debbugs.gnu.org
Subject: Re: bug#14377: 24.3.50; patch: run a hook after `bookmark-write'
Date: Sat, 11 May 2013 21:30:24 +0200
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

>> I want always to export my bookmarks when bookmark file is saved.
>> Consider this simple patch.
>
> You could use
>
>   (defadvice bookmark-write-file (after export activate)
>     (do what I want))

Sure.

> Of course, we could also install something like your patch, but the hook
> functions will probably need access to the file name (which might turn into
> a lexically scoped var any time).

Ahh.., that was not clear to me. Thanks for the hint.
Please close this report.

--
Eduard Wiebe




bug closed, send any further explanations to 14377 <at> debbugs.gnu.org and Eduard Wiebe <usenet <at> pusto.de> Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 12 May 2013 01:37:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14377; Package emacs. (Sun, 12 May 2013 01:43:01 GMT) Full text and rfc822 format available.

Message #16 received at 14377 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 14377 <at> debbugs.gnu.org
Subject: Re: bug#14377: 24.3.50; patch: run a hook after `bookmark-write'
Date: Sat, 11 May 2013 21:42:30 -0400
>> Of course, we could also install something like your patch, but the hook
>> functions will probably need access to the file name (which might turn into
>> a lexically scoped var any time).

Aren't matters of extensibility like this one reason why

http://www.gnu.org/software/emacs/emacs-paper.html#SEC15

favours dynamic binding?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14377; Package emacs. (Sun, 12 May 2013 18:03:02 GMT) Full text and rfc822 format available.

Message #19 received at 14377 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Glenn Morris'" <rgm <at> gnu.org>, <14377 <at> debbugs.gnu.org>
Cc: 'Eduard Wiebe' <usenet <at> pusto.de>
Subject: RE: bug#14377: 24.3.50; patch: run a hook after `bookmark-write'
Date: Sun, 12 May 2013 11:01:37 -0700
> >> Of course, we could also install something like your 
> >> patch, but the hook functions will probably need access
> >> to the file name (which might turn into a lexically
> >> scoped var any time).
> 
> Aren't matters of extensibility like this one reason why
> http://www.gnu.org/software/emacs/emacs-paper.html#SEC15
> favours dynamic binding?

;-)

FWIW, Bookmark+ has such a hook: `bmkp-write-bookmark-file-hook'.  (And it
passes the file name to the hook functions.)





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 10 Jun 2013 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 14 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.