[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/lisp ChangeLog textmodes/ispell.el
From: |
Agustin Martin Domingo |
Subject: |
[Emacs-diffs] emacs/lisp ChangeLog textmodes/ispell.el |
Date: |
Sat, 20 Dec 2008 18:34:45 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Agustin Martin Domingo <agmartin> 08/12/20 18:34:44
Modified files:
lisp : ChangeLog
lisp/textmodes : ispell.el
Log message:
* textmodes/ispell.el (ispell-check-minver): New function.
(ispell-check-version): Rewrite spellchecker and version checking.
Use (ispell-check-minver). Handle hunspell versions.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.14976&r2=1.14977
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/textmodes/ispell.el?cvsroot=emacs&r1=1.237&r2=1.238
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.14976
retrieving revision 1.14977
diff -u -b -r1.14976 -r1.14977
--- ChangeLog 20 Dec 2008 10:29:46 -0000 1.14976
+++ ChangeLog 20 Dec 2008 18:34:41 -0000 1.14977
@@ -1,3 +1,9 @@
+2008-12-20 Agustin Martin <address@hidden>
+
+ * textmodes/ispell.el (ispell-check-minver): New function.
+ (ispell-check-version): Rewrite spellchecker and version checking.
+ Use (ispell-check-minver). Handle hunspell versions.
+
2008-12-20 Chong Yidong <address@hidden>
* ido.el (ido-read-internal): Handle `confirm' and
@@ -35,7 +41,7 @@
(authors-canonical-author-name): Doc fix. Respect authors-fixed-case.
(authors): Ensure error buffer is writable.
-2008-12-18 AgustÃn MartÃn <address@hidden>
+2008-12-18 Agustin Martin <address@hidden>
(ispell-really-hunspell): New variable to signal hunspell.
(ispell-check-version):
Index: textmodes/ispell.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/textmodes/ispell.el,v
retrieving revision 1.237
retrieving revision 1.238
diff -u -b -r1.237 -r1.238
--- textmodes/ispell.el 18 Dec 2008 18:44:31 -0000 1.237
+++ textmodes/ispell.el 20 Dec 2008 18:34:44 -0000 1.238
@@ -196,6 +196,42 @@
;; Improved message reference matching in `ispell-message'.
;; Fixed bug in returning to nroff mode from tex mode.
+;;; Compatibility code for xemacs and (not too) older emacsen:
+
+(if (fboundp 'version<=)
+ (defalias 'ispell-check-minver 'version<=)
+ (defun ispell-check-minver (minver version)
+ "Check if string VERSION is at least string MINVER.
+Both must be in [0-9]+.[0-9]+... format. This is a fallback
+compatibility function in case version<= is not available."
+ (let ((pending t)
+ (return t)
+ start-ver start-mver)
+ ;; Loop until an absolute greater or smaller condition is reached
+ ;; or until no elements are left in any of version and minver. In
+ ;; this case version is exactly the minimal, so return OK.
+ (while pending
+ (let (ver mver)
+ (if (string-match "[0-9]+" version start-ver)
+ (setq start-ver (match-end 0)
+ ver (string-to-int (substring version (match-beginning 0)
(match-end 0)))))
+ (if (string-match "[0-9]+" minver start-mver)
+ (setq start-mver (match-end 0)
+ mver (string-to-int (substring minver (match-beginning 0)
(match-end 0)))))
+
+ (if (or ver mver)
+ (progn
+ (or ver (setq ver 0))
+ (or mver (setq mver 0))
+ ;; If none of below conditions match, this element is the
+ ;; same. Go checking next element.
+ (if (> ver mver)
+ (setq pending nil)
+ (if (< ver mver)
+ (setq pending nil
+ return nil))))
+ (setq pending nil))))
+ return)))
;;; Code:
@@ -714,7 +750,7 @@
(default-directory (or (and (boundp 'temporary-file-directory)
temporary-file-directory)
default-directory))
- result status)
+ result status ispell-program-version)
(save-excursion
(let ((buf (get-buffer " *ispell-tmp*")))
(if buf (kill-buffer buf)))
@@ -746,43 +782,51 @@
(if (not (memq status '(0 nil)))
(error "%s exited with %s %s" ispell-program-name
(if (stringp status) "signal" "code") status))
- (setq case-fold-search t
- status (re-search-forward
- (concat "\\<\\("
- (format "%d" (car ispell-required-version))
- "\\)\\.\\([0-9]*\\)\\.\\([0-9]*\\)\\>")
- nil t)
- case-fold-search case-fold-search-val)
- (if (or (not status) ; major version mismatch
- (< (car (read-from-string (match-string-no-properties 2)))
- (car (cdr ispell-required-version)))) ; minor version mismatch
- (error "%s version 3 release %d.%d.%d or greater is required"
- 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 or hunspell.
- (goto-char (point-min))
+ ;; Get relevant version strings. Only xx.yy.... format works well
(let (case-fold-search)
- (or
- (setq ispell-really-aspell
+ (setq ispell-program-version
+ (and (search-forward-regexp "\\([0-9]+\\.[0-9\\.]+\\)" nil t)
+ (match-string 1)))
+
+ ;; Make sure these variables are (re-)initialized to the default value
+ (setq ispell-really-aspell nil
+ ispell-aspell-supports-utf8 nil
+ ispell-really-hunspell nil)
+
+ (goto-char (point-min))
+ (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)))
+ "(but really Aspell \\([0-9]+\\.[0-9\\.]+\\)?)" nil t)
+ (match-string 1)))
(setq ispell-really-hunspell
- (search-forward-regexp
- "(but really Hunspell \\(.*?\\)\\(-[0-9]+\\)?)" nil t))
- )))
+ (and (search-forward-regexp
+ "(but really Hunspell \\([0-9]+\\.[0-9\\.]+\\)?)" nil t)
+ (match-string 1)))))
+
+ (let ((aspell-minver "0.50")
+ (aspell8-minver "0.60")
+ (ispell0-minver "3.1.0")
+ (ispell-minver "3.1.12")
+ (hunspell8-minver "1.1.6"))
+
+ (if (ispell-check-minver ispell0-minver ispell-program-version)
+ (or (ispell-check-minver ispell-minver ispell-program-version)
+ (setq ispell-offset 0))
+ (error "%s release %s or greater is required"
+ ispell-program-name
+ ispell-minver))
+
+ (cond
+ (ispell-really-aspell
+ (if (ispell-check-minver aspell-minver ispell-really-aspell)
+ (if (ispell-check-minver aspell8-minver ispell-really-aspell)
+ (setq ispell-aspell-supports-utf8 t))
+ (setq ispell-really-aspell nil)))
+ (ispell-really-hunspell
+ (or (ispell-check-minver hunspell8-minver ispell-really-hunspell)
+ (setq ispell-really-hunspell nil)))))
+
(kill-buffer (current-buffer)))
result))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs/lisp ChangeLog textmodes/ispell.el,
Agustin Martin Domingo <=