[COMMIT] Document the CL set functions and #'eql in the Lispref, not just cl.texi
13 years, 10 months
Aidan Kehoe
APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1298113426 0
# Node ID f5a5501814f5a160bfdd3e31be654e04aad3b4e0
# Parent 31475de17064148b3265c4a60d3e3d7c3849cea7
Document the CL set functions and #'eql in the Lispref, not just cl.texi
man/ChangeLog addition:
2011-02-19 Aidan Kehoe <kehoea(a)parhasard.net>
* lispref/lists.texi (Sets And Lists):
Document #'member*, #'remove*, #'delete* in this file. Document
#'memq, #'member, #'remq, #'remove, #'delq, #'delete in terms of
the former functions.
Document #'subsetp, #'union, #'intersection, #'set-difference,
#'set-exclusive-or and their destructive analogues in this file.
* lispref/lists.texi (Association Lists):
Document #'assoc*, #'rassoc* in this file. Document #'assq,
#'assoc, #'rassq, #'rassoc in terms of the first two functions.
* lispref/objects.texi (Equality Predicates):
Document #'eql here, don't leave it to cl.texi.
src/ChangeLog addition:
2011-02-19 Aidan Kehoe <kehoea(a)parhasard.net>
* fns.c (Fset_exclusive_or):
This function accepts the :stable keyword too, document this in
its arglist.
diff -r 31475de17064 -r f5a5501814f5 man/ChangeLog
--- a/man/ChangeLog Wed Feb 16 18:26:40 2011 +0000
+++ b/man/ChangeLog Sat Feb 19 11:03:46 2011 +0000
@@ -1,3 +1,17 @@
+2011-02-19 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * lispref/lists.texi (Sets And Lists):
+ Document #'member*, #'remove*, #'delete* in this file. Document
+ #'memq, #'member, #'remq, #'remove, #'delq, #'delete in terms of
+ the former functions.
+ Document #'subsetp, #'union, #'intersection, #'set-difference,
+ #'set-exclusive-or and their destructive analogues in this file.
+ * lispref/lists.texi (Association Lists):
+ Document #'assoc*, #'rassoc* in this file. Document #'assq,
+ #'assoc, #'rassq, #'rassoc in terms of the first two functions.
+ * lispref/objects.texi (Equality Predicates):
+ Document #'eql here, don't leave it to cl.texi.
+
2010-11-06 Aidan Kehoe <kehoea(a)parhasard.net>
* lispref/lists.texi (Rearrangement, Building Lists):
diff -r 31475de17064 -r f5a5501814f5 man/lispref/lists.texi
--- a/man/lispref/lists.texi Wed Feb 16 18:26:40 2011 +0000
+++ b/man/lispref/lists.texi Sat Feb 19 11:03:46 2011 +0000
@@ -1146,59 +1146,97 @@
A list can represent an unordered mathematical set---simply consider a
value an element of a set if it appears in the list, and ignore the
-order of the list. To form the union of two sets, use @code{append} (as
-long as you don't mind having duplicate elements). Other useful
-functions for sets include @code{memq} and @code{delq}, and their
-@code{equal} versions, @code{member} and @code{delete}.
+order of the list. XEmacs provides set operations inherited from Common
+Lisp.
-@cindex CL note---lack @code{union}, @code{set}
-@quotation
-@b{Common Lisp note:} Common Lisp has functions @code{union} (which
-avoids duplicate elements) and @code{intersection} for set operations,
-but XEmacs Lisp does not have them. You can write them in Lisp if
-you wish.
-@end quotation
+@defun member* item list @t{&key :test :test-not :key}
+This function tests to see whether @var{item} is a member of @var{list},
+comparing with @code{eql}. If it is, @code{member*} returns the tail of
+@var{list} starting with the first occurrence of @var{item}. Otherwise,
+it returns @code{nil}.
-@defun memq object list
-@cindex membership in a list
-This function tests to see whether @var{object} is a member of
-@var{list}. If it is, @code{memq} returns a list starting with the
-first occurrence of @var{object}. Otherwise, it returns @code{nil}.
-The letter @samp{q} in @code{memq} says that it uses @code{eq} to
-compare @var{object} against the elements of the list. For example:
+This is equivalent to the Common Lisp @code{member} function, but that
+name was already taken in Emacs Lisp, whence the asterisk at the end of
+@code{member*}.
+
+The @code{:test} keyword argument allows you to specify the test used to
+decide whether @var{item} is equivalent to a given element of
+@var{list}. The function should return non-@code{nil} if the items
+match, @code{nil} if they do not. The @code{:test-not} keyword is
+similar, but the meaning of @code{nil} and non-@code{nil} results are
+reversed. The @code{:key} keyword allows you to examine a component of
+each object in @var{list}, rather than the object itself.
@example
@group
-(memq 'b '(a b c b a))
+(member* 'b '(a b c b a))
@result{} (b c b a)
@end group
@group
-(memq '(2) '((1) (2))) ; @r{@code{(2)} and @code{(2)} are not @code{eq}.}
+(member* '(2) '((1) (2))) ; @r{@code{(2)} and @code{(2)} are not @code{eql}.}
@result{} nil
@end group
+@group
+(member* '(2) '((1) (2)) :test #'equal) ; @r{but they are @code{equal}.}
+ @result{} ((2))
+@end group
+@group
+(member* 3 '((1) (2) (3) (4)) :key 'car) ; @r{key not applied to @var{item}}
+ @result{} ((3) (4))
+@end group
@end example
@end defun
-@defun delq object list
-@cindex deletion of elements
-This function destructively removes all elements @code{eq} to
-@var{object} from @var{list}. The letter @samp{q} in @code{delq} says
-that it uses @code{eq} to compare @var{object} against the elements of
-the list, like @code{memq}.
+@defun memq item list
+This is equivalent to calling @code{(member* item list :test 'eq)}, but
+for historical reasons is more common in the XEmacs code base. Both
+expressions compile to the same byte-code.
@end defun
-When @code{delq} deletes elements from the front of the list, it does so
-simply by advancing down the list and returning a sublist that starts
-after those elements:
+@defun member item list
+This is equivalent to calling @code{(member* item list :test 'equal)}.
+@end defun
+
+@defun remove* item sequence @t{&key (test #'eql) (key #'identity) (start 0) (end (length sequence)) from-end count test-not}
+@cindex removal of elements
+
+This function removes all occurrences of @var{object} from
+@var{sequence}, which can be a list, vector, or bit-vector.
+
+The @code{:test} keyword argument allows you to specify the test used to
+decide whether @var{item} is equivalent to a given element of
+@var{sequence}. The function should return non-@code{nil} if the items
+match, @code{nil} if they do not. The @code{:test-not} keyword is
+similar, but the meaning of @code{nil} and non-@code{nil} results are
+reversed. The @code{:key} keyword allows you to examine a component of
+each object in @var{sequence}, rather than the object itself.
+
+The @code{:start} and @code{:end} keywords allow you to specify a
+zero-based subrange of @var{sequence} to operate on, @code{remove*} will
+call the test function on all items of @var{sequence} between the index
+specified by @code{:start}, inclusive, and @code{:end},
+exclusive. @code{:count} gives a maximum number of items to remove, and
+@code{:from-end}, most useful in combination with @code{:count},
+specifies that the removal should start from the end of @var{sequence}.
+
+As with @code{member*}, this function is equivalent to the Common Lisp
+function of almost the same name (the Common Lisp function has no
+asterisk.)
+
+When @code{remove*} removes elements from the front of a list
+@var{sequence}, it does so simply by advancing down the list and
+returning a sublist that starts after those elements:
@example
@group
-(delq 'a '(a b c)) @equiv{} (cdr '(a b c))
+(remove* 'a '(a b c)) @equiv{} (cdr '(a b c))
@end group
@end example
When an element to be deleted appears in the middle of the list,
-removing it involves changing the @sc{cdr}s (@pxref{Setcdr}).
+removing it involves copying the list conses up to that point, and
+setting the tail of the copied list to the tail of the original list
+past that point.
@example
@group
@@ -1206,7 +1244,7 @@
@result{} (a b c (4))
@end group
@group
-(delq 'a sample-list)
+(remove* 'a sample-list)
@result{} (b c (4))
@end group
@group
@@ -1214,7 +1252,55 @@
@result{} (a b c (4))
@end group
@group
-(delq 'c sample-list)
+(remove* 'c sample-list)
+ @result{} (a b (4))
+@end group
+@group
+sample-list
+ @result{} (a b c (4))
+@end group
+@end example
+
+Don't assume that a variable which formerly held the argument @var{list}
+now has fewer elements, or that it still holds the original list!
+Instead, save the result of @code{remove*} and use that. Most often we
+store the result back into the variable that held the original list:
+
+@example
+(setq flowers (remove* 'rose flowers))
+@end example
+
+In the following example, the @code{(4)} that @code{remove*} attempts to match
+and the @code{(4)} in the @code{sample-list} are not @code{eq}:
+
+@example
+@group
+(remove* '(4) sample-list)
+ @result{} (a b c (4))
+@end group
+@end example
+@end defun
+
+@defun remq item sequence
+This is equivalent to calling @code{(remove* item sequence :test #'eq)}.
+@end defun
+
+@defun remove item sequence
+This is equivalent to calling @code{(remove* item sequence :test #'equal)}.
+@end defun
+
+@defun delete* item sequence @t{&key (test #'eql) (key #'identity) (start 0) (end (length sequence)) from-end count test-not}
+This is like @code{remove*}, but a list @var{sequence} is modified
+in-place (`destructively', in Lisp parlance). So some of the examples
+above change:
+
+@example
+@group
+(setq sample-list '(a b c (4)))
+ @result{} (a b c (4))
+@end group
+@group
+(delete* 'c sample-list)
@result{} (a b (4))
@end group
@group
@@ -1222,78 +1308,80 @@
@result{} (a b (4))
@end group
@end example
-
-Note that @code{(delq 'c sample-list)} modifies @code{sample-list} to
-splice out the third element, but @code{(delq 'a sample-list)} does not
-splice anything---it just returns a shorter list. Don't assume that a
-variable which formerly held the argument @var{list} now has fewer
-elements, or that it still holds the original list! Instead, save the
-result of @code{delq} and use that. Most often we store the result back
-into the variable that held the original list:
-
-@example
-(setq flowers (delq 'rose flowers))
-@end example
-
-In the following example, the @code{(4)} that @code{delq} attempts to match
-and the @code{(4)} in the @code{sample-list} are not @code{eq}:
-
-@example
-@group
-(delq '(4) sample-list)
- @result{} (a c (4))
-@end group
-@end example
-
-The following two functions are like @code{memq} and @code{delq} but use
-@code{equal} rather than @code{eq} to compare elements. They are new in
-Emacs 19.
-
-@defun member object list
-The function @code{member} tests to see whether @var{object} is a member
-of @var{list}, comparing members with @var{object} using @code{equal}.
-If @var{object} is a member, @code{member} returns a list starting with
-its first occurrence in @var{list}. Otherwise, it returns @code{nil}.
-
-Compare this with @code{memq}:
-
-@example
-@group
-(member '(2) '((1) (2))) ; @r{@code{(2)} and @code{(2)} are @code{equal}.}
- @result{} ((2))
-@end group
-@group
-(memq '(2) '((1) (2))) ; @r{@code{(2)} and @code{(2)} are not @code{eq}.}
- @result{} nil
-@end group
-@group
-;; @r{Two strings with the same contents are @code{equal}.}
-(member "foo" '("foo" "bar"))
- @result{} ("foo" "bar")
-@end group
-@end example
@end defun
-@defun delete object list
-This function destructively removes all elements @code{equal} to
-@var{object} from @var{list}. It is to @code{delq} as @code{member} is
-to @code{memq}: it uses @code{equal} to compare elements with
-@var{object}, like @code{member}; when it finds an element that matches,
-it removes the element just as @code{delq} would. For example:
-
-@example
-@group
-(delete '(2) '((2) (1) (2)))
- @result{} '((1))
-@end group
-@end example
+@defun delq item sequence
+This is equivalent to calling @code{(delete* item sequence :test #'eq)}.
@end defun
-@quotation
-@b{Common Lisp note:} The functions @code{member} and @code{delete} in
-XEmacs Lisp are derived from Maclisp, not Common Lisp. The Common
-Lisp versions do not use @code{equal} to compare elements.
-@end quotation
+@defun delete item list
+This is equivalent to calling @code{(delete* item sequence :test #'equal)}.
+@end defun
+
+@defun subsetp list1 list2 @t{&key :test :test-not :key}
+This function returns non-@code{nil} if every item in @var{list1} is
+present in @var{list2}.
+@end defun
+
+@defun union list1 list2 @t{&key :test :test-not :key :stable}
+This function calculates the union of two lists, returning a list
+containing all those items that appear in either list. It doesn't
+guarantee that duplicates in @var{list1} or @var{list2} will be
+eliminated; see @code{remove-duplicates} if this is important to you.
+
+A non-nil value for the @code{:stable} keyword, not specified by Common
+Lisp, means return the items in the order they appear in @var{list1},
+followed by the remaining items in the order they appear in @var{list2}.
+The other keywords are as in @code{member*}.
+
+@code{union} does not modify @var{list1} or @var{list2}.
+@end defun
+
+@defun intersection list1 list2 @t{&key :test :test-not :key :stable}
+This function calculates the intersection of two lists, returning a list
+containing all those items that appear in both lists. It doesn't
+guarantee that duplicates in @var{list1} or @var{list2} will be
+eliminated; see @code{remove-duplicates} if this is important to
+you. @code{intersection} does not modify either list.
+
+A non-nil value for the @code{:stable} keyword, not specified by Common
+Lisp, means return the items in the order they appear in @var{list1}.
+The other keywords are as in @code{member*}.
+@end defun
+
+@defun set-difference list1 list2 @t{&key :test :test-not :key :stable}
+This function returns those items that are in @var{list1} but not in
+@var{list2}. It does not modify either list.
+
+A non-nil value for the @code{:stable} keyword, not specified by Common
+Lisp, means return the items in the order they appear in @var{list1}.
+The other keywords are as in @code{member*}.
+@end defun
+
+@defun set-exclusive-or list1 list2 @t{&key :test :test-not :key :stable}
+This function returns those items that are in @var{list1} but not in
+@var{list2}, together with those in @var{list2} but not in @var{list1}.
+It does not modify either list.
+
+A non-nil value for the @code{:stable} keyword, not specified by Common
+Lisp, means return the items in the order they appear in @var{list1},
+followed by the remaining items in the order they appear in @var{list2}.
+The other keywords are as in @code{member*}.
+@end defun
+
+The following functions are equivalent to the previous four functions,
+but with two important differences; they do not accept the
+@code{:stable} keyword, and they modify one or both list arguments in
+the same way @code{delete*} does.
+
+@defun nintersection list1 list2 @t{&key :test :test-not :key}
+@end defun
+@defun nset-difference list1 list2 @t{&key :test :test-not :key}
+@end defun
+@defun nset-exclusive-or list1 list2 @t{&key :test :test-not :key}
+@end defun
+@defun nunion list1 list2 @t{&key :test :test-not :key}
+@end defun
See also the function @code{add-to-list}, in @ref{Setting Variables},
for another way to add an element to a list stored in a variable.
@@ -1370,21 +1458,21 @@
each key can occur only once. @xref{Property Lists}, for a comparison
of property lists and association lists.
-@defun assoc key alist
+@defun assoc* key alist @t{&key :test :test-not :key}
This function returns the first association for @var{key} in
@var{alist}. It compares @var{key} against the alist elements using
-@code{equal} (@pxref{Equality Predicates}). It returns @code{nil} if no
-association in @var{alist} has a @sc{car} @code{equal} to @var{key}.
-For example:
+@code{eql} (@pxref{Equality Predicates}), or the test specified with the
+@code{:test} keyword. It returns @code{nil} if no association in
+@var{alist} has a @sc{car} @code{equal} to @var{key}. For example:
@smallexample
(setq trees '((pine . cones) (oak . acorns) (maple . seeds)))
@result{} ((pine . cones) (oak . acorns) (maple . seeds))
-(assoc 'oak trees)
+(assoc* 'oak trees)
@result{} (oak . acorns)
-(cdr (assoc 'oak trees))
+(cdr (assoc* 'oak trees))
@result{} acorns
-(assoc 'birch trees)
+(assoc* 'birch trees)
@result{} nil
@end smallexample
@@ -1396,31 +1484,36 @@
(3 "Pitch Pine")
(5 "White Pine")))
-(cdr (assoc 3 needles-per-cluster))
+(cdr (assoc* 3 needles-per-cluster))
@result{} ("Pitch Pine")
-(cdr (assoc 2 needles-per-cluster))
+(cdr (assoc* 2 needles-per-cluster))
@result{} ("Austrian Pine" "Red Pine")
@end smallexample
+
+The @code{:test} keyword argument allows you to specify the test used to
+decide whether @var{key} is equivalent to a given element of
+@var{alist}. The function should return non-@code{nil} if the items
+match, @code{nil} if they do not. The @code{:test-not} keyword is
+similar, but the meaning of @code{nil} and non-@code{nil} results are
+reversed. The @code{:key} keyword allows you to examine a component of
+each @sc{car} in @var{alist}, rather than the @sc{car} itself.
@end defun
-@defun rassoc value alist
+@defun rassoc* value alist @t{&key :test :test-not :key}
This function returns the first association with value @var{value} in
@var{alist}. It returns @code{nil} if no association in @var{alist} has
-a @sc{cdr} @code{equal} to @var{value}.
+a @sc{cdr} @code{eql} to @var{value}.
-@code{rassoc} is like @code{assoc} except that it compares the @sc{cdr} of
+@code{rassoc*} is like @code{assoc*} except that it compares the @sc{cdr} of
each @var{alist} association instead of the @sc{car}. You can think of
-this as ``reverse @code{assoc}'', finding the key for a given value.
+this as ``reverse @code{assoc*}'', finding the key for a given value.
+
+The keywords work similarly to @code{assoc*}.
@end defun
@defun assq key alist
-This function is like @code{assoc} in that it returns the first
-association for @var{key} in @var{alist}, but it makes the comparison
-using @code{eq} instead of @code{equal}. @code{assq} returns @code{nil}
-if no association in @var{alist} has a @sc{car} @code{eq} to @var{key}.
-This function is used more often than @code{assoc}, since @code{eq} is
-faster than @code{equal} and most alists use symbols as keys.
-@xref{Equality Predicates}.
+This is equivalent to calling @code{(assoc* key alist :test 'eq)}, and
+compiles to the same byte code.
@smallexample
(setq trees '((pine . cones) (oak . acorns) (maple . seeds)))
@@ -1429,8 +1522,8 @@
@result{} (pine . cones)
@end smallexample
-On the other hand, @code{assq} is not usually useful in alists where the
-keys may not be symbols:
+@code{assq} is not usually useful in alists where the keys may not be
+symbols:
@smallexample
(setq leaves
@@ -1445,15 +1538,8 @@
@end defun
@defun rassq value alist
-This function returns the first association with value @var{value} in
-@var{alist}. It returns @code{nil} if no association in @var{alist} has
-a @sc{cdr} @code{eq} to @var{value}.
-
-@code{rassq} is like @code{assq} except that it compares the @sc{cdr} of
-each @var{alist} association instead of the @sc{car}. You can think of
-this as ``reverse @code{assq}'', finding the key for a given value.
-
-For example:
+This is equivalent to calling @code{(rassoc* value alist :test 'eq)}, and
+compiles to the same byte code. For example:
@smallexample
(setq trees '((pine . cones) (oak . acorns) (maple . seeds)))
diff -r 31475de17064 -r f5a5501814f5 man/lispref/objects.texi
--- a/man/lispref/objects.texi Wed Feb 16 18:26:40 2011 +0000
+++ b/man/lispref/objects.texi Sat Feb 19 11:03:46 2011 +0000
@@ -2237,7 +2237,7 @@
@section Equality Predicates
@cindex equality
- Here we describe two functions that test for equality between any two
+ Here we describe functions that test for equality between any two
objects. Other functions test equality between objects of specific
types, e.g., strings. For these predicates, see the appropriate chapter
describing the data type.
@@ -2343,6 +2343,31 @@
@end example
@end defun
+@defun eql object1 object2
+
+This function returns @code{t} if the two arguments are the same object,
+as with @code{eq}. In addition, it returns @code{t} if @var{object1}
+and @var{object2} are numeric objects of the same type and with equal
+values. Otherwise it returns @code{nil}. @code{eql} is the default
+test for hash tables, and for many sequence-oriented functions inherited
+from Common Lisp.
+
+@example
+@group
+(eql 1 1)
+ @result{} t
+(eql 1 1.0) ; different types
+ @result{} nil
+(eq (+ 0.0 pi) pi)
+ @result{} nil ; in some contexts can be t, but don't rely on this!
+(eql (+ 0.0 pi) pi)
+ @result{} t ; this is more reliable.
+(position (+ 0 pi) (list 0 1 2 pi 4))
+ @result{} 3 ; function's test defaults to eql
+@end group
+@end example
+@end defun
+
@defun equal object1 object2
This function returns @code{t} if @var{object1} and @var{object2} have
equal components, @code{nil} otherwise. Whereas @code{eq} tests if its
diff -r 31475de17064 -r f5a5501814f5 src/ChangeLog
--- a/src/ChangeLog Wed Feb 16 18:26:40 2011 +0000
+++ b/src/ChangeLog Sat Feb 19 11:03:46 2011 +0000
@@ -1,3 +1,9 @@
+2011-02-19 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * fns.c (Fset_exclusive_or):
+ This function accepts the :stable keyword too, document this in
+ its arglist.
+
2011-02-16 Aidan Kehoe <kehoea(a)parhasard.net>
* xemacs.def.in.in:
diff -r 31475de17064 -r f5a5501814f5 src/fns.c
--- a/src/fns.c Wed Feb 16 18:26:40 2011 +0000
+++ b/src/fns.c Sat Feb 19 11:03:46 2011 +0000
@@ -10876,7 +10876,7 @@
return the items in the order they appear in LIST1, followed by the
remaining items in the order they appear in LIST2.
-arguments: (LIST1 LIST2 &key (TEST #'eql) (KEY #'identity) TEST-NOT)
+arguments: (LIST1 LIST2 &key (TEST #'eql) (KEY #'identity) TEST-NOT STABLE)
*/
(int nargs, Lisp_Object *args))
{
--
“Apart from the nine-banded armadillo, man is the only natural host of
Mycobacterium leprae, although it can be grown in the footpads of mice.”
-- Kumar & Clark, Clinical Medicine, summarising improbable leprosy research
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
Re: [Patch] [Bug: 21.5-b29] Can't build on cygwin 1.7
13 years, 10 months
Jeff Sparkes
On Tue, Dec 21, 2010 at 10:50 PM, FKtPp <m_pupil(a)yahoo.com.cn> wrote:
> ================================================================
> Dear Bug Team!
>
> when try build XEmacs in cygwin 1.7, the linker failed with following
> error message:
>
> undefined reference to `_IID_IPersistFile'
>
> This error is caused by the new libuuid.so delivered by
> cygwin1.7. With cygwin 1.7 there's multi-copy of libuuid delivered,
> the win32 copy of libuuid must be explictly linked instead of passing
> -luuid flag to linker.
>
> Attached is a simple patch for configure.ac and configure script.
>
>
> It's better to use the -L flag so that it will still link on Cygwin 1.5.
This will pick up all of the w32api libraries from the new location.
--
Jeff Sparkes
jsparkes(a)gmail.com
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
Re: [COMMIT] #'byte-compile-normal-call; only examine properties of (car FORM) if a symbol
13 years, 10 months
Raymond Toy
On 2/17/11 3:13 PM, Raymond Toy wrote:
> On 2/16/11 1:30 PM, Aidan Kehoe wrote:
>> Ar an cúigiú lá déag de mí Feabhra, scríobh Raymond Toy:
>>
>> > On 2/14/11 1:29 PM, Aidan Kehoe wrote:
>> > >
>> > > Ar an triú lá déag de mí Feabhra, scríobh Raymond Toy:
>> > > > Error attached. I'm using latest xemacs sources fresh from the hg
>> > > > repo yesterday. I'm attaching the Installation file, just for the
>> > > > record.
>> > >
>> > > Ah, thanks. I suspect 5dd1ba5e0113 has fixed this, can you try again
>> > > with a more recent build?
>> >
>> > Ok. I cloned xemacs yesterday (instead of xemacs-beta) and rebuilt it.
>> > Indeed that error is gone. But now I get another error when it's
>> > compiling semantic. Error message attached.
>>
>> Perfect, thanks for the report. As far as I can see, the warnings:
>>
>> While compiling se-jump in file /Volumes/share2/src/xemacs/hg/xemacs-packages/packages/xemacs-packages/semantic/semantic-example.el:
>> ** attempt to open-code anonymous lambda with too many arguments
>> ** attempt to open-code anonymous lambda with too many arguments
>>
>> reflect an actual problem that my recent changes made more evident. But I
>> don’t know enough about semantic to rush to change it, and I do know enough
>> about the byte compiler to rush to change *it*.
> I've recompiled xemacs and tried building the packages. It works fine.
> It does break when trying to build the info files because I don't have
> tex. I forgot to install tex, so I get to do this again.
Spoke too soon. Now I'm getting an error when compiling sudoku. Not
sure what happened previously, but I don't get far enough to run tex
anymore.
Error appended below.
Ray
While compiling sudoku-mode-setup-modeline in file
/Volumes/share2/src/xemacs/hg/xemacs-packages/packages/xemacs-packages/games/sudoku.el:
** modeline-multibyte-status is an obsolete variable; use
modeline-coding-system instead.
While compiling sudoku-autoinsert:
!! Wrong type argument ((symbolp (quote autoins)))
backtrace(nil t)
# bind (error-info)
byte-compile-report-error((wrong-type-argument symbolp (quote autoins)))
# bind (error-info)
#<compiled-function (from
"/Volumes/share/darwin10.6/share/xemacs-21.5-b29/lisp/bytecomp.elc")
(error-info) "...(4)" [error-info byte-compile-report-error] 2
0xbf3>((wrong-type-argument symbolp (quote autoins)))
symbol-name((quote autoins))
# bind (copy-properties symbol)
copy-symbol((quote autoins))
# bind (body name)
#<compiled-function (from
"/Volumes/share/darwin10.6/share/xemacs-21.5-b29/lisp/cl-macs.elc")
(name &rest body) "...(33)" [cl-macro-environment body name
cl-active-block-names copy-symbol progn put cl-block-name catch quote
cl-macroexpand-all] 5
("/Volumes/share/darwin10.6/share/xemacs-21.5-b29/lisp/cl-macs.elc" .
16959) 0xcb3>((quote autoins) (while (some (function (lambda (fun) (let
((rv (funcall fun cell deduce))) (when (and deduce rv) (return-from
(quote autoins) t)) rv))) sudoku-deduce-methods)))
#<subr macroexpand-internal>((block (quote autoins) (while (some
(function (lambda (fun) (let ((rv (funcall fun cell deduce))) (when (and
deduce rv) (return-from (quote autoins) t)) rv)))
sudoku-deduce-methods))) ((sudoku-foreach-cell . #<compiled-function
(cell &rest forms) "...(16)" [forms cell dotimes (i 9) (j 9) let ((cons
i j)) progn] 8 "Run FORMS for each CELL." 0xe7f>)
(sudoku-with-save-possibles . #<compiled-function (&rest forms) "...(6)"
[forms let ((sudoku-current-possibles (copy-tree
sudoku-current-possibles)))] 3 "Execute FORMS saving
`sudoku-current-possibles'." 0xe5d>) (sudoku-cell-ref .
#<compiled-function (cell board) "...(12)" [board cell nth car cdr] 5
0xe5a>) (byte-compiler-options . #<compiled-function (from
"/Volumes/share/darwin10.6/share/xemacs-21.5-b29/lisp/bytecomp.elc")
(&rest forms) "...(5)" [forms apply byte-compiler-options-handler] 3
0xbcc>) (eval-when-compile . #<compiled-function (from
"/Volumes/share/darwin10.6/share/xemacs-21.5-b29/lisp/bytecomp.elc")
(&rest body) "...(8)" [body quote byte-compile-eval progn] 4 0xbcd>)
(eval-and-compile . #<compiled-function (from
"/Volumes/share/darwin10.6/share/xemacs-21.5-b29/lisp/bytecomp.elc")
(&rest body) "...(10)" [body byte-compile-eval progn] 3 0xbce>) (the .
#<compiled-function (from
"/Volumes/share/darwin10.6/share/xemacs-21.5-b29/lisp/bytecomp.elc")
(type form) "...(31)" [byte-compile-delete-errors type form
cl-const-expr-p eval cl-make-type-test byte-compile-warn "%s is not of
type %s" the] 4 0xbcf>)))
# bind (cl-macro-environment cl-env cl-macro)
macroexpand((block (quote autoins) (while (some (function (lambda
(fun) (let ((rv (funcall fun cell deduce))) (when (and deduce rv)
(return-from (quote autoins) t)) rv))) sudoku-deduce-methods)))
((sudoku-foreach-cell . #<compiled-function (cell &rest forms) "...(16)"
[forms cell dotimes (i 9) (j 9) let ((cons i j)) progn] 8 "Run FORMS for
each CELL." 0xe7f>) (sudoku-with-save-possibles . #<compiled-function
(&rest forms) "...(6)" [forms let ((sudoku-current-possibles (copy-tree
sudoku-current-possibles)))] 3 "Execute FORMS saving
`sudoku-current-possibles'." 0xe5d>) (sudoku-cell-ref .
#<compiled-function (cell board) "...(12)" [board cell nth car cdr] 5
0xe5a>) (byte-compiler-options . #<compiled-function (from
"/Volumes/share/darwin10.6/share/xemacs-21.5-b29/lisp/bytecomp.elc")
(&rest forms) "...(5)" [forms apply byte-compiler-options-handler] 3
0xbcc>) (eval-when-compile . #<compiled-function (from
"/Volumes/share/darwin10.6/share/xemacs-21.5-b29/lisp/bytecomp.elc")
(&rest body) "...(8)" [body quote byte-compile-eval progn] 4 0xbcd>)
(eval-and-compile . #<compiled-function (from
"/Volumes/share/darwin10.6/share/xemacs-21.5-b29/lisp/bytecomp.elc")
(&rest body) "...(10)" [body byte-compile-eval progn] 3 0xbce>) (the .
#<compiled-function (from
"/Volumes/share/darwin10.6/share/xemacs-21.5-b29/lisp/bytecomp.elc")
(type form) "...(31)" [byte-compile-delete-errors type form
cl-const-expr-p eval cl-make-type-test byte-compile-warn "%s is not of
type %s" the] 4 0xbcf>)))
# bind (fn tmp for-effect form)
byte-optimize-form-code-walker((block (quote autoins) (while (some
(function (lambda (fun) (let ((rv (funcall fun cell deduce))) (when (and
deduce rv) (return-from (quote autoins) t)) rv)))
sudoku-deduce-methods))) nil)
# bind (for-effect form)
byte-optimize-form((block (quote autoins) (while (some (function
(lambda (fun) (let ((rv (funcall fun cell deduce))) (when (and deduce
rv) (return-from (quote autoins) t)) rv))) sudoku-deduce-methods))) nil)
# bind (fn tmp for-effect form)
byte-optimize-form-code-walker((unwind-protect (block (quote autoins)
(while (some (function (lambda (fun) (let ((rv (funcall fun cell
deduce))) (when (and deduce rv) (return-from (quote autoins) t)) rv)))
sudoku-deduce-methods))) (unless (equal sb sudoku-current-board) (push
sb sudoku-boards-stack)) (sudoku-goto-cell gc)) nil)
# bind (for-effect form)
byte-optimize-form((unwind-protect (block (quote autoins) (while (some
(function (lambda (fun) (let ((rv (funcall fun cell deduce))) (when (and
deduce rv) (return-from (quote autoins) t)) rv)))
sudoku-deduce-methods))) (unless (equal sb sudoku-current-board) (push
sb sudoku-boards-stack)) (sudoku-goto-cell gc)) nil)
# bind (rest result fe new all-for-effect forms)
byte-optimize-body(((unwind-protect (block (quote autoins) (while
(some (function (lambda (fun) (let ((rv (funcall fun cell deduce)))
(when (and deduce rv) (return-from (quote autoins) t)) rv)))
sudoku-deduce-methods))) (unless (equal sb sudoku-current-board) (push
sb sudoku-boards-stack)) (sudoku-goto-cell gc))) nil)
# bind (fn tmp for-effect form)
byte-optimize-form-code-walker((let ((gc (or cell
(sudoku-current-cell))) (sb (copy-tree sudoku-current-board)))
(unwind-protect (block (quote autoins) (while (some (function (lambda
(fun) (let ((rv (funcall fun cell deduce))) (when (and deduce rv)
(return-from (quote autoins) t)) rv))) sudoku-deduce-methods))) (unless
(equal sb sudoku-current-board) (push sb sudoku-boards-stack))
(sudoku-goto-cell gc))) nil)
# bind (for-effect form)
byte-optimize-form((let ((gc (or cell (sudoku-current-cell))) (sb
(copy-tree sudoku-current-board))) (unwind-protect (block (quote
autoins) (while (some (function (lambda (fun) (let ((rv (funcall fun
cell deduce))) (when (and deduce rv) (return-from (quote autoins) t))
rv))) sudoku-deduce-methods))) (unless (equal sb sudoku-current-board)
(push sb sudoku-boards-stack)) (sudoku-goto-cell gc))) nil)
# bind (rest result fe new all-for-effect forms)
byte-optimize-body(((let ((gc (or cell (sudoku-current-cell))) (sb
(copy-tree sudoku-current-board))) (unwind-protect (block (quote
autoins) (while (some (function (lambda (fun) (let ((rv (funcall fun
cell deduce))) (when (and deduce rv) (return-from (quote autoins) t))
rv))) sudoku-deduce-methods))) (unless (equal sb sudoku-current-board)
(push sb sudoku-boards-stack)) (sudoku-goto-cell gc)))) nil)
# bind (fn tmp for-effect form)
byte-optimize-form-code-walker((if (or (positivep
sudoku-current-pencil) (and cell (sudoku-cell-empty-p cell))) nil (let
((gc (or cell (sudoku-current-cell))) (sb (copy-tree
sudoku-current-board))) (unwind-protect (block (quote autoins) (while
(some (function (lambda (fun) (let ((rv (funcall fun cell deduce)))
(when (and deduce rv) (return-from (quote autoins) t)) rv)))
sudoku-deduce-methods))) (unless (equal sb sudoku-current-board) (push
sb sudoku-boards-stack)) (sudoku-goto-cell gc)))) nil)
# bind (for-effect form)
byte-optimize-form((if (or (positivep sudoku-current-pencil) (and cell
(sudoku-cell-empty-p cell))) nil (let ((gc (or cell
(sudoku-current-cell))) (sb (copy-tree sudoku-current-board)))
(unwind-protect (block (quote autoins) (while (some (function (lambda
(fun) (let ((rv (funcall fun cell deduce))) (when (and deduce rv)
(return-from (quote autoins) t)) rv))) sudoku-deduce-methods))) (unless
(equal sb sudoku-current-board) (push sb sudoku-boards-stack))
(sudoku-goto-cell gc)))) nil)
# bind (fn tmp for-effect form)
byte-optimize-form-code-walker((unless (or (positivep
sudoku-current-pencil) (and cell (sudoku-cell-empty-p cell))) (let ((gc
(or cell (sudoku-current-cell))) (sb (copy-tree sudoku-current-board)))
(unwind-protect (block (quote autoins) (while (some (function (lambda
(fun) (let ((rv (funcall fun cell deduce))) (when (and deduce rv)
(return-from (quote autoins) t)) rv))) sudoku-deduce-methods))) (unless
(equal sb sudoku-current-board) (push sb sudoku-boards-stack))
(sudoku-goto-cell gc)))) nil)
# bind (for-effect form)
byte-optimize-form((unless (or (positivep sudoku-current-pencil) (and
cell (sudoku-cell-empty-p cell))) (let ((gc (or cell
(sudoku-current-cell))) (sb (copy-tree sudoku-current-board)))
(unwind-protect (block (quote autoins) (while (some (function (lambda
(fun) (let ((rv (funcall fun cell deduce))) (when (and deduce rv)
(return-from (quote autoins) t)) rv))) sudoku-deduce-methods))) (unless
(equal sb sudoku-current-board) (push sb sudoku-boards-stack))
(sudoku-goto-cell gc)))) nil)
# bind (fn tmp for-effect form)
byte-optimize-form-code-walker((progn (unless (or (positivep
sudoku-current-pencil) (and cell (sudoku-cell-empty-p cell))) (let ((gc
(or cell (sudoku-current-cell))) (sb (copy-tree sudoku-current-board)))
(unwind-protect (block (quote autoins) (while (some (function (lambda
(fun) (let ((rv (funcall fun cell deduce))) (when (and deduce rv)
(return-from (quote autoins) t)) rv))) sudoku-deduce-methods))) (unless
(equal sb sudoku-current-board) (push sb sudoku-boards-stack))
(sudoku-goto-cell gc))))) nil)
# bind (for-effect form)
byte-optimize-form((progn (unless (or (positivep
sudoku-current-pencil) (and cell (sudoku-cell-empty-p cell))) (let ((gc
(or cell (sudoku-current-cell))) (sb (copy-tree sudoku-current-board)))
(unwind-protect (block (quote autoins) (while (some (function (lambda
(fun) (let ((rv (funcall fun cell deduce))) (when (and deduce rv)
(return-from (quote autoins) t)) rv))) sudoku-deduce-methods))) (unless
(equal sb sudoku-current-board) (push sb sudoku-boards-stack))
(sudoku-goto-cell gc))))) nil)
# bind (byte-compile-constants byte-compile-variables
byte-compile-tag-number byte-compile-depth byte-compile-maxdepth
byte-compile-output output-type for-effect form)
byte-compile-top-level((progn (unless (or (positivep
sudoku-current-pencil) (and cell (sudoku-cell-empty-p cell))) (let ((gc
(or cell (sudoku-current-cell))) (sb (copy-tree sudoku-current-board)))
(unwind-protect (block (quote autoins) (while (some (function (lambda
(fun) (let ((rv (funcall fun cell deduce))) (when (and deduce rv)
(return-from (quote autoins) t)) rv))) sudoku-deduce-methods))) (unless
(equal sb sudoku-current-board) (push sb sudoku-boards-stack))
(sudoku-goto-cell gc))))) nil lambda)
# bind (compiled-int int doc body byte-compile-bound-variables arglist
fun)
byte-compile-lambda((lambda (&optional cell deduce) "Fill cells with
only value possible.\nGoto CELL then.\nSuitable to be used with
`sudoku-after-change-hook'.\nIf `sudoku-autoinsert' raises \"Not a valid
move\" error\nthen it means it found contradiction, so some of your
previous moves\nwas incorrect.\nAuto-insert does not work for pencils."
(interactive) (unless (or (positivep sudoku-current-pencil) (and cell
(sudoku-cell-empty-p cell))) (let ((gc (or cell (sudoku-current-cell)))
(sb (copy-tree sudoku-current-board))) (unwind-protect (block (quote
autoins) (while (some (function (lambda (fun) (let ((rv (funcall fun
cell deduce))) (when (and deduce rv) (return-from (quote autoins) t))
rv))) sudoku-deduce-methods))) (unless (equal sb sudoku-current-board)
(push sb sudoku-boards-stack)) (sudoku-goto-cell gc))))))
# bind (byte-compile-free-assignments byte-compile-free-references
that-one this-one that-kind this-kind name macrop form)
byte-compile-file-form-defmumble((defun sudoku-autoinsert (&optional
cell deduce) "Fill cells with only value possible.\nGoto CELL
then.\nSuitable to be used with `sudoku-after-change-hook'.\nIf
`sudoku-autoinsert' raises \"Not a valid move\" error\nthen it means it
found contradiction, so some of your previous moves\nwas
incorrect.\nAuto-insert does not work for pencils." (interactive)
(unless (or (positivep sudoku-current-pencil) (and cell
(sudoku-cell-empty-p cell))) (let ((gc (or cell (sudoku-current-cell)))
(sb (copy-tree sudoku-current-board))) (unwind-protect (block (quote
autoins) (while (some (function (lambda (fun) (let ((rv (funcall fun
cell deduce))) (when (and deduce rv) (return-from (quote autoins) t))
rv))) sudoku-deduce-methods))) (unless (equal sb sudoku-current-board)
(push sb sudoku-boards-stack)) (sudoku-goto-cell gc))))) nil)
# bind (form)
byte-compile-file-form-defun((defun sudoku-autoinsert (&optional cell
deduce) "Fill cells with only value possible.\nGoto CELL then.\nSuitable
to be used with `sudoku-after-change-hook'.\nIf `sudoku-autoinsert'
raises \"Not a valid move\" error\nthen it means it found contradiction,
so some of your previous moves\nwas incorrect.\nAuto-insert does not
work for pencils." (interactive) (unless (or (positivep
sudoku-current-pencil) (and cell (sudoku-cell-empty-p cell))) (let ((gc
(or cell (sudoku-current-cell))) (sb (copy-tree sudoku-current-board)))
(unwind-protect (block (quote autoins) (while (some (function (lambda
(fun) (let ((rv (funcall fun cell deduce))) (when (and deduce rv)
(return-from (quote autoins) t)) rv))) sudoku-deduce-methods))) (unless
(equal sb sudoku-current-board) (push sb sudoku-boards-stack))
(sudoku-goto-cell gc))))))
# bind (byte-compile-current-form handler form)
byte-compile-file-form((defun sudoku-autoinsert (&optional cell
deduce) "Fill cells with only value possible.\nGoto CELL then.\nSuitable
to be used with `sudoku-after-change-hook'.\nIf `sudoku-autoinsert'
raises \"Not a valid move\" error\nthen it means it found contradiction,
so some of your previous moves\nwas incorrect.\nAuto-insert does not
work for pencils." (interactive) (unless (or (positivep
sudoku-current-pencil) (and cell (sudoku-cell-empty-p cell))) (let ((gc
(or cell (sudoku-current-cell))) (sb (copy-tree sudoku-current-board)))
(unwind-protect (block (quote autoins) (while (some (function (lambda
(fun) (let ((rv (funcall fun cell deduce))) (when (and deduce rv)
(return-from (quote autoins) t)) rv))) sudoku-deduce-methods))) (unless
(equal sb sudoku-current-board) (push sb sudoku-boards-stack))
(sudoku-goto-cell gc))))))
# (unwind-protect ...)
#<compiled-function (from
"/Volumes/share/darwin10.6/share/xemacs-21.5-b29/lisp/bytecomp.elc") nil
"...(56)" [byte-compile-unresolved-functions filename
byte-compile-inbuffer byte-compile-outbuffer goto-char point-max 1 " \n
" nil looking-at ";"
byte-compile-file-form read byte-compile-flush-pending
byte-compile-insert-header byte-compile-warn-about-unresolved-functions]
4 0xbf4>()
# (unwind-protect ...)
call-with-condition-handler(#<compiled-function (from
"/Volumes/share/darwin10.6/share/xemacs-21.5-b29/lisp/bytecomp.elc")
(error-info) "...(4)" [error-info byte-compile-report-error] 2 0xbf3>
#<compiled-function (from
"/Volumes/share/darwin10.6/share/xemacs-21.5-b29/lisp/bytecomp.elc") nil
"...(56)" [byte-compile-unresolved-functions filename
byte-compile-inbuffer byte-compile-outbuffer goto-char point-max 1 " \n
" nil
looking-at ";" byte-compile-file-form read byte-compile-flush-pending
byte-compile-insert-header byte-compile-warn-about-unresolved-functions]
4 0xbf4>)
# (unwind-protect ...)
# bind (byte-compile-warnings-beginning byte-compile-point-max-prev
byte-compile-log-buffer byte-compile-macro-environment
byte-compile-function-environment byte-compile-autoload-environment
byte-compile-unresolved-functions byte-compile-bound-variables
byte-compile-free-references byte-compile-free-assignments
byte-compile-verbose byte-optimize byte-compile-emacs19-compatibility
byte-compile-checks-on-load byte-compile-dynamic
byte-compile-dynamic-docstrings byte-compile-warnings
byte-compile-file-domain byte-compile-outbuffer float-output-format
case-fold-search print-length print-level byte-compile-constants
byte-compile-variables byte-compile-tag-number byte-compile-depth
byte-compile-maxdepth byte-compile-output
byte-compile-force-escape-quoted byte-compile-using-dynamic eval
filename byte-compile-inbuffer)
byte-compile-from-buffer(#<buffer " *Compiler Input*">
"/Volumes/share2/src/xemacs/hg/xemacs-packages/packages/xemacs-packages/games/sudoku.el")
# bind (byte-compile-current-file target-file input-buffer
output-buffer byte-compile-dest-file load filename)
byte-compile-file("sudoku.el")
byte-code("..." [file byte-compile-file t] 2)
or-message mapc #<compiled-function (from
"/Volumes/share/darwin10.6/share/xemacs-21.5-b29/lisp/bytecomp.elc") (x)
"...(8)" [x princ " " prin1] 2 0xc8e> "\n"] 3))))
# bind (file)
batch-byte-compile-1("sudoku.el")
# bind (error file-to-process)
batch-byte-compile-one-file()
# bind (error)
batch-byte-compile()
# bind (arg)
command-line-do-funcall("-f")
# bind (dir file-count line end-of-options file-p arg tem)
command-line-1()
# bind (command-line-args-left)
command-line()
# bind (error-data)
normal-top-level()
# (condition-case ... . error)
# (catch top-level ...)
>>Error occurred processing sudoku.el: Wrong type argument: symbolp,
(quote autoins)
Done
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[COMMIT] #'byte-compile-normal-call; only examine properties of (car FORM) if a symbol
13 years, 10 months
Aidan Kehoe
Ar an cúigiú lá déag de mí Feabhra, scríobh Raymond Toy:
> On 2/14/11 1:29 PM, Aidan Kehoe wrote:
> >
> > Ar an triú lá déag de mí Feabhra, scríobh Raymond Toy:
> > > Error attached. I'm using latest xemacs sources fresh from the hg
> > > repo yesterday. I'm attaching the Installation file, just for the
> > > record.
> >
> > Ah, thanks. I suspect 5dd1ba5e0113 has fixed this, can you try again
> > with a more recent build?
>
> Ok. I cloned xemacs yesterday (instead of xemacs-beta) and rebuilt it.
> Indeed that error is gone. But now I get another error when it's
> compiling semantic. Error message attached.
Perfect, thanks for the report. As far as I can see, the warnings:
While compiling se-jump in file /Volumes/share2/src/xemacs/hg/xemacs-packages/packages/xemacs-packages/semantic/semantic-example.el:
** attempt to open-code anonymous lambda with too many arguments
** attempt to open-code anonymous lambda with too many arguments
reflect an actual problem that my recent changes made more evident. But I
don’t know enough about semantic to rush to change it, and I do know enough
about the byte compiler to rush to change *it*.
APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1297880800 0
# Node ID 31475de17064148b3265c4a60d3e3d7c3849cea7
# Parent 503b9a3e5e4618f16972523c9e6d9fdacb285ba3
#'byte-compile-normal-call; only examine properties of (car FORM) if a symbol
2011-02-16 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el (byte-compile-normal-call):
Check that the car of FORM is a symbol before examining its
properties; it can be a lambda form if byte-optimize.el hasn't
worked its magic and transformed such a lambda call into inline
code.
diff -r 503b9a3e5e46 -r 31475de17064 lisp/ChangeLog
--- a/lisp/ChangeLog Wed Feb 16 15:35:35 2011 +0000
+++ b/lisp/ChangeLog Wed Feb 16 18:26:40 2011 +0000
@@ -1,3 +1,11 @@
+2011-02-16 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * bytecomp.el (byte-compile-normal-call):
+ Check that the car of FORM is a symbol before examining its
+ properties; it can be a lambda form if byte-optimize.el hasn't
+ worked its magic and transformed such a lambda call into inline
+ code.
+
2011-02-12 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el:
diff -r 503b9a3e5e46 -r 31475de17064 lisp/bytecomp.el
--- a/lisp/bytecomp.el Wed Feb 16 15:35:35 2011 +0000
+++ b/lisp/bytecomp.el Wed Feb 16 18:26:40 2011 +0000
@@ -2888,7 +2888,7 @@
(tree-equal . 3)))
(defun byte-compile-normal-call (form)
- (and (get (car form) 'byte-compile-keyword-start)
+ (and (symbolp (car form)) (get (car form) 'byte-compile-keyword-start)
(let ((plist (nthcdr (get (car form) 'byte-compile-keyword-start)
form)))
(symbol-macrolet
--
“Apart from the nine-banded armadillo, man is the only natural host of
Mycobacterium leprae, although it can be grown in the footpads of mice.”
-- Kumar & Clark, Clinical Medicine, summarising improbable leprosy research
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit: #'byte-compile-normal-call; only examine properties of (car FORM) if a symbol
13 years, 10 months
Aidan Kehoe
changeset: 5358:31475de17064
tag: tip
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Wed Feb 16 18:26:40 2011 +0000
files: lisp/ChangeLog lisp/bytecomp.el
description:
#'byte-compile-normal-call; only examine properties of (car FORM) if a symbol
2011-02-16 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el (byte-compile-normal-call):
Check that the car of FORM is a symbol before examining its
properties; it can be a lambda form if byte-optimize.el hasn't
worked its magic and transformed such a lambda call into inline
code.
diff -r 503b9a3e5e46 -r 31475de17064 lisp/ChangeLog
--- a/lisp/ChangeLog Wed Feb 16 15:35:35 2011 +0000
+++ b/lisp/ChangeLog Wed Feb 16 18:26:40 2011 +0000
@@ -1,3 +1,11 @@
+2011-02-16 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * bytecomp.el (byte-compile-normal-call):
+ Check that the car of FORM is a symbol before examining its
+ properties; it can be a lambda form if byte-optimize.el hasn't
+ worked its magic and transformed such a lambda call into inline
+ code.
+
2011-02-12 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el:
diff -r 503b9a3e5e46 -r 31475de17064 lisp/bytecomp.el
--- a/lisp/bytecomp.el Wed Feb 16 15:35:35 2011 +0000
+++ b/lisp/bytecomp.el Wed Feb 16 18:26:40 2011 +0000
@@ -2888,7 +2888,7 @@
(tree-equal . 3)))
(defun byte-compile-normal-call (form)
- (and (get (car form) 'byte-compile-keyword-start)
+ (and (symbolp (car form)) (get (car form) 'byte-compile-keyword-start)
(let ((plist (nthcdr (get (car form) 'byte-compile-keyword-start)
form)))
(symbol-macrolet
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
Re: [COMMIT] xemacs.def.in.in: no longer export acons(), export Facons() instead.
13 years, 10 months
Aidan Kehoe
Ar an séú lá déag de mí Feabhra, scríobh Mats Lidell:
> >>>>> Aidan Kehoe <kehoea(a)parhasard.net> writes:
>
> Aidan> Ar an séú lá déag de mí Feabhra, scríobh Mats Lidell:
>
> Aidan> Not in practice, none of the modules appear to use it. But if
> Aidan> people felt it appropriate to export acons(), then it's equally
> Aidan> appropriate to export Facons() to the modules. I've just
> Aidan> committed the below, thanks for the reports.
>
> No problem. I understood I was in deep water so I didn't want to
> submit my fix. ;-)
>
> I don't really understand how Facons can replace acons. Or was it that
> acons was the symbol to make external while it was implemented in lisp
> and Facons is the c-code symbol? So if a module now would like to use
> acons it should link, use, to the Facon symbol? Modules need to know
> if the function is implemented in C or in lisp?
In a way, yes. The internals manual says this (and this is actually the only
part of the internals manual relevant to this question):
‘All C functions that are Lisp primitives begin with a capital F, and no
others should begin this way.’
It’s not a big deal one way or the other, any call to acons (X, Y, Z) is
equivalent to Fcons (Fcons (X, Y), Z), and any incompatibility can be
eliminated by using the latter form.
> But I should very, very probably read some internals documents since I
> don't know a thing about how lisp interfaces to C in XEmacs. Is it
> RTFM again? ;-)
--
“Apart from the nine-banded armadillo, man is the only natural host of
Mycobacterium leprae, although it can be grown in the footpads of mice.”
-- Kumar & Clark, Clinical Medicine, summarising improbable leprosy research
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[COMMIT] xemacs.def.in.in: no longer export acons(), export Facons() instead.
13 years, 10 months
Aidan Kehoe
Ar an séú lá déag de mí Feabhra, scríobh Mats Lidell:
> >>>>> Jeff Sparkes <jsparkes(a)gmail.com> writes:
>
> Jeff> Where is it getting acons from? It's not in the source any
> Jeff> more, or in the object files.
>
> It is in xemacs.def and used by dlltool to produce xemacs-export.o
> which then contains an undefined reference to '_acons'
>
> This was my next question. If Aidans patch simply made acons in C
> visible instead of acons in lisp why do we get the undefined
> reference?
>
> Removing acons from xemacs.def fixes the undefined reference but it is
> right, does it undermine anything for the modules?
Not in practice, none of the modules appear to use it. But if people felt it
appropriate to export acons(), then it’s equally appropriate to export
Facons() to the modules. I’ve just committed the below, thanks for the
reports.
APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1297870535 0
# Node ID 503b9a3e5e4618f16972523c9e6d9fdacb285ba3
# Parent 5dd1ba5e01137d935224d5156fe55ac773844eaf
xemacs.def.in.in: no longer export acons(), export Facons() instead.
2011-02-16 Aidan Kehoe <kehoea(a)parhasard.net>
* xemacs.def.in.in:
No longer export acons(), export Facons() instead, thank you Mats,
Jerry and Jeff Sparkes.
diff -r 5dd1ba5e0113 -r 503b9a3e5e46 src/ChangeLog
--- a/src/ChangeLog Sat Feb 12 14:07:38 2011 +0000
+++ b/src/ChangeLog Wed Feb 16 15:35:35 2011 +0000
@@ -1,3 +1,9 @@
+2011-02-16 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * xemacs.def.in.in:
+ No longer export acons(), export Facons() instead, thank you Mats,
+ Jerry and Jeff Sparkes.
+
2011-02-10 Aidan Kehoe <kehoea(a)parhasard.net>
* fns.c (shortest_length_among_sequences):
diff -r 5dd1ba5e0113 -r 503b9a3e5e46 src/xemacs.def.in.in
--- a/src/xemacs.def.in.in Sat Feb 12 14:07:38 2011 +0000
+++ b/src/xemacs.def.in.in Wed Feb 16 15:35:35 2011 +0000
@@ -34,7 +34,6 @@
NAME xemacs.exe
EXPORTS
/* Exported functions */
-acons
#ifdef NEW_GC
alloc_lrecord /* ALLOC_LISP_OBJECT */
alloc_sized_lrecord /* ALLOC_SIZED_LISP_OBJECT */
@@ -249,6 +248,7 @@
Dynarr_insert_many /* Dynarr_add_{literal,lisp}_string */
Dynarr_newf /* Dynarr_new, Dynarr_new2 */
Dynarr_resize /* Dynarr_add */
+Facons
Fappend
Fapply
Fbuffer_modified_p
--
“Apart from the nine-banded armadillo, man is the only natural host of
Mycobacterium leprae, although it can be grown in the footpads of mice.”
-- Kumar & Clark, Clinical Medicine, summarising improbable leprosy research
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit: xemacs.def.in.in: no longer export acons(), export Facons() instead.
13 years, 10 months
Aidan Kehoe
changeset: 5357:503b9a3e5e46
tag: tip
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Wed Feb 16 15:35:35 2011 +0000
files: src/ChangeLog src/xemacs.def.in.in
description:
xemacs.def.in.in: no longer export acons(), export Facons() instead.
2011-02-16 Aidan Kehoe <kehoea(a)parhasard.net>
* xemacs.def.in.in:
No longer export acons(), export Facons() instead, thank you Mats,
Jerry and Jeff Sparkes.
diff -r 5dd1ba5e0113 -r 503b9a3e5e46 src/ChangeLog
--- a/src/ChangeLog Sat Feb 12 14:07:38 2011 +0000
+++ b/src/ChangeLog Wed Feb 16 15:35:35 2011 +0000
@@ -1,3 +1,9 @@
+2011-02-16 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * xemacs.def.in.in:
+ No longer export acons(), export Facons() instead, thank you Mats,
+ Jerry and Jeff Sparkes.
+
2011-02-10 Aidan Kehoe <kehoea(a)parhasard.net>
* fns.c (shortest_length_among_sequences):
diff -r 5dd1ba5e0113 -r 503b9a3e5e46 src/xemacs.def.in.in
--- a/src/xemacs.def.in.in Sat Feb 12 14:07:38 2011 +0000
+++ b/src/xemacs.def.in.in Wed Feb 16 15:35:35 2011 +0000
@@ -34,7 +34,6 @@
NAME xemacs.exe
EXPORTS
/* Exported functions */
-acons
#ifdef NEW_GC
alloc_lrecord /* ALLOC_LISP_OBJECT */
alloc_sized_lrecord /* ALLOC_SIZED_LISP_OBJECT */
@@ -249,6 +248,7 @@
Dynarr_insert_many /* Dynarr_add_{literal,lisp}_string */
Dynarr_newf /* Dynarr_new, Dynarr_new2 */
Dynarr_resize /* Dynarr_add */
+Facons
Fappend
Fapply
Fbuffer_modified_p
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[A] [C] xemacsweb: Update smoketest URL
13 years, 10 months
Adrian Aichner
NOTE: This patch has been committed. The version below is informational only.
In particular, whitespace difference have been removed.
APPROVE COMMIT
Oh, the last commit to the website has been a while ...
Let me know if when link needs another update.
Looks like the smoketest page needs some data refresh too.
I have followed the current active thread on the subject loosely.
Adrian
xemacsweb ChangeLog patch:
Diff command: cvs -q diff -wbBtU0
Files affected: Develop/ChangeLog
Index: Develop/ChangeLog
===================================================================
RCS file: /cvsroot/xemacs/XEmacs/xemacsweb/Develop/ChangeLog,v
retrieving revision 1.123
diff -u -w -b -B -t -U 0 -r1.123 ChangeLog
--- Develop/ChangeLog 22 Dec 2009 13:10:11 -0000 1.123
+++ Develop/ChangeLog 13 Feb 2011 21:05:24 -0000
@@ -0,0 +1,4 @@
+2011-02-13 Adrian Aichner <adrian(a)xemacs.org>
+
+ * index.content: Update smoketest URL
+
xemacsweb source patch:
Diff command: cvs -q diff -uwbBt
Files affected: Develop/index.content
Index: Develop/index.content
===================================================================
RCS file: /cvsroot/xemacs/XEmacs/xemacsweb/Develop/index.content,v
retrieving revision 1.17
diff -u -u -w -b -B -t -r1.17 index.content
--- Develop/index.content 7 Dec 2009 07:46:55 -0000 1.17
+++ Develop/index.content 13 Feb 2011 21:05:05 -0000
@@ -103,7 +103,7 @@
<p>
The development of XEmacs Packages is supported by hourly builds
from latest CVS sources. <a
- href="http://labb.contactor.se/~matsl/smoketest/logs/">XEmacs
+ href="http://www.contactor.se/~matsl/smoketest/">XEmacs
Package Smoketest</a> results are readily available.</p>
<h2 id="website">XEmacs Website Development</h2>
--
Adrian Aichner
mailto:adrian@xemacs.org
http://www.xemacs.org/
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[COMMIT] Be better about eliminating `block's that are not `return-from'd, bytecomp.el
13 years, 10 months
Aidan Kehoe
APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1297519658 0
# Node ID 5dd1ba5e01137d935224d5156fe55ac773844eaf
# Parent 70b15ac66ee5f431c1e663ea985f825bfd09ea63
Be better about eliminating `block's that are not `return-from'd, bytecomp.el
2011-02-12 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el:
* bytecomp.el (byte-compile-initial-macro-environment):
* bytecomp.el (unwind-protect):
* bytecomp.el (byte-compile-active-blocks):
* bytecomp.el (byte-compile-catch):
* bytecomp.el ('return-from-1): Removed.
* bytecomp.el ('block-1): Removed.
* bytecomp.el (byte-compile-block-1): Removed.
* bytecomp.el (byte-compile-return-from-1): Removed.
* bytecomp.el (byte-compile-throw):
* cl-macs.el (block):
* cl-macs.el (return-from):
In my last change, the elimination of `block's that were never
`return-from'd didn't work if `cl-macroexpand-all' was called
explicitly, something much code in cl-macs.el does. Change the
implementation to something that doesn't require shadowing of the
macros in `byte-compile-initial-macro-environment', putting a
`cl-block-name' property on the gensym'd symbol argument to
`catch' instead.
diff -r 70b15ac66ee5 -r 5dd1ba5e0113 lisp/ChangeLog
--- a/lisp/ChangeLog Thu Feb 10 08:46:10 2011 +0000
+++ b/lisp/ChangeLog Sat Feb 12 14:07:38 2011 +0000
@@ -1,3 +1,25 @@
+2011-02-12 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * bytecomp.el:
+ * bytecomp.el (byte-compile-initial-macro-environment):
+ * bytecomp.el (unwind-protect):
+ * bytecomp.el (byte-compile-active-blocks):
+ * bytecomp.el (byte-compile-catch):
+ * bytecomp.el ('return-from-1): Removed.
+ * bytecomp.el ('block-1): Removed.
+ * bytecomp.el (byte-compile-block-1): Removed.
+ * bytecomp.el (byte-compile-return-from-1): Removed.
+ * bytecomp.el (byte-compile-throw):
+ * cl-macs.el (block):
+ * cl-macs.el (return-from):
+ In my last change, the elimination of `block's that were never
+ `return-from'd didn't work if `cl-macroexpand-all' was called
+ explicitly, something much code in cl-macs.el does. Change the
+ implementation to something that doesn't require shadowing of the
+ macros in `byte-compile-initial-macro-environment', putting a
+ `cl-block-name' property on the gensym'd symbol argument to
+ `catch' instead.
+
2011-02-09 Aidan Kehoe <kehoea(a)parhasard.net>
* cl.el (acons): Removed, make the implementation in alloc.c
diff -r 70b15ac66ee5 -r 5dd1ba5e0113 lisp/bytecomp.el
--- a/lisp/bytecomp.el Thu Feb 10 08:46:10 2011 +0000
+++ b/lisp/bytecomp.el Sat Feb 12 14:07:38 2011 +0000
@@ -511,11 +511,7 @@
"%s is not of type %s" form type)))
(if byte-compile-delete-errors
form
- (funcall (cdr (symbol-function 'the)) type form))))
- (return-from .
- ,#'(lambda (name &optional result) `(return-from-1 ',name ,result)))
- (block .
- ,#'(lambda (name &rest body) `(block-1 ',name ,@body))))
+ (funcall (cdr (symbol-function 'the)) type form)))))
"The default macro-environment passed to macroexpand by the compiler.
Placing a macro here will cause a macro to have different semantics when
expanded by the compiler as when expanded by the interpreter.")
@@ -4186,8 +4182,6 @@
;;; other tricky macro-like special-operators
(byte-defop-compiler-1 catch)
-(byte-defop-compiler-1 block-1)
-(byte-defop-compiler-1 return-from-1)
(byte-defop-compiler-1 unwind-protect)
(byte-defop-compiler-1 condition-case)
(byte-defop-compiler-1 save-excursion)
@@ -4196,44 +4190,33 @@
(byte-defop-compiler-1 with-output-to-temp-buffer)
;; no track-mouse.
+(defvar byte-compile-active-blocks nil)
+
(defun byte-compile-catch (form)
- (byte-compile-form (car (cdr form)))
- (byte-compile-push-constant
- (byte-compile-top-level (cons 'progn (cdr (cdr form))) for-effect))
- (byte-compile-out 'byte-catch 0))
-
-;; `return-from' and `block' are different from `throw' and `catch' when it
-;; comes to scope and extent. These differences are implemented for
-;; interpreted code in cl-macs.el, in compiled code in bytecomp.el. There's
-;; a certain amount of bootstrapping needed for the latter, and until this
-;; is done return-from and block behave as throw and catch in their scope
-;; and extent. This is only relevant to people working on bytecomp.el.
-
-(defalias 'return-from-1 'throw)
-(defalias 'block-1 'catch)
-
-(defvar byte-compile-active-blocks nil)
-
-(defun byte-compile-block-1 (form)
- (let* ((name (nth 1 (nth 1 form)))
- (elt (list name (copy-symbol name) nil))
- (byte-compile-active-blocks (cons elt byte-compile-active-blocks))
- (body (byte-compile-top-level (cons 'progn (cddr form)))))
- (if (nth 2 elt)
- (byte-compile-catch `(catch ',(nth 1 elt) ,body))
- (byte-compile-form body))))
-
-(defun byte-compile-return-from-1 (form)
- (let* ((name (nth 1 (nth 1 form)))
- (assq (assq name byte-compile-active-blocks)))
- (if assq
- (setf (nth 2 assq) t)
- (byte-compile-warn
- "return-from: %S: no current lexical block with this name"
- name))
- (byte-compile-throw
- `(throw ',(or (nth 1 assq) (copy-symbol name))
- ,@(nthcdr 2 form)))))
+ "Byte-compile and return a `catch' from.
+
+If FORM is the result of macroexpanding a `block' form (the TAG argument is
+a quoted symbol with a non-nil `cl-block-name' property) and there is no
+corresponding `return-from' within the block--or equivalently, it was
+optimized away--just byte compile and return the BODY."
+ (let* ((symbol (car-safe (cdr-safe (nth 1 form))))
+ (block (and symbol (symbolp symbol) (get symbol 'cl-block-name)))
+ (elt (and block (cons block nil)))
+ (byte-compile-active-blocks
+ (if block
+ (cons elt byte-compile-active-blocks)
+ byte-compile-active-blocks))
+ (body
+ (byte-compile-top-level (cons 'progn (cddr form))
+ (if block nil for-effect))))
+ (if (and block (not (cdr elt)))
+ ;; A lexical block without any contained return-from clauses:
+ (byte-compile-form body)
+ ;; A normal catch call, or a lexical block with a contained
+ ;; return-from clause.
+ (byte-compile-form (car (cdr form)))
+ (byte-compile-push-constant body)
+ (byte-compile-out 'byte-catch 0))))
(defun byte-compile-unwind-protect (form)
(byte-compile-push-constant
@@ -4383,6 +4366,12 @@
(byte-compile-normal-call
`(signal 'wrong-number-of-arguments '(,(car form)
,(length (cdr form))))))
+ ;; If this form was macroexpanded from `return-from', mark the
+ ;; corresponding block as having been referenced.
+ (let* ((symbol (car-safe (cdr-safe (nth 1 form))))
+ (block (and symbol (symbolp symbol) (get symbol 'cl-block-name)))
+ (assq (and block (assq block byte-compile-active-blocks))))
+ (and assq (setcdr assq t)))
(byte-compile-form (nth 1 form)) ;; Push the arguments
(byte-compile-form (nth 2 form))
(byte-compile-out (get (car form) 'byte-opcode) 0)
diff -r 70b15ac66ee5 -r 5dd1ba5e0113 lisp/cl-macs.el
--- a/lisp/cl-macs.el Thu Feb 10 08:46:10 2011 +0000
+++ b/lisp/cl-macs.el Sat Feb 12 14:07:38 2011 +0000
@@ -747,6 +747,9 @@
(let ((cl-active-block-names (acons name (copy-symbol name)
cl-active-block-names))
(body (cons 'progn body)))
+ ;; Tell the byte-compiler this is a block, not a normal catch call, and
+ ;; as such it can eliminate it if that's appropriate:
+ (put (cdar cl-active-block-names) 'cl-block-name name)
`(catch ',(cdar cl-active-block-names)
,(cl-macroexpand-all body cl-macro-environment))))
@@ -763,8 +766,13 @@
returning RESULT from that form (or nil if RESULT is omitted).
This is compatible with Common Lisp, but note that `defun' and
`defmacro' do not create implicit blocks as they do in Common Lisp."
- `(throw ',(or (cdr (assq name cl-active-block-names)) (copy-symbol name))
- ,result))
+ `(throw ',(or (cdr (assq name cl-active-block-names))
+ (prog1 (copy-symbol name)
+ (and-fboundp 'byte-compile-warn (cl-compiling-file)
+ (byte-compile-warn
+ "return-from: no enclosing block named `%s'"
+ name))))
+ ,result))
;;; The "loop" macro.
--
“Apart from the nine-banded armadillo, man is the only natural host of
Mycobacterium leprae, although it can be grown in the footpads of mice.”
-- Kumar & Clark, Clinical Medicine, summarising improbable leprosy research
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches