GNU bug report logs - #16353
24.3.50; cl-position fails in 23.4.1

Previous Next

Package: emacs;

Reported by: joaotavora <at> gmail.com (João Távora)

Date: Sun, 5 Jan 2014 18:43:02 UTC

Severity: minor

Found in version 24.3.50

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 16353 in the body.
You can then email your comments to 16353 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#16353; Package emacs. (Sun, 05 Jan 2014 18:43:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to joaotavora <at> gmail.com (João Távora):
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 05 Jan 2014 18:43:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: joaotavora <at> gmail.com (João Távora)
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; cl-position fails in 23.4.1
Date: Sun, 05 Jan 2014 18:39:37 +0000
Hi,

This is GNU Emacs 23.4.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10)
 of 2012-09-08 on trouble, modified by Debian

Using that emacs and cl-lib-0.3.el this fails

/usr/bin/emacs --batch -Q -l cl-lib.el \
               --eval "(princ (cl-position 2 '(1 2 3)))"

where it should have printed "1". This works

/usr/bin/emacs --batch -Q -l cl-lib.el \
               --eval "(princ (cl-position-if #'(lambda (n) (eq n 2)) '(1 2 3)))"

All other cl-lib functions seem ok. This might be a debian bug.

João




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16353; Package emacs. (Mon, 06 Jan 2014 01:15:02 GMT) Full text and rfc822 format available.

Message #8 received at 16353 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: joaotavora <at> gmail.com (João Távora)
Cc: 16353 <at> debbugs.gnu.org
Subject: Re: bug#16353: 24.3.50; cl-position fails in 23.4.1
Date: Sun, 05 Jan 2014 20:14:46 -0500
João Távora wrote:

> This is GNU Emacs 23.4.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10)
>  of 2012-09-08 on trouble, modified by Debian
>
> Using that emacs and cl-lib-0.3.el this fails
>
> /usr/bin/emacs --batch -Q -l cl-lib.el \
>                --eval "(princ (cl-position 2 '(1 2 3)))"

Namespace clash. cl-seq.el used to contain an internal function called
"cl-position". It was renamed to cl--position in 24.3.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16353; Package emacs. (Mon, 06 Jan 2014 01:17:02 GMT) Full text and rfc822 format available.

Message #11 received at 16353 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: joaotavora <at> gmail.com (João Távora)
Cc: 16353 <at> debbugs.gnu.org
Subject: Re: bug#16353: 24.3.50; cl-position fails in 23.4.1
Date: Sun, 05 Jan 2014 20:16:35 -0500
PS you can expect the same issue with at least cl-adjoin.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16353; Package emacs. (Mon, 06 Jan 2014 04:09:02 GMT) Full text and rfc822 format available.

Message #14 received at 16353 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: João Távora <joaotavora <at> gmail.com>,
 16353 <at> debbugs.gnu.org
Subject: Re: bug#16353: 24.3.50; cl-position fails in 23.4.1
Date: Sun, 05 Jan 2014 23:08:46 -0500
>> This is GNU Emacs 23.4.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10)
>> of 2012-09-08 on trouble, modified by Debian
>> Using that emacs and cl-lib-0.3.el this fails
>> /usr/bin/emacs --batch -Q -l cl-lib.el \
>> --eval "(princ (cl-position 2 '(1 2 3)))"
> Namespace clash. cl-seq.el used to contain an internal function called
> "cl-position". It was renamed to cl--position in 24.3.

Indeed, thanks.  We need to adjust elpa's cl-lib.el accordingly (not
sure how best to do that, tho).


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16353; Package emacs. (Mon, 06 Jan 2014 22:52:01 GMT) Full text and rfc822 format available.

Message #17 received at 16353 <at> debbugs.gnu.org (full text, mbox):

From: joaotavora <at> gmail.com (João Távora)
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Glenn Morris <rgm <at> gnu.org>, 16353 <at> debbugs.gnu.org
Subject: Re: bug#16353: 24.3.50; cl-position fails in 23.4.1
Date: Mon, 06 Jan 2014 22:49:29 +0000
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>>> This is GNU Emacs 23.4.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10)
>>> of 2012-09-08 on trouble, modified by Debian
>>> Using that emacs and cl-lib-0.3.el this fails
>>> /usr/bin/emacs --batch -Q -l cl-lib.el \
>>> --eval "(princ (cl-position 2 '(1 2 3)))"
>> Namespace clash. cl-seq.el used to contain an internal function called
>> "cl-position". It was renamed to cl--position in 24.3.
>
> Indeed, thanks.  We need to adjust elpa's cl-lib.el accordingly (not
> sure how best to do that, tho).

