+2012-05-28 Agustín Martín Domingo <agustin.martin@hispalinux.es>
+
+ Decrease XEmacs incompatibilities.
+ * textmodes/flyspell.el (flyspell-check-pre-word-p):
+ Use `string-match'.
+ (flyspell-delete-region-overlays): Use alternative definition for
+ XEmacs.
+ (flyspell-delete-all-overlays): Use `flyspell-delete-region-overlays'.
+ (flyspell-word): Use `process-kill-without-query' if XEmacs.
+ (flyspell-mode-on): Use `interactive-p' if XEmacs.
+ (flyspell-incorrect-face, flyspell-duplicate-face): Do not use
+ `define-obsolete-face-alias' under XEmacs, but old method.
+
+ * textmodes/ispell.el (ispell-with-no-warnings): XEmacs alternative
+ `with-no-warnings' definition or Emacs alias.
+ (ispell-command-loop, ispell-message): Use `ispell-with-no-warnings'.
+ (ispell-word): Do not use `region-p' if XEmacs.
+
2012-05-28 Agustín Martín Domingo <agustin.martin@hispalinux.es>
* textmodes/ispell.el (ispell-find-aspell-dictionaries):
(t (:bold t)))
"Face used for marking a misspelled word in Flyspell."
:group 'flyspell)
-(define-obsolete-face-alias 'flyspell-incorrect-face 'flyspell-incorrect "22.1")
+(if (featurep 'emacs)
+ (define-obsolete-face-alias 'flyspell-incorrect-face 'flyspell-incorrect "22.1")
+ (put 'flyspell-incorrect-face 'face-alias 'flyspell-incorrect))
(defface flyspell-duplicate
'((((class color)) (:foreground "Gold3" :bold t :underline t))
"Face used for marking a misspelled word that appears twice in the buffer.
See also `flyspell-duplicate-distance'."
:group 'flyspell)
-(define-obsolete-face-alias 'flyspell-duplicate-face 'flyspell-duplicate "22.1")
+(if (featurep 'emacs)
+ (define-obsolete-face-alias 'flyspell-duplicate-face 'flyspell-duplicate "22.1")
+ (put 'flyspell-duplicate-face 'face-alias 'flyspell-duplicate))
(defvar flyspell-overlay nil)
;; the welcome message
(if (and flyspell-issue-message-flag
flyspell-issue-welcome-flag
- (called-interactively-p 'interactive))
+ (if (featurep 'xemacs)
+ (interactive-p) ;; XEmacs does not have (called-interactively-p)
+ (called-interactively-p 'interactive)))
(let ((binding (where-is-internal 'flyspell-auto-correct-word
nil 'non-ascii)))
(message "%s"
((or (and (= flyspell-pre-point (- (point) 1))
(or (eq (char-syntax (char-after flyspell-pre-point)) ?w)
(and (not (string= "" ispell-otherchars))
- (string-match-p
+ (string-match
ispell-otherchars
(buffer-substring-no-properties
flyspell-pre-point (1+ flyspell-pre-point))))))
(null (char-after flyspell-pre-point))
(or (eq (char-syntax (char-after flyspell-pre-point)) ?w)
(and (not (string= "" ispell-otherchars))
- (string-match-p
+ (string-match
ispell-otherchars
(buffer-substring-no-properties
flyspell-pre-point (1+ flyspell-pre-point)))))))
(ispell-send-string (concat "^" word "\n"))
;; we mark the ispell process so it can be killed
;; when emacs is exited without query
- (set-process-query-on-exit-flag ispell-process nil)
+ (if (featurep 'xemacs)
+ (process-kill-without-query ispell-process)
+ (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."
- (remove-overlays beg end 'flyspell-overlay t))
-
+ (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)))))))
(defun flyspell-delete-all-overlays ()
"Delete all the overlays used by flyspell."
- (remove-overlays (point-min) (point-max) 'flyspell-overlay t))
+ (flyspell-delete-region-overlays (point-min) (point-max)))
;;*---------------------------------------------------------------------*/
;;* flyspell-unhighlight-at ... */
(declare-function ispell-check-minver "ispell" (v1 v2))
(declare-function ispell-looking-back "ispell"
(regexp &optional limit &rest ignored))
+(declare-function ispell-with-no-warnings (&rest body))
(if (fboundp 'version<=)
(defalias 'ispell-check-minver 'version<=)
(save-excursion
(re-search-backward (concat "\\(?:" regexp "\\)\\=") limit t))))
+;;; XEmacs21 does not have `with-no-warnings'
+
+(if (fboundp 'with-no-warnings)
+ (defalias 'ispell-with-no-warnings 'with-no-warnings)
+ (defun ispell-with-no-warnings (&rest body)
+ "Like `progn', but prevents compiler warnings in the body."
+ ;; Taken from Emacs' byte-run.el
+ ;; The implementation for the interpreter is basically trivial.
+ (car (last body))))
+
;;; Code:
(defvar mail-yank-prefix)
quit spell session exited."
(interactive (list ispell-following-word ispell-quietly current-prefix-arg t))
(cond
- ((and region (use-region-p))
+ ((and region
+ (if (featurep 'emacs)
+ (use-region-p)
+ (and (boundp 'transient-mark-mode) transient-mark-mode
+ (boundp 'mark-active) mark-active
+ (not (eq (region-beginning) (region-end))))))
(ispell-region (region-beginning) (region-end)))
(continue (ispell-continue))
(t
" -- dict: " (or ispell-current-dictionary "default")
" -- prog: " (file-name-nondirectory ispell-program-name)))
;; XEmacs: no need for horizontal scrollbar in choices window
- (with-no-warnings
+ (ispell-with-no-warnings
(and (fboundp 'set-specifier)
(boundp 'horizontal-scrollbar-visible-p)
(set-specifier horizontal-scrollbar-visible-p nil
(cite-regexp ;Prefix of quoted text
(cond
((functionp 'sc-cite-regexp) ; sc 3.0
- (with-no-warnings
+ (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 "\\)" "\\|"
- (with-no-warnings
+ (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
(concat "In article <" "\\|"
"[^,;&+=\n]+ <[^,;&+=]+> writes:" "\\|"
- (with-no-warnings message-cite-prefix-regexp)
+ (ispell-with-no-warnings message-cite-prefix-regexp)
"\\|"
default-prefix))
((equal major-mode 'mh-letter-mode) ; mh mail message
(concat "[^,;&+=\n]+ writes:" "\\|"
- (with-no-warnings
+ (ispell-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:" "\\|"