emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r108407: textmodex/{ispell, flyspell}


From: Agustin Martin
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r108407: textmodex/{ispell, flyspell}.el: Decrease XEmacs incompatibilities.
Date: Mon, 28 May 2012 18:11:15 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108407
committer: Agustin Martin <address@hidden>
branch nick: trunk
timestamp: Mon 2012-05-28 18:11:15 +0200
message:
  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.
modified:
  lisp/ChangeLog
  lisp/textmodes/flyspell.el
  lisp/textmodes/ispell.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-05-28 14:36:27 +0000
+++ b/lisp/ChangeLog    2012-05-28 16:11:15 +0000
@@ -1,5 +1,23 @@
 2012-05-28  Agustín Martín Domingo  <address@hidden>
 
+       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  <address@hidden>
+
        * textmodes/ispell.el (ispell-find-aspell-dictionaries):
        Check for `ispell-dictionary-base-alist' instead of full
        `ispell-dictionary-alist'.

=== modified file 'lisp/textmodes/flyspell.el'
--- a/lisp/textmodes/flyspell.el        2012-05-18 19:04:07 +0000
+++ b/lisp/textmodes/flyspell.el        2012-05-28 16:11:15 +0000
@@ -450,7 +450,9 @@
     (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 @@
   "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 @@
   ;; 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 @@
      ((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 @@
               (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 @@
                   (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 @@
 ;;*---------------------------------------------------------------------*/
 (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 ...                                      */

=== modified file 'lisp/textmodes/ispell.el'
--- a/lisp/textmodes/ispell.el  2012-05-28 14:36:27 +0000
+++ b/lisp/textmodes/ispell.el  2012-05-28 16:11:15 +0000
@@ -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 @@
     (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 @@
 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 @@
              "  --  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 @@
           (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:" "\\|"


reply via email to

[Prev in Thread] Current Thread [Next in Thread]