* Re: [Emacs-diffs] master e4de91d: Introduce new macros to cover Emacs's new names in cl-lib.el.
[not found] ` <E1ZPdcz-0000Aw-Eb@vcs.savannah.gnu.org>
@ 2015-08-13 2:48 ` Stefan Monnier
2015-08-13 10:55 ` Alan Mackenzie
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2015-08-13 2:48 UTC (permalink / raw)
To: emacs-devel; +Cc: Alan Mackenzie
> Change this back to cc-external-require from an eval-when-compile
> require.
I haven't been able to figure out what is the difference. Can you
enlighten us with, ideally, a testcase?
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Emacs-diffs] master e4de91d: Introduce new macros to cover Emacs's new names in cl-lib.el.
2015-08-13 2:48 ` [Emacs-diffs] master e4de91d: Introduce new macros to cover Emacs's new names in cl-lib.el Stefan Monnier
@ 2015-08-13 10:55 ` Alan Mackenzie
2015-08-13 16:02 ` Stefan Monnier
0 siblings, 1 reply; 5+ messages in thread
From: Alan Mackenzie @ 2015-08-13 10:55 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Hello, Stefan.
On Wed, Aug 12, 2015 at 10:48:42PM -0400, Stefan Monnier wrote:
> > Change this back to cc-external-require from an eval-when-compile
> > require.
> I haven't been able to figure out what is the difference. Can you
> enlighten us with, ideally, a testcase?
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.
> Stefan
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Emacs-diffs] master e4de91d: Introduce new macros to cover Emacs's new names in cl-lib.el.
2015-08-13 10:55 ` Alan Mackenzie
@ 2015-08-13 16:02 ` Stefan Monnier
2015-08-15 12:34 ` Alan Mackenzie
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2015-08-13 16:02 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: emacs-devel
> 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?
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Emacs-diffs] master e4de91d: Introduce new macros to cover Emacs's new names in cl-lib.el.
2015-08-13 16:02 ` Stefan Monnier
@ 2015-08-15 12:34 ` Alan Mackenzie
2015-08-18 16:05 ` Stefan Monnier
0 siblings, 1 reply; 5+ messages in thread
From: Alan Mackenzie @ 2015-08-15 12:34 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Hello, Stefan.
On Thu, Aug 13, 2015 at 12:02:20PM -0400, Stefan Monnier wrote:
> > 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'.
An example of an XEmacs function which gets this treatment is
`buffer-syntactic-context'. An example of an Emacs function is
`string-to-syntax'.
> Stefan
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Emacs-diffs] master e4de91d: Introduce new macros to cover Emacs's new names in cl-lib.el.
2015-08-15 12:34 ` Alan Mackenzie
@ 2015-08-18 16:05 ` Stefan Monnier
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2015-08-18 16:05 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: emacs-devel
>> > 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)))))
\f
(provide 'cc-bytecomp)
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-08-18 16:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20150812213205.640.84865@vcs.savannah.gnu.org>
[not found] ` <E1ZPdcz-0000Aw-Eb@vcs.savannah.gnu.org>
2015-08-13 2:48 ` [Emacs-diffs] master e4de91d: Introduce new macros to cover Emacs's new names in cl-lib.el Stefan Monnier
2015-08-13 10:55 ` Alan Mackenzie
2015-08-13 16:02 ` Stefan Monnier
2015-08-15 12:34 ` Alan Mackenzie
2015-08-18 16:05 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.