unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Lennart Borgman <lennart.borgman.073@student.lu.se>
Subject: Patch that adds help to isearch
Date: Fri, 25 Nov 2005 00:02:06 +0100	[thread overview]
Message-ID: <4386466E.4090407@student.lu.se> (raw)

[-- Attachment #1: Type: text/plain, Size: 932 bytes --]

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?



[-- Attachment #2: isearch-20051124.path --]
[-- Type: text/plain, Size: 2827 bytes --]


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))
 
 \f
@@ -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."

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

             reply	other threads:[~2005-11-24 23:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-24 23:02 Lennart Borgman [this message]
2005-11-26  4:22 ` Patch that adds help to isearch Richard M. Stallman
2005-11-27 22:53   ` Lennart Borgman
2005-11-28  7:21     ` Lennart Borgman
2005-11-29  9:04   ` Juri Linkov
2005-11-29 21:47     ` Richard M. Stallman
2005-11-29 22:12       ` Lennart Borgman
2005-11-30  2:48         ` Juri Linkov
  -- strict thread matches above, loose matches on Subject: below --
2005-11-29 10:23 LENNART BORGMAN
2005-11-30  2:47 ` Juri Linkov
2005-11-30  8:24   ` Lennart Borgman
2005-11-30 15:34     ` Juri Linkov
2005-11-30 22:27       ` Lennart Borgman

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=4386466E.4090407@student.lu.se \
    --to=lennart.borgman.073@student.lu.se \
    /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).