textmodex/{ispell,flyspell}.el: Decrease XEmacs incompatibilities.
* 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. * 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.
This commit is contained in:
parent
8cab9efc05
commit
85c8c5b653
3 changed files with 64 additions and 15 deletions
|
@ -1,3 +1,21 @@
|
|||
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):
|
||||
|
|
|
@ -450,7 +450,9 @@ like <img alt=\"Some thing.\">."
|
|||
(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))
|
||||
|
@ -458,7 +460,9 @@ like <img alt=\"Some thing.\">."
|
|||
"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)
|
||||
|
||||
|
@ -615,7 +619,9 @@ in your .emacs file.
|
|||
;; 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"
|
||||
|
@ -739,7 +745,7 @@ before the current command."
|
|||
((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))))))
|
||||
|
@ -758,7 +764,7 @@ before the current command."
|
|||
(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)))))))
|
||||
|
@ -1112,7 +1118,9 @@ 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
|
||||
(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)
|
||||
|
@ -1646,12 +1654,19 @@ FLYSPELL-BUFFER."
|
|||
;;*---------------------------------------------------------------------*/
|
||||
(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 ... */
|
||||
|
|
|
@ -203,6 +203,7 @@
|
|||
(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<=)
|
||||
|
@ -254,6 +255,16 @@ full featured `looking-back' function is missing."
|
|||
(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)
|
||||
|
@ -1703,7 +1714,12 @@ nil word is correct or spelling is accepted.
|
|||
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
|
||||
|
@ -1929,7 +1945,7 @@ Global `ispell-quit' set to start location to continue spell session."
|
|||
" -- 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
|
||||
|
@ -3708,23 +3724,23 @@ You can bind this to the key C-c i in GNUS or mail by adding to
|
|||
(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:" "\\|"
|
||||
|
|
Loading…
Add table
Reference in a new issue