From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: Tassilo Horn <tassilo@member.fsf.org>
Cc: Karl Fogel <kfogel@red-bean.com>, emacs-devel@gnu.org
Subject: Re: No answer on bugs
Date: Tue, 29 Jun 2010 21:57:08 +0200 [thread overview]
Message-ID: <87iq51ehnv.fsf@tux.homenetwork> (raw)
In-Reply-To: <201006292126.15409.tassilo@member.fsf.org> (Tassilo Horn's message of "Tue, 29 Jun 2010 21:26:14 +0200")
[-- Attachment #1: Type: text/plain, Size: 934 bytes --]
Tassilo Horn <tassilo@member.fsf.org> writes:
> On Tuesday 29 June 2010 15:54:53 Karl Fogel wrote:
>
> Hi!
>
>> Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:
>> >- bug#5975: 24.0.50; [PATCH]Feature request: bookmarking from gnus article
>> > buffer
>> >
>> >No one answer, not fixed.
>>
>> I'll take a look at this.
>
> Karl, you might want to have a look at org-gnus.el, which provides
> linking support to gnus articles and groups for org-mode. Maybe you can
> either borrow some code from me or even better, use those few functions.
FYI bookmarking from gnus(summary) is now provided in Emacs(24).
What is missing is bookmarking from gnus-article buffer.
The patch i propose apply on my precedent work.
If you want to reuse org code, you will have much more work to enable it
for bookmark (rewrite all), as the things are differents.
I attach here my patch again.
--
Thierry Volpiatto
Gpg key: http://pgp.mit.edu/
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch-109087.patch --]
[-- Type: text/x-patch, Size: 6253 bytes --]
# HG changeset patch
# User Thierry Volpiatto <thierry.volpiatto@gmail.com>
# Date 1277840529 -7200
# Node ID dc2c984058cf101132a55fcf22bf85e173f6482e
# Parent 20190537be1cd79ad83375df1f70ff0ec3dc60fd
Allow to bookmark a mail from a Gnus article buffer and retrieve position.
* lisp/bookmark.el (bookmark-make-record-default) Avoid recording *-context-string when not needed.
* lisp/gnus/gnus-art.el set `bookmark-make-record-function' local.
* lisp/gnus/gnus-sum.el (gnus-summary-bookmark-make-record) allow recording from article buffer.
(gnus-summary-bookmark-jump) maybe jump to article buffer.
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -528,26 +528,30 @@
(setq bookmark-current-bookmark stripped-name)
(bookmark-bmenu-surreptitiously-rebuild-list)))
-(defun bookmark-make-record-default (&optional point-only)
+(defun bookmark-make-record-default (&optional point-only pos read-only)
"Return the record describing the location of a new bookmark.
Must be at the correct position in the buffer in which the bookmark is
being set.
If POINT-ONLY is non-nil, then only return the subset of the
-record that pertains to the location within the buffer."
+record that pertains to the location within the buffer.
+If READ-ONLY is non-nil that's mean buffer is read-only and
+there is no need to record front/rear-context-string, position is enough."
`(,@(unless point-only `((filename . ,(bookmark-buffer-file-name))))
- (front-context-string
- . ,(if (>= (- (point-max) (point)) bookmark-search-size)
- (buffer-substring-no-properties
- (point)
- (+ (point) bookmark-search-size))
- nil))
- (rear-context-string
- . ,(if (>= (- (point) (point-min)) bookmark-search-size)
- (buffer-substring-no-properties
- (point)
- (- (point) bookmark-search-size))
- nil))
- (position . ,(point))))
+ ,@(unless read-only `((front-context-string
+ . ,(if (>= (- (point-max) (point))
+ bookmark-search-size)
+ (buffer-substring-no-properties
+ (point)
+ (+ (point) bookmark-search-size))
+ nil))))
+ ,@(unless read-only `((rear-context-string
+ . ,(if (>= (- (point) (point-min))
+ bookmark-search-size)
+ (buffer-substring-no-properties
+ (point)
+ (- (point) bookmark-search-size))
+ nil))))
+ (position . ,(or pos (point)))))
\f
;;; File format stuff
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -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)
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -12628,18 +12628,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 'point-only pos 'read-only)
+ (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)
@@ -12647,10 +12653,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-06-29 19:57 UTC|newest]
Thread overview: 75+ 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 [this message]
2010-06-29 20:10 ` Tassilo Horn
2010-06-29 20:16 ` Thierry Volpiatto
2010-07-13 21:31 ` bug#5975: Base patch for bug #5975 (bookmarking from Gnus Article buffer) Karl Fogel
2010-07-13 21:31 ` Karl Fogel
2010-04-19 17:07 ` bug#5975: 24.0.50; [PATCH]Feature request: bookmarking from gnus article buffer Thierry Volpiatto
2010-05-17 14:14 ` Thierry Volpiatto
2010-07-13 21:46 ` bug#5975: Bazaar branch where this is being fixed Karl Fogel
2010-07-13 23:30 ` bug#5975: Base patch for bug #5975 (bookmarking from Gnus Article buffer) Glenn Morris
2010-07-14 19:48 ` bug#5975: [PATCH] Allow using C-w (bookmark-yank-word) when bookmarking from a gnus article buffer Thierry Volpiatto
2010-07-13 21:41 ` Base patch for bug #5975 (bookmarking from Gnus Article buffer) Karl Fogel
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 21:41 ` bug#5975: " Karl Fogel
2010-07-13 23:30 ` Glenn Morris
2010-07-14 0:33 ` Karl Fogel
2010-07-14 0:33 ` bug#5975: " Karl Fogel
2010-07-14 8:55 ` Andreas Schwab
2010-07-14 8:55 ` Andreas Schwab
2010-07-14 15:29 ` bug#5975: " Karl Fogel
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
[not found] <87630icytd.fsf@tux.homenetwork>
2010-07-14 16:44 ` bug#5975: [PATCH] Allow using C-w (bookmark-yank-word) when bookmarking from a gnus article buffer Karl Fogel
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87iq51ehnv.fsf@tux.homenetwork \
--to=thierry.volpiatto@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=kfogel@red-bean.com \
--cc=tassilo@member.fsf.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.