]> git.eshelyaron.com Git - emacs.git/commitdiff
ispell.el: Add `ispell-looking-back' XEmacs compatibility function for `looking-back'
authorAgustín Martín <agustin.martin@hispalinux.es>
Thu, 25 Jun 2009 11:25:09 +0000 (11:25 +0000)
committerAgustín Martín <agustin.martin@hispalinux.es>
Thu, 25 Jun 2009 11:25:09 +0000 (11:25 +0000)
flyspell.el (sgml-mode-flyspell-verify): Use `ispell-looking-back'

lisp/ChangeLog
lisp/textmodes/flyspell.el
lisp/textmodes/ispell.el

index fed3621c9ee08a0f315faef1234159ebeead577a..a565001508605045b7f8b6a1fac1a360b5e113b2 100644 (file)
@@ -1,3 +1,11 @@
+2009-06-25  Agustín Martín  <agustin.martin@hispalinux.es>
+
+       * textmodes/ispell.el: Add `ispell-looking-back' XEmacs
+         compatibility function for `looking-back'
+
+       * textmodes/flyspell.el (sgml-mode-flyspell-verify): Use
+         `ispell-looking-back'
+
 2009-06-24  Michael Albinus  <michael.albinus@gmx.de>
 
        * net/tramp-gvfs.el (tramp-gvfs-handle-make-directory): Use `dir'
index d2cf0ba3877cd4a22f864225b361b9674f918ccb..f3a15b2c5cc90c8ff1ebb0398bc7571723599f2d 100644 (file)
@@ -363,9 +363,9 @@ property of the major mode name.")
   "Function used for `flyspell-generic-check-word-predicate' in SGML mode."
   (not (save-excursion
         (or (looking-at "[^<\n]*>")
-            (looking-back "<[^>\n]*")
+            (ispell-looking-back "<[^>\n]*")
             (and (looking-at "[^&\n]*;")
-                 (looking-back "&[^;\n]*"))))))
+                 (ispell-looking-back "&[^;\n]*"))))))
 
 ;;*---------------------------------------------------------------------*/
 ;;*    Programming mode                                                 */
index 2f7b2e68fbd41e26b114c2c2fa2c5b02d38905d0..86e663fed68a65f5498dc2191a42ad3dfa7b1680 100644 (file)
 ;; Improved message reference matching in `ispell-message'.
 ;; Fixed bug in returning to nroff mode from tex mode.
 
-;;; Compatibility code for xemacs and (not too) older emacsen:
+;;; Compatibility code for XEmacs and (not too) older emacsen:
 
-(eval-and-compile ;; Protect against declare-function undefined in xemacs
+(eval-and-compile ;; Protect against declare-function undefined in XEmacs
   (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
 
 (declare-function ispell-check-minver "ispell" (v1 v2))
+(declare-function ispell-looking-back "ispell" (regexp &optional limit))
 
 (if (fboundp 'version<=)
     (defalias 'ispell-check-minver 'version<=)
@@ -238,6 +239,21 @@ compatibility function in case `version<=' is not available."
            (setq pending nil))))
       return)))
 
+;; XEmacs does not have looking-back
+(if (fboundp 'looking-back)
+    (defalias 'ispell-looking-back 'looking-back)
+  (defun ispell-looking-back (regexp &optional limit &rest ignored)
+    "Return non-nil if text before point matches regular expression REGEXP.
+Like `looking-at' except matches before point, and is slower.
+LIMIT if non-nil speeds up the search by specifying a minimum
+starting position, to avoid checking matches that would start
+before LIMIT.
+
+This is a stripped down compatibility function for use when
+full featured `looking-back' function is missing."
+    (save-excursion
+      (re-search-backward (concat "\\(?:" regexp "\\)\\=") limit t))))
+
 ;;; Code:
 
 (defvar mail-yank-prefix)