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.

Full log


View this message in rfc822 format

From: Helmut Eller <eller.helmut <at> gmail.com>
To: 16353 <at> debbugs.gnu.org
Subject: 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





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

Previous Next


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