Commit 63f827ab authored by Reuben Thomas's avatar Reuben Thomas
Browse files

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.
parent cfa2fb26
......@@ -447,12 +447,7 @@ like <img alt=\"Some thing.\">."
;;* The minor mode declaration. */
;;*---------------------------------------------------------------------*/
(defvar flyspell-mouse-map
(let ((map (make-sparse-keymap)))
(if (featurep 'xemacs)
(define-key map [button2] #'flyspell-correct-word)
(define-key map [down-mouse-2] #'flyspell-correct-word)
(define-key map [mouse-2] 'undefined))
map)
(make-sparse-keymap)
"Keymap for Flyspell to put on erroneous words.")
(defvar flyspell-mode-map
......@@ -652,9 +647,7 @@ in your init file.
;; the welcome message
(if (and flyspell-issue-message-flag
flyspell-issue-welcome-flag
(if (featurep 'xemacs)
(interactive-p) ;; XEmacs does not have (called-interactively-p)
(called-interactively-p 'interactive)))
(called-interactively-p 'interactive))
(let ((binding (where-is-internal 'flyspell-auto-correct-word
nil 'non-ascii)))
(message "%s"
......@@ -1179,9 +1172,7 @@ misspelling and skips redundant spell-checking step."
(ispell-send-string (concat "^" word "\n"))
;; we mark the ispell process so it can be killed
;; when emacs is exited without query
(if (featurep 'xemacs)
(process-kill-without-query ispell-process)
(set-process-query-on-exit-flag ispell-process nil))
(set-process-query-on-exit-flag ispell-process nil)
;; Wait until ispell has processed word.
(while (progn
(accept-process-output ispell-process)
......@@ -1716,15 +1707,7 @@ FLYSPELL-BUFFER."
;;*---------------------------------------------------------------------*/
(defun flyspell-delete-region-overlays (beg end)
"Delete overlays used by flyspell in a given region."
(if (featurep 'emacs)
(remove-overlays beg end 'flyspell-overlay t)
;; XEmacs does not have `remove-overlays'
(let ((l (overlays-in beg end)))
(while (consp l)
(progn
(if (flyspell-overlay-p (car l))
(delete-overlay (car l)))
(setq l (cdr l)))))))
(remove-overlays beg end 'flyspell-overlay t))
(defun flyspell-delete-all-overlays ()
"Delete all the overlays used by flyspell."
......@@ -2156,10 +2139,7 @@ If OPOINT is non-nil, restore point there after adjusting it for replacement."
((null poss)
;; ispell error
(error "Ispell: error in Ispell process"))
((featurep 'xemacs)
(flyspell-xemacs-popup
poss word cursor-location start end opoint))
(t
(t
;; The word is incorrect, we have to propose a replacement.
(flyspell-do-correct (flyspell-emacs-popup event poss word)
poss word cursor-location start end opoint)))
......@@ -2170,17 +2150,12 @@ If OPOINT is non-nil, restore point there after adjusting it for replacement."
;;*---------------------------------------------------------------------*/
(defun flyspell-do-correct (replace poss word cursor-location start end save)
"The popup menu callback."
;; Originally, the XEmacs code didn't do the (goto-char save) here and did
;; it instead right after calling the function.
(cond ((eq replace 'ignore)
(goto-char save)
nil)
((eq replace 'save)
(goto-char save)
(ispell-send-string (concat "*" word "\n"))
;; This was added only to the XEmacs side in revision 1.18 of
;; flyspell. I assume its absence on the Emacs side was an
;; oversight. --Stef
(ispell-send-string "#\n")
(flyspell-unhighlight-at cursor-location)
(setq ispell-pdict-modified-p '(t)))
......@@ -2197,8 +2172,6 @@ If OPOINT is non-nil, restore point there after adjusting it for replacement."
(if (eq replace 'buffer)
(ispell-add-per-file-word-list word)))
(replace
;; This was added only to the Emacs side. I assume its absence on
;; the XEmacs side was an oversight. --Stef
(flyspell-unhighlight-at cursor-location)
(let ((old-max (point-max))
(new-word (if (atom replace)
......@@ -2212,8 +2185,6 @@ If OPOINT is non-nil, restore point there after adjusting it for replacement."
(funcall flyspell-insert-function new-word)
(if flyspell-abbrev-p
(flyspell-define-abbrev word new-word)))
;; In the original Emacs code, this was only called in the body
;; of the if. I arbitrarily kept the XEmacs behavior instead.
(flyspell-ajust-cursor-point save cursor-location old-max)))
(t
(goto-char save)
......@@ -2275,78 +2246,6 @@ If OPOINT is non-nil, restore point there after adjusting it for replacement."
ispell-dictionary))
menu)))))
;;*---------------------------------------------------------------------*/
;;* flyspell-xemacs-popup ... */
;;*---------------------------------------------------------------------*/
(defun flyspell-xemacs-popup (poss word cursor-location start end save)
"The XEmacs popup menu."
(let* ((corrects (flyspell-sort (car (cdr (cdr poss))) word))
(cor-menu (if (consp corrects)
(mapcar (lambda (correct)
(vector correct
(list 'flyspell-do-correct
correct
(list 'quote poss)
word
cursor-location
start
end
save)
t))
corrects)
'()))
(affix (car (cdr (cdr (cdr poss)))))
show-affix-info
(menu (let ((save (if (and (consp affix) show-affix-info)
(vector
(concat "Save affix: " (car affix))
(list 'flyspell-do-correct
''save
(list 'quote poss)
word
cursor-location
start
end
save)
t)
(vector
"Save word"
(list 'flyspell-do-correct
''save
(list 'quote poss)
word
cursor-location
start
end
save)
t)))
(session (vector "Accept (session)"
(list 'flyspell-do-correct
''session
(list 'quote poss)
word
cursor-location
start
end
save)
t))
(buffer (vector "Accept (buffer)"
(list 'flyspell-do-correct
''buffer
(list 'quote poss)
word
cursor-location
start
end
save)
t)))
(if (consp cor-menu)
(append cor-menu (list "-" save session buffer))
(list save session buffer)))))
(popup-menu (cons (format "%s [%s]" word (or ispell-local-dictionary
ispell-dictionary))
menu))))
;;*---------------------------------------------------------------------*/
;;* Some example functions for real autocorrecting */
;;*---------------------------------------------------------------------*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment