unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Conflict about M-s
@ 2008-12-19  7:33 Richard M Stallman
  2008-12-19 22:12 ` Juri Linkov
  0 siblings, 1 reply; 8+ messages in thread
From: Richard M Stallman @ 2008-12-19  7:33 UTC (permalink / raw)
  To: emacs-devel

M-s has been made into a prefix character for searching, but Rmail
still defines M-s as a search command in a different way.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Conflict about M-s
  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
  0 siblings, 2 replies; 8+ messages in thread
From: Juri Linkov @ 2008-12-19 22:12 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

> M-s has been made into a prefix character for searching, but Rmail
> still defines M-s as a search command in a different way.

It should be easy to write an isearch wrapper around `rmail-search'
(exactly as is already implemented in `Info-isearch-search' that wraps
`Info-search').  This will allow incremental searching with `C-s',
`C-M-s', `C-r', `C-M-r' in Rmail messages.

I will take care of that.

-- 
Juri Linkov
http://www.jurta.org/emacs/




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Conflict about M-s
  2008-12-19 22:12 ` Juri Linkov
@ 2008-12-20  1:45   ` Chong Yidong
  2008-12-20 18:03   ` Richard M Stallman
  1 sibling, 0 replies; 8+ messages in thread
From: Chong Yidong @ 2008-12-20  1:45 UTC (permalink / raw)
  To: Juri Linkov; +Cc: rms, emacs-devel

Juri Linkov <juri@jurta.org> writes:

>> M-s has been made into a prefix character for searching, but Rmail
>> still defines M-s as a search command in a different way.
>
> It should be easy to write an isearch wrapper around `rmail-search'
> (exactly as is already implemented in `Info-isearch-search' that wraps
> `Info-search').  This will allow incremental searching with `C-s',
> `C-M-s', `C-r', `C-M-r' in Rmail messages.
>
> I will take care of that.

Please remember to add the same changes to the pmail*.el files, which
will eventually replace rmail (possibly after the 23.1 release).




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Conflict about M-s
  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
  1 sibling, 1 reply; 8+ messages in thread
From: Richard M Stallman @ 2008-12-20 18:03 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel

    It should be easy to write an isearch wrapper around `rmail-search'
    (exactly as is already implemented in `Info-isearch-search' that wraps
    `Info-search').  This will allow incremental searching with `C-s',
    `C-M-s', `C-r', `C-M-r' in Rmail messages.

Hold on -- I am not sure that is a good idea.

It is useful that M-s foo RET will only find another message
and will not find matches in the current message.  It is useful
that repeating it with M-s RET finds a different message each time.

Perhaps the thing to do is to move it onto the sequence M-s M-s.

By the way, I think there are other modes which bind M-s.
Did someone check for them?




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Conflict about M-s
  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-28 23:55       ` Multi-article Isearch in Gnus (was: Conflict about M-s) Juri Linkov
  0 siblings, 2 replies; 8+ messages in thread
From: Juri Linkov @ 2008-12-20 20:17 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

>     It should be easy to write an isearch wrapper around `rmail-search'
>     (exactly as is already implemented in `Info-isearch-search' that wraps
>     `Info-search').  This will allow incremental searching with `C-s',
>     `C-M-s', `C-r', `C-M-r' in Rmail messages.
>
> Hold on -- I am not sure that is a good idea.
>
> It is useful that M-s foo RET will only find another message
> and will not find matches in the current message.  It is useful
> that repeating it with M-s RET finds a different message each time.

We can add a new key binding to isearch-mode-map that will do the same.
For instance, `M-N' in Isearch mode could skip remaining matches
in the current message and advance to the next message.  The same
key binding will be useful in a general multi-buffer Isearch mode
started with `multi-isearch-buffers'.

> Perhaps the thing to do is to move it onto the sequence M-s M-s.

This is the easiest thing to do and could be done also for other modes
which bind M-s.

> By the way, I think there are other modes which bind M-s.
> Did someone check for them?

There are not too many that I can find:

1. Gnus binds `M-s' to `gnus-summary-search-article-forward'.

2. Minibuffer binds `M-s' to `next-matching-history-element'
   (not useful any more since C-s can now search in the history).

3. Shell mode binds `M-s' to `comint-next-matching-input'.
   This key binding can be changed later when we will implement
   incremental search through the shell history.

4. `center-line' in Text mode was already moved to the text formatting
   keymap as `M-o M-s' (thus this binding is not necessary any more
   in `nroff-mode-map' too and can be removed now from the nroff mode
   because it can now use the global key binding `M-o M-s' `center-line').

5. PCL-CVS binds `M-s' to `cvs-status', and log-edit-mode binds it to
   `log-edit-comment-search-forward'.  Perhaps search commands
   on the global key binding `M-s' are useless in these modes.

-- 
Juri Linkov
http://www.jurta.org/emacs/




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Conflict about M-s
  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       ` Multi-article Isearch in Gnus (was: Conflict about M-s) Juri Linkov
  1 sibling, 1 reply; 8+ messages in thread
From: Richard M Stallman @ 2008-12-21 16:24 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel

    > By the way, I think there are other modes which bind M-s.
    > Did someone check for them?

    There are not too many that I can find:

Would you please make a note in FOR-RELEASE to list these issues
to make sure that they are attended to before the release?




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Conflict about M-s
  2008-12-21 16:24       ` Richard M Stallman
@ 2008-12-22  1:32         ` Juri Linkov
  0 siblings, 0 replies; 8+ messages in thread
From: Juri Linkov @ 2008-12-22  1:32 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

>     > By the way, I think there are other modes which bind M-s.
>     > Did someone check for them?
>
>     There are not too many that I can find:
>
> Would you please make a note in FOR-RELEASE to list these issues
> to make sure that they are attended to before the release?

Done.

-- 
Juri Linkov
http://www.jurta.org/emacs/




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Multi-article Isearch in Gnus (was: Conflict about M-s)
  2008-12-20 20:17     ` Juri Linkov
  2008-12-21 16:24       ` Richard M Stallman
@ 2008-12-28 23:55       ` Juri Linkov
  1 sibling, 0 replies; 8+ 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] 8+ messages in thread

end of thread, other threads:[~2008-12-28 23:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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       ` Multi-article Isearch in Gnus (was: Conflict about M-s) Juri Linkov

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).