Subject: Re: bug#25107: Acknowledgement (Patches to clean up ispell.el)

From: Reuben Thomas <[email-masked]>
Date: Tue, 13 Dec 2016 00:55:55 +0000

One final update to this patch series: I added a patch to remove support
for aspell < 0.60 (released in 2004).

-- 
http://rrt.sc3d.org
From de69e5faf89edc5b2bad555bad8e1440d1191260 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Sun, 4 Dec 2016 00:49:35 +0000
Subject: [PATCH 02/25] Remove ispell.el pre-GNU Emacs comments

* lisp/textmodes/ispell.el (Commentary): Remove original maintainer
  details, as Emacs version, bug report address and so forth should be
  used instead for this version.  Remove in-line change history; use
  git instead.
---
 lisp/textmodes/ispell.el | 77 ------------------------------------------------
 1 file changed, 77 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 5d5d422..25099e3 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -3,12 +3,7 @@
 ;; Copyright (C) 1994-1995, 1997-2016 Free Software Foundation, Inc.
 
 ;; Author:           Ken Stevens <[email-masked]>
-;; Maintainer:       Ken Stevens <[email-masked]>
-;; Stevens Mod Date: Mon Jan  7 12:32:44 PST 2003
-;; Stevens Revision: 3.6
 ;; Status          : Release with 3.1.12+ and 3.2.0+ ispell.
-;; Bug Reports     : [email-masked]
-;; Web Site        : http://kdstevens.com/~stevens/ispell-page.html
 ;; Keywords: unix wp
 
 ;; This file is part of GNU Emacs.
@@ -123,78 +118,6 @@
 ;;  Recursive edits (?C-r or ?R) inside a keyboard text replacement check (?r)
 ;;    can cause misalignment errors.
 
