* Multi-article Isearch in Gnus (was: Conflict about M-s)
[not found] ` <87zliq1ukx.fsf@jurta.org>
@ 2008-12-28 23:55 ` Juri Linkov
2008-12-29 18:27 ` Multi-article Isearch in Gnus jidanni
0 siblings, 1 reply; 2+ messages in thread
From: Juri Linkov @ 2008-12-28 23:55 UTC (permalink / raw)
To: emacs-devel; +Cc: ding
[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/
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Multi-article Isearch in Gnus
2008-12-28 23:55 ` Multi-article Isearch in Gnus (was: Conflict about M-s) Juri Linkov
@ 2008-12-29 18:27 ` jidanni
0 siblings, 0 replies; 2+ messages in thread
From: jidanni @ 2008-12-29 18:27 UTC (permalink / raw)
To: juri; +Cc: ding
JL> type `s' in the *Summary* buffer that will start Isearch in the
JL> *Article* buffer
BTW, I find that is one of the most confusing parts of gnus. Especially
when the search ends, the cursor jumps back to the *Summary* buffer.
I sort of wish it was all not invented.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-12-29 18:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <E1LDZr6-0004Hm-Qj@fencepost.gnu.org>
[not found] ` <877i5vu84j.fsf@jurta.org>
[not found] ` <E1LE6Au-0004ak-MH@fencepost.gnu.org>
[not found] ` <87zliq1ukx.fsf@jurta.org>
2008-12-28 23:55 ` Multi-article Isearch in Gnus (was: Conflict about M-s) Juri Linkov
2008-12-29 18:27 ` Multi-article Isearch in Gnus jidanni
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 NNTP newsgroup(s).