From: Karl Fogel <kfogel@red-bean.com>
To: emacs-devel@gnu.org
Cc: 5975@debbugs.gnu.org, Thierry Volpiatto <thierry.volpiatto@gmail.com>
Subject: Re: Base patch for bug #5975 (bookmarking from Gnus Article buffer).
Date: Tue, 13 Jul 2010 17:41:44 -0400 [thread overview]
Message-ID: <87d3urdppj.fsf@red-bean.com> (raw)
In-Reply-To: <87k4ozdq6b.fsf_-_@red-bean.com> (Karl Fogel's message of "Tue, 13 Jul 2010 17:31:40 -0400")
Karl Fogel <kfogel@red-bean.com> writes:
>Just for reference, the current (preparatory) patch is below. I will
>follow up separately with the gnus/* patch, so it's in the archives.
Here's that patch (still needs the C-w fix referred to in the bug, though).
=== modified file 'lisp/gnus/ChangeLog'
--- lisp/gnus/ChangeLog 2010-07-13 21:20:34 +0000
+++ lisp/gnus/ChangeLog 2010-07-13 21:39:19 +0000
@@ -1,5 +1,16 @@
2010-07-13 Karl Fogel <kfogel@red-bean.com>
+ Allow bookmarks to be set from Gnus Article buffers.
+ Based on a patch by Thierry Volpiatto (Bug #5975).
+
+ * gnus-art.el (bookmark-make-record-function): New local variable.
+
+ * gnus-sum.el (gnus-summary-bookmark-make-record): Allow setting
+ from article buffer.
+ (gnus-summary-bookmark-jump): Maybe jump to article buffer.
+
+2010-07-13 Karl Fogel <kfogel@red-bean.com>
+
* gnus/gnus-sum.el (bookmark-make-record-default): Adjust
declaration, based on changes in bookmark.el.
=== modified file 'lisp/gnus/gnus-art.el'
--- lisp/gnus/gnus-art.el 2010-06-10 05:33:55 +0000
+++ lisp/gnus/gnus-art.el 2010-07-13 21:39:19 +0000
@@ -4452,6 +4452,8 @@
(make-local-variable 'gnus-article-image-alist)
(make-local-variable 'gnus-article-charset)
(make-local-variable 'gnus-article-ignored-charsets)
+ (set (make-local-variable 'bookmark-make-record-function)
+ 'gnus-summary-bookmark-make-record)
;; Prevent Emacs 22 from displaying non-break space with `nobreak-space'
;; face.
(set (make-local-variable 'nobreak-char-display) nil)
=== modified file 'lisp/gnus/gnus-sum.el'
--- lisp/gnus/gnus-sum.el 2010-07-13 21:20:34 +0000
+++ lisp/gnus/gnus-sum.el 2010-07-13 21:39:19 +0000
@@ -12629,18 +12629,24 @@
(defun gnus-summary-bookmark-make-record ()
"Make a bookmark entry for a Gnus summary buffer."
- (unless (and (derived-mode-p 'gnus-summary-mode) gnus-article-current)
- (error "Please retry from the Gnus summary buffer")) ;[1]
- (let* ((subject (elt (gnus-summary-article-header) 1))
- (grp (car gnus-article-current))
- (art (cdr gnus-article-current))
- (head (gnus-summary-article-header art))
- (id (mail-header-id head)))
- `(,subject
- ,@(bookmark-make-record-default 'point-only)
- (location . ,(format "Gnus %s:%d:%s" grp art id))
- (group . ,grp) (article . ,art)
- (message-id . ,id) (handler . gnus-summary-bookmark-jump))))
+ (let (pos buf)
+ (unless (and (derived-mode-p 'gnus-summary-mode) gnus-article-current)
+ (save-restriction ; FIXME is it necessary to widen?
+ (widen) (setq pos (point))) ; Set position in gnus-article buffer.
+ (setq buf "art") ; We are recording bookmark from article buffer.
+ (gnus-article-show-summary)) ; Go back in summary buffer.
+ ;; We are now recording bookmark from summary buffer.
+ (unless buf (setq buf "sum"))
+ (let* ((subject (elt (gnus-summary-article-header) 1))
+ (grp (car gnus-article-current))
+ (art (cdr gnus-article-current))
+ (head (gnus-summary-article-header art))
+ (id (mail-header-id head)))
+ `(,subject
+ ,@(bookmark-make-record-default 'no-file 'no-context pos)
+ (location . ,(format "Gnus-%s %s:%d:%s" buf grp art id))
+ (group . ,grp) (article . ,art)
+ (message-id . ,id) (handler . gnus-summary-bookmark-jump)))))
;;;###autoload
(defun gnus-summary-bookmark-jump (bookmark)
@@ -12648,10 +12654,18 @@
BOOKMARK is a bookmark name or a bookmark record."
(let ((group (bookmark-prop-get bookmark 'group))
(article (bookmark-prop-get bookmark 'article))
- (id (bookmark-prop-get bookmark 'message-id)))
+ (id (bookmark-prop-get bookmark 'message-id))
+ (buf (car (split-string (bookmark-prop-get bookmark 'location)))))
(gnus-fetch-group group (list article))
(gnus-summary-insert-cached-articles)
(gnus-summary-goto-article id nil 'force)
+ ;; FIXME we have to wait article buffer is ready (only large buffer)
+ ;; Is there a better solution to know that?
+ ;; If we don't wait `bookmark-default-handler' will have no chance
+ ;; to set position. However there is no error, just wrong pos.
+ (sit-for 1)
+ (when (string= buf "Gnus-art")
+ (other-window 1))
(bookmark-default-handler
`(""
(buffer . ,(current-buffer))
next prev parent reply other threads:[~2010-07-13 21:41 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-29 12:43 No answer on bugs Thierry Volpiatto
2010-06-29 13:12 ` Lennart Borgman
2010-06-29 13:54 ` Karl Fogel
2010-06-29 14:14 ` Thierry Volpiatto
2010-06-29 19:26 ` Tassilo Horn
2010-06-29 19:57 ` Thierry Volpiatto
2010-06-29 20:10 ` Tassilo Horn
2010-06-29 20:16 ` Thierry Volpiatto
2010-07-13 21:31 ` Base patch for bug #5975 (bookmarking from Gnus Article buffer) Karl Fogel
2010-07-13 21:41 ` Karl Fogel [this message]
2010-07-14 8:29 ` Thierry Volpiatto
2010-07-14 8:37 ` Eli Zaretskii
2010-07-14 9:06 ` Thierry Volpiatto
2010-07-14 9:42 ` Eli Zaretskii
2010-07-14 10:07 ` Thierry Volpiatto
2010-07-14 10:18 ` Eli Zaretskii
2010-07-14 10:57 ` Thierry Volpiatto
2010-07-14 15:32 ` Karl Fogel
2010-07-13 23:30 ` Glenn Morris
2010-07-14 0:33 ` Karl Fogel
2010-07-14 8:55 ` Andreas Schwab
2010-07-14 15:29 ` Karl Fogel
2010-07-14 5:03 ` Thierry Volpiatto
2010-07-14 16:06 ` Karl Fogel
2010-07-14 16:55 ` Karl Fogel
2010-06-30 18:16 ` No answer on bugs Ted Zlatanov
2010-06-30 18:36 ` Thierry Volpiatto
2010-06-30 19:23 ` more on anything.el inclusion (was: No answer on bugs) Ted Zlatanov
2010-06-30 20:10 ` more on anything.el inclusion Thierry Volpiatto
2010-06-30 22:59 ` Dan Nicolaescu
2010-07-01 5:53 ` Thierry Volpiatto
2010-07-01 6:48 ` Dan Nicolaescu
2010-07-01 7:50 ` Thierry Volpiatto
2010-07-01 8:36 ` Dan Nicolaescu
2010-07-01 8:53 ` Thierry Volpiatto
2010-07-01 16:02 ` Dan Nicolaescu
2010-07-01 16:33 ` Harald Hanche-Olsen
2010-07-01 16:43 ` Ted Zlatanov
2010-07-01 17:18 ` Thierry Volpiatto
2010-07-01 17:43 ` Dan Nicolaescu
2010-07-01 18:14 ` Thierry Volpiatto
2010-07-01 18:48 ` Ted Zlatanov
2010-07-01 18:57 ` Wojciech Meyer
2010-07-01 17:36 ` Harald Hanche-Olsen
2010-07-01 15:20 ` Anything Use Case (was: more on anything.el inclusion) Memnon Anon
2010-07-01 13:18 ` more on anything.el inclusion Ted Zlatanov
2010-07-01 14:15 ` Thierry Volpiatto
2010-07-01 14:48 ` Lennart Borgman
2010-07-01 15:55 ` Ted Zlatanov
2010-07-01 16:43 ` Lennart Borgman
2010-07-01 18:55 ` Ted Zlatanov
2010-07-01 22:08 ` Lennart Borgman
2010-07-09 14:46 ` Thierry Volpiatto
2010-07-17 13:37 ` rubikitch
2010-07-17 15:16 ` Thierry Volpiatto
2010-07-04 22:02 ` Stefan Monnier
2010-07-07 16:47 ` Ted Zlatanov
2010-07-23 15:35 ` Stefan Monnier
2010-07-23 21:49 ` rubikitch
2010-08-12 23:02 ` Ted Zlatanov
2010-08-24 19:24 ` rubikitch
2010-08-25 13:51 ` Juri Linkov
2010-09-11 12:02 ` Thierry Volpiatto
2010-09-11 11:59 ` Thierry Volpiatto
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=87d3urdppj.fsf@red-bean.com \
--to=kfogel@red-bean.com \
--cc=5975@debbugs.gnu.org \
--cc=emacs-devel@gnu.org \
--cc=thierry.volpiatto@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).