;;* 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
;; 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"
(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)
;;*---------------------------------------------------------------------*/
(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."
((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)))
;;*---------------------------------------------------------------------*/
(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)))
(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)
(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)
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 */
;;*---------------------------------------------------------------------*/