* progmodes/python.el (python-syntax--context-compiler-macro): New defun.
authorFabián Ezequiel Gallina <fgallina@gnu.org>
Wed, 17 Apr 2013 02:52:50 +0000 (23:52 -0300)
committerFabián Ezequiel Gallina <fgallina@gnu.org>
Wed, 17 Apr 2013 02:52:50 +0000 (23:52 -0300)
(python-syntax-context): Use named compiler-macro for backwards
compatibility with Emacs 24.x.

lisp/ChangeLog
lisp/progmodes/python.el

index 23b873d..cbb63e3 100644 (file)
@@ -1,3 +1,9 @@
+2013-04-17  Fabián Ezequiel Gallina  <fgallina@gnu.org>
+
+       * progmodes/python.el (python-syntax--context-compiler-macro): New defun.
+       (python-syntax-context): Use named compiler-macro for backwards
+       compatibility with Emacs 24.x.
+
 2013-04-17  Leo Liu  <sdl.web@gmail.com>
 
        * progmodes/octave-mod.el (octave-mode-map): Fix key binding to
index fde7fad..b0c00a3 100644 (file)
@@ -368,22 +368,24 @@ This variant of `rx' supports common python named REGEXPS."
 \f
 ;;; Font-lock and syntax
 
+(eval-when-compile
+  (defun python-syntax--context-compiler-macro (form type &optional syntax-ppss)
+    (pcase type
+      (`'comment
+       `(let ((ppss (or ,syntax-ppss (syntax-ppss))))
+          (and (nth 4 ppss) (nth 8 ppss))))
+      (`'string
+       `(let ((ppss (or ,syntax-ppss (syntax-ppss))))
+          (and (nth 3 ppss) (nth 8 ppss))))
+      (`'paren
+       `(nth 1 (or ,syntax-ppss (syntax-ppss))))
+      (_ form))))
+
 (defun python-syntax-context (type &optional syntax-ppss)
   "Return non-nil if point is on TYPE using SYNTAX-PPSS.
 TYPE can be `comment', `string' or `paren'.  It returns the start
 character address of the specified TYPE."
-  (declare (compiler-macro
-            (lambda (form)
-              (pcase type
-                (`'comment
-                 `(let ((ppss (or ,syntax-ppss (syntax-ppss))))
-                    (and (nth 4 ppss) (nth 8 ppss))))
-                (`'string
-                 `(let ((ppss (or ,syntax-ppss (syntax-ppss))))
-                    (and (nth 3 ppss) (nth 8 ppss))))
-                (`'paren
-                 `(nth 1 (or ,syntax-ppss (syntax-ppss))))
-                (_ form)))))
+  (declare (compiler-macro python-syntax--context-compiler-macro))
   (let ((ppss (or syntax-ppss (syntax-ppss))))
     (pcase type
       (`comment (and (nth 4 ppss) (nth 8 ppss)))