From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: jari.aalto@poboxes.com (Jari Aalto+mail.emacs) Newsgroups: gmane.emacs.bugs Subject: [patch] 21.3 ispell.el to support aspell better Date: Thu, 02 Sep 2004 01:11:41 +0300 Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87hdqhskpu.fsf@cante.net> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1094080921 29735 80.91.224.253 (1 Sep 2004 23:22:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 1 Sep 2004 23:22:01 +0000 (UTC) Cc: cjm@pobox.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 02 01:21:52 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1C2eQJ-0006iu-00 for ; Thu, 02 Sep 2004 01:21:51 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C2eVG-000696-6t for geb-bug-gnu-emacs@m.gmane.org; Wed, 01 Sep 2004 19:26:58 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C2eVC-00066q-H2 for bug-gnu-emacs@gnu.org; Wed, 01 Sep 2004 19:26:54 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C2eV7-00064W-Bb for bug-gnu-emacs@gnu.org; Wed, 01 Sep 2004 19:26:52 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C2eV7-00064M-4a for bug-gnu-emacs@gnu.org; Wed, 01 Sep 2004 19:26:49 -0400 Original-Received: from [193.229.0.35] (helo=fep31-app.kolumbus.fi) by monty-python.gnu.org with esmtp (Exim 4.34) id 1C2ePj-0004d9-2p for bug-gnu-emacs@gnu.org; Wed, 01 Sep 2004 19:21:15 -0400 Original-Received: from cante.net ([81.197.3.110]) by fep06-app.kolumbus.fi with ESMTP id <20040901221152.FUDP23657.fep06-app.kolumbus.fi@cante.net>; Thu, 2 Sep 2004 01:11:52 +0300 Original-Received: from jaalto by cante.net with local (Exim 4.34) id 1C2dKQ-0004ng-Ex; Thu, 02 Sep 2004 01:11:51 +0300 Original-To: bug-gnu-emacs@gnu.org User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: jari.aalto@poboxes.com X-SA-Exim-Version: 4.1 (built Tue, 17 Aug 2004 11:06:07 +0200) X-SA-Exim-Scanned: Yes (on cante.net) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:8905 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:8905 At http://aspell.neT there is additional patch to ispell.el. In 21.3 sources is was not yet present so I applied it and the patch seems to work ok. Here is the diffs that might be good idea for new release as well. 2004-09-02 Thu Jari Aalto * textmodes/ispell.el: 1.1.1.1 Applied Aspell patch from ftp://ftp.gnu.org/gnu/aspell/ispell.el-aspell-0.1.diff From: Christopher J. Madsen Date: Fri, 20 Dec 2002 14:46:22 -0600 (CST) The attached patch will notify aspell of the replacements you make so it can improve the suggestion list in the future. Index: ispell.el =================================================================== RCS file: /cygdrive/l/data/vc/cvsroot/lisp/emacs/21.3/lisp/textmodes/ispell.el,v retrieving revision 1.1.1.1 diff -u -IId: -b -w -c -r1.1.1.1 ispell.el *** ispell.el 26 Jun 2003 18:06:40 -0000 1.1.1.1 --- ispell.el 1 Sep 2004 21:59:24 -0000 *************** *** 721,726 **** --- 721,728 ---- (defconst ispell-version "ispell.el 3.4 -- Fri Aug 4 09:41:50 PDT 2000") + (defvar ispell-really-aspell nil) ;Non-nil if aspell extensions should be used + (defun check-ispell-version (&optional interactivep) "Ensure that `ispell-program-name' is valid and the correct version. *************** *** 788,794 **** (< (car (read-from-string (buffer-substring-no-properties (match-beginning 3)(match-end 3)))) (car (cdr (cdr ispell-required-version))))) ! (setq ispell-offset 0))) (kill-buffer (current-buffer))) result)) --- 790,801 ---- (< (car (read-from-string (buffer-substring-no-properties (match-beginning 3)(match-end 3)))) (car (cdr (cdr ispell-required-version))))) ! (setq ispell-offset 0)) ! ;; check to see if it's really aspell. ! (goto-char (point-min)) ! (let (case-fold-search) ! (setq ispell-really-aspell ! (and (search-forward "(but really Aspell " nil t) t)))) (kill-buffer (current-buffer))) result)) *************** *** 1305,1310 **** --- 1312,1323 ---- (delete-region start (point))) (setq more-lines (= 0 (forward-line)))))))))))))) + (defun ispell-send-replacement (misspelled replacement) + "Notify aspell that MISSPELLED should be spelled REPLACEMENT. + This allows it to improve the suggestion list based on actual mispellings." + (and ispell-really-aspell + (ispell-send-string (concat "$$ra " misspelled "," replacement "\n")))) + ;;;###autoload *************** *** 2703,2712 **** --- 2716,2727 ---- (if (not (listp replace)) (progn (insert replace) ; insert dictionary word + (ispell-send-replacement (car poss) replace) (setq accept-list (cons replace accept-list))) (let ((replace-word (car replace))) ;; Recheck hand entered replacement word (insert replace-word) + (ispell-send-replacement (car poss) replace-word) (if (car (cdr replace)) (save-window-excursion (delete-other-windows) ; to correctly show help.