aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2008-04-22 20:32:23 +0000
committerJuri Linkov2008-04-22 20:32:23 +0000
commitb92368b4712ac13e1cacd1d5666a0409fca40e49 (patch)
treef4ee8a186d5279bcfd0845c93d10fa3de0e389cd
parent0ec3382b012291ce7c882c88ed12e132243fc794 (diff)
downloademacs-b92368b4712ac13e1cacd1d5666a0409fca40e49.tar.gz
emacs-b92368b4712ac13e1cacd1d5666a0409fca40e49.zip
(eval-when-compile): Require `help-macro'.
(isearch-help-for-help-internal): Isearch specific Help screen created by `make-help-screen'. (isearch-help-map): New variable that binds "b", "k", "m" to isearch-specific commands, and binds other keys to isearch-other-control-char, thus allowing other Help keys to exit isearch mode and execute their global definitions. (isearch-help-for-help, isearch-describe-bindings) (isearch-describe-key, isearch-describe-mode): New commands. (isearch-mode-help): Define alias to isearch-describe-mode and remove its old function definition. (isearch-mode-map): Bind "\C-h" to isearch-help-map. Remove old comments because this issue is settled now. (isearch-forward): Describe three new Help commands in the docstring. (isearch-mode): Remove \\{isearch-mode-map} from the docstring, leave the single sentence at the first line of the docstring, and prepend the word "function" before `isearch-forward' to make the Help link to the function instead of variable.
-rw-r--r--lisp/ChangeLog41
-rw-r--r--lisp/isearch.el88
2 files changed, 116 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d7ae805cc10..7db5250f09c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,46 @@
12008-04-22 Juri Linkov <juri@jurta.org> 12008-04-22 Juri Linkov <juri@jurta.org>
2 2
3 * isearch.el (eval-when-compile): Require `help-macro'.
4 (isearch-help-for-help-internal): Isearch specific Help screen
5 created by `make-help-screen'.
6 (isearch-help-map): New variable that binds "b", "k", "m" to
7 isearch-specific commands, and binds other keys to
8 isearch-other-control-char, thus allowing other Help keys to
9 exit isearch mode and execute their global definitions.
10 (isearch-help-for-help, isearch-describe-bindings)
11 (isearch-describe-key, isearch-describe-mode): New commands.
12 (isearch-mode-help): Define alias to isearch-describe-mode
13 and remove its old function definition.
14 (isearch-mode-map): Bind "\C-h" to isearch-help-map.
15 Remove old comments because this issue is settled now.
16 (isearch-forward): Describe three new Help commands in the docstring.
17 (isearch-mode): Remove \\{isearch-mode-map} from the docstring,
18 leave the single sentence at the first line of the docstring,
19 and prepend the word "function" before `isearch-forward'
20 to make the Help link to the function instead of variable.
21
222008-04-22 Juri Linkov <juri@jurta.org>
23
24 * isearch.el (isearch-success-function): New variable with default
25 to `isearch-success-function-default'.
26 (isearch-search): Call a function from `isearch-success-function'
27 instead of calling the hard-coded `isearch-range-invisible'.
28 (isearch-success-function-default): New function that calls
29 `isearch-range-invisible' and inverts its return value.
30
31 * info.el (Info-search): In two similar places that skip
32 undesired search matches move code to Info-search-success-function,
33 and call `isearch-success-function' instead.
34 (Info-search-success-function): New function copied from code
35 in Info-search. Replace isearch-range-invisible with
36 text-property-not-all that checks for 'invisible and 'display
37 properties to skip partially invisible matches (whose display
38 properties were set by Info-fontify-node).
39 (Info-mode): Set buffer-local isearch-success-function
40 to Info-search-success-function.
41
422008-04-22 Juri Linkov <juri@jurta.org>
43
3 * minibuffer.el (internal-complete-buffer-except): New function. 44 * minibuffer.el (internal-complete-buffer-except): New function.
4 45
5 * files.el (read-buffer-to-switch): New function. 46 * files.el (read-buffer-to-switch): New function.
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 92176236d5c..ef6321be02c 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -181,7 +181,7 @@ to the search status stack.")
181(defvar isearch-success-function 'isearch-success-function-default 181(defvar isearch-success-function 'isearch-success-function-default
182 "Function to report whether the new search match is considered successful. 182 "Function to report whether the new search match is considered successful.
183The function has two arguments: the positions of start and end of text 183The function has two arguments: the positions of start and end of text
184matched by the search. It this function returns nil, continue 184matched by the search. If this function returns nil, continue
185searching without stopping at this match.") 185searching without stopping at this match.")
186 186
187;; Search ring. 187;; Search ring.
@@ -328,6 +328,73 @@ A value of nil means highlight all matches."
328 'lazy-highlight-face 328 'lazy-highlight-face
329 "22.1") 329 "22.1")
330 330
331;; Define isearch help map.
332
333(defvar isearch-help-map
334 (let ((i 0)
335 (map (make-sparse-keymap)))
336 (define-key map [t] 'isearch-other-control-char)
337 (define-key map (char-to-string help-char) 'isearch-help-for-help)
338 (define-key map [help] 'isearch-help-for-help)
339 (define-key map [f1] 'isearch-help-for-help)
340 (define-key map "?" 'isearch-help-for-help)
341 (define-key map "b" 'isearch-describe-bindings)
342 (define-key map "k" 'isearch-describe-key)
343 (define-key map "m" 'isearch-describe-mode)
344 (define-key map "q" 'help-quit)
345 map)
346 "Keymap for characters following the Help key for isearch mode.")
347
348(eval-when-compile (require 'help-macro))
349
350(make-help-screen isearch-help-for-help-internal
351 "Type a help option: [bkm] or ?"
352 "You have typed %THIS-KEY%, the help character. Type a Help option:
353\(Type \\<help-map>\\[help-quit] to exit the Help command.)
354
355b Display all isearch key bindings.
356k KEYS Display full documentation of isearch key sequence.
357m Display documentation of isearch mode.
358
359You can't type here other help keys available in the global help map,
360but outise of this help window when you type them in isearch mode,
361they exit isearch mode before displaying global help."
362 isearch-help-map)
363
364(defun isearch-help-for-help ()
365 "Display isearch help menu."
366 (interactive)
367 (let (same-window-buffer-names same-window-regexps)
368 (isearch-help-for-help-internal))
369 (isearch-update))
370
371(defun isearch-describe-bindings ()
372 "Show a list of all keys defined in isearch mode, and their definitions.
373This is like `describe-bindings', but displays only isearch keys."
374 (interactive)
375 (let (same-window-buffer-names same-window-regexps)
376 (with-help-window "*Help*"
377 (with-current-buffer standard-output
378 (princ "Isearch Mode Bindings:\n")
379 (princ (substitute-command-keys "\\{isearch-mode-map}"))))))
380
381(defun isearch-describe-key ()
382 "Display documentation of the function invoked by isearch key."
383 (interactive)
384 (let (same-window-buffer-names same-window-regexps)
385 (call-interactively 'describe-key))
386 (isearch-update))
387
388(defun isearch-describe-mode ()
389 "Display documentation of isearch mode."
390 (interactive)
391 (let (same-window-buffer-names same-window-regexps)
392 (describe-function 'isearch-forward))
393 (isearch-update))
394
395(defalias 'isearch-mode-help 'isearch-describe-mode)
396
397
331;; Define isearch-mode keymap. 398;; Define isearch-mode keymap.
332 399
333(defvar isearch-mode-map 400(defvar isearch-mode-map
@@ -394,9 +461,7 @@ A value of nil means highlight all matches."
394 (define-key map "\M-\C-y" 'isearch-yank-char) 461 (define-key map "\M-\C-y" 'isearch-yank-char)
395 (define-key map "\C-y" 'isearch-yank-line) 462 (define-key map "\C-y" 'isearch-yank-line)
396 463
397 ;; Turned off because I find I expect to get the global definition--rms. 464 (define-key map "\C-h" isearch-help-map)
398 ;; ;; Instead bind C-h to special help command for isearch-mode.
399 ;; (define-key map "\C-h" 'isearch-mode-help)
400 465
401 (define-key map "\M-n" 'isearch-ring-advance) 466 (define-key map "\M-n" 'isearch-ring-advance)
402 (define-key map "\M-p" 'isearch-ring-retreat) 467 (define-key map "\M-p" 'isearch-ring-retreat)
@@ -581,6 +646,10 @@ Type \\[isearch-ring-retreat] to search for the previous item in the search\
581 ring. 646 ring.
582Type \\[isearch-complete] to complete the search string using the search ring. 647Type \\[isearch-complete] to complete the search string using the search ring.
583 648
649Type \\[isearch-describe-bindings] to display all isearch key bindings.
650Type \\[isearch-describe-key] to display documentation of isearch key.
651Type \\[isearch-describe-mode] to display documentation of isearch mode.
652
584If an input method is turned on in the current buffer, that input 653If an input method is turned on in the current buffer, that input
585method is also active while you are typing characters to search. To 654method is also active while you are typing characters to search. To
586toggle the input method, type \\[isearch-toggle-input-method]. It 655toggle the input method, type \\[isearch-toggle-input-method]. It
@@ -633,12 +702,6 @@ is treated as a regexp. See \\[isearch-forward] for more info."
633 (interactive "P\np") 702 (interactive "P\np")
634 (isearch-mode nil (null not-regexp) nil (not no-recursive-edit))) 703 (isearch-mode nil (null not-regexp) nil (not no-recursive-edit)))
635 704
636
637(defun isearch-mode-help ()
638 (interactive)
639 (describe-function 'isearch-forward)
640 (isearch-update))
641
642 705
643;; isearch-mode only sets up incremental search for the minor mode. 706;; isearch-mode only sets up incremental search for the minor mode.
644;; All the work is done by the isearch-mode commands. 707;; All the work is done by the isearch-mode commands.
@@ -650,9 +713,8 @@ is treated as a regexp. See \\[isearch-forward] for more info."
650 713
651 714
652(defun isearch-mode (forward &optional regexp op-fun recursive-edit word-p) 715(defun isearch-mode (forward &optional regexp op-fun recursive-edit word-p)
653 "Start isearch minor mode. Called by `isearch-forward', etc. 716 "Start isearch minor mode.
654 717It is called by the function `isearch-forward' and other related functions."
655\\{isearch-mode-map}"
656 718
657 ;; Initialize global vars. 719 ;; Initialize global vars.
658 (setq isearch-forward forward 720 (setq isearch-forward forward