From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/68008 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel,gmane.emacs.gnus.general Subject: Multi-article Isearch in Gnus (was: Conflict about M-s) Date: Mon, 29 Dec 2008 01:55:11 +0200 Organization: JURTA Message-ID: <87tz8ng9g0.fsf_-_@jurta.org> References: <877i5vu84j.fsf@jurta.org> <87zliq1ukx.fsf@jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1230508767 2572 80.91.229.12 (28 Dec 2008 23:59:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 28 Dec 2008 23:59:27 +0000 (UTC) Cc: ding@gnus.org To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 29 01:00:34 2008 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.50) id 1LH5Yg-0003iv-4h for ged-emacs-devel@m.gmane.org; Mon, 29 Dec 2008 01:00:34 +0100 Original-Received: from localhost ([127.0.0.1]:59478 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LH5XS-0006ix-Q4 for ged-emacs-devel@m.gmane.org; Sun, 28 Dec 2008 18:59:18 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LH5XN-0006iZ-Mn for emacs-devel@gnu.org; Sun, 28 Dec 2008 18:59:13 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LH5XM-0006iI-1O for emacs-devel@gnu.org; Sun, 28 Dec 2008 18:59:13 -0500 Original-Received: from [199.232.76.173] (port=56811 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LH5XL-0006iF-Qz for emacs-devel@gnu.org; Sun, 28 Dec 2008 18:59:11 -0500 Original-Received: from relay02.kiev.sovam.com ([62.64.120.197]:61638) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LH5XL-0005lJ-5c for emacs-devel@gnu.org; Sun, 28 Dec 2008 18:59:11 -0500 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay02.kiev.sovam.com with esmtp (Exim 4.67) (envelope-from ) id 1LH5XI-0004FD-V0; Mon, 29 Dec 2008 01:59:09 +0200 In-Reply-To: <87zliq1ukx.fsf@jurta.org> (Juri Linkov's message of "Sat, 20 Dec 2008 22:17:45 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) X-Scanner-Signature: e5a023dad48cfed04c9aaaf8a25ccfed X-DrWeb-checked: yes X-SpamTest-Envelope-From: juri@jurta.org X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Trusted X-SpamTest-Info: Profiles 5467 [Oct 22 2008] X-SpamTest-Info: {received from trusted relay: common white list} X-SpamTest-Info: {HEADERS: header Content-Type found without required header Content-Transfer-Encoding} X-SpamTest-Method: white ip list X-SpamTest-Rate: 10 X-SpamTest-Status: Trusted X-SpamTest-Status-Extended: trusted X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0278], KAS30/Release X-detected-operating-system: by monty-python.gnu.org: FreeBSD 6.x (1) 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:107354 gmane.emacs.gnus.general:68008 Archived-At: [Cc'd ding@gnus.org] > 1. Gnus binds `M-s' to `gnus-summary-search-article-forward'. In order to compensate the need to change the key binding `M-s' in Gnus that now conflicts with the global prefix key `M-s' in Emacs 23, I implemented support for multi-article Isearch. This means that after installing the following small patch, typing `C-s' in the *Article* buffer will switch to the next article with more search hits when Isearch finds no more search results in the current article. This works like the current non-incremental command `M-s', but like `C-s' it searches incrementally. Another way to run it is to type `s' in the *Summary* buffer that will start Isearch in the *Article* buffer with multi-article support. It has no effect on versions other than Emacs 23. Index: lisp/gnus/gnus-art.el =================================================================== RCS file: /sources/emacs/emacs/lisp/gnus/gnus-art.el,v retrieving revision 1.172 diff -u -r1.172 gnus-art.el --- lisp/gnus/gnus-art.el 4 Dec 2008 10:53:19 -0000 1.172 +++ lisp/gnus/gnus-art.el 28 Dec 2008 23:55:05 -0000 @@ -4366,6 +4366,9 @@ ;; Prevent Emacs 22 from displaying non-break space with `nobreak-space' ;; face. (set (make-local-variable 'nobreak-char-display) nil) + ;; For multi-article Isearch in Emacs 23. + (set (make-local-variable 'multi-isearch-next-buffer-function) + 'gnus-article-isearch-next-buffer) (setq cursor-in-non-selected-windows nil) (setq truncate-lines gnus-article-truncate-lines) (gnus-set-default-directory) @@ -6758,6 +6761,48 @@ (point)) (set-buffer buf)))))) + +(defun gnus-article-isearch-next-buffer (&optional buffer wrap) + "Find and return the next article buffer for multi-article Isearch. +`gnus-select-article-hook' is not called during the search." + ;; We have to require this here to make sure that the following + ;; dynamic binding isn't shadowed by autoloading. + (require 'gnus-async) + (require 'gnus-art) + (let ((gnus-select-article-hook nil) ;Disable hook. + (gnus-article-prepare-hook nil) + (gnus-mark-article-hook nil) ;Inhibit marking as read. + (gnus-use-article-prefetch nil) + (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay. + (gnus-use-trees nil) ;Inhibit updating tree buffer. + (gnus-visual nil) + (gnus-keep-backlog nil) + (gnus-break-pages nil) + (gnus-summary-display-arrow nil) + (gnus-updated-mode-lines nil) + (gnus-auto-center-summary nil) + (gnus-display-mime-function nil) + (found 'not)) + (with-current-buffer gnus-summary-buffer + (if wrap + (goto-char (if isearch-forward (point-min) (point-max))) + (while (eq found 'not) + (if (not (if isearch-forward + (gnus-summary-find-next) + (gnus-summary-find-prev))) + ;; No more articles. + (setq found nil) + ;; Select the next article and adjust point. + (unless (gnus-summary-article-sparse-p + (gnus-summary-article-number)) + (setq found t))))) + (gnus-summary-select-article) + (pop-to-buffer gnus-article-buffer) + (widen) + ;; Return nil when no more articles. + (and found (current-buffer))))) + + ;;; ;;; Article editing ;;; -- Juri Linkov http://www.jurta.org/emacs/