unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Helmut Eller <eller.helmut@gmail.com>
To: 16353@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	[thread overview]
Message-ID: <m2ppo4153h.fsf@gmail.com> (raw)
In-Reply-To: <87a9faw9w6.fsf@gmail.com>

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






  reply	other threads:[~2014-01-07 10:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-05 18:39 bug#16353: 24.3.50; cl-position fails in 23.4.1 João Távora
2014-01-06  1:14 ` Glenn Morris
2014-01-06  1:16   ` Glenn Morris
2014-01-06  4:08   ` Stefan Monnier
2014-01-06 22:49     ` João Távora
2014-01-07  0:42       ` Stefan Monnier
2014-01-07  9:21         ` João Távora
2014-01-07 10:03           ` Helmut Eller [this message]
2014-01-08  3:59             ` Stefan Monnier
2014-01-25  5:20 ` Stefan Monnier
2014-01-28  9:31   ` João Távora

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2ppo4153h.fsf@gmail.com \
    --to=eller.helmut@gmail.com \
    --cc=16353@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).