Can it be done so that it I can still use cl-position in emacs 23.4.1?
Maybe by including in cl-lib-0.4 some byte-recompilation of the
cl-seq.el functions that Glenn mentions:

   (defun remove* (cl-item cl-seq &rest cl-keys)
   (defun delete* (cl-item cl-seq &rest cl-keys)
   (defun cl-delete-duplicates (cl-seq cl-keys cl-copy)
   (defun substitute (cl-new cl-old cl-seq &rest cl-keys)
   (defun position (cl-item cl-seq &rest cl-keys)
   (defun search (cl-seq1 cl-seq2 &rest cl-keys)

This was only for cl-position.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16353; Package emacs. (Tue, 07 Jan 2014 00:43:02 GMT) Full text and rfc822 format available.

Message #20 received at 16353 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: joaotavora <at> gmail.com (João Távora)
Cc: Glenn Morris <rgm <at> gnu.org>, 16353 <at> debbugs.gnu.org
Subject: Re: bug#16353: 24.3.50; cl-position fails in 23.4.1
Date: Mon, 06 Jan 2014 19:42:06 -0500
>>>> This is GNU Emacs 23.4.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10)
>>>> of 2012-09-08 on trouble, modified by Debian
>>>> Using that emacs and cl-lib-0.3.el this fails
>>>> /usr/bin/emacs --batch -Q -l cl-lib.el \
>>>> --eval "(princ (cl-position 2 '(1 2 3)))"
>>> Namespace clash. cl-seq.el used to contain an internal function called
>>> "cl-position". It was renamed to cl--position in 24.3.
>> Indeed, thanks.  We need to adjust elpa's cl-lib.el accordingly (not
>> sure how best to do that, tho).
> Can it be done so that it I can still use cl-position in emacs 23.4.1?

That would be best, yes.

> Maybe by including in cl-lib-0.4 some byte-recompilation of the
> cl-seq.el functions that Glenn mentions:

Could be.  It'd be good to first get a list of the all conflicting functions.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16353; Package emacs. (Tue, 07 Jan 2014 09:24:02 GMT) Full text and rfc822 format available.

Message #23 received at 16353 <at> debbugs.gnu.org (full text, mbox):

From: joaotavora <at> gmail.com (João Távora)
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Glenn Morris <rgm <at> gnu.org>, 16353 <at> debbugs.gnu.org
Subject: Re: bug#16353: 24.3.50; cl-position fails in 23.4.1
Date: Tue, 07 Jan 2014 09:21:48 +0000
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>>>>> This is GNU Emacs 23.4.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10)
>>>>> of 2012-09-08 on trouble, modified by Debian
>>>>> Using that emacs and cl-lib-0.3.el this fails
>>>>> /usr/bin/emacs --batch -Q -l cl-lib.el \
>>>>> --eval "(princ (cl-position 2 '(1 2 3)))"
>>>> Namespace clash. cl-seq.el used to contain an internal function called
>>>> "cl-position". It was renamed to cl--position in 24.3.
>>> Indeed, thanks.  We need to adjust elpa's cl-lib.el accordingly (not
>>> sure how best to do that, tho).
>> Can it be done so that it I can still use cl-position in emacs 23.4.1?
>
> That would be best, yes.
>
>> Maybe by including in cl-lib-0.4 some byte-recompilation of the
>> cl-seq.el functions that Glenn mentions:
>
> Could be.

Can it be done without including the full definitions, e.g. via some
bytecode-changing trick? I'm asking because I could include this
workaround

> It'd be good to first get a list of the all conflicting functions.

Here's what I found

using cl-position:

   (defun remove* (cl-item cl-seq &rest cl-keys)
   (defun delete* (cl-item cl-seq &rest cl-keys)
   (defun cl-delete-duplicates (cl-seq cl-keys cl-copy)
   (defun cl-delete-duplicates (cl-seq cl-keys cl-copy)
   (defun cl-delete-duplicates (cl-seq cl-keys cl-copy)
   (defun substitute (cl-new cl-old cl-seq &rest cl-keys)
   (defun position (cl-item cl-seq &rest cl-keys)
   (defun search (cl-seq1 cl-seq2 &rest cl-keys)

these are all in cl-seq.el. using cl-adoing:
    
   (defun adjoin (cl-item cl-list &rest cl-keys)    in cl.el

using cl-delete-duplicates:

   (defun remove-duplicates (cl-seq &rest cl-keys) in cl-seq.el
   (defun delete-duplicates (cl-seq &rest cl-keys) in cl-seq.el

There are more internal functions prefixed with "cl-", but I don't think
they clash with aliases exported by cl-lib.

There's cl-macroexpand and cl-macroexpand-all, but I think these were
exported functions even back in 23.4.1.

João







Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16353; Package emacs. (Tue, 07 Jan 2014 10:05:02 GMT) Full text and rfc822 format available.

Message #26 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Helmut Eller <eller.helmut <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#16353: 24.3.50; cl-position fails in 23.4.1
Date: Tue, 07 Jan 2014 11:03:30 +0100
On Tue, Jan 07 2014, João Távora wrote:

> Can it be done without including the full definitions, e.g. via some
> bytecode-changing trick? I'm asking because I could include this
> workaround

Here's an idea for a solution: unintern the existing symbol, say
cl-postion, then intern "cl-position" again to create a second symbol.
defalias the second symbol.  Code loaded before the unintern dance, will
call the function of the uninterned symbols and code loaded afterwards
calls the function of the second symbol.  To make this work it's
important to load all code that must call uninterned symbols into
memory.  In practice that seems to be cl-seq.elc.

--- cl-lib-0.3.el.orig	2014-01-07 10:47:47.508299389 +0100
+++ cl-lib-0.3.el	2014-01-07 10:48:57.436296376 +0100
@@ -299,9 +299,20 @@
                dolist
                dotimes
                ))
-  (let ((new (if (consp fun) (prog1 (cdr fun) (setq fun (car fun)))
-               (intern (format "cl-%s" fun)))))
-    (unless (fboundp new) (defalias new fun))))
+  (let* ((old (cond ((consp fun) (car fun))
+		    (t fun)))
+	 (new (cond ((consp fun) (cdr fun))
+		    (t (intern (format "cl-%s" fun)))))
+	 (f (symbol-function old))
+	 (autoload (and (consp f) (eq (car f) 'autoload))))
+    (when autoload
+      (load (cadr f)))
+    (let ((new2 (cond ((fboundp new)
+		       (message "Conflict: %s" new)
+		       (unintern new)
+		       (intern (symbol-name new)))
+		      (t new))))
+      (defalias new2 old))))
 
 ;; `cl-labels' is not 100% compatible with `labels' when using dynamic scoping
 ;; (mostly because it does not turn lambdas that refer to those functions into





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16353; Package emacs. (Wed, 08 Jan 2014 04:00:02 GMT) Full text and rfc822 format available.

Message #29 received at 16353 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Helmut Eller <eller.helmut <at> gmail.com>
Cc: 16353 <at> debbugs.gnu.org
Subject: Re: bug#16353: 24.3.50; cl-position fails in 23.4.1
Date: Tue, 07 Jan 2014 22:59:41 -0500
> Here's an idea for a solution: unintern the existing symbol, say
> cl-postion, then intern "cl-position" again to create a second symbol.

That was my initial idea as well, but there's the risk some code that
wants the cl-lib version of cl-position has already been `read' and
hence already refers to the incorrect symbol.

IOW, it's too hackish and fraught with problems.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16353; Package emacs. (Sat, 25 Jan 2014 05:21:02 GMT) Full text and rfc822 format available.

Message #32 received at 16353 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: joaotavora <at> gmail.com (João Távora)
Cc: 16353 <at> debbugs.gnu.org
Subject: Re: bug#16353: 24.3.50; cl-position fails in 23.4.1
Date: Sat, 25 Jan 2014 00:20:19 -0500
> Using that emacs and cl-lib-0.3.el this fails
> /usr/bin/emacs --batch -Q -l cl-lib.el \
>                --eval "(princ (cl-position 2 '(1 2 3)))"
> where it should have printed "1". This works

I have pushed a cl-lib v0.4 (to appear hopefully to morrow) which should
resolve this problem, along with two other similar issues (with
cl-member and cl-delete-duplicates).  Thank you,


        Stefan




bug closed, send any further explanations to 16353 <at> debbugs.gnu.org and joaotavora <at> gmail.com (João Távora) Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 28 Jan 2014 00:54:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16353; Package emacs. (Tue, 28 Jan 2014 09:33:02 GMT) Full text and rfc822 format available.

Message #37 received at 16353 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 16353 <at> debbugs.gnu.org
Subject: Re: bug#16353: 24.3.50; cl-position fails in 23.4.1
Date: Tue, 28 Jan 2014 09:31:51 +0000
> I have pushed a cl-lib v0.4 (to appear hopefully to morrow) which should
> resolve this problem, along with two other similar issues (with
> cl-member and cl-delete-duplicates).  Thank you,

Thank you!




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 25 Feb 2014 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 119 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.