From 1332f1a08b5261f4681cf3b01e2cad2c42ff367a Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Fri, 18 Mar 2005 10:01:12 +0000 Subject: [PATCH] (ispell-lazy-highlight): New defcustom. (ispell-highlight-face): Set default face to `isearch' when lazy highlighting is enabled. (ispell-highlight-spelling-error-overlay): Set `ispell-overlay' priority to 1. Add lazy highlighting. (ispell-highlight-spelling-error-xemacs): Remove obsolete arg from `isearch-dehighlight'. --- lisp/ChangeLog | 33 +++++++++++++++++++++++++++++++++ lisp/textmodes/ispell.el | 31 ++++++++++++++++++++++++++++--- 2 files changed, 61 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 24b68851034..6a005871549 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,36 @@ +2005-03-18 Juri Linkov + + * isearch.el (isearch-lazy-highlight-new-loop): + Make arguments beg and end optional. + (isearch-update): Remove optional arguments nil from + isearch-lazy-highlight-new-loop. + (isearch-lazy-highlight-search): Let-bind case-fold-search to + isearch-lazy-highlight-case-fold-search instead of + isearch-case-fold-search, and let-bind isearch-regexp to + isearch-lazy-highlight-regexp. Use + isearch-lazy-highlight-last-string instead of isearch-string. + + * replace.el (perform-replace): Remove bindings of global + variables isearch-string, isearch-regexp, isearch-case-fold-search. + Add three new arguments to `replace-highlight'. + (replace-highlight): Add arguments string, regexp, case-fold. + Let-bind isearch-string, isearch-regexp, isearch-case-fold-search + to allow isearch-lazy-highlight-new-loop to use these values + to set corresponding isearch-lazy-highlight-... internal + variables whose values lazy highlighting will use regardless of + changes to global variables isearch-string, isearch-regexp, + isearch-case-fold-search during lazy highlighting loop. + (replace-dehighlight): Rename `isearch-lazy-highlight-cleanup' + to `lazy-highlight-cleanup'. + + * textmodes/ispell.el (ispell-lazy-highlight): New defcustom. + (ispell-highlight-face): Set default face to `isearch' when + lazy highlighting is enabled. + (ispell-highlight-spelling-error-overlay): Set `ispell-overlay' + priority to 1. Add lazy highlighting. + (ispell-highlight-spelling-error-xemacs): Remove obsolete arg + from `isearch-dehighlight'. + 2005-03-18 David Ponce * files.el (hack-local-variables): Do a case-insensitive search diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 38f69bd2250..a55f79381bb 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -238,7 +238,17 @@ When set to `block', assumes a block cursor with TTY displays." :type '(choice (const block) (const :tag "off" nil) (const :tag "on" t)) :group 'ispell) -(defcustom ispell-highlight-face 'highlight +(defcustom ispell-lazy-highlight (boundp 'lazy-highlight-cleanup) + "*Controls the lazy-highlighting of spelling errors. +When non-nil, all text in the buffer matching the current spelling +error is highlighted lazily using isearch lazy highlighting (see +`lazy-highlight-initial-delay' and `lazy-highlight-interval')." + :type 'boolean + :group 'lazy-highlight + :group 'ispell + :version "22.1") + +(defcustom ispell-highlight-face (if ispell-lazy-highlight 'isearch 'highlight) "*The face used for Ispell highlighting. For Emacses with overlays. Possible values are `highlight', `modeline', `secondary-selection', `region', and `underline'. @@ -2160,7 +2170,7 @@ When the optional third arg HIGHLIGHT is set, the word is highlighted, otherwise it is displayed normally." (if highlight (isearch-highlight start end) - (isearch-dehighlight t)) + (isearch-dehighlight)) ;;(sit-for 0) ) @@ -2174,8 +2184,23 @@ The variable `ispell-highlight-face' selects the face to use for highlighting." (if highlight (progn (setq ispell-overlay (make-overlay start end)) + (overlay-put ispell-overlay 'priority 1) ;higher than lazy overlays (overlay-put ispell-overlay 'face ispell-highlight-face)) - (delete-overlay ispell-overlay))) + (delete-overlay ispell-overlay)) + (if (and ispell-lazy-highlight (boundp 'lazy-highlight-cleanup)) + (if highlight + (let ((isearch-string + (concat + "\\b" + (regexp-quote (buffer-substring-no-properties start end)) + "\\b")) + (isearch-regexp t) + (isearch-case-fold-search nil)) + (isearch-lazy-highlight-new-loop + (if (boundp 'reg-start) reg-start) + (if (boundp 'reg-end) reg-end))) + (lazy-highlight-cleanup lazy-highlight-cleanup) + (setq isearch-lazy-highlight-last-string nil)))) (defun ispell-highlight-spelling-error (start end &optional highlight refresh) -- 2.39.2