From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.devel Subject: Patch that adds help to isearch Date: Fri, 25 Nov 2005 00:02:06 +0100 Message-ID: <4386466E.4090407@student.lu.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010501050009080304070500" X-Trace: sea.gmane.org 1132873450 29744 80.91.229.2 (24 Nov 2005 23:04:10 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 24 Nov 2005 23:04:10 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 25 00:04:03 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EfQ6r-0003tx-3A for ged-emacs-devel@m.gmane.org; Fri, 25 Nov 2005 00:02:34 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EfQ6q-0006Go-9W for ged-emacs-devel@m.gmane.org; Thu, 24 Nov 2005 18:02:32 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EfQ6T-0006Dn-Mt for emacs-devel@gnu.org; Thu, 24 Nov 2005 18:02:09 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EfQ6S-0006Bl-Tj for emacs-devel@gnu.org; Thu, 24 Nov 2005 18:02:09 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EfQ6S-0006BO-Nu for emacs-devel@gnu.org; Thu, 24 Nov 2005 18:02:08 -0500 Original-Received: from [81.228.11.159] (helo=pne-smtpout2-sn1.fre.skanova.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EfQ6S-0006PL-9c for emacs-devel@gnu.org; Thu, 24 Nov 2005 18:02:08 -0500 Original-Received: from [192.168.123.121] (83.249.218.244) by pne-smtpout2-sn1.fre.skanova.net (7.2.069.1) id 4384D3AA00067AEC for emacs-devel@gnu.org; Fri, 25 Nov 2005 00:02:07 +0100 User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en Original-To: Emacs Devel 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:46547 Archived-At: This is a multi-part message in MIME format. --------------010501050009080304070500 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Some months ago we discussed help for isearch-forward/backward. I tried several alternatives at that time, but did not send in any patch. The attached patch is a simple way to give help. It simply defines C-h and f1 to call isearch-mode-help and allows scrolling of the help with keys that are bound to scroll-other-window[-down]. This was the only alternative I could get to work in a nice manner as far as I remember now. I also found some small errors which I tried to correct. This was something with the isearch-ring but I can not remember the details right now. I included that also in the patch however. I renamed search-ring-update to isearch-ring-update which seems more consistent. Maybe that should not be done if that breaks something? BTW I think there may be some useful key definitions missing in the help. Could you for example not switch the direction with C-r? Should not that be added to the help? --------------010501050009080304070500 Content-Type: text/plain; name="isearch-20051124.path" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="isearch-20051124.path" Index: lisp/isearch.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/isearch.el,v retrieving revision 1.276 diff -u -r1.276 isearch.el --- lisp/isearch.el 24 Nov 2005 09:59:11 -0000 1.276 +++ lisp/isearch.el 24 Nov 2005 17:30:35 -0000 @@ -193,7 +193,7 @@ "Index in `regexp-search-ring' of last string reused. It is nil if none yet.") -(defcustom search-ring-update nil +(defcustom isearch-ring-update nil "*Non-nil if advancing or retreating in the search ring should cause search. Default value, nil, means edit the string instead." :type 'boolean @@ -370,7 +370,8 @@ ;; Turned off because I find I expect to get the global definition--rms. ;; ;; Instead bind C-h to special help command for isearch-mode. - ;; (define-key map "\C-h" 'isearch-mode-help) + (define-key map "\C-h" 'isearch-mode-help) + (define-key map [(f1)] 'isearch-mode-help) (define-key map "\M-n" 'isearch-ring-advance) (define-key map "\M-p" 'isearch-ring-retreat) @@ -609,6 +610,12 @@ (defun isearch-mode-help () (interactive) (describe-function 'isearch-forward) + (save-excursion + (set-buffer "*Help*") + (let ((inhibit-read-only t)) + (insert (substitute-command-keys + "To scroll help use \\[scroll-other-window-down] and \\[scroll-other-window].\n\n"))) + ) (isearch-update)) @@ -1702,6 +1709,18 @@ ((eq search-exit-option 'edit) (apply 'isearch-unread keylist) (isearch-edit-string)) + ;; Always scroll other window if help buffer + ((let ((binding (key-binding key)) + other-buffer-is-help) + (when (or (eq binding 'scroll-other-window-down) + (eq binding 'scroll-other-window)) + (other-window 1) + (setq other-buffer-is-help (equal (buffer-name) "*Help*")) + (other-window -1) + (when other-buffer-is-help + (command-execute binding) + (isearch-update) + t)))) ;; Handle a scrolling function. ((and isearch-allow-scroll (progn (setq key (isearch-reread-key-sequence-naturally keylist)) @@ -1843,13 +1862,14 @@ (defun isearch-ring-adjust (advance) ;; Helper for isearch-ring-advance and isearch-ring-retreat (isearch-ring-adjust1 advance) - (if search-ring-update + ;; Changed because isearch-edit-string calls isearch-push-state + ;; but isearch-search does not + (if isearch-ring-update (progn (isearch-search) + (isearch-push-state) (isearch-update)) - (isearch-edit-string) - ) - (isearch-push-state)) + (isearch-edit-string))) (defun isearch-ring-advance () "Advance to the next search string in the ring." --------------010501050009080304070500 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --------------010501050009080304070500--