[COMMIT] Use the old #'labels implementation if #'lexical-let changes lambdas.
13 years
Aidan Kehoe
APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1323808112 0
# Node ID 2c20bc575989a4cbda81d72a048d74f2665327ef
# Parent d489e88450aa0e1139f9300fcbef034172edd8c7
Use the old #'labels implementation if #'lexical-let changes lambdas.
lisp/ChangeLog addition:
2011-12-13 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el (byte-compile-initial-macro-environment):
If lexical let has played with our lambas, give up on constructing
the compiled functions at compiled time, that strategy doesn't
work.
diff -r d489e88450aa -r 2c20bc575989 lisp/ChangeLog
--- a/lisp/ChangeLog Sat Dec 10 16:19:16 2011 +0000
+++ b/lisp/ChangeLog Tue Dec 13 20:28:32 2011 +0000
@@ -3,6 +3,13 @@
* mule/mule-cmds.el (posix-charset-to-coding-system-hash):
Correct the docstring for this variable.
+2011-12-13 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * bytecomp.el (byte-compile-initial-macro-environment):
+ If lexical let has played with our lambas, give up on constructing
+ the compiled functions at compiled time, that strategy doesn't
+ work.
+
2011-12-09 Aidan Kehoe <kehoea(a)parhasard.net>
* cl-macs.el (load-time-value):
diff -r d489e88450aa -r 2c20bc575989 lisp/bytecomp.el
--- a/lisp/bytecomp.el Sat Dec 10 16:19:16 2011 +0000
+++ b/lisp/bytecomp.el Tue Dec 13 20:28:32 2011 +0000
@@ -636,9 +636,31 @@
(cons 'progn
(byte-compile-transform-labels
form names lambdas placeholders))))))
- (cl-macroexpand-all `(,gensym ',names (list ,@lambdas)
- ',placeholders ,@body)
- byte-compile-macro-environment)))))
+ (setq body
+ (cl-macroexpand-all `(,gensym ',names (list ,@lambdas)
+ ',placeholders ,@body)
+ byte-compile-macro-environment))
+ (if (position 'lambda (mapcar #'(lambda (object)
+ (car-safe (cdr-safe
+ object)))
+ (cdr (third body)))
+ :key #'car-safe :test-not #'eq)
+ ;; #'lexical-let has worked its magic, not all the
+ ;; lambdas are lambdas. Give up on pre-compiling the
+ ;; labels.
+ (setq names (mapcar #'copy-symbol names)
+ lambdas (cdr (third body))
+ body (sublis (pairlis placeholders names)
+ (nthcdr 4 body) :test #'eq)
+ lambdas (sublis (pairlis placeholders names)
+ lambdas :test #'eq)
+ body (cl-macroexpand-all
+ `(lexical-let
+ ,names
+ (setf ,@(mapcan #'list names lambdas))
+ ,@body)
+ byte-compile-macro-environment))
+ body)))))
(flet .
,#'(lambda (bindings &rest body)
(let* ((names (mapcar 'car bindings))
--
‘Iodine deficiency was endemic in parts of the UK until, through what has been
described as “an unplanned and accidental public health triumph”, iodine was
added to cattle feed to improve milk production in the 1930s.’
(EN Pearce, Lancet, June 2011)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[COMMIT] Be more careful about what we shadow, #'byte-compile-eval.
13 years
Aidan Kehoe
APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1323808950 0
# Node ID a944c124b2d39f393676c0168ae690e7141d5576
# Parent 2c20bc575989a4cbda81d72a048d74f2665327ef
Be more careful about what we shadow, #'byte-compile-eval.
2011-12-13 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el (byte-compile-eval):
When evaluating code at compile time, don't put those macros in
the macro environment that only make sense when creating
byte-compiled output.
diff -r 2c20bc575989 -r a944c124b2d3 lisp/ChangeLog
--- a/lisp/ChangeLog Tue Dec 13 20:28:32 2011 +0000
+++ b/lisp/ChangeLog Tue Dec 13 20:42:30 2011 +0000
@@ -5,6 +5,13 @@
2011-12-13 Aidan Kehoe <kehoea(a)parhasard.net>
+ * bytecomp.el (byte-compile-eval):
+ When evaluating code at compile time, don't put those macros in
+ the macro environment that only make sense when creating
+ byte-compiled output.
+
+2011-12-13 Aidan Kehoe <kehoea(a)parhasard.net>
+
* bytecomp.el (byte-compile-initial-macro-environment):
If lexical let has played with our lambas, give up on constructing
the compiled functions at compiled time, that strategy doesn't
diff -r 2c20bc575989 -r a944c124b2d3 lisp/bytecomp.el
--- a/lisp/bytecomp.el Tue Dec 13 20:28:32 2011 +0000
+++ b/lisp/bytecomp.el Tue Dec 13 20:42:30 2011 +0000
@@ -455,11 +455,16 @@
;;; "If a file being compiled contains a `defmacro' form, the macro is
;;; defined temporarily for the rest of the compilation of that file."
(defun byte-compile-eval (form)
- (let ((save-macro-environment nil))
+ (let ((save-macro-environment nil)
+ ;; These are macros in byte-compile-initial-macro-environment that
+ ;; shouldn't be shadowed when calling #'byte-compile-eval, since
+ ;; such code is interpreted, not compiled.
+ ;; #### Consider giving this a docstring and a top-level value.
+ (byte-compile-no-shadow '(load-time-value labels flet)))
(unwind-protect
(loop
for (sym . def) in byte-compile-macro-environment
- do (when (symbolp sym)
+ do (when (and (symbolp sym) (not (memq sym byte-compile-no-shadow)))
(push
(if (fboundp sym)
(cons sym (symbol-function sym))
--
‘Iodine deficiency was endemic in parts of the UK until, through what has been
described as “an unplanned and accidental public health triumph”, iodine was
added to cattle feed to improve milk production in the 1930s.’
(EN Pearce, Lancet, June 2011)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit/XEmacs: 2 new changesets
13 years
Bitbucket
2 new commits in XEmacs:
https://bitbucket.org/xemacs/xemacs/changeset/2c20bc575989/
changeset: 2c20bc575989
user: kehoea
date: 2011-12-13 21:28:32
summary: Use the old #'labels implementation if #'lexical-let changes lambdas.
lisp/ChangeLog addition:
2011-12-13 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el (byte-compile-initial-macro-environment):
If lexical let has played with our lambas, give up on constructing
the compiled functions at compiled time, that strategy doesn't
work.
affected #: 2 files
https://bitbucket.org/xemacs/xemacs/changeset/a944c124b2d3/
changeset: a944c124b2d3
user: kehoea
date: 2011-12-13 21:42:30
summary: Be more careful about what we shadow, #'byte-compile-eval.
2011-12-13 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el (byte-compile-eval):
When evaluating code at compile time, don't put those macros in
the macro environment that only make sense when creating
byte-compiled output.
affected #: 2 files
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[C21.4] fix bug in parsing ^ after shy group in regex
13 years
Vin Shelton
On Sun, Dec 11, 2011 at 2:57 PM, Julian Bradfield
<jcb+xeb(a)jcbradfield.org> wrote:
> ^ was wrongly interpreted as literal when occurring at the start
> of a shy group. Cause: regex.c:at_begline_loc_p() was not told about
> shy groups.
> Two tests added to tests/automated/regexp-tests.el.
COMMIT 21.4
Thanks for the patch, Julian.
- Vin
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[PATCH21.5] fix bug in parsing ^ after shy group in regex
13 years
Julian Bradfield
^ was wrongly interpreted as literal when occurring at the start
of a shy group. Cause: regex.c:at_begline_loc_p() was not told about
shy groups.
Two tests added to tests/automated/regexp-tests.el.
Patch applies against 21.5.31.
--- src/regex.c-dist 2011-04-29 14:31:16.000000000 +0100
+++ src/regex.c 2011-12-11 19:43:46.000000000 +0000
@@ -3553,12 +3553,18 @@
{
re_char *prev = p - 2;
re_bool prev_prev_backslash = prev > pattern && prev[-1] == '\\';
+ re_bool shy_open = prev-1 > pattern && prev[0] == ':'
+ && prev[-1] == '?' && prev[-2] == '(';
+ re_bool ppp_backslash = prev-2 > pattern && prev[-3] == '\\';
return
/* After a subexpression? */
(*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash))
/* After an alternative? */
- || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash));
+ || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash))
+ /* After a shy open? */
+ || (!(syntax & RE_NO_SHY_GROUPS) && shy_open
+ && (syntax & RE_NO_BK_PARENS || ppp_backslash));
}
--- tests/automated/regexp-tests.el-dist 2011-04-29 14:31:17.000000000 +0100
+++ tests/automated/regexp-tests.el 2011-12-11 19:48:59.000000000 +0000
@@ -401,6 +401,11 @@
(Assert (progn (string-match "\\(a\\)" a)
(string-match "\\(?:a\\)" a)
(not (match-beginning 1))))
+
+ ;; ^ at beginning of shy group. Fix by
+ ;; Julian Bradfield on 2012-12-11.
+ (Assert (string-match "\\(?:^\\)" ""))
+ (Assert (string-match "a(?:^)" "a:^)"))
)
;; bug identified by Katsumi Yamaoka 2004-09-03 <b9ywtzbbpue.fsf_-_(a)jpl.org>
@@ -548,7 +553,7 @@
;; combinations of STRING and STRBUFFER.
;; empty string at point
-;; Thanks Julian Bradford on XEmacs Beta
+;; Thanks Julian Bradfield on XEmacs Beta
;; <18652.54975.894512.880956(a)krk.inf.ed.ac.uk>
(with-string-as-buffer-contents "aáa"
(goto-char (point-min))
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[PATCH21.4] fix bug in parsing ^ after shy group in regex
13 years
Julian Bradfield
^ was wrongly interpreted as literal when occurring at the start
of a shy group. Cause: regex.c:at_begline_loc_p() was not told about
shy groups.
Two tests added to tests/automated/regexp-tests.el.
Patch applies against 21.4.22. (Patch for 21.5 follows.)
--- src/regex.c-dist 2006-03-31 02:29:00.000000000 +0100
+++ src/regex.c 2011-12-11 18:47:22.000000000 +0000
@@ -3295,12 +3295,18 @@
{
re_char *prev = p - 2;
re_bool prev_prev_backslash = prev > pattern && prev[-1] == '\\';
+ re_bool shy_open = prev-1 > pattern && prev[0] == ':'
+ && prev[-1] == '?' && prev[-2] == '(';
+ re_bool ppp_backslash = prev-2 > pattern && prev[-3] == '\\';
return
/* After a subexpression? */
(*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash))
/* After an alternative? */
- || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash));
+ || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash))
+ /* After a shy open? */
+ || (!(syntax & RE_NO_SHY_GROUPS) && shy_open
+ && (syntax & RE_NO_BK_PARENS || ppp_backslash));
}
--- tests/automated/regexp-tests.el-dist 2008-12-26 03:45:29.000000000 +0000
+++ tests/automated/regexp-tests.el 2011-12-11 19:20:46.000000000 +0000
@@ -447,11 +447,16 @@
(Assert (progn (string-match "\\(a\\)" "a")
(string-match "\\(?:a\\)" "a")
(not (match-beginning 1))))
+
+ ;; ^ at beginning of shy group. Fix by
+ ;; Julian Bradfield on 2012-12-11.
+ (Assert (string-match "\\(?:^\\)" ""))
+ (Assert (string-match "a(?:^)" "a:^)"))
)
;; empty string at point
-;; Thanks Julian Bradford on XEmacs Beta
+;; Thanks Julian Bradfield on XEmacs Beta
;; <18652.54975.894512.880956(a)krk.inf.ed.ac.uk>
(with-string-as-buffer-contents "aáa"
(goto-char (point-min))
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[COMMIT] Correct and clarify docstring, #'load-time-value
13 years
Aidan Kehoe
APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1323419887 0
# Node ID 3152c2c214612b81eb7bba521081b6a54e0145e9
# Parent 4cffcc80b299943ca34a38863344056e000271c4
Correct and clarify docstring, #'load-time-value
lisp/ChangeLog addition:
2011-12-09 Aidan Kehoe <kehoea(a)parhasard.net>
* cl-macs.el (load-time-value):
Clarify the docstring here, thanks for pointing out its inaccuracy
Julian Bradfield.
diff -r 4cffcc80b299 -r 3152c2c21461 lisp/ChangeLog
--- a/lisp/ChangeLog Thu Dec 08 10:05:14 2011 -0500
+++ b/lisp/ChangeLog Fri Dec 09 08:38:07 2011 +0000
@@ -1,3 +1,9 @@
+2011-12-09 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * cl-macs.el (load-time-value):
+ Clarify the docstring here, thanks for pointing out its inaccuracy
+ Julian Bradfield.
+
2011-11-14 Vin Shelton <acs(a)xemacs.org>
* faces.el: When the default background was changed from light to
diff -r 4cffcc80b299 -r 3152c2c21461 lisp/cl-macs.el
--- a/lisp/cl-macs.el Thu Dec 08 10:05:14 2011 -0500
+++ b/lisp/cl-macs.el Fri Dec 09 08:38:07 2011 +0000
@@ -3891,8 +3891,10 @@
;;;###autoload
(defmacro load-time-value (form &optional read-only)
- "Like `progn', but evaluates the body at load time.
-The result of the body appears to the compiler as a quoted constant."
+ "Evaluate FORM once at load time if byte-compiled.
+
+The result of FORM is returned and stored for later access. In
+interpreted code, `load-time-value' is equivalent to `progn'."
(list 'progn form))
;;;###autoload
--
‘Iodine deficiency was endemic in parts of the UK until, through what has been
described as “an unplanned and accidental public health triumph”, iodine was
added to cattle feed to improve milk production in the 1930s.’
(EN Pearce, Lancet, June 2011)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches