From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: ispell highlighting Date: Tue, 18 Jan 2005 12:47:14 +0200 Organization: JURTA Message-ID: <877jmbnhci.fsf@jurta.org> References: <87wtujuzd3.fsf@jurta.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1106048249 28865 80.91.229.6 (18 Jan 2005 11:37:29 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 18 Jan 2005 11:37:29 +0000 (UTC) Cc: k.stevens@ieee.org, ispell-el-bugs@itcorp.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 18 12:37:22 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Cqrfl-0004MT-00 for ; Tue, 18 Jan 2005 12:37:22 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Cqrrf-0004T4-FU for ged-emacs-devel@m.gmane.org; Tue, 18 Jan 2005 06:49:39 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Cqrn4-0001iZ-TE for emacs-devel@gnu.org; Tue, 18 Jan 2005 06:44:55 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Cqrlq-0001Jo-1a for emacs-devel@gnu.org; Tue, 18 Jan 2005 06:43:38 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Cqrb0-0007pq-Kg for emacs-devel@gnu.org; Tue, 18 Jan 2005 06:32:26 -0500 Original-Received: from [194.126.101.114] (helo=HOT-Bounce1.hot.ee) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Cqr6E-0004x9-HQ for emacs-devel@gnu.org; Tue, 18 Jan 2005 06:00:38 -0500 Original-Received: from localhost (HOT-Bounce1 [127.0.0.1]) by HOT-Bounce1.hot.ee (Postfix) with ESMTP id 2231A184CD for ; Tue, 18 Jan 2005 12:57:13 +0200 (EET) Original-Received: from HOT-Bounce1.hot.ee ([127.0.0.1]) by localhost (HOT-Bounce1 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 20582-12 for ; Tue, 18 Jan 2005 12:57:13 +0200 (EET) Original-Received: from MXR-1.estpak.ee (unknown [192.168.1.20]) by HOT-Bounce1.hot.ee (Postfix) with ESMTP id 0F367184BE for ; Tue, 18 Jan 2005 12:57:13 +0200 (EET) Original-Received: from mail.neti.ee (80-235-38-192-dsl.mus.estpak.ee [80.235.38.192]) by MXR-1.estpak.ee (Postfix) with ESMTP id 3588E14C3BE; Tue, 18 Jan 2005 13:00:30 +0200 (EET) Original-To: emacs-devel@gnu.org In-Reply-To: <87wtujuzd3.fsf@jurta.org> (Juri Linkov's message of "Wed, 12 Jan 2005 03:59:09 +0200") User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) X-Virus-Scanned: by amavisd-new-2.2.1 (20041222) (Debian) at neti.ee X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:32328 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:32328 Below is an improved patch for ispell.el. I changed isearch-regexp for highlighting from `nil' to `t', added `regexp-quote' and "\\b" around the string. This may not highlight all words correctly according to CASECHARS rules, but at least it will highlight exactly the same words that will be replaced by query-replace invoked from ispell.el after typing R. (And when query-replace is activated from ispell.el, it rehighlights the same words with its own highlighting). Index: lisp/textmodes/ispell.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/textmodes/ispell.el,v retrieving revision 1.152 diff -u -r1.152 ispell.el --- lisp/textmodes/ispell.el 13 Jan 2005 04:33:05 -0000 1.152 +++ lisp/textmodes/ispell.el 18 Jan 2005 09:51:25 -0000 @@ -237,7 +237,17 @@ :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 "21.4") + +(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'. @@ -2181,8 +2191,21 @@ (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)) + (isearch-lazy-highlight-cleanup lazy-highlight-cleanup) + (setq isearch-lazy-highlight-last-string nil)))) (defun ispell-highlight-spelling-error (start end &optional highlight refresh) -- Juri Linkov http://www.jurta.org/emacs/