From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#11799: 24.1.50; M-x ibuffer: Symbol's function definition is void: cl-minusp Date: Wed, 27 Jun 2012 23:31:48 -0400 Message-ID: References: <87lij81zbz.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1340854385 1049 80.91.229.3 (28 Jun 2012 03:33:05 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 28 Jun 2012 03:33:05 +0000 (UTC) Cc: 11799-done@debbugs.gnu.org To: michael_heerdegen@web.de Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 28 05:33:03 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Sk5TW-000136-T5 for geb-bug-gnu-emacs@m.gmane.org; Thu, 28 Jun 2012 05:32:59 +0200 Original-Received: from localhost ([::1]:58269 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sk5TW-0004N3-L2 for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Jun 2012 23:32:58 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:34438) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sk5TT-0004Mf-5C for bug-gnu-emacs@gnu.org; Wed, 27 Jun 2012 23:32:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sk5TR-0006V9-1N for bug-gnu-emacs@gnu.org; Wed, 27 Jun 2012 23:32:54 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51938) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sk5TQ-0006V0-Tt for bug-gnu-emacs@gnu.org; Wed, 27 Jun 2012 23:32:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Sk5XS-0003Uj-1S for bug-gnu-emacs@gnu.org; Wed, 27 Jun 2012 23:37:02 -0400 Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Thu, 28 Jun 2012 03:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 11799 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Mail-Followup-To: 11799@debbugs.gnu.org, monnier@iro.umontreal.ca Original-Received: via spool by 11799-done@debbugs.gnu.org id=D11799.134085456213320 (code D ref 11799); Thu, 28 Jun 2012 03:37:01 +0000 Original-Received: (at 11799-done) by debbugs.gnu.org; 28 Jun 2012 03:36:02 +0000 Original-Received: from localhost ([127.0.0.1]:33250 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sk5WU-0003Sn-9w for submit@debbugs.gnu.org; Wed, 27 Jun 2012 23:36:02 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:17160) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sk5WS-0003SN-7n for 11799-done@debbugs.gnu.org; Wed, 27 Jun 2012 23:36:00 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu09soXbe/2dsb2JhbABEtBGBCIIVAQEEAVYjBQsLNBIUGA03iAkFugmQRAOjM4FYgwU X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="192246309" Original-Received: from 108-161-118-222.dsl.teksavvy.com (HELO pastel.home) ([108.161.118.222]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 27 Jun 2012 23:31:49 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id BA444592B0; Wed, 27 Jun 2012 23:31:48 -0400 (EDT) In-Reply-To: <87lij81zbz.fsf@web.de> (Michael Heerdegen's message of "Wed, 27 Jun 2012 18:42:08 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:61352 Archived-At: > start emacs -Q, and do M-x ibuffer. I get these messages: > Updating buffer list... > Formats have changed, recompiling... > and then this error: > ibuffer-compile-format: Symbol's function definition is void: cl-minusp > There is no such error if I eval (require 'cl-lib) before calling > ibuffer. I installed the patch below which should hopefully fix it. Stefan === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-06-27 21:16:32 +0000 +++ lisp/ChangeLog 2012-06-28 03:29:10 +0000 @@ -1,3 +1,11 @@ +2012-06-28 Stefan Monnier + + Make inlining of other-mode interpreted functions work. + * emacs-lisp/bytecomp.el (byte-compile--refiy-function): New fun. + (byte-compile): Use it to fix compilation of lexical-binding closures. + * emacs-lisp/byte-opt.el (byte-compile-inline-expand): Compile the + function, if needed. + 2012-06-27 Stefan Monnier * help-mode.el (help-make-xrefs): Don't just withstand === modified file 'lisp/emacs-lisp/byte-opt.el' --- lisp/emacs-lisp/byte-opt.el 2012-06-13 13:16:34 +0000 +++ lisp/emacs-lisp/byte-opt.el 2012-06-28 03:25:59 +0000 @@ -266,42 +266,30 @@ ;; (message "Inlining byte-code for %S!" name) ;; The byte-code will be really inlined in byte-compile-unfold-bcf. `(,fn ,@(cdr form))) - ((or (and `(lambda ,args . ,body) (let env nil)) - `(closure ,env ,args . ,body)) + ((or `(lambda . ,_) `(closure . ,_)) (if (not (or (eq fn localfn) ;From the same file => same mode. - (eq (not lexical-binding) (not env)))) ;Same mode. + (eq (car fn) ;Same mode. + (if lexical-binding 'closure 'lambda)))) ;; While byte-compile-unfold-bcf can inline dynbind byte-code into ;; letbind byte-code (or any other combination for that matter), we ;; can only inline dynbind source into dynbind source or letbind ;; source into letbind source. - ;; FIXME: we could of course byte-compile the inlined function + (progn + ;; We can of course byte-compile the inlined function ;; first, and then inline its byte-code. - form - (let ((renv ())) - ;; Turn the function's closed vars (if any) into local let bindings. - (dolist (binding env) - (cond - ((consp binding) - ;; We check shadowing by the args, so that the `let' can be - ;; moved within the lambda, which can then be unfolded. - ;; FIXME: Some of those bindings might be unused in `body'. - (unless (memq (car binding) args) ;Shadowed. - (push `(,(car binding) ',(cdr binding)) renv))) - ((eq binding t)) - (t (push `(defvar ,binding) body)))) + (byte-compile name) + `(,(symbol-function name) ,@(cdr form))) (let ((newfn (if (eq fn localfn) ;; If `fn' is from the same file, it has already ;; been preprocessed! `(function ,fn) (byte-compile-preprocess - (if (null renv) - `(lambda ,args ,@body) - `(lambda ,args (let ,(nreverse renv) ,@body))))))) + (byte-compile--refiy-function fn))))) (if (eq (car-safe newfn) 'function) (byte-compile-unfold-lambda `(,(cadr newfn) ,@(cdr form))) (byte-compile-log-warning (format "Inlining closure %S failed" name)) - form))))) + form)))) (t ;; Give up on inlining. form)))) === modified file 'lisp/emacs-lisp/bytecomp.el' --- lisp/emacs-lisp/bytecomp.el 2012-06-22 13:42:38 +0000 +++ lisp/emacs-lisp/bytecomp.el 2012-06-28 03:23:27 +0000 @@ -2451,7 +2451,26 @@ (- (position-bytes (point)) (point-min) -1) (goto-char (point-max)))))) - +(defun byte-compile--refiy-function (fun) + "Return an expression which will evaluate to a function value FUN. +FUN should be either a `lambda' value or a `closure' value." + (pcase-let* (((or (and `(lambda ,args . ,body) (let env nil)) + `(closure ,env ,args . ,body)) fun) + (renv ())) + ;; Turn the function's closed vars (if any) into local let bindings. + (dolist (binding env) + (cond + ((consp binding) + ;; We check shadowing by the args, so that the `let' can be moved + ;; within the lambda, which can then be unfolded. FIXME: Some of those + ;; bindings might be unused in `body'. + (unless (memq (car binding) args) ;Shadowed. + (push `(,(car binding) ',(cdr binding)) renv))) + ((eq binding t)) + (t (push `(defvar ,binding) body)))) + (if (null renv) + `(lambda ,args ,@body) + `(lambda ,args (let ,(nreverse renv) ,@body))))) ;;;###autoload (defun byte-compile (form) @@ -2459,23 +2478,29 @@ If FORM is a lambda or a macro, byte-compile it as a function." (displaying-byte-compile-warnings (byte-compile-close-variables - (let* ((fun (if (symbolp form) + (let* ((lexical-binding lexical-binding) + (fun (if (symbolp form) (and (fboundp form) (symbol-function form)) form)) (macro (eq (car-safe fun) 'macro))) (if macro (setq fun (cdr fun))) - (cond ((eq (car-safe fun) 'lambda) + (when (symbolp form) + (unless (memq (car-safe fun) '(closure lambda)) + (error "Don't know how to compile %S" fun)) + (setq fun (byte-compile--refiy-function fun)) + (setq lexical-binding (eq (car fun) 'closure))) + (unless (eq (car-safe fun) 'lambda) + (error "Don't know how to compile %S" fun)) ;; Expand macros. (setq fun (byte-compile-preprocess fun)) ;; Get rid of the `function' quote added by the `lambda' macro. (if (eq (car-safe fun) 'function) (setq fun (cadr fun))) - (setq fun (if macro - (cons 'macro (byte-compile-lambda fun)) - (byte-compile-lambda fun))) + (setq fun (byte-compile-lambda fun)) + (if macro (push 'macro fun)) (if (symbolp form) - (defalias form fun) - fun))))))) + (fset form fun) + fun))))) (defun byte-compile-sexp (sexp) "Compile and return SEXP."