comparison lisp/isearch-mode.el @ 1601:442db3c3c43b

[xemacs-hg @ 2003-08-02 08:42:10 by michaels] 2003-07-31 Mike Sperber <mike@xemacs.org> * isearch-mode.el (isearch-mode-help): (isearch-update): (isearch-done): (isearch-edit-string): Change the way window configurations are handled: Formerly, the code would do `set-window-configuration' off `pre-command-hook' which isn't really allowed. (The old window-configuration code would quietly ignore this restriction.) Instead, save the window configuration only when someone asks for help, and restore afterwards, and otherwise leave it alone.
author michaels
date Sat, 02 Aug 2003 08:42:11 +0000
parents 79940b592197
children 488b2f76d852
comparison
equal deleted inserted replaced
1600:98419bcfe892 1601:442db3c3c43b
488 ;; The problem here is that you can't scroll the help screen; as soon 488 ;; The problem here is that you can't scroll the help screen; as soon
489 ;; as you press a key, it's gone. I don't know of a good way to fix 489 ;; as you press a key, it's gone. I don't know of a good way to fix
490 ;; it, though. -hniksic 490 ;; it, though. -hniksic
491 (defun isearch-mode-help () 491 (defun isearch-mode-help ()
492 (interactive "_") 492 (interactive "_")
493 (let ((w (selected-window))) 493 (let ((config (current-window-configuration)))
494 (describe-function 'isearch-forward) 494 (let ((w (selected-window)))
495 (select-window w)) 495 (describe-function 'isearch-forward)
496 (isearch-update)) 496 (select-window w))
497 (isearch-update)
498 (setq isearch-window-configuration config)))
497 499
498 500
499 ;;;================================================================== 501 ;;;==================================================================
500 ;; isearch-mode only sets up incremental search for the minor mode. 502 ;; isearch-mode only sets up incremental search for the minor mode.
501 ;; All the work is done by the isearch-mode commands. 503 ;; All the work is done by the isearch-mode commands.
537 539
538 isearch-opoint (point) 540 isearch-opoint (point)
539 search-ring-yank-pointer nil 541 search-ring-yank-pointer nil
540 regexp-search-ring-yank-pointer nil 542 regexp-search-ring-yank-pointer nil
541 isearch-unhidden-extents nil 543 isearch-unhidden-extents nil
542 isearch-window-configuration (current-window-configuration)
543 544
544 ;; #### What we really need is a buffer-local 545 ;; #### What we really need is a buffer-local
545 ;; overriding-local-map. See isearch-pre-command-hook for 546 ;; overriding-local-map. See isearch-pre-command-hook for
546 ;; more details. 547 ;; more details.
547 overriding-local-map (progn 548 overriding-local-map (progn
582 ;;;==================================================== 583 ;;;====================================================
583 ;; Some high level utilities. Others below. 584 ;; Some high level utilities. Others below.
584 585
585 (defun isearch-update () 586 (defun isearch-update ()
586 ;; Called after each command to update the display. 587 ;; Called after each command to update the display.
588 (if isearch-window-configuration
589 (progn
590 (set-window-configuration isearch-window-configuration)
591 (setq isearch-window-configuration nil)))
587 (if (null unread-command-events) 592 (if (null unread-command-events)
588 (progn 593 (progn
589 (if (not (input-pending-p)) 594 (if (not (input-pending-p))
590 (isearch-message)) 595 (isearch-message))
591 (if (and isearch-slow-terminal-mode 596 (if (and isearch-slow-terminal-mode
620 ) 625 )
621 626
622 627
623 (defun isearch-done (&optional nopush edit) 628 (defun isearch-done (&optional nopush edit)
624 ;; Called by all commands that terminate isearch-mode. 629 ;; Called by all commands that terminate isearch-mode.
630 (setq isearch-window-configuration nil)
625 (let ((inhibit-quit t)) ; danger danger! 631 (let ((inhibit-quit t)) ; danger danger!
626 (if (and isearch-buffer (buffer-live-p isearch-buffer)) 632 (if (and isearch-buffer (buffer-live-p isearch-buffer))
627 ;; Some loser process filter might have switched the window's 633 ;; Some loser process filter might have switched the window's
628 ;; buffer, so be sure to set these variables back in the 634 ;; buffer, so be sure to set these variables back in the
629 ;; buffer we frobbed them in. But only if the buffer is still 635 ;; buffer we frobbed them in. But only if the buffer is still
646 ;; it's not critical that this be inside inhibit-quit, but leaving 652 ;; it's not critical that this be inside inhibit-quit, but leaving
647 ;; things in small-window-mode would be bad. 653 ;; things in small-window-mode would be bad.
648 (let ((found-start (window-start (selected-window))) 654 (let ((found-start (window-start (selected-window)))
649 (found-point (point))) 655 (found-point (point)))
650 (cond ((eq (selected-frame) isearch-selected-frame) 656 (cond ((eq (selected-frame) isearch-selected-frame)
651 (set-window-configuration isearch-window-configuration)
652
653 (if isearch-small-window 657 (if isearch-small-window
654 (goto-char found-point) 658 (goto-char found-point)
655 ;; Exiting the save-window-excursion clobbers 659 ;; Exiting the save-window-excursion clobbers
656 ;; window-start; restore it. 660 ;; window-start; restore it.
657 (set-window-start (selected-window) found-start t)))) 661 (set-window-start (selected-window) found-start t))))
766 ;;; (isearch-other-end isearch-other-end) 770 ;;; (isearch-other-end isearch-other-end)
767 (isearch-opoint isearch-opoint) 771 (isearch-opoint isearch-opoint)
768 (isearch-slow-terminal-mode isearch-slow-terminal-mode) 772 (isearch-slow-terminal-mode isearch-slow-terminal-mode)
769 (isearch-small-window isearch-small-window) 773 (isearch-small-window isearch-small-window)
770 (isearch-recursive-edit isearch-recursive-edit) 774 (isearch-recursive-edit isearch-recursive-edit)
771 (isearch-window-configuration (current-window-configuration))
772 (isearch-selected-frame (selected-frame)) 775 (isearch-selected-frame (selected-frame))
773 ) 776 )
774 ;; Actually terminate isearching until editing is done. 777 ;; Actually terminate isearching until editing is done.
775 ;; This is so that the user can do anything without failure, 778 ;; This is so that the user can do anything without failure,
776 ;; like switch buffers and start another isearch, and return. 779 ;; like switch buffers and start another isearch, and return.