From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master e4de91d: Introduce new macros to cover Emacs's new names in cl-lib.el. Date: Tue, 18 Aug 2015 12:05:37 -0400 Message-ID: References: <20150812213205.640.84865@vcs.savannah.gnu.org> <20150813105530.GA2834@acm.fritz.box> <20150815123408.GA2637@acm.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1439914136 5027 80.91.229.3 (18 Aug 2015 16:08:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 18 Aug 2015 16:08:56 +0000 (UTC) Cc: emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 18 18:08:37 2015 Return-path: Envelope-to: ged-emacs-devel@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 1ZRjRD-00053A-PZ for ged-emacs-devel@m.gmane.org; Tue, 18 Aug 2015 18:08:35 +0200 Original-Received: from localhost ([::1]:58261 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRjRC-0003Jk-KZ for ged-emacs-devel@m.gmane.org; Tue, 18 Aug 2015 12:08:34 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52932) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRjOr-0007q5-Pu for emacs-devel@gnu.org; Tue, 18 Aug 2015 12:06:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZRjOl-0000xG-MD for emacs-devel@gnu.org; Tue, 18 Aug 2015 12:06:09 -0400 Original-Received: from mercure.iro.umontreal.ca ([132.204.24.67]:51466) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRjOl-0000uy-Cb for emacs-devel@gnu.org; Tue, 18 Aug 2015 12:06:03 -0400 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 5432D11C05B; Tue, 18 Aug 2015 12:06:02 -0400 (EDT) Original-Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id DCFA11E5B8C; Tue, 18 Aug 2015 12:05:37 -0400 (EDT) Original-Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id C4B6DB4288; Tue, 18 Aug 2015 12:05:37 -0400 (EDT) In-Reply-To: <20150815123408.GA2637@acm.fritz.box> (Alan Mackenzie's message of "Sat, 15 Aug 2015 12:34:08 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82, MC_TSTLAST 0.00) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 132.204.24.67 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:188893 Archived-At: >> > The (eval-when-compile (require 'cl)) was inadequate, because >> > cl.el (now cl-lib.el) is now required at run-time, too. Without the >> > change, the error "cl-mapcan not known" gets thrown when attempting to >> > visit the first file.c in an Emacs session. >> Oh, right, sorry, so the question becomes: what is the difference >> between `require' and `cc-external-require' here? > Not a great deal, to be honest. The main difference is that symbols > whose function cell has been given a placeholder value to inhibit > compiler warnings have these function cells restored to their correct > values in `cc-external-require' around the actual `require'. Ah, so it tries to restore temporary sanity while loading the file. That makes sense, thank you. > An example of an XEmacs function which gets this treatment is > `buffer-syntactic-context'. An example of an Emacs function is > `string-to-syntax'. BTW, how 'bout using something like the patch below, to try and avoid messing with function cells when we can? Stefan diff --git a/lisp/progmodes/cc-bytecomp.el b/lisp/progmodes/cc-bytecomp.el index b63eeb4..fe7cac7 100644 --- a/lisp/progmodes/cc-bytecomp.el +++ b/lisp/progmodes/cc-bytecomp.el @@ -377,6 +377,8 @@ about incorrect number of arguments. It's dangerous to try to replace existing functions since the byte compiler might need the definition at compile time, e.g. for macros and inline functions." + (if (fboundp 'declare-function) + `(declare-function ,fun nil) `(eval-when-compile (if (fboundp ',fun) (cc-bytecomp-debug-msg @@ -393,7 +395,7 @@ (fset ',fun (intern (concat "cc-bytecomp-ignore-fun:" (symbol-name ',fun)))) (cc-bytecomp-debug-msg - "cc-bytecomp-defun: Covered function %s" ',fun)))))) + "cc-bytecomp-defun: Covered function %s" ',fun))))))) (defmacro cc-bytecomp-put (symbol propname value) "Set a property on a symbol during compilation (and evaluation) of @@ -428,13 +428,15 @@ the compilation. This is the same as using `fboundp' but additionally exclude any functions that have been bound during compilation with `cc-bytecomp-defun'." + (if (fboundp 'declare-function) + `(fboundp ,symbol) (let (fun-elem) (if (and (cc-bytecomp-is-compiling) (setq fun-elem (assq (car (cdr symbol)) cc-bytecomp-original-functions)) (eq (elt fun-elem 2) 'unbound)) nil - `(fboundp ,symbol)))) + `(fboundp ,symbol))))) (provide 'cc-bytecomp)