HCoop
/
bpt
/
emacs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use guile subrs
[bpt/emacs.git]
/
src
/
doc.c
diff --git
a/src/doc.c
b/src/doc.c
index
7e69316
..
a0d01c2
100644
(file)
--- a/
src/doc.c
+++ b/
src/doc.c
@@
-84,7
+84,6
@@
get_doc_string (Lisp_Object filepos, bool unibyte, bool definition)
int offset;
EMACS_INT position;
Lisp_Object file, tem, pos;
int offset;
EMACS_INT position;
Lisp_Object file, tem, pos;
- ptrdiff_t count;
USE_SAFE_ALLOCA;
if (INTEGERP (filepos))
USE_SAFE_ALLOCA;
if (INTEGERP (filepos))
@@
-150,7
+149,7
@@
get_doc_string (Lisp_Object filepos, bool unibyte, bool definition)
file, build_string ("\"\n"));
}
}
file, build_string ("\"\n"));
}
}
-
count = SPECPDL_INDEX
();
+
dynwind_begin
();
record_unwind_protect_int (close_file_unwind, fd);
/* Seek only to beginning of disk block. */
record_unwind_protect_int (close_file_unwind, fd);
/* Seek only to beginning of disk block. */
@@
-206,7
+205,7
@@
get_doc_string (Lisp_Object filepos, bool unibyte, bool definition)
}
p += nread;
}
}
p += nread;
}
-
unbind_to (count, Qnil
);
+
dynwind_end (
);
SAFE_FREE ();
/* Sanity checking. */
SAFE_FREE ();
/* Sanity checking. */
@@
-351,18
+350,17
@@
string is passed through `substitute-command-keys'. */)
}
fun = Findirect_function (function, Qnil);
}
fun = Findirect_function (function, Qnil);
- if (CONSP (fun) && EQ (XCAR (fun), Qmacro))
+ if (CONSP (fun)
+ && (EQ (XCAR (fun), Qmacro)
+ || EQ (XCAR (fun), Qspecial_operator)))
fun = XCDR (fun);
fun = XCDR (fun);
- if (
SUBRP (fun
))
+ if (
scm_is_true (scm_procedure_p (fun)
))
{
{
- if (XSUBR (fun)->doc == 0)
- return Qnil;
- /* FIXME: This is not portable, as it assumes that string
- pointers have the top bit clear. */
- else if ((intptr_t) XSUBR (fun)->doc >= 0)
- doc = build_string (XSUBR (fun)->doc);
+ Lisp_Object tem = scm_procedure_property (fun, intern ("emacs-documentation"));
+ if (scm_is_true (tem))
+ doc = tem;
else
else
-
doc = make_number ((intptr_t) XSUBR (fun)->doc)
;
+
return Qnil
;
}
else if (COMPILEDP (fun))
{
}
else if (COMPILEDP (fun))
{
@@
-498,15
+496,16
@@
store_function_docstring (Lisp_Object obj, ptrdiff_t offset)
{
/* Don't use indirect_function here, or defaliases will apply their
docstrings to the base functions (Bug#2603). */
{
/* Don't use indirect_function here, or defaliases will apply their
docstrings to the base functions (Bug#2603). */
- Lisp_Object fun = SYMBOLP (obj) ?
XSYMBOL (obj)->function
: obj;
+ Lisp_Object fun = SYMBOLP (obj) ?
SYMBOL_FUNCTION (obj)
: obj;
/* The type determines where the docstring is stored. */
/* The type determines where the docstring is stored. */
- /* Lisp_Subrs have a slot for it. */
- if (
SUBRP (fun
))
+
+ if (
scm_is_true (scm_procedure_p (fun)
))
{
{
- intptr_t negative_offset = - offset;
- XSUBR (fun)->doc = (char *) negative_offset;
+ scm_set_procedure_property_x (fun,
+ intern ("emacs-documentation"),
+ make_number (offset));
}
/* If it's a lisp form, stick it in the form. */
}
/* If it's a lisp form, stick it in the form. */
@@
-524,7
+523,7
@@
store_function_docstring (Lisp_Object obj, ptrdiff_t offset)
correctness is quite delicate. */
XSETCAR (tem, make_number (offset));
}
correctness is quite delicate. */
XSETCAR (tem, make_number (offset));
}
- else if (EQ (tem, Qmacro))
+ else if (EQ (tem, Qmacro)
|| EQ (tem, Qspecial_operator)
)
store_function_docstring (XCDR (fun), offset);
}
store_function_docstring (XCDR (fun), offset);
}
@@
-537,7
+536,7
@@
store_function_docstring (Lisp_Object obj, ptrdiff_t offset)
ASET (fun, COMPILED_DOC_STRING, make_number (offset));
else
message ("No docstring slot for %s",
ASET (fun, COMPILED_DOC_STRING, make_number (offset));
else
message ("No docstring slot for %s",
- SYMBOLP (obj) ? SDATA (SYMBOL_NAME (obj)) : "<anonymous>");
+ SYMBOLP (obj) ? S
S
DATA (SYMBOL_NAME (obj)) : "<anonymous>");
}
}
}
}
@@
-595,7
+594,7
@@
the same file name is found in the `doc-directory'. */)
{
#include "buildobj.h"
};
{
#include "buildobj.h"
};
- int i =
sizeof buildobj / sizeof *buildobj
;
+ int i =
ARRAYELTS (buildobj)
;
while (0 <= --i)
Vbuild_files = Fcons (build_string (buildobj[i]), Vbuild_files);
Vbuild_files = Fpurecopy (Vbuild_files);
while (0 <= --i)
Vbuild_files = Fcons (build_string (buildobj[i]), Vbuild_files);
Vbuild_files = Fpurecopy (Vbuild_files);
@@
-608,7
+607,7
@@
the same file name is found in the `doc-directory'. */)
report_file_errno ("Opening doc string file", build_string (name),
open_errno);
}
report_file_errno ("Opening doc string file", build_string (name),
open_errno);
}
-
count = SPECPDL_INDEX
();
+
dynwind_begin
();
record_unwind_protect_int (close_file_unwind, fd);
Vdoc_file_name = filename;
filled = 0;
record_unwind_protect_int (close_file_unwind, fd);
Vdoc_file_name = filename;
filled = 0;
@@
-688,7
+687,8
@@
the same file name is found in the `doc-directory'. */)
filled -= end - buf;
memmove (buf, end, filled);
}
filled -= end - buf;
memmove (buf, end, filled);
}
- return unbind_to (count, Qnil);
+ dynwind_end ();
+ return Qnil;
}
\f
DEFUN ("substitute-command-keys", Fsubstitute_command_keys,
}
\f
DEFUN ("substitute-command-keys", Fsubstitute_command_keys,
@@
-747,7
+747,7
@@
Otherwise, return a new string. */)
keymap = Voverriding_local_map;
bsize = SBYTES (string);
keymap = Voverriding_local_map;
bsize = SBYTES (string);
- bufp = buf = xmalloc (bsize);
+ bufp = buf = xmalloc
_atomic
(bsize);
strp = SDATA (string);
while (strp < SDATA (string) + SBYTES (string))
strp = SDATA (string);
while (strp < SDATA (string) + SBYTES (string))
@@
-844,7
+844,7
@@
Otherwise, return a new string. */)
/* This is for computing the SHADOWS arg for describe_map_tree. */
Lisp_Object active_maps = Fcurrent_active_maps (Qnil, Qnil);
Lisp_Object earlier_maps;
/* This is for computing the SHADOWS arg for describe_map_tree. */
Lisp_Object active_maps = Fcurrent_active_maps (Qnil, Qnil);
Lisp_Object earlier_maps;
-
ptrdiff_t count = SPECPDL_INDEX
();
+
dynwind_begin
();
changed = 1;
strp += 2; /* skip \{ or \< */
changed = 1;
strp += 2; /* skip \{ or \< */
@@
-909,7
+909,7
@@
Otherwise, return a new string. */)
tem = Fbuffer_string ();
Ferase_buffer ();
set_buffer_internal (oldbuf);
tem = Fbuffer_string ();
Ferase_buffer ();
set_buffer_internal (oldbuf);
-
unbind_to (count, Qnil
);
+
dynwind_end (
);
subst_string:
start = SDATA (tem);
subst_string:
start = SDATA (tem);
@@
-951,12
+951,14
@@
Otherwise, return a new string. */)
else
tem = string;
xfree (buf);
else
tem = string;
xfree (buf);
-
RETURN_UNGCPRO (tem)
;
+
return tem
;
}
\f
void
syms_of_doc (void)
{
}
\f
void
syms_of_doc (void)
{
+#include "doc.x"
+
DEFSYM (Qfunction_documentation, "function-documentation");
DEFVAR_LISP ("internal-doc-file-name", Vdoc_file_name,
DEFSYM (Qfunction_documentation, "function-documentation");
DEFVAR_LISP ("internal-doc-file-name", Vdoc_file_name,
@@
-966,9
+968,4
@@
syms_of_doc (void)
DEFVAR_LISP ("build-files", Vbuild_files,
doc: /* A list of files used to build this Emacs binary. */);
Vbuild_files = Qnil;
DEFVAR_LISP ("build-files", Vbuild_files,
doc: /* A list of files used to build this Emacs binary. */);
Vbuild_files = Qnil;
-
- defsubr (&Sdocumentation);
- defsubr (&Sdocumentation_property);
- defsubr (&Ssnarf_documentation);
- defsubr (&Ssubstitute_command_keys);
}
}