[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
isearch+.el - extensions to GNU `isearch.el'
From: |
Drew Adams |
Subject: |
isearch+.el - extensions to GNU `isearch.el' |
Date: |
Tue, 16 Jan 2001 21:35:20 -0500 |
;;; isearch+.el --- Extensions to `isearch.el'.
;;
;; Emacs Lisp Archive Entry
;; Filename: isearch+.el
;; Description: Extensions to `isearch.el'.
;; Author: Drew Adams
;; Maintainer: Drew Adams
;; Copyright (C) 1996-2001, Drew Adams, all rights reserved.
;; Created: Fri Dec 15 10:44:14 1995
;; Version: $Id: isearch+.el,v 1.4 2001/01/08 23:21:53 dadams Exp $
;; Last-Updated: Mon Jan 8 15:21:40 2001
;; By: dadams
;; Update #: 178
;; Keywords: help, matching, internal, local
;; Compatibility: GNU Emacs 20.x
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; Extensions to `isearch.el'.
;;
;;
;; ***** NOTE: The following functions defined in `isearch.el' have
;; been REDEFINED HERE:
;;
;; `isearch-mode-help' - Dehighlights *Help* buffer. Lists bindings.
;; `isearch-search' - 1. Prevent null `isearch-string' from giving
;; `wrong-type-arg' error. This fixes a bug:
;; C-M-s M-p C-s with no previous regexp.
;; 2. The general `error' handler now shows the
;; whole error message to the user (in
;; `isearch-invalid-regexp'). The original
;; version showed just (cadr lossage), assuming
;; that the error was a regexp stack overflow.
;;
;;
;; The following bindings are made here for incremental search mode
;; (`C-s' prefix):
;;
;; `C-c' `isearch-toggle-case-fold'
;; `C-h' `isearch-mode-help'
;; `C-j' `isearch-edit-string'
;; `C-t' `isearch-toggle-regexp'
;;
;;
;; This file should be loaded after loading the standard GNU file
;; `isearch.el'. So, in your `~/.emacs' file, do this:
;; (eval-after-load "isearch" '(require 'isearch+))
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Change log:
;;
;; RCS $Log: isearch+.el,v $
;; RCS Revision 1.4 2001/01/08 23:21:53 dadams
;; RCS Adapted file header for Emacs Lisp Archive.
;; RCS
;; RCS Revision 1.3 2001/01/03 17:39:08 dadams
;; RCS *** empty log message ***
;; RCS
;; RCS Revision 1.2 2001/01/03 00:46:44 dadams
;; RCS *** empty log message ***
;; RCS
;; RCS Revision 1.1 2000/09/14 17:20:41 dadams
;; RCS Initial revision
;; RCS
; Revision 1.5 1999/09/09 12:47:57 dadams
; Corrected test for minibuffer-only frame: use create-builtin-frames.
;
; Revision 1.4 1999/08/25 13:58:55 dadams
; *** empty log message ***
;
; Revision 1.3 1999/04/01 13:33:53 dadams
; Don't add color-*-minibuffer-frame as hook if no separate minibuf frame.
;
; Revision 1.2 1999/03/17 14:51:20 dadams
; 1. color-isearch-minibuffer-frame: use x-color-defined-p, not
; x-defined-colors.
; 2. Updated to corrspond to Emacs 34.1 version.
;
; Revision 1.1 1997/03/20 13:42:25 dadams
; Initial revision
;
; Revision 1.14 1996/07/01 13:15:30 dadams
; (trivial)
;
; Revision 1.13 1996/06/20 11:58:11 dadams
; (trivial)
;
; Revision 1.12 1996/06/14 13:53:20 dadams
; Updated file header Commentary to mention new fns and vars defined here.
;
; Revision 1.11 1996/06/06 14:10:13 dadams
; 1. Require help.el.
; 2. Update of file dependency comments (e.g. "Autoloaded from...").
;
; Revision 1.10 1996/04/24 15:50:41 dadams
; Added redefinition of isearch-search. Require cl.el.
;
; Revision 1.9 1996/04/15 07:37:51 dadams
; Changed isearch-minibuffer-frame-background to "bisque".
;
; Revision 1.8 1996/04/12 15:47:37 dadams
; Added isearch-minibuffer-frame-background, color-isearch-minibuffer-frame.
; Use as isearch-mode-hook. isearch-mode-end-hook resets color.
;
; Revision 1.7 1996/04/05 14:30:09 dadams
; Improved Commentary: List redefinitions.
;
; Revision 1.6 1996/03/08 12:26:46 dadams
; Copyright.
;
; Revision 1.5 1996/02/15 16:10:28 dadams
; (trivial)
;
; Revision 1.4 1996/02/12 10:01:40 dadams
; Updated header keywords (for finder).
;
; Revision 1.3 1995/12/28 06:59:28 dadams
; Changed isearch-edit-string binding.
;
; Revision 1.1 1995/12/15 09:57:06 dadams
; Initial revision
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
;; Cannot do (require 'isearch), because `isearch.el' does no `provide'.
;; Don't want to do a (load-library "isearch") either, because it wouldn't
;; allow doing (eval-after-load "isearch" '(progn (require 'isearch+)))
(provide 'isearch+)
;;;;;;;;;;;;;;;;;;;;;;;;;
(add-hook 'isearch-mode-hook
(function
(lambda ()
(define-key isearch-mode-map "\C-h" 'isearch-mode-help)
(define-key isearch-mode-map "\C-t" 'isearch-toggle-regexp)
(define-key isearch-mode-map "\C-c" 'isearch-toggle-case-fold)
(define-key isearch-mode-map "\C-j" 'isearch-edit-string))))
;; An alternative to binding `isearch-edit-string' (but less flexible):
;; (setq search-exit-option 'edit) ; M- = edit search string, not exit.
;; REPLACES ORIGINAL in `isearch.el':
;; 1. Ends isearch: does `isearch-done' and `isearch-clean-overlays'
;; instead of `isearch-update'.
;; 2. Lists isearch bindings too,
;;;###autoload
(defun isearch-mode-help ()
(interactive)
(describe-function 'isearch-forward)
(isearch-done)
(isearch-clean-overlays)
(save-excursion
(set-buffer "*Help*")
(goto-char (point-max))
(let ((buffer-read-only nil))
(insert (substitute-command-keys "
Bindings in Isearch minor mode:
------------------------------
\\{isearch-mode-map}")))))
;;;(require 'cl) ;; when, unless, cadr
;;;;; REPLACES ORIGINAL in `isearch.el':
;;;;; 1. Prevent null `isearch-string' from giving wrong-type-arg error.
;;;;; This fixes a bug: C-M-s M-p C-s with no previous regexp search.
;;;;; 2. The general `error' handler shows the whole error message to
;;;;; user (in `isearch-invalid-regexp'). The original version showed
;;;;; just (cadr lossage).
;;;;;;###autoload
;;;(defun isearch-search ()
;;; ;; Do the search with the current search string.
;;; (isearch-message nil t)
;;; (when (and (eq isearch-case-fold-search t) search-upper-case)
;;; (setq isearch-case-fold-search
;;; (isearch-no-upper-case-p isearch-string isearch-regexp)))
;;; (condition-case lossage
;;; (let ((inhibit-quit nil)
;;; (case-fold-search isearch-case-fold-search))
;;; (when isearch-regexp (setq isearch-invalid-regexp nil))
;;; (setq isearch-within-brackets nil)
;;; ;; Prevent a null isearch-string from giving a wrong-type-arg error.
;;; (setq isearch-string (or isearch-string ""))
;;; (setq isearch-success
;;; (funcall (cond (isearch-word (if isearch-forward
;;; 'word-search-forward
;;; 'word-search-backward))
;;; (isearch-regexp (if isearch-forward
;;; 're-search-forward
;;; 're-search-backward))
;;; (t (if isearch-forward 'search-forward
;;; 'search-backward)))
;;; isearch-string nil t))
;;; (setq isearch-just-started nil)
;;; (when isearch-success (setq isearch-other-end (if isearch-forward
;;; (match-beginning 0)
;;; (match-end 0)))))
;;; (quit (isearch-unread ?\C-g) (setq isearch-success nil))
;;; (invalid-regexp
;;; (setq isearch-invalid-regexp (cadr lossage))
;;; (setq isearch-within-brackets (string-match "\\`Unmatched \\["
;;; isearch-invalid-regexp))
;;; (when (string-match "\\`Premature \\|\\`Unmatched \\|\\`Invalid "
;;; isearch-invalid-regexp)
;;; (setq isearch-invalid-regexp "incomplete input")))
;;; ;; Stack overflow in regexp search. (original comment)
;;; ;; The original version set `isearch-invalid-regexp' to: (cadr lossage).
;;; ;; But this handler catches all errors, not just regexp stack overflow,
;;; ;; so it may be best to show the whole error message to the user (in
;;; ;; `isearch-invalid-regexp').
;;; (error (setq isearch-invalid-regexp (format "%s" lossage))))
;;; (unless isearch-success
;;; ;; Ding if failed this time after succeeding last time.
;;; (when (nth 3 (car isearch-cmds)) (ding))
;;; (goto-char (nth 2 (car isearch-cmds)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; `isearch+.el' ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- isearch+.el - extensions to GNU `isearch.el',
Drew Adams <=