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: ispell highlighting Date: Wed, 12 Jan 2005 03:59:09 +0200 Organization: JURTA Message-ID: <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 1105499745 29337 80.91.229.6 (12 Jan 2005 03:15:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 12 Jan 2005 03:15:45 +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 Wed Jan 12 04:15:38 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 1CoYyv-00088A-00 for ; Wed, 12 Jan 2005 04:15:37 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CoZAV-0002YP-Ti for ged-emacs-devel@m.gmane.org; Tue, 11 Jan 2005 22:27:35 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1CoZ9U-000274-KU for emacs-devel@gnu.org; Tue, 11 Jan 2005 22:26:32 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1CoZ9S-00025V-FM for emacs-devel@gnu.org; Tue, 11 Jan 2005 22:26:30 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CoZ9R-00025K-Bs for emacs-devel@gnu.org; Tue, 11 Jan 2005 22:26:29 -0500 Original-Received: from [194.126.101.98] (helo=MXR-3.estpak.ee) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CoYxp-0000wc-DJ for emacs-devel@gnu.org; Tue, 11 Jan 2005 22:14:29 -0500 Original-Received: from mail.neti.ee (80-235-40-7-dsl.mus.estpak.ee [80.235.40.7]) by MXR-3.estpak.ee (Postfix) with ESMTP id B6B02114CFF; Wed, 12 Jan 2005 05:14:24 +0200 (EET) Original-To: emacs-devel@gnu.org 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:32147 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:32147 Ispell is one of the few packages for which it would be natural to take advantage of isearch lazy highlighting. Actually, ispell.el already uses isearch highlighting to highlight spelling errors, but only for XEmacs in `ispell-highlight-spelling-error-xemacs'. (BTW, with the recent removal of arguments of `isearch-dehighlight' in Emacs CVS the byte compiler now started to complain in this function about missing arguments of `isearch-dehighlight'. Is it possible to enclose this line in a conditional construct for its compilation only in XEmacs?) I don't know what is the best way to get this change installed. Would maintainers of ispell.el prefer to update it on the Web page or is it right to simply install it in Emacs CVS? Anyway, the code below takes care of compatibility with other Emacs versions and will use lazy highlighting only in the presence of recently renamed lazy-highlight variables which guarantees that the code will correctly work (together with another patch I have just submitted and which I hope will be installed as well). Index: lisp/textmodes/ispell.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/textmodes/ispell.el,v retrieving revision 1.151 diff -u -r1.151 ispell.el --- lisp/textmodes/ispell.el 22 Dec 2004 00:22:58 -0000 1.151 +++ lisp/textmodes/ispell.el 12 Jan 2005 01:01:30 -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'. @@ -2142,8 +2152,17 @@ (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 (buffer-substring-no-properties start end)) + (isearch-regexp nil) + (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/