aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Engster <[email protected]>2011-10-31 09:00:32 +0800
committerChong Yidong <[email protected]>2011-10-31 09:00:32 +0800
commit72b8747b4fb41633284f9bcf1d9544eda69519aa (patch)
tree9be6546997272d69a59b27f06384c0a185f403b3
parent84bd6e9e02c051816d8ba8e31fec2c3f912ae8fa (diff)
* admin/grammars/bovine-grammar.el: Avoid using old-style backquotes.
-rw-r--r--admin/ChangeLog4
-rw-r--r--admin/grammars/bovine-grammar.el19
2 files changed, 23 insertions, 0 deletions
diff --git a/admin/ChangeLog b/admin/ChangeLog
index 7c2f1a743b..f91d53194c 100644
--- a/admin/ChangeLog
+++ b/admin/ChangeLog
@@ -1,3 +1,7 @@
+2011-10-31 David Engster <[email protected]>
+
+ * grammars/bovine-grammar.el: Avoid using old-style backquotes.
+
2011-10-28 Eli Zaretskii <[email protected]>
* nt/README-ftp-server: Mention UNICOWS.DLL as prerequisite for
diff --git a/admin/grammars/bovine-grammar.el b/admin/grammars/bovine-grammar.el
index 5a94860867..0e8756e1c5 100644
--- a/admin/grammars/bovine-grammar.el
+++ b/admin/grammars/bovine-grammar.el
@@ -109,6 +109,14 @@ NAME, ALIASCLASS, DEFINITION and ATTRIBUTES."
;; Cache of macro definitions currently in use.
(defvar bovine--grammar-macros nil)
+;; Detect if we have an Emacs with newstyle unquotes allowed outside
+;; of backquote.
+;; This should probably be changed to a test to (= emacs-major-version 24)
+;; when it is released, but at the moment it might be possible that people
+;; are using an older snapshot.
+(defvar bovine--grammar-newstyle-unquote
+ (equal '(, test) (read ",test")))
+
(defun bovine-grammar-expand-form (form quotemode &optional inplace)
"Expand FORM into a new one suitable to the bovine parser.
FORM is a list in which we are substituting.
@@ -142,6 +150,17 @@ expanded from elsewhere."
(while form
(setq first (car form)
form (cdr form))
+ ;; Hack for dealing with new reading of unquotes outside of
+ ;; backquote (introduced in rev. 102591 in emacs-bzr).
+ (when (and bovine--grammar-newstyle-unquote
+ (listp first)
+ (or (equal (car first) '\,)
+ (equal (car first) '\,@)))
+ (if (listp (cadr first))
+ (setq form (append (cdr first) form)
+ first (car first))
+ (setq first (intern (concat (symbol-name (car first))
+ (symbol-name (cadr first)))))))
(cond
((eq first nil)
(when (and (not inlist) (not inplace))