From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Karl Fogel Newsgroups: gmane.emacs.bugs Subject: bug#5975: Base patch for bug #5975 (bookmarking from Gnus Article buffer). Date: Tue, 13 Jul 2010 17:41:44 -0400 Message-ID: <87d3urdppj.fsf__42776.2249521495$1279058434$gmane$org@red-bean.com> References: <87y6dydn6q.fsf@tux.homenetwork> <201006292126.15409.tassilo@member.fsf.org> <87iq51ehnv.fsf@tux.homenetwork> <201006292210.43121.tassilo@member.fsf.org> <87eifpegqx.fsf@tux.homenetwork> <87k4ozdq6b.fsf_-_@red-bean.com> Reply-To: Karl Fogel NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1279058434 3098 80.91.229.12 (13 Jul 2010 22:00:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 13 Jul 2010 22:00:34 +0000 (UTC) Cc: 5975@debbugs.gnu.org, Thierry Volpiatto To: emacs-devel@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 14 00:00:31 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OYnWh-0003Ze-1C for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Jul 2010 00:00:31 +0200 Original-Received: from localhost ([127.0.0.1]:42326 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OYnWf-0001OA-UN for geb-bug-gnu-emacs@m.gmane.org; Tue, 13 Jul 2010 18:00:29 -0400 Original-Received: from [140.186.70.92] (port=45762 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OYnWV-0001La-3N for bug-gnu-emacs@gnu.org; Tue, 13 Jul 2010 18:00:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OYnWS-0007oO-19 for bug-gnu-emacs@gnu.org; Tue, 13 Jul 2010 18:00:19 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:55188) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OYnWR-0007oK-Vs for bug-gnu-emacs@gnu.org; Tue, 13 Jul 2010 18:00:16 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OYnEo-0005SY-Gh; Tue, 13 Jul 2010 17:42:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Karl Fogel Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 Jul 2010 21:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 5975 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 5975-submit@debbugs.gnu.org id=B5975.127905730020927 (code B ref 5975); Tue, 13 Jul 2010 21:42:02 +0000 Original-Received: (at 5975) by debbugs.gnu.org; 13 Jul 2010 21:41:40 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OYnES-0005RU-6V for submit@debbugs.gnu.org; Tue, 13 Jul 2010 17:41:40 -0400 Original-Received: from osh-net-219-98.onshore.net ([66.146.219.98] helo=sanpietro.red-bean.com) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OYnEQ-0005RD-Ev for 5975@debbugs.gnu.org; Tue, 13 Jul 2010 17:41:39 -0400 Original-Received: from localhost ([127.0.0.1]:54485 helo=floss ident=kfogel) by sanpietro.red-bean.com with esmtp (Exim 4.72) (envelope-from ) id 1OYnEW-0001YY-Mb; Tue, 13 Jul 2010 16:41:44 -0500 In-Reply-To: <87k4ozdq6b.fsf_-_@red-bean.com> (Karl Fogel's message of "Tue, 13 Jul 2010 17:31:40 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 13 Jul 2010 17:42:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:38493 Archived-At: Karl Fogel 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 + 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 + * 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))