From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Karl Fogel Newsgroups: gmane.emacs.devel Subject: Re: Base patch for bug #5975 (bookmarking from Gnus Article buffer). Date: Tue, 13 Jul 2010 17:41:44 -0400 Message-ID: <87d3urdppj.fsf@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 1279057824 891 80.91.229.12 (13 Jul 2010 21:50:24 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 13 Jul 2010 21:50:24 +0000 (UTC) Cc: 5975@debbugs.gnu.org, Thierry Volpiatto To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 13 23:50:22 2010 Return-path: Envelope-to: ged-emacs-devel@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 1OYnMq-0007lu-Tq for ged-emacs-devel@m.gmane.org; Tue, 13 Jul 2010 23:50:21 +0200 Original-Received: from localhost ([127.0.0.1]:53256 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OYnMq-0005JC-A6 for ged-emacs-devel@m.gmane.org; Tue, 13 Jul 2010 17:50:20 -0400 Original-Received: from [140.186.70.92] (port=49024 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OYnF3-0001po-4i for emacs-devel@gnu.org; Tue, 13 Jul 2010 17:42:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OYnEY-00051S-HD for emacs-devel@gnu.org; Tue, 13 Jul 2010 17:42:16 -0400 Original-Received: from osh-net-219-98.onshore.net ([66.146.219.98]:33011 helo=sanpietro.red-bean.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OYnEY-000515-CN for emacs-devel@gnu.org; Tue, 13 Jul 2010 17:41:46 -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-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:127217 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))