+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
\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)))