bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] 21.3 ispell.el to support aspell better


From: Jari Aalto+mail.emacs
Subject: [patch] 21.3 ispell.el to support aspell better
Date: Thu, 02 Sep 2004 01:11:41 +0300
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux)


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  <jari dot aalto A T poboxes dot com>

        * 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 <cjm at pobox com>
        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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]