emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/lisp/textmodes flyspell.el ispell.el


From: Agustin Martin Domingo
Subject: [Emacs-diffs] emacs/lisp/textmodes flyspell.el ispell.el
Date: Thu, 18 Dec 2008 18:44:32 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Agustin Martin Domingo <agmartin>       08/12/18 18:44:32

Modified files:
        lisp/textmodes : flyspell.el ispell.el 

Log message:
        (ispell-really-hunspell): new variable to signal hunspell
        (ispell-check-version):
        Check if hunspell and set ispell-really-hunspell if needed
        (ispell-send-string), (ispell-start-process), (flyspell-large-region):
        Pass right options for hunspell if needed

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/textmodes/flyspell.el?cvsroot=emacs&r1=1.137&r2=1.138
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/textmodes/ispell.el?cvsroot=emacs&r1=1.236&r2=1.237

Patches:
Index: flyspell.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/textmodes/flyspell.el,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -b -r1.137 -r1.138
--- flyspell.el 17 Sep 2008 00:55:38 -0000      1.137
+++ flyspell.el 18 Dec 2008 18:44:31 -0000      1.138
@@ -1526,6 +1526,7 @@
          (or ispell-local-pdict ispell-personal-dictionary))
     (let ((args (ispell-get-ispell-args))
          (encoding (ispell-get-coding-system))
+         encoding-command
          c)
       (if (and ispell-current-dictionary  ; use specified dictionary
               (not (member "-d" args)))  ; only define if not overridden
@@ -1538,14 +1539,21 @@
                              (expand-file-name
                               ispell-current-personal-dictionary)))))
       (setq args (append args ispell-extra-args))
-      (if (and ispell-really-aspell
-              ispell-aspell-supports-utf8)
+
+      ;; If we are using recent aspell or hunspell, make sure we use the right 
encoding
+      ;; for communication. ispell or older aspell/hunspell does not support 
this
+      (if (or (and ispell-really-aspell
+                  ispell-aspell-supports-utf8
+                  (setq encoding-command "--encoding="))
+             (and ispell-really-hunspell
+                  (setq encoding-command "-i ")))
          (setq args
                (append args
                        (list
-                        (concat "--encoding="
+                        (concat encoding-command
                                 (symbol-name
                                  encoding))))))
+
       (let ((process-coding-system-alist (list (cons "\\.*" encoding))))
        (setq c (apply 'ispell-call-process-region beg
                       end

Index: ispell.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/textmodes/ispell.el,v
retrieving revision 1.236
retrieving revision 1.237
diff -u -b -r1.236 -r1.237
--- ispell.el   18 Nov 2008 21:42:20 -0000      1.236
+++ ispell.el   18 Dec 2008 18:44:31 -0000      1.237
@@ -669,6 +669,7 @@
 LANGUAGE.aff file \(e.g., english.aff\).")
 
 (defvar ispell-really-aspell nil) ; Non-nil if aspell extensions should be used
+(defvar ispell-really-hunspell nil) ; Non-nil if hunspell extensions should be 
used
 
 (defvar ispell-aspell-supports-utf8 nil
   "Non-nil means to try to automatically find aspell dictionaries.
@@ -759,22 +760,29 @@
                 ispell-program-name (car ispell-required-version)
                 (car (cdr ispell-required-version))
                 (car (cdr (cdr ispell-required-version))))
+
        ;; check that it is the correct version.
        (if (and (= (car (read-from-string (match-string-no-properties 2)))
                    (car (cdr ispell-required-version)))
                 (< (car (read-from-string (match-string-no-properties 3)))
                    (car (cdr (cdr ispell-required-version)))))
           (setq ispell-offset 0))
-        ;; Check to see if it's really aspell.
+
+        ;; Check to see if it's really aspell or hunspell.
         (goto-char (point-min))
         (let (case-fold-search)
+         (or
           (setq ispell-really-aspell
                (and (search-forward-regexp
                      "(but really Aspell \\(.*?\\)\\(-[0-9]+\\)?)" nil t)
                     (progn
                       (setq ispell-aspell-supports-utf8
                             (not (version< (match-string 1) "0.60")))
-                      t)))))
+                       t)))
+          (setq ispell-really-hunspell
+                (search-forward-regexp
+                 "(but really Hunspell \\(.*?\\)\\(-[0-9]+\\)?)" nil t))
+          )))
       (kill-buffer (current-buffer)))
     result))
 
@@ -1493,7 +1501,10 @@
                           (point-min) (point-max)
                           ispell-program-name nil
                           output-buf nil
-                          "-a" "-m" ispell-args))
+                          "-a"
+                          ;; hunspell -m option means something different
+                          (if ispell-really-hunspell "" "-m")
+                          ispell-args))
              (set-buffer output-buf)
              (goto-char (point-min))
              (save-match-data
@@ -2473,6 +2484,7 @@
   "Start the ispell process, with support for no asynchronous processes.
 Keeps argument list for future ispell invocations for no async support."
   (let ((default-directory default-directory)
+       encoding-command
        args)
     (unless (and (file-directory-p default-directory)
                 (file-readable-p default-directory))
@@ -2493,12 +2505,18 @@
              (append args
                      (list "-p"
                            (expand-file-name 
ispell-current-personal-dictionary)))))
-    (if (and ispell-really-aspell
-            ispell-aspell-supports-utf8)
+
+    ;; If we are using recent aspell or hunspell, make sure we use the right 
encoding
+    ;; for communication. ispell or older aspell/hunspell does not support this
+    (if (or (and ispell-really-aspell
+                ispell-aspell-supports-utf8
+                (setq encoding-command "--encoding="))
+           (and ispell-really-hunspell
+                (setq encoding-command "-i ")))
        (setq args
              (append args
                      (list
-                      (concat "--encoding="
+                      (concat encoding-command
                               (symbol-name (ispell-get-coding-system)))))))
     (setq args (append args ispell-extra-args))
 
@@ -2510,8 +2528,8 @@
          (apply 'start-process
                 "ispell" nil ispell-program-name
                 "-a"                   ; accept single input lines
-                "-m"                   ; make root/affix combos not in dict
-                args))
+                (if ispell-really-hunspell "" "-m") ; make root/affix combos 
not in dict
+                args))                              ; hunspell -m option means 
different
       (setq ispell-cmd-args args
            ispell-output-buffer (generate-new-buffer " *ispell-output*")
            ispell-session-buffer (generate-new-buffer " *ispell-session*"))




reply via email to

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