-;; HISTORY
-
-;; Modifications made in latest versions:
-
-;; Revision 3.6 2003/01/07 12:32:44	kss
-;; Removed extra -d LIB in dictionary defs. (Pavel Janik)
-;; Filtered process calls with duplicate dictionary entries.
-;; Fixed bug where message-text-end is inside a mime skipped region.
-;; Minor fixes to get ispell menus right in XEmacs
-;; Fixed skip regexp so it doesn't match stuff like `/.\w'.
-;; Detecting dictionary change not working.  Fixed.  kss
-;; function `ispell-change-dictionary' now only completes valid dicts.
-
-;; Revision 3.5 2001/7/11 18:43:57	kss
-;; Added fix for aspell to work in XEmacs (ispell-check-version).
-;; Added Portuguese dictionary definition.
-;; New feature: MIME mail message support, Fcc support.
-;; Bug fix: retain comment syntax on lines with region skipping. (TeX $ bug...)
-;; Improved allocation for graphic mode lines.  (Miles Bader)
-;; Support -v flag for old versions of aspell.  (Eli Zaretskii)
-;; Clear minibuffer on ^G from ispell-help (Tak Ota)
-
-;; Revision 3.4 2000/8/4 09:41:50	kss
-;; Support new color display functions.
-;; Fixed misalignment offset bug when replacing a string after a shift made.
-;; Set to standard Author/Maintainer heading,
-;; ensure localwords lists are separated from the text by newline. (Dave Love)
-;; Added dictionary definition for Italian (William Deakin)
-;; HTML region skipping greatly improved. (Chuck D. Phillips)
-;; improved menus.  Fixed regexp matching http/email addresses.
-;; one arg always for XEmacs sleep-for (gunnar Evermann)
-;; support for synchronous processes (Eli Zaretskii)
-
-;; Revision 3.3  1999/11/29 11:38:34     kss
-;; Only word replacements entered in from the keyboard are rechecked.
-;; This fixes a bug in tex parsing and misalignment.
-;; Exceptions exist for recursive edit and query-replace, with tex error
-;; condition tested.  Recursive editing improved.
-;; XEmacs repair for when `enable-multibyte-characters' defined - Didier Verna.
-;; ispell-help fixed for XEmacs.  Choices minibuffer now displayed in XEmacs.
-;; Only list valid dictionaries in Spell menu.  Russian dictionary doesn't allow
-;; run-together words, and uses koi8-r font.  Don't skip text in html <TT>
-;; fonts.
-
-;; Revision 3.2  1999/5/7 14:25:14	kss
-;; Accept ispell versions 3.X.Y where X>=1
-;; fine tuned latex region skipping.  Fixed bug in ispell-word that did not
-;; point in right place on words < 2 chars.  Simplified ispell-minor-mode.
-;; Fixed bug in TeX parsing when math commands are in the comments.
-;; Removed calls to `when' macro.
-
-;; Revision 3.1  1998/12/1 13:21:52	kss
-;; Improved and fixed customize support.
-;; Improved and fixed comments in variables and messages.
-;; A coding system is now required for all languages.
-;; casechars improved for castellano, castellano8, and norsk dictionaries.
-;; Dictionary norsk7-tex removed.  Dictionary polish added.
-;; Dictionaries redefined at load-time to support dictionary changes.
-;; Menu redefined at load time to support dictionary changes.
-;; ispell-check-version added as an alias for `check-ispell-version'.
-;; Spelling suggestions returned in order generated by ispell.
-;; Small bug fixed in matching ispell error messages.
-;; Robustness added to ensure `case-fold-search' doesn't get redefined.
-;; Fixed bug that didn't respect case of word in `ispell-complete-word'.
-;; Multibyte character coding support added for process interactions.
-;; Ensure ispell process has terminated before starting new process.
-;;  This can otherwise confuse process filters and hang ispell.
-;; Improved skipping support for SGML.
-;; Fixed bug using ^M rather than \r in `ispell-minor-check'.
-;; 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:
 (defalias 'ispell-check-minver
   (if (fboundp 'version<=) 'version<=
-- 
2.7.4

From 34f1db6a92236f101db1de19e3797c02fc257187 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Sun, 4 Dec 2016 00:54:04 +0000
Subject: [PATCH 03/25] Assume we have version<= for checking ispell version

* lisp/textmodes/ispell.el (ispell-check-minver): Remove.
(ispell-check-version): Use version<= directly.
---
 lisp/textmodes/ispell.el | 46 +++++-----------------------------------------
 1 file changed, 5 insertions(+), 41 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 25099e3..14a782d 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -118,42 +118,6 @@
 ;;  Recursive edits (?C-r or ?R) inside a keyboard text replacement check (?r)
 ;;    can cause misalignment errors.
 
-;;; Compatibility code for XEmacs and (not too) older emacsen:
-(defalias 'ispell-check-minver
-  (if (fboundp 'version<=) 'version<=
-    (lambda (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-number (match-string 0 version))))
-            (if (string-match "[0-9]+" minver start-mver)
-                (setq start-mver (match-end 0)
-                      mver (string-to-number (match-string 0 minver))))
-
-            (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))))
-
 ;; XEmacs does not have looking-back
 (defalias 'ispell-looking-back
   (if (fboundp 'looking-back) 'looking-back
@@ -829,8 +793,8 @@ ispell-check-version
 	    (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)
+	(if (version<= ispell0-minver ispell-program-version)
+	    (or (version<= ispell-minver ispell-program-version)
 		(setq ispell-offset 0))
 	  (error "%s release %s or greater is required"
 		 ispell-program-name
@@ -838,14 +802,14 @@ ispell-check-version
 
 	(cond
 	 (ispell-really-aspell
-	  (if (ispell-check-minver aspell-minver ispell-really-aspell)
-	      (if (ispell-check-minver aspell8-minver ispell-really-aspell)
+	  (if (version<= aspell-minver ispell-really-aspell)
+	      (if (version<= aspell8-minver ispell-really-aspell)
 		  (progn
 		    (setq ispell-aspell-supports-utf8 t)
 		    (setq ispell-encoding8-command "--encoding=")))
 	    (setq ispell-really-aspell nil)))
 	 (ispell-really-hunspell
-	  (if (ispell-check-minver hunspell8-minver ispell-really-hunspell)
+	  (if (version<= hunspell8-minver ispell-really-hunspell)
 	      (setq ispell-encoding8-command "-i")
 	    (setq ispell-really-hunspell nil))))))
     result))
-- 
2.7.4

From e761f78db277dba3768607542fcfbc2ee1b23ea4 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Sun, 4 Dec 2016 01:06:26 +0000
Subject: [PATCH 04/25] Remove unused ispell-looking-back

* lisp/textmodes/ispell.el (ispell-looking-back): Remove unused alias.
---
 lisp/textmodes/ispell.el | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 14a782d..554905c 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -118,21 +118,6 @@
 ;;  Recursive edits (?C-r or ?R) inside a keyboard text replacement check (?r)
 ;;    can cause misalignment errors.
 
-;; XEmacs does not have looking-back
-(defalias 'ispell-looking-back
-  (if (fboundp 'looking-back) 'looking-back
-    (lambda (regexp &optional limit &rest ignored)
-      "Return non-nil if text before point matches regular expression REGEXP.
-Like `looking-at' except matches before point, and is slower.
-LIMIT if non-nil speeds up the search by specifying a minimum
-starting position, to avoid checking matches that would start
-before LIMIT.
-
-This is a stripped down compatibility function for use when
-full featured `looking-back' function is missing."
-      (save-excursion
-        (re-search-backward (concat "\\(?:" regexp "\\)\\=") limit t)))))
-
 ;;; XEmacs21 does not have `with-no-warnings'. Taken from org mode.
 (defmacro ispell-with-no-warnings (&rest body)
   (cons (if (fboundp 'with-no-warnings) 'with-no-warnings 'progn) body))
-- 
2.7.4

From 4625ac98f34afdc9733e8b8e623fc05a771feae9 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Sun, 4 Dec 2016 13:52:04 +0000
Subject: [PATCH 05/25] Remove tests for built-in functions

* lisp/textmodes/ispell.el (buffer-substring-no-properties): Remove
back-up definition.
(ispell-add-per-file-word-list): Remove tests for comment-padright and
comment-normalize-vars.
---
 lisp/textmodes/ispell.el | 32 ++++++++++++--------------------
 1 file changed, 12 insertions(+), 20 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 554905c..462cb32 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -132,10 +132,6 @@ ispell
   "User variables for Emacs ispell interface."
   :group 'applications)
 
-(if (not (fboundp 'buffer-substring-no-properties))
-    (defun buffer-substring-no-properties (start end)
-      (buffer-substring start end)))
-
 (defalias 'check-ispell-version 'ispell-check-version)
 
 ;;; **********************************************************************
@@ -2300,15 +2296,15 @@ ispell-command-loop
 		   ((= char ?i)		; accept and insert word into pers dict
 		    (ispell-send-string (concat "*" word "\n"))
 		    (setq ispell-pdict-modified-p '(t)) ; dictionary modified!
-		    (and (fboundp 'flyspell-unhighlight-at)
-			 (flyspell-unhighlight-at start))
+		    (when (fboundp 'flyspell-unhighlight-at)
+                          (flyspell-unhighlight-at start))
 		    nil)
 		   ((or (= char ?a) (= char ?A)) ; accept word without insert
 		    (ispell-send-string (concat "@" word "\n"))
 		    (cl-pushnew word ispell-buffer-session-localwords
                                 :test #'equal)
-		    (and (fboundp 'flyspell-unhighlight-at)
-			 (flyspell-unhighlight-at start))
+		    (when (fboundp 'flyspell-unhighlight-at)
+                          (flyspell-unhighlight-at start))
 		    (or ispell-buffer-local-name ; session localwords might conflict
 			(setq ispell-buffer-local-name (buffer-name)))
 		    (if (null ispell-pdict-modified-p)
@@ -4259,8 +4255,8 @@ ispell-buffer-local-words
 
 ;; Returns optionally adjusted region-end-point.
 
-;; If comment-padright is defined, newcomment must be loaded.
-(declare-function comment-add "newcomment" (arg))
+;; If comment-normalize-vars is defined, newcomment must be loaded.
+(declare-function comment-normalize-vars "newcomment" (&optional noerror))
 
 (defun ispell-add-per-file-word-list (word)
   "Add WORD to the per-file word list."
@@ -4286,16 +4282,12 @@ ispell-add-per-file-word-list
 		    (unless found (newline))
 		    (insert (if comment-start
                                 (concat
-                                  (if (fboundp 'comment-padright)
-                                      ;; Try and use the proper comment marker,
-                                      ;; e.g. ";;" rather than ";".
-				      (progn
-					;; XEmacs: comment-normalize-vars
-					;; (newcomment.el) only in >= 21.5
-					(and (fboundp 'comment-normalize-vars)
-					     (comment-normalize-vars))
-					(comment-padright comment-start
-							  (comment-add nil)))
+                                  (progn
+                                   ;; Try and use the proper comment marker,
+                                   ;; e.g. ";;" rather than ";".
+                                    (comment-normalize-vars)
+                                    (comment-padright comment-start
+                                                      (comment-add nil))
                                     comment-start)
                                   " ")
                               "")
-- 
2.7.4

From 9a0f547dc8dd03525431bf284f3a63325410bbc3 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Sun, 4 Dec 2016 13:55:31 +0000
Subject: [PATCH 06/25] Generalise over-specific documentation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lisp/textmodes/ispell.el (ispell-personal-dictionary): Rather than
document precise personal wordlist filenames for only two supported
spelling checkers, simply say that the default personal dictionary
depends on the chosen spelling checker.  The user can check the
spelling checker’s documentation if necessary.  This is simpler, and
works for other supported (and future, or unknown) spelling checkers.
---
 lisp/textmodes/ispell.el | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 462cb32..5ad7d05 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -349,9 +349,7 @@ ispell-use-framepop-p
 ;;;###autoload
 (defcustom ispell-personal-dictionary nil
   "File name of your personal spelling dictionary, or nil.
-If nil, the default personal dictionary, (\"~/.ispell_DICTNAME\" for ispell or
-\"~/.aspell.LANG.pws\" for Aspell) is used, where DICTNAME is the name of your
-default dictionary and LANG the two letter language code."
+If nil, the default personal dictionary for your spelling checker is used."
   :type '(choice file
 		 (const :tag "default" nil))
   :group 'ispell)
-- 
2.7.4

From 135bb390886d05b884a3e736aebec4b47c450617 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Sun, 4 Dec 2016 13:59:59 +0000
Subject: [PATCH 07/25] Remove some XEmacs-specific code from ispell.el

* lisp/textmodes/ispell.el: Remove XEmacs menubar setup.
(ispell-int-char): Remove.
---
 lisp/textmodes/ispell.el | 69 +++++-------------------------------------------
 1 file changed, 6 insertions(+), 63 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 5ad7d05..5670bcd 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1466,62 +1466,6 @@ ispell-valid-dictionary-list
       ;;(put 'ispell-region 'menu-enable 'mark-active)
       (fset 'ispell-menu-map (symbol-value 'ispell-menu-map))))
 
-;;; XEmacs versions 19 & 20
-(if (and (featurep 'xemacs)
-	 (featurep 'menubar)
-	 ;;(null ispell-menu-xemacs)
-	 (not (and (boundp 'infodock-version) infodock-version)))
-    (let ((dicts (if (fboundp 'ispell-valid-dictionary-list)
-		     (reverse (ispell-valid-dictionary-list))))
-	  (current-menubar (or current-menubar default-menubar))
-	  (menu
-	   '(["Help"		(describe-function 'ispell-help) t]
-	     ;;["Help"		(popup-menu ispell-help-list)	t]
-	     ["Check Message"	ispell-message			t]
-	     ["Check Buffer"	ispell-buffer			t]
-	     ["Check Comments"	ispell-comments-and-strings	t]
-	     ["Check Word"	ispell-word			t]
-	     ["Check Region"	ispell-region  (or (not zmacs-regions) (mark))]
-	     ["Continue Check"	ispell-continue			t]
-	     ["Complete Word Frag"ispell-complete-word-interior-frag t]
-	     ["Complete Word"	ispell-complete-word		t]
-	     ["Kill Process"	(ispell-kill-ispell nil 'clear) t]
-	     ["Customize..."	(customize-group 'ispell)	t]
-	     ;; flyspell-mode may not be bound...
-	     ;;["flyspell"	flyspell-mode
-	     ;;			:style toggle :selected flyspell-mode ]
-	     "-"
-	     ["Save Personal Dict"(ispell-pdict-save t t)	t]
-	     ["Change Dictionary" ispell-change-dictionary	t])))
-      (if (null dicts)
-	  (setq dicts (cons "default" nil)))
-      (dolist (name dicts)
-	(setq menu (append menu
-			   (list
-			     (vector
-			      (concat "Select " (capitalize name))
-			      (list 'ispell-change-dictionary name)
-			      t)))))
-      (setq ispell-menu-xemacs menu)
-      (if current-menubar
-	  (progn
-	    (if (car (find-menu-item current-menubar '("Cmds")))
-		(progn
-		  ;; XEmacs 21.2
-		  (delete-menu-item '("Cmds" "Spell-Check"))
-		  (add-menu '("Cmds") "Spell-Check" ispell-menu-xemacs))
-	      ;; previous
-	      (delete-menu-item '("Edit" "Spell")) ; in case already defined
-	      (add-menu '("Edit") "Spell" ispell-menu-xemacs))))))
-
-(defalias 'ispell-int-char
-  ;; Allow incrementing characters as integers in XEmacs 20
-  (if (and (featurep 'xemacs)
-	   (fboundp 'int-char))
-      'int-char
-    ;; Emacs and XEmacs 19 or earlier
-    'identity))
-
 
 ;;; **********************************************************************
 
@@ -2230,12 +2174,12 @@ ispell-command-loop
 	;; not so good if there are over 20 or 30 options, but then, if
 	;; there are that many you don't want to scan them all anyway...
 	(while (memq count command-characters) ; skip command characters.
-	  (setq count (ispell-int-char (1+ count))
+	  (setq count (1+ count)
 		skipped (1+ skipped)))
 	(insert "(" count ") " (car choices) "  ")
 	(setq choices (cdr choices)
-	      count (ispell-int-char (1+ count))))
-      (setq count (ispell-int-char (- count ?0 skipped))))
+	      count (1+ count)))
+      (setq count (- count ?0 skipped)))
 
     (run-hooks 'ispell-update-post-hook)
 
@@ -2382,13 +2326,12 @@ ispell-command-loop
 					 (window-width))
 				  (insert "\n"))
 				(while (memq count command-characters)
-				  (setq count (ispell-int-char (1+ count))
+				  (setq count (1+ count)
 					skipped (1+ skipped)))
 				(insert "(" count ") " (car choices) "  ")
 				(setq choices (cdr choices)
-				      count (ispell-int-char (1+ count))))
-			      (setq count (ispell-int-char
-					   (- count ?0 skipped))))
+				      count (1+ count)))
+			      (setq count (- count ?0 skipped)))
 			    (setq textwin (selected-window))
 			    (ispell-show-choices)
 			    (select-window textwin))))
-- 
2.7.4

From ccdfc3bc1a9aadb06878b0218c06dbba32885985 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Sun, 4 Dec 2016 14:02:48 +0000
Subject: [PATCH 08/25] Assume Emacs supports [:alpha:] in regexps

* lisp/textmodes/ispell.el (ispell-emacs-alpha-regexp): Remove.
(ispell-set-spellchecker-params): Remove tests of
ispell-emacs-alpha-regexp.
---
 lisp/textmodes/ispell.el | 55 +++++++++++++++++++-----------------------------
 1 file changed, 22 insertions(+), 33 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 5670bcd..6246eb3 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -666,12 +666,6 @@ ispell-dicts-name2locale-equivs-alist
   "Alist with known matching locales for standard dict names in
   `ispell-dictionary-base-alist'.")
 
-(defvar ispell-emacs-alpha-regexp
-  (if (string-match "^[[:alpha:]]+$" "abcde")
-      "[[:alpha:]]"
-    nil)
-  "[[:alpha:]] if Emacs supports [:alpha:] regexp, nil
-otherwise (current XEmacs does not support it).")
 
 ;;; **********************************************************************
 ;;; The following are used by ispell, and should not be changed.
@@ -1244,11 +1238,9 @@ ispell-set-spellchecker-params
 		   (setq ispell-library-directory (ispell-check-version))
 		   t)
 	       (error nil))
-	     ispell-encoding8-command
-	     ispell-emacs-alpha-regexp)
+	     ispell-encoding8-command)
 	;; auto-detection will only be used if spellchecker is not
-	;; ispell, supports a way  to set communication to UTF-8 and
-	;; Emacs flavor supports [:alpha:]
+	;; ispell and supports a way to set communication to UTF-8.
 	(if ispell-really-aspell
 	    (or ispell-aspell-dictionary-alist
 		(ispell-find-aspell-dictionaries))
@@ -1262,9 +1254,8 @@ ispell-set-spellchecker-params
     ;; installed dictionaries and add to it elements of the original
     ;; list that are not present there. Allow distro info.
     (let ((found-dicts-alist
-	   (if (and ispell-encoding8-command
-		    ispell-emacs-alpha-regexp)
-	       (if ispell-really-aspell
+	   (if ispell-encoding8-command
+               (if ispell-really-aspell
 		   ispell-aspell-dictionary-alist
 		 (if ispell-really-hunspell
 		     ispell-hunspell-dictionary-alist))
@@ -1331,28 +1322,26 @@ ispell-set-spellchecker-params
 	  (push dict all-dicts-alist)))
       (setq ispell-dictionary-alist all-dicts-alist))
 
-    ;; If Emacs flavor supports [:alpha:] use it for global dicts.  If
-    ;; spellchecker also supports UTF-8 via command-line option use it
+    ;; If spellchecker supports UTF-8 via command-line option, use it
     ;; in communication.  This does not affect definitions in your
     ;; init file.
-    (if ispell-emacs-alpha-regexp
-     	(let (tmp-dicts-alist)
-    	  (dolist (adict ispell-dictionary-alist)
-	    (cl-pushnew (if (cadr adict) ;; Do not touch hunspell uninitialized entries
-                            (list
-                             (nth 0 adict)   ; dict name
-                             "[[:alpha:]]"   ; casechars
-                             "[^[:alpha:]]"  ; not-casechars
-                             (nth 3 adict)   ; otherchars
-                             (nth 4 adict)   ; many-otherchars-p
-                             (nth 5 adict)   ; ispell-args
-                             (nth 6 adict)   ; extended-character-mode
-                             (if ispell-encoding8-command
-                                 'utf-8
-                               (nth 7 adict)))
-                          adict)
-                        tmp-dicts-alist :test #'equal))
-	  (setq ispell-dictionary-alist tmp-dicts-alist)))))
+    (let (tmp-dicts-alist)
+      (dolist (adict ispell-dictionary-alist)
+        (cl-pushnew (if (cadr adict) ;; Do not touch hunspell uninitialized entries
+                        (list
+                         (nth 0 adict)   ; dict name
+                         "[[:alpha:]]"   ; casechars
+                         "[^[:alpha:]]"  ; not-casechars
+                         (nth 3 adict)   ; otherchars
+                         (nth 4 adict)   ; many-otherchars-p
+                         (nth 5 adict)   ; ispell-args
+                         (nth 6 adict)   ; extended-character-mode
+                         (if ispell-encoding8-command
+                             'utf-8
+                           (nth 7 adict)))
+                      adict)
+                    tmp-dicts-alist :test #'equal))
+      (setq ispell-dictionary-alist tmp-dicts-alist))))
 
 (defun ispell-valid-dictionary-list ()
   "Return a list of valid dictionaries.
-- 
2.7.4

From 3e3b46debf35624ecbb48bd88be11312790592c7 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Sun, 4 Dec 2016 14:05:07 +0000
Subject: [PATCH 09/25] Remove XEmacs and old Emacs highlighting code

* lisp/textmodes/ispell.el
(ispell-highlight-spelling-error-xemacs): Remove.
(ispell-highlight-spelling-error): Assume display-color-p exists.
---
 lisp/textmodes/ispell.el | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 6246eb3..95e87e4 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -2633,17 +2633,6 @@ ispell-highlight-spelling-error-generic
 	  (if (eq 'block refresh) start (- start 2)) end t))))

-(defun ispell-highlight-spelling-error-xemacs (start end &optional highlight)
-  "Highlight the word from START to END using `isearch-highlight'.
-When the optional third arg HIGHLIGHT is set, the word is highlighted,
-otherwise it is displayed normally."
-  (if highlight
-      (isearch-highlight start end)
-    (isearch-dehighlight))
-  ;;(sit-for 0)
-  )
-
-
 (defun ispell-highlight-spelling-error-overlay (start end &optional highlight)
   "Highlight the word from START to END using overlays.
 When the optional third arg HIGHLIGHT is set, the word is highlighted
@@ -2679,14 +2668,9 @@ ispell-highlight-spelling-error-overlay

 (defun ispell-highlight-spelling-error (start end &optional highlight refresh)
-  (cond
-   ((featurep 'xemacs)
-    (ispell-highlight-spelling-error-xemacs start end highlight))
-   ((and (featurep 'faces)
-	 (or (and (fboundp 'display-color-p) (display-color-p))
-	     window-system))
-    (ispell-highlight-spelling-error-overlay start end highlight))
-   (t (ispell-highlight-spelling-error-generic start end highlight refresh))))
+  (if (display-color-p)
+      (ispell-highlight-spelling-error-overlay start end highlight)
+    (ispell-highlight-spelling-error-generic start end highlight refresh)))
 
 (defun ispell-display-buffer (buffer)
   "Show BUFFER in new window above selected one.
-- 
2.7.4

From b0f33c83e498723b24e2b3de66f471f5d189ea5c Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Sun, 4 Dec 2016 14:15:50 +0000
Subject: [PATCH 10/25] Remove some commented-out code

lisp/textmodes/ispell.el (ispell-process)
ispell-valid-dictionary-list): Remove commented-out code.
---
 lisp/textmodes/ispell.el | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 95e87e4..a6dd905 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -860,11 +860,7 @@ ispell-process
 
 (defvar ispell-async-processp (and (fboundp 'delete-process)
 				   (fboundp 'process-send-string)
-				   (fboundp 'accept-process-output)
-				   ;;(fboundp 'make-process)
-				   ;;(fboundp 'set-process-filter)
-				   ;;(fboundp 'process-kill-without-query)
-				   )
+				   (fboundp 'accept-process-output))
   "Non-nil means that the OS supports asynchronous processes.")
 
 ;; Make ispell.el work better with aspell.
@@ -1452,7 +1448,6 @@ ispell-valid-dictionary-list
       (define-key ispell-menu-map [ispell-buffer]
 	`(menu-item ,(purecopy "Spell-Check Buffer") ispell-buffer
 		    :help ,(purecopy "Check spelling of selected buffer")))
-      ;;(put 'ispell-region 'menu-enable 'mark-active)
       (fset 'ispell-menu-map (symbol-value 'ispell-menu-map))))

-- 
2.7.4

From a3c98562d654b7584a124e61cde4bc7204568389 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Sun, 4 Dec 2016 14:19:26 +0000
Subject: [PATCH 11/25] Remove XEmacs-specific code from ispell.el

* lisp/textmodes/ispell.el (ispell-menu-xemacs): Remove
(ispell-menu-map-needed): Remove XEmacs-specific check.
(ispell-word): Remove XEmacs-specific extent code.
(ispell-init-process): Remove XEmacs workaround for local add-hook.
Assume we have set-process-query-on-exit-flag.
(ispell-kill-ispell, ispell-change-dictionary): Remove XEmacs
workaround for called-interactively-p.
---
 lisp/textmodes/ispell.el | 55 +++++++++---------------------------------------
 1 file changed, 10 insertions(+), 45 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index a6dd905..6a28db6 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -833,22 +833,10 @@ ispell-menu-map
 ;; Redo menu when loading ispell to get dictionary modifications
 (setq ispell-menu-map nil)
 
-;;;###autoload
-(defvar ispell-menu-xemacs nil
-  "Spelling menu for XEmacs.
-If nil when package is loaded, a standard menu will be set,
-and added as a submenu of the \"Edit\" menu.")
-
-;; Break out XEmacs menu and split into several calls to avoid having
-;; long lines in loaddefs.el.  Detect need off following constant.
-
 ;;; Set up dictionary
 ;;;###autoload
 (defvar ispell-menu-map-needed
-  ;; only needed when not version 18 and not XEmacs.
-  (and (not ispell-menu-map)
-       (not (featurep 'xemacs))
-       'reload))
+  (unless ispell-menu-map 'reload))
 
 (defvar ispell-library-directory (condition-case ()
 				     (ispell-check-version)
@@ -1932,32 +1920,20 @@ ispell-word
       (cond ((eq poss t)
 	     (or quietly
 		 (message "%s is correct"
-			  (funcall ispell-format-word-function word)))
-	     (and (featurep 'xemacs)
-		  (extent-at start)
-		  (and (fboundp 'delete-extent)
-		       (delete-extent (extent-at start)))))
+			  (funcall ispell-format-word-function word))))
 	    ((stringp poss)
 	     (or quietly
 		 (message "%s is correct because of root %s"
 			  (funcall ispell-format-word-function word)
-			  (funcall ispell-format-word-function poss)))
-	     (and (featurep 'xemacs)
-		  (extent-at start)
-		  (and (fboundp 'delete-extent)
-		       (delete-extent (extent-at start)))))
+			  (funcall ispell-format-word-function poss))))
 	    ((null poss)
 	     (message "Error checking word %s using %s with %s dictionary"
 		      (funcall ispell-format-word-function word)
 		      (file-name-nondirectory ispell-program-name)
 		      (or ispell-current-dictionary "default")))
 	    (ispell-check-only	      ; called from ispell minor mode.
-	     (if (fboundp 'make-extent)
-		 (if (fboundp 'set-extent-property)
-		     (let ((ext (make-extent start end)))
-		       (set-extent-property ext 'face ispell-highlight-face)
-		       (set-extent-property ext 'priority 2000)))
-	       (beep)
+	     (progn
+               (beep)
 	       (message "%s is incorrect"
                         (funcall ispell-format-word-function word))))
 	    (t				; prompt for correct word.
@@ -2890,10 +2866,7 @@ ispell-init-process
 		;; to avoid over and over ispell kill.
 		(window-buffer (minibuffer-selected-window))
 	      (current-buffer))
-	  ;; 'local does not automatically make hook buffer-local in XEmacs.
-	  (if (featurep 'xemacs)
-	      (make-local-hook 'kill-buffer-hook))
-	  (add-hook 'kill-buffer-hook
+          (add-hook 'kill-buffer-hook
 		    (lambda () (ispell-kill-ispell t)) nil 'local)))
 
       (if ispell-async-processp
@@ -2938,12 +2911,8 @@ ispell-init-process
       (let ((extended-char-mode (ispell-get-extended-character-mode)))
 	(if extended-char-mode		; ~ extended character mode
 	    (ispell-send-string (concat extended-char-mode "\n"))))
-      (if ispell-async-processp
-	  (if (featurep 'emacs)
-	      (set-process-query-on-exit-flag ispell-process nil)
-	    (if (fboundp 'set-process-query-on-exit-flag)
-		(set-process-query-on-exit-flag ispell-process nil)
-	      (process-kill-without-query ispell-process)))))))
+      (when ispell-async-processp
+        (set-process-query-on-exit-flag ispell-process nil)))))
 
 ;;;###autoload
 (defun ispell-kill-ispell (&optional no-error clear)
@@ -2955,9 +2924,7 @@ ispell-kill-ispell
   ;; to optimize the common cases.
   (run-hooks 'ispell-kill-ispell-hook)
   (if (or clear
-	  (if (featurep 'xemacs)
-	      (interactive-p)
-	    (called-interactively-p 'interactive)))
+	  (called-interactively-p 'interactive))
       (setq ispell-buffer-session-localwords nil))
   (if (not (and ispell-process
 		(eq (ispell-process-status) 'run)))
@@ -3006,9 +2973,7 @@ ispell-change-dictionary
 	 ;; Specified dictionary is the default already. Could reload
 	 ;; the dictionaries if needed.
 	 (ispell-internal-change-dictionary)
-	 (and (if (featurep 'xemacs)
-		  (interactive-p)
-		(called-interactively-p 'interactive))
+	 (when (called-interactively-p 'interactive)
 	      (message "No change, using %s dictionary" dict)))
 	(t				; reset dictionary!
 	 (if (or (assoc dict ispell-local-dictionary-alist)
-- 
2.7.4

From 09af64343512dfba91b132d783f0026c5ef54795 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Sun, 4 Dec 2016 14:35:42 +0000
Subject: [PATCH 12/25] Remove XEmacs-specific code dealing with
 enable-multibyte-characters

* lisp/textmodes/ispell.el (ispell-decode-string):
(ispell-init-process):  Remove XEmacs-specific guard.
---
 lisp/textmodes/ispell.el | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 6a28db6..f0bb569 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1451,17 +1451,8 @@ ispell-current-personal-dictionary
 This is passed to the Ispell process using the `-p' switch.")
 
 (defun ispell-decode-string (str)
-  "Decodes multibyte character strings.
-Protects against bogus binding of `enable-multibyte-characters' in XEmacs."
-  ;; FIXME: enable-multibyte-characters is read-only, so bogus bindings are
-  ;; really nasty (they signal an error in Emacs): Who does that?  --Stef
-  (if (and (or (featurep 'xemacs)
-	       (and (boundp 'enable-multibyte-characters)
-		    enable-multibyte-characters))
-	   (fboundp 'decode-coding-string)
-	   (ispell-get-coding-system))
-      (decode-coding-string str (ispell-get-coding-system))
-    str))
+  "Decodes multibyte character strings."
+  (decode-coding-string str (ispell-get-coding-system)))
 
 ;; Return a string decoded from Nth element of the current dictionary.
 (defun ispell-get-decoded-string (n)
@@ -2871,11 +2862,7 @@ ispell-init-process
 
       (if ispell-async-processp
 	  (set-process-filter ispell-process 'ispell-filter))
-      ;; Protect against XEmacs bogus binding of `enable-multibyte-characters'.
-      (if (and (or (featurep 'xemacs)
-		   (and (boundp 'enable-multibyte-characters)
-			enable-multibyte-characters))
-	       (fboundp 'set-process-coding-system)
+      (if (and enable-multibyte-characters
                ;; Evidently, some people use the synchronous mode even
                ;; when async subprocesses are supported, in which case
                ;; set-process-coding-system is bound, but
-- 
2.7.4

From b2b75d836e7c70376561fafe64636d54f5b8b8c5 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Sun, 4 Dec 2016 14:37:37 +0000
Subject: [PATCH 13/25] Remove XEmacs-specific horizontal scrollbar handling in
 ispell.el

* lisp/textmodes/ispell.el (ispell-command-loop): Remove
XEmacs-specific code.
---
 lisp/textmodes/ispell.el | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index f0bb569..8978d14 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -2094,15 +2094,9 @@ ispell-command-loop
              "--  %b  --  word: " word
              "  --  dict: " (or ispell-current-dictionary "default")
              "  --  prog: " (file-name-nondirectory ispell-program-name)))
-      ;; XEmacs: no need for horizontal scrollbar in choices window
+      ;; No need for horizontal scrollbar in choices window
       (ispell-with-no-warnings
-       (and (fboundp 'set-specifier)
-	    (boundp 'horizontal-scrollbar-visible-p)
-	    (set-specifier horizontal-scrollbar-visible-p nil
-			   (cons (current-buffer) nil))))
-      (ispell-with-no-warnings
-       (and (boundp 'horizontal-scroll-bar)
-	    (setq horizontal-scroll-bar nil)))
+       (setq horizontal-scroll-bar nil))
       (erase-buffer)
       (if guess
 	  (progn
-- 
2.7.4

From 3f552c07b5da309061f5e1cc3c51061aa767cd18 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Sun, 4 Dec 2016 14:38:51 +0000
Subject: [PATCH 14/25] Remove XEmacs-specific minibuffer handling code from
 ispell.el

* lisp/textmodes/ispell.el (ispell-init-process): Assume we are not in
XEmacs.
---
 lisp/textmodes/ispell.el | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 8978d14..c2d6d60 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -2794,7 +2794,7 @@ ispell-init-process
 	 (current-ispell-directory default-directory) ;FIXME: Unused?
 	 ;; The default directory for the process.
 	 ;; Use "~/" as default-directory unless using Ispell with per-dir
-	 ;; personal dictionaries and not in a minibuffer under XEmacs
+	 ;; personal dictionaries
 	 (default-directory
 	   (if (or ispell-really-aspell
 		   ispell-really-hunspell
@@ -2807,9 +2807,8 @@ ispell-init-process
 						     ".ispell_"
 						     (or dict-bname
 							 "default")))))
-		   ;; Ispell, in a minibuffer, and XEmacs
-		   (and (window-minibuffer-p)
-			(not (fboundp 'minibuffer-selected-window))))
+		   ;; Ispell, in a minibuffer
+		   (window-minibuffer-p))
 	       (expand-file-name "~/")
 	     (expand-file-name default-directory))))
     ;; Check if process needs restart
@@ -2841,12 +2840,11 @@ ispell-init-process
 
       (unless (equal ispell-process-directory (expand-file-name "~/"))
 	;; At this point, `ispell-process-directory' will be "~/" unless using
-	;; Ispell with directory-specific dicts and not in XEmacs minibuffer.
+	;; Ispell with directory-specific dicts.
 	;; If not, kill ispell process when killing buffer.  It may be in a
 	;; removable device that would otherwise become un-mountable.
 	(with-current-buffer
-	    (if (and (window-minibuffer-p)                  ;; In minibuffer
-		     (fboundp 'minibuffer-selected-window)) ;; Not XEmacs.
+	    (if (window-minibuffer-p)                  ;; In minibuffer
 		;; In this case kill ispell only when parent buffer is killed
 		;; to avoid over and over ispell kill.
 		(window-buffer (minibuffer-selected-window))
-- 
2.7.4

From b31fbdc083786a24a1d27a0b43345e3b39586d33 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Sun, 4 Dec 2016 14:39:42 +0000
Subject: [PATCH 15/25] Remove remaining mentions of XEmacs from ispell.el

* lisp/textmodes/ispell.el (ispell-valid-dictionary-list):
(ispell-add-per-file-word-list): Remove mentions of XEmacs from
comments.
---
 lisp/textmodes/ispell.el | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index c2d6d60..3abefdc 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1331,8 +1331,7 @@ ispell-valid-dictionary-list
   "Return a list of valid dictionaries.
 The variable `ispell-library-directory' defines their location."
   ;; Initialize variables and dictionaries alists for desired spellchecker.
-  ;; Make sure ispell.el is loaded to avoid some autoload loops in XEmacs
-  ;; (and may be others)
+  ;; Make sure ispell.el is loaded to avoid some autoload loops.
   (if (featurep 'ispell)
       (ispell-set-spellchecker-params))
 
@@ -4189,6 +4188,6 @@ ispell-add-per-file-word-list
 ; LocalWords:  minipage pers dict unhighlight buf grep sync prev inc
 ; LocalWords:  fn oldot NB AIX msg init read's bufs pt cmd Quinlan eg
 ; LocalWords:  uuencoded unidiff sc nn VM SGML eval IspellPersDict
-; LocalWords:  lns XEmacs HTML casechars Multibyte
+; LocalWords:  lns HTML casechars Multibyte
 
 ;;; ispell.el ends here
-- 
2.7.4

From d55218f14ff514d770def03be1f3a8553419a869 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Sun, 4 Dec 2016 19:20:19 +0000
Subject: [PATCH 16/25] Remove support for old versions of supercite and GNUS
 from ispell.el

* lisp/textmodes/ispell.el (ispell-message): Require supercite >= 3.0
and GNUS >= 5.  Not exactly the bleeding edge!
---
 lisp/textmodes/ispell.el | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 3abefdc..2f91ec2 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -3866,16 +3866,11 @@ ispell-message
 	       "   \\|\t"))
 	   (cite-regexp			;Prefix of quoted text
 	    (cond
-	     ((functionp 'sc-cite-regexp)	; sc 3.0
+	     ((functionp 'sc-cite-regexp)	; supercite >= 3.0
 	      (ispell-with-no-warnings
 	       (concat "\\(" (sc-cite-regexp) "\\)" "\\|"
 		       (ispell-non-empty-string sc-reference-tag-string))))
-	     ((boundp 'sc-cite-regexp)		; sc 2.3
-	      (concat "\\(" sc-cite-regexp "\\)" "\\|"
-		      (ispell-with-no-warnings
-		       (ispell-non-empty-string sc-reference-tag-string))))
-	     ((or (equal major-mode 'news-reply-mode) ;GNUS 4 & below
-		  (equal major-mode 'message-mode))   ;GNUS 5
+	     ((equal major-mode 'message-mode)  ; GNUS >= 5
 	      (concat "In article <" "\\|"
 		      "[^,;&+=\n]+ <[^,;&+=]+> writes:" "\\|"
 		      (ispell-with-no-warnings message-cite-prefix-regexp)
-- 
2.7.4

From 54a2a7c445c8a2086a53331f348410b31c63d3a0 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Sun, 4 Dec 2016 21:47:02 +0000
Subject: [PATCH 17/25] Remove unused constant

* lisp/textmodes/ispell.el (ispell-required-version): Remove.
---
 lisp/textmodes/ispell.el | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 2f91ec2..b3fee99 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -673,10 +673,6 @@ ispell-dicts-name2locale-equivs-alist

-;; The version must be 3.1 or greater for this version of ispell.el
-;; There is an incompatibility between version 3.1.12 and lower versions.
-(defconst ispell-required-version '(3 1 12)
-  "Ispell versions with which this version of ispell.el is known to work.")
 (defvar ispell-offset -1
   "Offset that maps protocol differences between ispell 3.1 versions.")
 
-- 
2.7.4

From 47fd7e922a8640d1bb3139f64f30049b4778fbcc Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Sun, 4 Dec 2016 21:50:18 +0000
Subject: [PATCH 18/25] Remove support for ispell < 3.1.12

* lisp/textmodes/ispell.el (ispell-offset): Remove.
(ispell-check-version): Require ispell >= 3.1.12, released in 1994.
(ispell-process-line): No longer use ispell-offset.
---
 lisp/textmodes/ispell.el | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index b3fee99..412e838 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -673,9 +673,6 @@ ispell-dicts-name2locale-equivs-alist

-(defvar ispell-offset -1
-  "Offset that maps protocol differences between ispell 3.1 versions.")
-
 (defconst ispell-version "ispell.el 3.6 - 7-Jan-2003")

@@ -758,13 +755,10 @@ ispell-check-version
 
       (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 (version<= ispell0-minver ispell-program-version)
-	    (or (version<= ispell-minver ispell-program-version)
-		(setq ispell-offset 0))
+	(unless (version<= ispell-minver ispell-program-version)
 	  (error "%s release %s or greater is required"
 		 ispell-program-name
 		 ispell-minver))
@@ -3360,7 +3354,7 @@ ispell-process-line
 	  ;; Markers can move with highlighting!  This destroys
 	  ;; end of region markers line-end and ispell-region-end
 	  (let ((word-start
-		 (copy-marker (+ ispell-start ispell-offset (car (cdr poss)))))
+		 (copy-marker (+ ispell-start (car (cdr poss)))))
 		(word-len (length (car poss)))
 		(line-end (copy-marker ispell-end))
 		(line-start (copy-marker ispell-start))
-- 
2.7.4

From 7fafe3684f9ce4301596b846347e916cc0ced1cb Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Sun, 4 Dec 2016 21:55:19 +0000
Subject: [PATCH 19/25] Remove boundp test for always-bound symbol
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lisp/textmodes/ispell.el (ispell-message): mail-yank-prefix is
defvar’d at the top of the file, so remove a test to see if it is
bound.
---
 lisp/textmodes/ispell.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 412e838..894e2ea 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -3851,8 +3851,7 @@ ispell-message
 		       (point-max)))
 		    (t (min (point-max) (funcall ispell-message-text-end))))))
 	   (default-prefix   ; Vanilla cite prefix (just used for cite-regexp)
-	     (if (and (boundp 'mail-yank-prefix) mail-yank-prefix)
-		 (ispell-non-empty-string mail-yank-prefix)
+	     (if (ispell-non-empty-string mail-yank-prefix)
 	       "   \\|\t"))
 	   (cite-regexp			;Prefix of quoted text
 	    (cond
-- 
2.7.4

From 2e015c185d648242e18330d667a92773b9f3b40a Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Sun, 4 Dec 2016 21:58:00 +0000
Subject: [PATCH 20/25] Remove meaningless defconst ispell-version
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lisp/textmodes/ispell.el (ispell-version): Since ispell.el is now
firmly part of Emacs, and the version hasn’t changed since 2003, and
isn’t used anywhere, remove it.  3rd-party code can better use the
Emacs version, or feature or function checks.
(ispell-check-version): No longer report ispell.el version.
---
 lisp/textmodes/ispell.el | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 894e2ea..398e83e 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -671,11 +671,6 @@ ispell-dicts-name2locale-equivs-alist
 ;;; The following are used by ispell, and should not be changed.
 ;;; **********************************************************************
 
-
-
-(defconst ispell-version "ispell.el 3.6 - 7-Jan-2003")
-
-
 (defun ispell-check-version (&optional interactivep)
   "Ensure that `ispell-program-name' is valid and has the correct version.
 Returns version number if called interactively.
@@ -710,13 +705,11 @@ ispell-check-version
 		      (if (string-match "\\`aspell" speller) "-v" "-vv"))))
       (goto-char (point-min))
       (if interactivep
-	  ;; Report version information of ispell and ispell.el
+	  ;; Report version information of ispell
 	  (progn
 	    (end-of-line)
-	    (setq result (concat (buffer-substring-no-properties (point-min)
-								 (point))
-				 ", "
-				 ispell-version))
+	    (setq result (buffer-substring-no-properties (point-min)
+                                                         (point)))
 	    (message "%s" result))
 	;; return LIBDIR or LIBRARYVAR (overrides LIBDIR) env.
 	(progn
-- 
2.7.4

From 43e42968990a2071262448201f455650dddb43a4 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Sun, 4 Dec 2016 22:01:56 +0000
Subject: [PATCH 21/25] Remove XEmacs-specific ispell-with-no-warnings

* lisp/textmodes/ispell.el (ispell-with-no-warnings): Remove this
defmacro, needed only for XEmacs.
(ispell-command-loop, ispell-message): Use with-no-warnings directly.
---
 lisp/textmodes/ispell.el | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 398e83e..c55d316 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -118,10 +118,6 @@
 ;;  Recursive edits (?C-r or ?R) inside a keyboard text replacement check (?r)
 ;;    can cause misalignment errors.
 
-;;; XEmacs21 does not have `with-no-warnings'. Taken from org mode.
-(defmacro ispell-with-no-warnings (&rest body)
-  (cons (if (fboundp 'with-no-warnings) 'with-no-warnings 'progn) body))
-
 ;;; Code:
 
 (eval-when-compile (require 'cl-lib))
@@ -2077,7 +2073,7 @@ ispell-command-loop
              "  --  dict: " (or ispell-current-dictionary "default")
              "  --  prog: " (file-name-nondirectory ispell-program-name)))
       ;; No need for horizontal scrollbar in choices window
-      (ispell-with-no-warnings
+      (with-no-warnings
        (setq horizontal-scroll-bar nil))
       (erase-buffer)
       (if guess
@@ -3849,18 +3845,18 @@ ispell-message
 	   (cite-regexp			;Prefix of quoted text
 	    (cond
 	     ((functionp 'sc-cite-regexp)	; supercite >= 3.0
-	      (ispell-with-no-warnings
+	      (with-no-warnings
 	       (concat "\\(" (sc-cite-regexp) "\\)" "\\|"
 		       (ispell-non-empty-string sc-reference-tag-string))))
 	     ((equal major-mode 'message-mode)  ; GNUS >= 5
 	      (concat "In article <" "\\|"
 		      "[^,;&+=\n]+ <[^,;&+=]+> writes:" "\\|"
-		      (ispell-with-no-warnings message-cite-prefix-regexp)
+		      (with-no-warnings message-cite-prefix-regexp)
 		      "\\|"
 		      default-prefix))
 	     ((equal major-mode 'mh-letter-mode) ; mh mail message
 	      (concat "[^,;&+=\n]+ writes:" "\\|"
-		      (ispell-with-no-warnings
+		      (with-no-warnings
 		       (ispell-non-empty-string mh-ins-buf-prefix))))
 	     ((not internal-messagep)	; Assume nn sent us this message.
 	      (concat "In [a-zA-Z.]+ you write:" "\\|"
-- 
2.7.4

From 803a92d85111bc450ca21f6d599de2563c422226 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Mon, 5 Dec 2016 21:11:52 +0000
Subject: [PATCH 22/25] Remove unused variable

* lisp/textmodes/ispell.el (current-ispell-directory): Remove.
---
 lisp/textmodes/ispell.el | 2 --
 1 file changed, 2 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index c55d316..6733c75 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -2768,8 +2768,6 @@ ispell-init-process
   (let* (;; Basename of dictionary used by the spell-checker
 	 (dict-bname (or (car (cdr (member "-d" (ispell-get-ispell-args))))
 			 ispell-current-dictionary))
-	 ;; The directory where process was started.
-	 (current-ispell-directory default-directory) ;FIXME: Unused?
 	 ;; The default directory for the process.
 	 ;; Use "~/" as default-directory unless using Ispell with per-dir
 	 ;; personal dictionaries
-- 
2.7.4

From 5af3d9d654661cac17ba45e110392be2b7f76272 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Tue, 13 Dec 2016 00:30:51 +0000
Subject: [PATCH 23/25] Minor docstring and comment fixes to ispell.el

lisp/textmodes/ispell.el (ispell-aspell-dictionary-alist): Mention
ispell-aspell-dictionary-alist, not ispell-dictionary-alist.
(ispell-set-spellchecker-params): Change double-single quotes to
single single quotes in comment.
---
 lisp/textmodes/ispell.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 6733c75..c45b620 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -837,7 +837,7 @@ ispell-aspell-dictionary-alist
 Internal use.")
 
 (defun ispell-find-aspell-dictionaries ()
-  "Find Aspell's dictionaries, and record in `ispell-dictionary-alist'."
+  "Find Aspell's dictionaries, and record in `ispell-aspell-dictionary-alist'."
   (unless (and ispell-really-aspell ispell-encoding8-command)
     (error "This function only works with Aspell >= 0.60"))
   (let* ((dictionaries
@@ -1277,7 +1277,7 @@ ispell-set-spellchecker-params
 
       (run-hooks 'ispell-initialize-spellchecker-hook)
 
-      ;; Add dicts to ``ispell-dictionary-alist'' unless already present.
+      ;; Add dicts to `ispell-dictionary-alist' unless already present.
       (dolist (dict (append found-dicts-alist
 			    ispell-base-dicts-override-alist
 			    ispell-dictionary-base-alist))
-- 
2.7.4

From 8c70e8715505f9f4e6ad99d48a931986b1d13853 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Tue, 13 Dec 2016 00:43:21 +0000
Subject: [PATCH 24/25] Remove support for aspell < 0.60 (from 2004)

lisp/textmodes/ispell.el (ispell-check-version): Require Aspell 0.60.
(ispell-aspell-dictionary-alist): Remove check that we have Aspell 0.60.
---
 lisp/textmodes/ispell.el | 35 ++++++++++++++++-------------------
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index c45b620..37a6ffc 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -727,8 +727,7 @@ ispell-check-version
 
 	;; 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
+              ispell-really-hunspell nil
 	      ispell-encoding8-command nil)
 
 	(goto-char (point-min))
@@ -742,24 +741,24 @@ ispell-check-version
                         nil t)
 		       (match-string 1)))))
 
-      (let ((aspell-minver    "0.50")
-	    (aspell8-minver   "0.60")
-	    (ispell-minver    "3.1.12")
-	    (hunspell8-minver "1.1.6"))
-
-	(unless (version<= ispell-minver ispell-program-version)
-	  (error "%s release %s or greater is required"
-		 ispell-program-name
-		 ispell-minver))
+      (let* ((aspell8-minver   "0.60")
+             (ispell-minver    "3.1.12")
+             (hunspell8-minver "1.1.6")
+             (minver (cond
+                      ((not (version<= ispell-minver ispell-program-version))
+                       ispell-minver)
+                      ((and ispell-really-aspell
+                            (not (version<= aspell8-minver ispell-really-aspell)))
+                       aspell8-minver))))
+
+        (if minver
+	    (error "%s release %s or greater is required"
+                   ispell-program-name
+                   minver))
 
 	(cond
 	 (ispell-really-aspell
-	  (if (version<= aspell-minver ispell-really-aspell)
-	      (if (version<= aspell8-minver ispell-really-aspell)
-		  (progn
-		    (setq ispell-aspell-supports-utf8 t)
-		    (setq ispell-encoding8-command "--encoding=")))
-	    (setq ispell-really-aspell nil)))
+	  (setq ispell-encoding8-command "--encoding="))
 	 (ispell-really-hunspell
 	  (if (version<= hunspell8-minver ispell-really-hunspell)
 	      (setq ispell-encoding8-command "-i")
@@ -838,8 +837,6 @@ ispell-aspell-dictionary-alist
 
 (defun ispell-find-aspell-dictionaries ()
   "Find Aspell's dictionaries, and record in `ispell-aspell-dictionary-alist'."
-  (unless (and ispell-really-aspell ispell-encoding8-command)
-    (error "This function only works with Aspell >= 0.60"))
   (let* ((dictionaries
 	  (split-string
 	   (with-temp-buffer
-- 
2.7.4