summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey <lorentey@elte.hu>2005-09-17 19:10:55 +0000
committerKaroly Lorentey <lorentey@elte.hu>2005-09-17 19:10:55 +0000
commit5826661f18ae8c95b26951a042692e68b9bc093f (patch)
tree534dee8bd5250e83e84a896ebd29f82be3370c07 /src
parent567c887847144d9609ccfe550fd7ef178120297a (diff)
parent5b51c03716d7c487d1c2336df2a76a6417a2343c (diff)
downloademacs-5826661f18ae8c95b26951a042692e68b9bc093f.tar.gz
Merged from miles@gnu.org--gnu-2005 (patch 116-117, 544-550)
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-544 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-545 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-546 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-547 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-548 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-549 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-550 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-116 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-117 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-421
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog44
-rw-r--r--src/Makefile.in11
-rw-r--r--src/coding.c29
-rw-r--r--src/composite.c126
-rw-r--r--src/composite.h1
-rw-r--r--src/emacs.c2
-rw-r--r--src/fileio.c32
-rw-r--r--src/print.c2
-rw-r--r--src/xdisp.c43
9 files changed, 113 insertions, 177 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 29f3929ccd8..c0f1ceee87e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,47 @@
+2005-09-15 Richard M. Stallman <rms@gnu.org>
+
+ * xdisp.c (overlay_arrow_at_row): Add HAVE_WINDOW_SYSTEM conditional.
+ (display_mode_element): Instead of `lisp_string' and `this',
+ record `offset' and increment that.
+ `last_offset' replaces `last'.
+
+ * Makefile.in (XMENU_OBJ): Variable deleted.
+ (obj): Use xmenu.o unconditionally.
+ (SOME_MACHINE_OBJECTS): Delete xmenu.o.
+
+ * emacs.c (main): Don't conditionalize syms_of_xmenu on HAVE_XMENU.
+
+2005-09-15 Kim F. Storm <storm@cua.dk>
+
+ * xdisp.c (move_it_vertically): Don't try to fetch byte BEGV-1.
+ (reseat_at_next_visible_line_start): Likewise (in xassert).
+
+2005-09-14 Romain Francoise <romain@orebokech.com>
+
+ * fileio.c (write_region_inhibit_fsync): New variable.
+ (Fwrite_region): Use it to skip call to fsync.
+ (syms_of_fileio): Initialize it.
+
+2005-09-14 Kenichi Handa <handa@m17n.org>
+
+ * coding.c (code_convert_region_unwind): Argument format changed.
+ (run_pre_post_conversion_on_str): If pre-write-conversion function
+ changed the current buffer, delete the new buffer.
+ (run_pre_write_conversin_on_c_str): Likewise.
+
+ * fileio.c (Fexpand_file_name): Check multibyteness of
+ default_directory.
+
+2005-09-13 Kenichi Handa <handa@m17n.org>
+
+ * composite.c (compose_chars_in_text): Delete it.
+
+ * composite.h (compose_chars_in_text): Delete extern.
+
+2005-09-13 Kim F. Storm <storm@cua.dk>
+
+ * print.c (print_error_message): Fix last change.
+
2005-09-12 Kim F. Storm <storm@cua.dk>
* composite.c (compose_chars_in_text): Fix setup of `pend'.
diff --git a/src/Makefile.in b/src/Makefile.in
index fdeeb544b1b..b3dedd5453a 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -310,10 +310,6 @@ XOBJ= xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o
#ifdef HAVE_MENUS
-#ifndef HAVE_CARBON
-XMENU_OBJ = xmenu.o
-#endif
-
#ifdef USE_GTK
GTK_OBJ= gtkutil.o
#endif
@@ -449,9 +445,6 @@ LIBX= $(LIBXMENU) $(X11_LDFLAGS) $(LIBXT) LIBTIFF LIBJPEG LIBPNG LIBGIF LIBXPM L
LIBX= $(LIBXMENU) LD_SWITCH_X_SITE -lX10 LIBX10_MACHINE LIBX10_SYSTEM
#endif /* not HAVE_X11 */
#else /* not HAVE_X_WINDOWS */
-#if defined(HAVE_MENUS) && !defined(HAVE_CARBON)
-XMENU_OBJ = xmenu.o
-#endif
#endif /* not HAVE_X_WINDOWS */
LIBSOUND= @LIBSOUND@
@@ -577,7 +570,7 @@ emacsappsrc = ${srcdir}/../mac/Emacs.app/
/* lastfile must follow all files
whose initialized data areas should be dumped as pure by dump-emacs. */
-obj= dispnew.o frame.o scroll.o xdisp.o $(XMENU_OBJ) window.o \
+obj= dispnew.o frame.o scroll.o xdisp.o xmenu.o window.o \
charset.o coding.o category.o ccl.o \
cm.o term.o xfaces.o $(XOBJ) $(GTK_OBJ)\
emacs.o keyboard.o macros.o keymap.o sysdep.o \
@@ -596,7 +589,7 @@ obj= dispnew.o frame.o scroll.o xdisp.o $(XMENU_OBJ) window.o \
These go in the DOC file on all machines
in case they are needed there. */
SOME_MACHINE_OBJECTS = sunfns.o dosfns.o msdos.o \
- xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
+ xterm.o xfns.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
mac.o macterm.o macfns.o macmenu.o macselect.o fontset.o \
w32.o w32bdf.o w32console.o w32fns.o w32heap.o w32inevt.o \
w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o
diff --git a/src/coding.c b/src/coding.c
index 9d2d04af6cb..5658a8ab09a 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -5349,8 +5349,8 @@ static int shrink_conversion_region_threshhold = 1024;
} \
} while (0)
-/* ARG is (CODING . BUFFER) where CODING is what to be set in
- Vlast_coding_system_used and BUFFER if non-nil is a buffer to
+/* ARG is (CODING BUFFER ...) where CODING is what to be set in
+ Vlast_coding_system_used and the remaining elements are buffers to
kill. */
static Lisp_Object
code_convert_region_unwind (arg)
@@ -5358,8 +5358,8 @@ code_convert_region_unwind (arg)
{
inhibit_pre_post_conversion = 0;
Vlast_coding_system_used = XCAR (arg);
- if (! NILP (XCDR (arg)))
- Fkill_buffer (XCDR (arg));
+ for (arg = XCDR (arg); ! NILP (arg); arg = XCDR (arg))
+ Fkill_buffer (XCAR (arg));
return Qnil;
}
@@ -6077,6 +6077,7 @@ run_pre_post_conversion_on_str (str, coding, encodep)
int multibyte = STRING_MULTIBYTE (str);
Lisp_Object old_deactivate_mark;
Lisp_Object buffer_to_kill;
+ Lisp_Object unwind_arg;
record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
/* It is not crucial to specbind this. */
@@ -6087,15 +6088,25 @@ run_pre_post_conversion_on_str (str, coding, encodep)
unibyte<->multibyte conversion. For that, we adjust the
multibyteness of the working buffer to that of STR. */
buffer_to_kill = set_conversion_work_buffer (multibyte);
- record_unwind_protect (code_convert_region_unwind,
- Fcons (Vlast_coding_system_used, buffer_to_kill));
+ if (NILP (buffer_to_kill))
+ unwind_arg = Fcons (Vlast_coding_system_used, Qnil);
+ else
+ unwind_arg = list2 (Vlast_coding_system_used, buffer_to_kill);
+ record_unwind_protect (code_convert_region_unwind, unwind_arg);
insert_from_string (str, 0, 0,
SCHARS (str), SBYTES (str), 0);
UNGCPRO;
inhibit_pre_post_conversion = 1;
if (encodep)
- call2 (coding->pre_write_conversion, make_number (BEG), make_number (Z));
+ {
+ struct buffer *prev = current_buffer;
+
+ call2 (coding->pre_write_conversion, make_number (BEG), make_number (Z));
+ if (prev != current_buffer)
+ /* We must kill the current buffer too. */
+ Fsetcdr (unwind_arg, Fcons (Fcurrent_buffer (), XCDR (unwind_arg)));
+ }
else
{
Vlast_coding_system_used = coding->symbol;
@@ -6129,6 +6140,7 @@ run_pre_write_conversin_on_c_str (str, size, nchars, nbytes, coding)
{
struct gcpro gcpro1, gcpro2;
struct buffer *cur = current_buffer;
+ struct buffer *prev;
Lisp_Object old_deactivate_mark, old_last_coding_system_used;
Lisp_Object args[3];
Lisp_Object buffer_to_kill;
@@ -6145,6 +6157,7 @@ run_pre_write_conversin_on_c_str (str, size, nchars, nbytes, coding)
insert_1_both (*str, nchars, nbytes, 0, 0, 0);
UNGCPRO;
inhibit_pre_post_conversion = 1;
+ prev = current_buffer;
args[0] = coding->pre_write_conversion;
args[1] = make_number (BEG);
args[2] = make_number (Z);
@@ -6164,6 +6177,8 @@ run_pre_write_conversin_on_c_str (str, size, nchars, nbytes, coding)
bcopy (BEG_ADDR, *str, coding->produced);
coding->src_multibyte
= ! NILP (current_buffer->enable_multibyte_characters);
+ if (prev != current_buffer)
+ Fkill_buffer (Fcurrent_buffer ());
set_buffer_internal (cur);
if (! NILP (buffer_to_kill))
Fkill_buffer (buffer_to_kill);
diff --git a/src/composite.c b/src/composite.c
index 02abb66e1e5..f03d5054c33 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -589,132 +589,6 @@ compose_text (start, end, components, modification_func, string)
Qcomposition, prop, string);
}
-/* Compose sequences of characters in the region between START and END
- by functions registered in Vcomposition_function_table. If STRING
- is non-nil, operate on characters contained between indices START
- and END in STRING. */
-
-void
-compose_chars_in_text (start, end, string)
- int start, end;
- Lisp_Object string;
-{
- int count = 0;
- struct gcpro gcpro1;
- Lisp_Object tail, elt, val, to;
- /* Set to nonzero if we don't have to compose ASCII characters. */
- int skip_ascii;
- int i, len, stop, c;
- const unsigned char *ptr, *pend;
-
- if (! CHAR_TABLE_P (Vcomposition_function_table))
- return;
-
- if (STRINGP (string))
- {
- count = SPECPDL_INDEX ();
- GCPRO1 (string);
- stop = end;
- ptr = SDATA (string) + string_char_to_byte (string, start);
- pend = SDATA (string) + SBYTES (string);
- }
- else
- {
- record_unwind_protect (save_excursion_restore, save_excursion_save ());
- TEMP_SET_PT (start);
- stop = (start < GPT && GPT < end ? GPT : end);
- ptr = CHAR_POS_ADDR (start);
- pend = CHAR_POS_ADDR (end);
- }
-
- /* Preserve the match data. */
- record_unwind_save_match_data ();
-
- /* If none of ASCII characters have composition functions, we can
- skip them quickly. */
- for (i = 0; i < 128; i++)
- if (!NILP (CHAR_TABLE_REF (Vcomposition_function_table, i)))
- break;
- skip_ascii = (i == 128);
-
-
- while (1)
- {
- if (skip_ascii)
- while (start < stop && ASCII_BYTE_P (*ptr))
- start++, ptr++;
-
- if (start >= stop)
- {
- if (stop == end || start >= end)
- break;
- stop = end;
- if (STRINGP (string))
- ptr = SDATA (string) + string_char_to_byte (string, start);
- else
- ptr = CHAR_POS_ADDR (start);
- }
-
- c = STRING_CHAR_AND_LENGTH (ptr, pend - ptr, len);
- tail = CHAR_TABLE_REF (Vcomposition_function_table, c);
- while (CONSP (tail))
- {
- elt = XCAR (tail);
- if (CONSP (elt)
- && STRINGP (XCAR (elt))
- && !NILP (Ffboundp (XCDR (elt))))
- {
- if (STRINGP (string))
- val = Fstring_match (XCAR (elt), string, make_number (start));
- else
- {
- val = Flooking_at (XCAR (elt));
- if (!NILP (val))
- val = make_number (start);
- }
- if (INTEGERP (val) && XFASTINT (val) == start)
- {
- to = Fmatch_end (make_number (0));
- val = call4 (XCDR (elt), val, to, XCAR (elt), string);
- if (INTEGERP (val) && XINT (val) > 1)
- {
- start += XINT (val);
- if (STRINGP (string))
- {
- ptr = SDATA (string) + string_char_to_byte (string, start);
- pend = SDATA (string) + SBYTES (string);
- }
- else
- ptr = CHAR_POS_ADDR (start);
- }
- else if (STRINGP (string))
- {
- start++;
- ptr = SDATA (string) + string_char_to_byte (string, start);
- pend = SDATA (string) + SBYTES (string);
- }
- else
- {
- start++;
- ptr += len;
- }
- break;
- }
- }
- tail = XCDR (tail);
- }
- if (!CONSP (tail))
- {
- /* No composition done. Try the next character. */
- start++;
- ptr += len;
- }
- }
-
- unbind_to (count, Qnil);
- if (STRINGP (string))
- UNGCPRO;
-}
/* Emacs Lisp APIs. */
diff --git a/src/composite.h b/src/composite.h
index 26cf13d27d4..cdcc9301792 100644
--- a/src/composite.h
+++ b/src/composite.h
@@ -209,7 +209,6 @@ extern void compose_region P_ ((int, int, Lisp_Object, Lisp_Object,
extern void syms_of_composite P_ ((void));
extern void compose_text P_ ((int, int, Lisp_Object, Lisp_Object,
Lisp_Object));
-extern void compose_chars_in_text P_ ((int, int, Lisp_Object));
#endif /* not EMACS_COMPOSITE_H */
diff --git a/src/emacs.c b/src/emacs.c
index 8724cbf2928..71b17a064c4 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1628,14 +1628,12 @@ main (argc, argv
#endif
#endif /* HAVE_X_WINDOWS */
-#ifdef HAVE_MENUS
#ifndef HAVE_NTGUI
#ifndef MAC_OS
/* Called before init_window_once for Mac OS Classic. */
syms_of_xmenu ();
#endif
#endif
-#endif
#ifdef HAVE_NTGUI
syms_of_w32term ();
diff --git a/src/fileio.c b/src/fileio.c
index 56557da6a30..906c42d9126 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -227,6 +227,11 @@ int vms_stmlf_recfm;
expanding file names. This can be bound to / or \. */
Lisp_Object Vdirectory_sep_char;
+#ifdef HAVE_FSYNC
+/* Nonzero means skip the call to fsync in Fwrite-region. */
+int write_region_inhibit_fsync;
+#endif
+
extern Lisp_Object Vuser_login_name;
#ifdef WINDOWSNT
@@ -1058,6 +1063,7 @@ See also the function `substitute-in-file-name'. */)
#endif /* DOS_NT */
int length;
Lisp_Object handler, result;
+ int multibyte;
CHECK_STRING (name);
@@ -1135,6 +1141,7 @@ See also the function `substitute-in-file-name'. */)
name = FILE_SYSTEM_CASE (name);
nm = SDATA (name);
+ multibyte = STRING_MULTIBYTE (name);
#ifdef DOS_NT
/* We will force directory separators to be either all \ or /, so make
@@ -1300,8 +1307,7 @@ See also the function `substitute-in-file-name'. */)
if (index (nm, '/'))
{
nm = sys_translate_unix (nm);
- return make_specified_string (nm, -1, strlen (nm),
- STRING_MULTIBYTE (name));
+ return make_specified_string (nm, -1, strlen (nm), multibyte);
}
#endif /* VMS */
#ifdef DOS_NT
@@ -1313,8 +1319,7 @@ See also the function `substitute-in-file-name'. */)
if (IS_DIRECTORY_SEP (nm[1]))
{
if (strcmp (nm, SDATA (name)) != 0)
- name = make_specified_string (nm, -1, strlen (nm),
- STRING_MULTIBYTE (name));
+ name = make_specified_string (nm, -1, strlen (nm), multibyte);
}
else
#endif
@@ -1323,8 +1328,7 @@ See also the function `substitute-in-file-name'. */)
{
char temp[] = " :";
- name = make_specified_string (nm, -1, p - nm,
- STRING_MULTIBYTE (name));
+ name = make_specified_string (nm, -1, p - nm, multibyte);
temp[0] = DRIVE_LETTER (drive);
name = concat2 (build_string (temp), name);
}
@@ -1332,8 +1336,7 @@ See also the function `substitute-in-file-name'. */)
#else /* not DOS_NT */
if (nm == SDATA (name))
return name;
- return make_specified_string (nm, -1, strlen (nm),
- STRING_MULTIBYTE (name));
+ return make_specified_string (nm, -1, strlen (nm), multibyte);
#endif /* not DOS_NT */
}
}
@@ -1445,6 +1448,7 @@ See also the function `substitute-in-file-name'. */)
&& !newdir)
{
newdir = SDATA (default_directory);
+ multibyte |= STRING_MULTIBYTE (default_directory);
#ifdef DOS_NT
/* Note if special escape prefix is present, but remove for now. */
if (newdir[0] == '/' && newdir[1] == ':')
@@ -1710,8 +1714,7 @@ See also the function `substitute-in-file-name'. */)
CORRECT_DIR_SEPS (target);
#endif /* DOS_NT */
- result = make_specified_string (target, -1, o - target,
- STRING_MULTIBYTE (name));
+ result = make_specified_string (target, -1, o - target, multibyte);
/* Again look to see if the file name has special constructs in it
and perhaps call the corresponding file handler. This is needed
@@ -5300,7 +5303,7 @@ This does code conversion according to the value of
Disk full in NFS may be reported here. */
/* mib says that closing the file will try to write as fast as NFS can do
it, and that means the fsync here is not crucial for autosave files. */
- if (!auto_saving && fsync (desc) < 0)
+ if (!auto_saving && !write_region_inhibit_fsync && fsync (desc) < 0)
{
/* If fsync fails with EINTR, don't treat that as serious. */
if (errno != EINTR)
@@ -6746,6 +6749,13 @@ shortly after Emacs reads your `.emacs' file, if you have not yet given it
a non-nil value. */);
Vauto_save_list_file_name = Qnil;
+#ifdef HAVE_FSYNC
+ DEFVAR_BOOL ("write-region-inhibit-fsync", &write_region_inhibit_fsync,
+ doc: /* *Non-nil means don't call fsync after saving files.
+Enabling this variable may result in data loss! */);
+ write_region_inhibit_fsync = 0;
+#endif
+
defsubr (&Sfind_file_name_handler);
defsubr (&Sfile_name_directory);
defsubr (&Sfile_name_nondirectory);
diff --git a/src/print.c b/src/print.c
index 2ba749aff44..91642afd651 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1028,7 +1028,7 @@ print_error_message (data, stream, context, caller)
Lisp_Object cname = SYMBOL_NAME (caller);
char *name = alloca (SBYTES (cname));
bcopy (SDATA (cname), name, SBYTES (cname));
- message_dolog (name, strlen (name), 0, 0);
+ message_dolog (name, SBYTES (cname), 0, 0);
message_dolog (": ", 2, 0, 0);
}
diff --git a/src/xdisp.c b/src/xdisp.c
index 031260c48ad..c5c05408e3c 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -4794,7 +4794,8 @@ reseat_at_next_visible_line_start (it, on_newline_p)
&& indented_beyond_p (IT_CHARPOS (*it), IT_BYTEPOS (*it),
(double) it->selective)) /* iftc */
{
- xassert (FETCH_BYTE (IT_BYTEPOS (*it) - 1) == '\n');
+ xassert (IT_BYTEPOS (*it) == BEGV
+ || FETCH_BYTE (IT_BYTEPOS (*it) - 1) == '\n');
newline_found_p = forward_to_next_line_start (it, &skipped_p);
}
@@ -6512,6 +6513,7 @@ move_it_vertically (it, dy)
/* If buffer ends in ZV without a newline, move to the start of
the line to satisfy the post-condition. */
if (IT_CHARPOS (*it) == ZV
+ && ZV > BEGV
&& FETCH_BYTE (IT_BYTEPOS (*it) - 1) != '\n')
move_it_by_lines (it, 0, 0);
}
@@ -10019,12 +10021,14 @@ overlay_arrow_at_row (it, row)
if (FRAME_WINDOW_P (it->f)
&& WINDOW_LEFT_FRINGE_WIDTH (it->w) > 0)
{
+#ifdef HAVE_WINDOW_SYSTEM
if (val = Fget (var, Qoverlay_arrow_bitmap), SYMBOLP (val))
{
int fringe_bitmap;
if ((fringe_bitmap = lookup_fringe_bitmap (val)) != 0)
return make_number (fringe_bitmap);
}
+#endif
return make_number (-1); /* Use default arrow bitmap */
}
return overlay_arrow_string_or_property (var);
@@ -15969,7 +15973,7 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky)
{
/* A string: output it and check for %-constructs within it. */
unsigned char c;
- const unsigned char *this, *lisp_string;
+ int offset = 0;
if (!NILP (props) || risky)
{
@@ -16027,8 +16031,7 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky)
}
}
- this = SDATA (elt);
- lisp_string = this;
+ offset = 0;
if (literal)
{
@@ -16051,42 +16054,44 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky)
break;
}
+ /* Handle the non-literal case. */
+
while ((precision <= 0 || n < precision)
- && *this
+ && SREF (elt, offset) != 0
&& (mode_line_target != MODE_LINE_DISPLAY
|| it->current_x < it->last_visible_x))
{
- const unsigned char *last = this;
+ int last_offset = offset;
/* Advance to end of string or next format specifier. */
- while ((c = *this++) != '\0' && c != '%')
+ while ((c = SREF (elt, offset++)) != '\0' && c != '%')
;
- if (this - 1 != last)
+ if (offset - 1 != last_offset)
{
int nchars, nbytes;
/* Output to end of string or up to '%'. Field width
is length of string. Don't output more than
PRECISION allows us. */
- --this;
+ offset--;
- prec = c_string_width (last, this - last, precision - n,
+ prec = c_string_width (SDATA (elt) + last_offset,
+ offset - last_offset, precision - n,
&nchars, &nbytes);
switch (mode_line_target)
{
case MODE_LINE_NOPROP:
case MODE_LINE_TITLE:
- n += store_mode_line_noprop (last, 0, prec);
+ n += store_mode_line_noprop (SDATA (elt) + last_offset, 0, prec);
break;
case MODE_LINE_STRING:
{
- int bytepos = last - lisp_string;
+ int bytepos = last_offset;
int charpos = string_byte_to_char (elt, bytepos);
int endpos = (precision <= 0
- ? string_byte_to_char (elt,
- this - lisp_string)
+ ? string_byte_to_char (elt, offset)
: charpos + nchars);
n += store_mode_line_string (NULL,
@@ -16097,7 +16102,7 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky)
break;
case MODE_LINE_DISPLAY:
{
- int bytepos = last - lisp_string;
+ int bytepos = last_offset;
int charpos = string_byte_to_char (elt, bytepos);
n += display_string (NULL, elt, Qnil, 0, charpos,
it, 0, prec, 0,
@@ -16108,12 +16113,12 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky)
}
else /* c == '%' */
{
- const unsigned char *percent_position = this;
+ int percent_position = offset;
/* Get the specified minimum width. Zero means
don't pad. */
field = 0;
- while ((c = *this++) >= '0' && c <= '9')
+ while ((c = SREF (elt, offset++)) >= '0' && c <= '9')
field = field * 10 + c - '0';
/* Don't pad beyond the total padding allowed. */
@@ -16133,7 +16138,7 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky)
int bytepos, charpos;
unsigned char *spec;
- bytepos = percent_position - lisp_string;
+ bytepos = percent_position;
charpos = (STRING_MULTIBYTE (elt)
? string_byte_to_char (elt, bytepos)
: bytepos);
@@ -16191,8 +16196,6 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky)
else /* c == 0 */
break;
}
- this += SDATA (elt) - lisp_string;
- lisp_string = SDATA (elt);
}
}
break;