From: Juri Linkov <juri@jurta.org>
To: emacs-devel@gnu.org
Cc: ding@gnus.org
Subject: Multi-article Isearch in Gnus (was: Conflict about M-s)
Date: Mon, 29 Dec 2008 01:55:11 +0200 [thread overview]
Message-ID: <87tz8ng9g0.fsf_-_@jurta.org> (raw)
In-Reply-To: <87zliq1ukx.fsf@jurta.org> (Juri Linkov's message of "Sat, 20 Dec 2008 22:17:45 +0200")
[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/
prev parent reply other threads:[~2008-12-28 23:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-19 7:33 Conflict about M-s Richard M Stallman
2008-12-19 22:12 ` Juri Linkov
2008-12-20 1:45 ` Chong Yidong
2008-12-20 18:03 ` Richard M Stallman
2008-12-20 20:17 ` Juri Linkov
2008-12-21 16:24 ` Richard M Stallman
2008-12-22 1:32 ` Juri Linkov
2008-12-28 23:55 ` Juri Linkov [this message]
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=87tz8ng9g0.fsf_-_@jurta.org \
--to=juri@jurta.org \
--cc=ding@gnus.org \
--cc=emacs-devel@gnu.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 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).