;; This applies to config files like ~/.emacs,
;; which people sometimes compile.
((let (fn)
- (and (string-match "\\`\\..*\\.elc\\'"
+ (and (string-match "\\`\\..*\\.el[cn]\\'"
(file-name-nondirectory file-name))
(string-equal (file-name-directory file-name)
(file-name-as-directory (expand-file-name "~")))
;; When the Elisp source file can be found in the install
;; directory, return the name of that file.
((let ((lib-name
- (if (string-match "[.]elc\\'" file-name)
+ (if (string-match "[.]el[cn]\\'" file-name)
(substring-no-properties file-name 0 -1)
file-name)))
(or (and (file-readable-p lib-name) lib-name)
;; name, convert that back to a file name and see if we
;; get the original one. If so, they are equivalent.
(if (equal file-name (locate-file lib-name load-path '("")))
- (if (string-match "[.]elc\\'" lib-name)
+ (if (string-match "[.]el[cn]\\'" lib-name)
(substring-no-properties lib-name 0 -1)
lib-name)
file-name))
;; aliases before functions.
(aliased
(format-message "an alias for `%s'" real-def))
+ ((subr-native-elisp-p def)
+ "native compiled Lisp function")
((subrp def)
(concat beg (if (eq 'unevalled (cdr (subr-arity def)))
"special form"
static union Aligned_Lisp_Subr Swatch_gc_cons_threshold =
{{{ PSEUDOVECTOR_FLAG | (PVEC_SUBR << PSEUDOVECTOR_AREA_BITS) },
{ .a4 = watch_gc_cons_threshold },
- 4, 4, "watch_gc_cons_threshold", 0, 0}};
+ 4, 4, "watch_gc_cons_threshold", 0, {0}}};
XSETSUBR (watcher, &Swatch_gc_cons_threshold.s);
Fadd_variable_watcher (Qgc_cons_threshold, watcher);
static union Aligned_Lisp_Subr Swatch_gc_cons_percentage =
{{{ PSEUDOVECTOR_FLAG | (PVEC_SUBR << PSEUDOVECTOR_AREA_BITS) },
{ .a4 = watch_gc_cons_percentage },
- 4, 4, "watch_gc_cons_percentage", 0, 0}};
+ 4, 4, "watch_gc_cons_percentage", 0, {0}}};
XSETSUBR (watcher, &Swatch_gc_cons_percentage.s);
Fadd_variable_watcher (Qgc_cons_percentage, watcher);
}
void *func = dynlib_sym (handle, SSDATA (c_name));
eassert (func);
+ /* FIXME add gc support, now just leaking. */
union Aligned_Lisp_Subr *x = xmalloc (sizeof (union Aligned_Lisp_Subr));
+
x->s.header.size = PVEC_SUBR << PSEUDOVECTOR_AREA_BITS;
x->s.function.a0 = func;
x->s.min_args = XFIXNUM (minarg);
x->s.max_args = FIXNUMP (maxarg) ? XFIXNUM (maxarg) : MANY;
- x->s.symbol_name = SSDATA (Fsymbol_name (name));
+ x->s.symbol_name = xstrdup (SSDATA (Fsymbol_name (name)));
x->s.intspec = NULL;
- x->s.doc = 0; /* FIXME */
+ x->s.native_doc = doc;
x->s.native_elisp = true;
defsubr (x);
+ LOADHIST_ATTACH (Fcons (Qdefun, name));
+
return Qnil;
}
xsignal1 (Qvoid_function, function);
if (CONSP (fun) && EQ (XCAR (fun), Qmacro))
fun = XCDR (fun);
+#ifdef HAVE_NATIVE_COMP
+ if (!NILP (Fsubr_native_elisp_p (fun)))
+ doc = XSUBR (fun)->native_doc;
+ else
+#endif
if (SUBRP (fun))
doc = make_fixnum (XSUBR (fun)->doc);
#ifdef HAVE_MODULES
/* Lisp_Subrs have a slot for it. */
else if (SUBRP (fun))
- XSUBR (fun)->doc = offset;
+ {
+#ifdef HAVE_NATIVE_COMP
+ eassert (NILP (Fsubr_native_elisp_p (fun)));
+#endif
+ XSUBR (fun)->doc = offset;
+ }
/* Bytecode objects sometimes have slots for it. */
else if (COMPILEDP (fun))
short min_args, max_args;
const char *symbol_name;
const char *intspec;
- EMACS_INT doc;
+ union {
+ EMACS_INT doc;
#ifdef HAVE_NATIVE_COMP
- bool native_elisp;
+ Lisp_Object native_doc;
#endif
+ };
+ bool native_elisp;
} GCALIGNED_STRUCT;
union Aligned_Lisp_Subr
{
static union Aligned_Lisp_Subr sname = \
{{{ PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, \
{ .a ## maxargs = fnname }, \
- minargs, maxargs, lname, intspec, 0}}; \
+ minargs, maxargs, lname, intspec, {0}}}; \
Lisp_Object fnname
/* defsubr (Sname);