summaryrefslogtreecommitdiff
path: root/src/editfns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/editfns.c')
-rw-r--r--src/editfns.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 991f79abac7..c8219decb06 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1452,8 +1452,8 @@ DEFUN ("insert-char", Finsert_char, Sinsert_char, 1, 3,
(prefix-numeric-value current-prefix-arg)\
t))",
doc: /* Insert COUNT copies of CHARACTER.
-Interactively, prompt for CHARACTER. You can specify CHARACTER in one
-of these ways:
+Interactively, prompt for CHARACTER using `read-char-by-name'.
+You can specify CHARACTER in one of these ways:
- As its Unicode character name, e.g. \"LATIN SMALL LETTER A\".
Completion is available; if you type a substring of the name
@@ -1697,7 +1697,11 @@ they can be in either order. */)
DEFUN ("buffer-string", Fbuffer_string, Sbuffer_string, 0, 0, 0,
doc: /* Return the contents of the current buffer as a string.
If narrowing is in effect, this function returns only the visible part
-of the buffer. */)
+of the buffer.
+
+This function copies the text properties of that part of the buffer
+into the result string; if you don’t want the text properties,
+use `buffer-substring-no-properties' instead. */)
(void)
{
return make_buffer_string_both (BEGV, BEGV_BYTE, ZV, ZV_BYTE, 1);
@@ -2133,7 +2137,7 @@ nil. */)
the file now. */
if (SAVE_MODIFF == MODIFF
&& STRINGP (BVAR (a, file_truename)))
- unlock_file (BVAR (a, file_truename));
+ Funlock_file (BVAR (a, file_truename));
}
return Qt;
@@ -2367,7 +2371,7 @@ Both characters must have the same length of multi-byte form. */)
/* replace_range is less efficient, because it moves the gap,
but it handles combining correctly. */
replace_range (pos, pos + 1, string,
- false, false, true, false);
+ false, false, true, false, false);
pos_byte_next = CHAR_TO_BYTE (pos);
if (pos_byte_next > pos_byte)
/* Before combining happened. We should not increment
@@ -2574,7 +2578,7 @@ It returns the number of characters changed. */)
but it should handle multibyte characters correctly. */
string = make_multibyte_string ((char *) str, 1, str_len);
replace_range (pos, pos + 1, string,
- true, false, true, false);
+ true, false, true, false, false);
len = str_len;
}
else
@@ -2609,7 +2613,8 @@ It returns the number of characters changed. */)
= (VECTORP (val)
? Fconcat (1, &val)
: Fmake_string (make_fixnum (1), val, Qnil));
- replace_range (pos, pos + len, string, true, false, true, false);
+ replace_range (pos, pos + len, string, true, false, true, false,
+ false);
pos_byte += SBYTES (string);
pos += SCHARS (string);
characters_changed += SCHARS (string);
@@ -2937,6 +2942,8 @@ DEFUN ("propertize", Fpropertize, Spropertize, 1, MANY, 0,
First argument is the string to copy.
Remaining arguments form a sequence of PROPERTY VALUE pairs for text
properties to add to the result.
+
+See Info node `(elisp) Text Properties' for more information.
usage: (propertize STRING &rest PROPERTIES) */)
(ptrdiff_t nargs, Lisp_Object *args)
{
@@ -2945,7 +2952,7 @@ usage: (propertize STRING &rest PROPERTIES) */)
/* Number of args must be odd. */
if ((nargs & 1) == 0)
- error ("Wrong number of arguments");
+ xsignal2 (Qwrong_number_of_arguments, Qpropertize, make_fixnum (nargs));
properties = string = Qnil;
@@ -3134,7 +3141,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
char *format_start = SSDATA (args[0]);
bool multibyte_format = STRING_MULTIBYTE (args[0]);
ptrdiff_t formatlen = SBYTES (args[0]);
- bool fmt_props = string_intervals (args[0]);
+ bool fmt_props = !!string_intervals (args[0]);
/* Upper bound on number of format specs. Each uses at least 2 chars. */
ptrdiff_t nspec_bound = SCHARS (args[0]) >> 1;
@@ -3382,12 +3389,11 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
else
{
ptrdiff_t nch, nby;
- width = lisp_string_width (arg, prec, &nch, &nby);
+ nchars_string = SCHARS (arg);
+ width = lisp_string_width (arg, 0, nchars_string, prec,
+ &nch, &nby, false);
if (prec < 0)
- {
- nchars_string = SCHARS (arg);
- nbytes = SBYTES (arg);
- }
+ nbytes = SBYTES (arg);
else
{
nchars_string = nch;
@@ -4448,6 +4454,7 @@ syms_of_editfns (void)
{
DEFSYM (Qbuffer_access_fontify_functions, "buffer-access-fontify-functions");
DEFSYM (Qwall, "wall");
+ DEFSYM (Qpropertize, "propertize");
DEFVAR_LISP ("inhibit-field-text-motion", Vinhibit_field_text_motion,
doc: /* Non-nil means text motion commands don't notice fields. */);