aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReuben Thomas2016-12-17 19:06:34 +0000
committerReuben Thomas2016-12-17 21:07:57 +0000
commit63f827ab022e84e603bb5fff6f7d185d11950c40 (patch)
treea54ef589697982999f81fa1f9f0049935f99a749
parentcfa2fb26263d741dca3c941febc0eb092a62b52e (diff)
downloademacs-63f827ab022e84e603bb5fff6f7d185d11950c40.tar.gz
emacs-63f827ab022e84e603bb5fff6f7d185d11950c40.zip
Remove XEmacs support from flyspell.el (Bug#25218)
lisp/textmodes/flyspell.el (flyspell-prog-mode, flyspell-mode-on): (flyspell-word, flyspell-delete-region-overlays): (flyspell-correct-word-before-point): Remove XEmacs support. (flyspell-xemacs-popup): Remove XEmacs-specific defun.
-rw-r--r--lisp/textmodes/flyspell.el111
1 files changed, 5 insertions, 106 deletions
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 29aa2312521..c63508d1342 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -447,12 +447,7 @@ like <img alt=\"Some thing.\">."
447;;* The minor mode declaration. */ 447;;* The minor mode declaration. */
448;;*---------------------------------------------------------------------*/ 448;;*---------------------------------------------------------------------*/
449(defvar flyspell-mouse-map 449(defvar flyspell-mouse-map
450 (let ((map (make-sparse-keymap))) 450 (make-sparse-keymap)
451 (if (featurep 'xemacs)
452 (define-key map [button2] #'flyspell-correct-word)
453 (define-key map [down-mouse-2] #'flyspell-correct-word)
454 (define-key map [mouse-2] 'undefined))
455 map)
456 "Keymap for Flyspell to put on erroneous words.") 451 "Keymap for Flyspell to put on erroneous words.")
457 452
458(defvar flyspell-mode-map 453(defvar flyspell-mode-map
@@ -652,9 +647,7 @@ in your init file.
652 ;; the welcome message 647 ;; the welcome message
653 (if (and flyspell-issue-message-flag 648 (if (and flyspell-issue-message-flag
654 flyspell-issue-welcome-flag 649 flyspell-issue-welcome-flag
655 (if (featurep 'xemacs) 650 (called-interactively-p 'interactive))
656 (interactive-p) ;; XEmacs does not have (called-interactively-p)
657 (called-interactively-p 'interactive)))
658 (let ((binding (where-is-internal 'flyspell-auto-correct-word 651 (let ((binding (where-is-internal 'flyspell-auto-correct-word
659 nil 'non-ascii))) 652 nil 'non-ascii)))
660 (message "%s" 653 (message "%s"
@@ -1179,9 +1172,7 @@ misspelling and skips redundant spell-checking step."
1179 (ispell-send-string (concat "^" word "\n")) 1172 (ispell-send-string (concat "^" word "\n"))
1180 ;; we mark the ispell process so it can be killed 1173 ;; we mark the ispell process so it can be killed
1181 ;; when emacs is exited without query 1174 ;; when emacs is exited without query
1182 (if (featurep 'xemacs) 1175 (set-process-query-on-exit-flag ispell-process nil)
1183 (process-kill-without-query ispell-process)
1184 (set-process-query-on-exit-flag ispell-process nil))
1185 ;; Wait until ispell has processed word. 1176 ;; Wait until ispell has processed word.
1186 (while (progn 1177 (while (progn
1187 (accept-process-output ispell-process) 1178 (accept-process-output ispell-process)
@@ -1716,15 +1707,7 @@ FLYSPELL-BUFFER."
1716;;*---------------------------------------------------------------------*/ 1707;;*---------------------------------------------------------------------*/
1717(defun flyspell-delete-region-overlays (beg end) 1708(defun flyspell-delete-region-overlays (beg end)
1718 "Delete overlays used by flyspell in a given region." 1709 "Delete overlays used by flyspell in a given region."
1719 (if (featurep 'emacs) 1710 (remove-overlays beg end 'flyspell-overlay t))
1720 (remove-overlays beg end 'flyspell-overlay t)
1721 ;; XEmacs does not have `remove-overlays'
1722 (let ((l (overlays-in beg end)))
1723 (while (consp l)
1724 (progn
1725 (if (flyspell-overlay-p (car l))
1726 (delete-overlay (car l)))
1727 (setq l (cdr l)))))))
1728 1711
1729(defun flyspell-delete-all-overlays () 1712(defun flyspell-delete-all-overlays ()
1730 "Delete all the overlays used by flyspell." 1713 "Delete all the overlays used by flyspell."
@@ -2156,10 +2139,7 @@ If OPOINT is non-nil, restore point there after adjusting it for replacement."
2156 ((null poss) 2139 ((null poss)
2157 ;; ispell error 2140 ;; ispell error
2158 (error "Ispell: error in Ispell process")) 2141 (error "Ispell: error in Ispell process"))
2159 ((featurep 'xemacs) 2142 (t
2160 (flyspell-xemacs-popup
2161 poss word cursor-location start end opoint))
2162 (t
2163 ;; The word is incorrect, we have to propose a replacement. 2143 ;; The word is incorrect, we have to propose a replacement.
2164 (flyspell-do-correct (flyspell-emacs-popup event poss word) 2144 (flyspell-do-correct (flyspell-emacs-popup event poss word)
2165 poss word cursor-location start end opoint))) 2145 poss word cursor-location start end opoint)))
@@ -2170,17 +2150,12 @@ If OPOINT is non-nil, restore point there after adjusting it for replacement."
2170;;*---------------------------------------------------------------------*/ 2150;;*---------------------------------------------------------------------*/
2171(defun flyspell-do-correct (replace poss word cursor-location start end save) 2151(defun flyspell-do-correct (replace poss word cursor-location start end save)
2172 "The popup menu callback." 2152 "The popup menu callback."
2173 ;; Originally, the XEmacs code didn't do the (goto-char save) here and did
2174 ;; it instead right after calling the function.
2175 (cond ((eq replace 'ignore) 2153 (cond ((eq replace 'ignore)
2176 (goto-char save) 2154 (goto-char save)
2177 nil) 2155 nil)
2178 ((eq replace 'save) 2156 ((eq replace 'save)
2179 (goto-char save) 2157 (goto-char save)
2180 (ispell-send-string (concat "*" word "\n")) 2158 (ispell-send-string (concat "*" word "\n"))
2181 ;; This was added only to the XEmacs side in revision 1.18 of
2182 ;; flyspell. I assume its absence on the Emacs side was an
2183 ;; oversight. --Stef
2184 (ispell-send-string "#\n") 2159 (ispell-send-string "#\n")
2185 (flyspell-unhighlight-at cursor-location) 2160 (flyspell-unhighlight-at cursor-location)
2186 (setq ispell-pdict-modified-p '(t))) 2161 (setq ispell-pdict-modified-p '(t)))
@@ -2197,8 +2172,6 @@ If OPOINT is non-nil, restore point there after adjusting it for replacement."
2197 (if (eq replace 'buffer) 2172 (if (eq replace 'buffer)
2198 (ispell-add-per-file-word-list word))) 2173 (ispell-add-per-file-word-list word)))
2199 (replace 2174 (replace
2200 ;; This was added only to the Emacs side. I assume its absence on
2201 ;; the XEmacs side was an oversight. --Stef
2202 (flyspell-unhighlight-at cursor-location) 2175 (flyspell-unhighlight-at cursor-location)
2203 (let ((old-max (point-max)) 2176 (let ((old-max (point-max))
2204 (new-word (if (atom replace) 2177 (new-word (if (atom replace)
@@ -2212,8 +2185,6 @@ If OPOINT is non-nil, restore point there after adjusting it for replacement."
2212 (funcall flyspell-insert-function new-word) 2185 (funcall flyspell-insert-function new-word)
2213 (if flyspell-abbrev-p 2186 (if flyspell-abbrev-p
2214 (flyspell-define-abbrev word new-word))) 2187 (flyspell-define-abbrev word new-word)))
2215 ;; In the original Emacs code, this was only called in the body
2216 ;; of the if. I arbitrarily kept the XEmacs behavior instead.
2217 (flyspell-ajust-cursor-point save cursor-location old-max))) 2188 (flyspell-ajust-cursor-point save cursor-location old-max)))
2218 (t 2189 (t
2219 (goto-char save) 2190 (goto-char save)
@@ -2276,78 +2247,6 @@ If OPOINT is non-nil, restore point there after adjusting it for replacement."
2276 menu))))) 2247 menu)))))
2277 2248
2278;;*---------------------------------------------------------------------*/ 2249;;*---------------------------------------------------------------------*/
2279;;* flyspell-xemacs-popup ... */
2280;;*---------------------------------------------------------------------*/
2281(defun flyspell-xemacs-popup (poss word cursor-location start end save)
2282 "The XEmacs popup menu."
2283 (let* ((corrects (flyspell-sort (car (cdr (cdr poss))) word))
2284 (cor-menu (if (consp corrects)
2285 (mapcar (lambda (correct)
2286 (vector correct
2287 (list 'flyspell-do-correct
2288 correct
2289 (list 'quote poss)
2290 word
2291 cursor-location
2292 start
2293 end
2294 save)
2295 t))
2296 corrects)
2297 '()))
2298 (affix (car (cdr (cdr (cdr poss)))))
2299 show-affix-info
2300 (menu (let ((save (if (and (consp affix) show-affix-info)
2301 (vector
2302 (concat "Save affix: " (car affix))
2303 (list 'flyspell-do-correct
2304 ''save
2305 (list 'quote poss)
2306 word
2307 cursor-location
2308 start
2309 end
2310 save)
2311 t)
2312 (vector
2313 "Save word"
2314 (list 'flyspell-do-correct
2315 ''save
2316 (list 'quote poss)
2317 word
2318 cursor-location
2319 start
2320 end
2321 save)
2322 t)))
2323 (session (vector "Accept (session)"
2324 (list 'flyspell-do-correct
2325 ''session
2326 (list 'quote poss)
2327 word
2328 cursor-location
2329 start
2330 end
2331 save)
2332 t))
2333 (buffer (vector "Accept (buffer)"
2334 (list 'flyspell-do-correct
2335 ''buffer
2336 (list 'quote poss)
2337 word
2338 cursor-location
2339 start
2340 end
2341 save)
2342 t)))
2343 (if (consp cor-menu)
2344 (append cor-menu (list "-" save session buffer))
2345 (list save session buffer)))))
2346 (popup-menu (cons (format "%s [%s]" word (or ispell-local-dictionary
2347 ispell-dictionary))
2348 menu))))
2349
2350;;*---------------------------------------------------------------------*/
2351;;* Some example functions for real autocorrecting */ 2250;;* Some example functions for real autocorrecting */
2352;;*---------------------------------------------------------------------*/ 2251;;*---------------------------------------------------------------------*/
2353(defun flyspell-maybe-correct-transposition (beg end poss) 2252(defun flyspell-maybe-correct-transposition (beg end poss)