summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-08-04 19:19:34 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-08-04 19:19:34 -0700
commit0e51f7172bd1ab8b9c1bb52598afb5017e19b9c3 (patch)
tree5f09676e1b87f3f274a60fe79728f84a3d0c9a9b /src
parent0065d05491ce5981ea20896bb26d21dcd31e6769 (diff)
parente504613cc63d2a3925c546177a04637e25a1a4ae (diff)
Merge from trunk.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog195
-rw-r--r--src/Makefile.in5
-rw-r--r--src/alloc.c18
-rw-r--r--src/bidi.c44
-rw-r--r--src/callproc.c6
-rw-r--r--src/chartab.c2
-rw-r--r--src/dispextern.h5
-rw-r--r--src/emacs.c4
-rw-r--r--src/fontset.c2
-rw-r--r--src/gmalloc.c2
-rw-r--r--src/gtkutil.c12
-rw-r--r--src/image.c10
-rw-r--r--src/keyboard.c2
-rw-r--r--src/keymap.c33
-rw-r--r--src/lisp.h1
-rw-r--r--src/regex.c11
-rw-r--r--src/syssignal.h2
-rw-r--r--src/w32term.c16
-rw-r--r--src/xdisp.c112
-rw-r--r--src/xterm.c38
20 files changed, 333 insertions, 187 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b525d83e28..94e7d98f81 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -408,6 +408,95 @@
(gs_load): Use printmax_t to print the widest integers possible.
Check for integer overflow when computing image height and width.
+2011-08-04 Jan Djärv <jan.h.d@swipnet.se>
+
+ * Makefile.in (LIB_PTHREAD): New variable.
+ (LIBES): Add LIB_PTHREAD (Bug#9216).
+
+ * alloc.c, emacs.c, gmalloc.c, gtkutil.c, keyboard.c, syssignal.h:
+ Rename HAVE_GTK_AND_PTHREAD to HAVE_PTHREAD (Bug#9216).
+
+2011-08-04 Andreas Schwab <schwab@linux-m68k.org>
+
+ * regex.c (re_iswctype): Remove some redundant boolean
+ conversions.
+
+2011-08-04 Jan Djärv <jan.h.d@swipnet.se>
+
+ * xterm.c (x_find_topmost_parent): New function.
+ (x_set_frame_alpha): Find topmost parent window with
+ x_find_topmost_parent and set the property there also (bug#9181).
+ (handle_one_xevent): Call x_set_frame_alpha on ReparentNotify.
+
+2011-08-04 Paul Eggert <eggert@cs.ucla.edu>
+
+ * callproc.c (Fcall_process): Avoid vfork clobbering
+ the local vars buffer, coding_systems, current_dir.
+
+2011-08-03 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * keymap.c (Fmake_composed_keymap): Move to subr.el.
+
+2011-08-03 Paul Eggert <eggert@cs.ucla.edu>
+
+ * fontset.c (dump_fontset) [FONTSET_DEBUG]: Declare EXTERNALLY_VISIBLE
+ so that it is not optimized away.
+
+ * xdisp.c (compute_display_string_pos): Remove unused local.
+
+2011-08-02 Eli Zaretskii <eliz@gnu.org>
+
+ Fix slow cursor motion and scrolling in large buffers with
+ selective display, like Org Mode buffers. (Bug#9218)
+
+ * dispextern.h (struct bidi_it): New member disp_prop_p.
+
+ * xdisp.c: Remove one-slot cache of display string positions.
+ (compute_display_string_pos): Accept an additional argument
+ DISP_PROP_P; callers changed. Scan at most 5K characters forward
+ for a display string or property. If found, set DISP_PROP_P
+ non-zero.
+
+ * bidi.c (bidi_fetch_char): Accept an additional argument
+ DISP_PROP_P, and pass it to compute_display_string_pos.
+ Only handle text covered by a display string if DISP_PROP_P is returned
+ non-zero. All callers of bidi_fetch_char changed.
+
+2011-08-02 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * keymap.c (Fdefine_key): Fix Lisp_Object/int mixup; apply some CSE.
+
+2010-12-03 Don March <don@ohspite.net>
+
+ * keymap.c (Fdefine_key): Fix non-prefix key error message when
+ last character M-[char] is translated to ESC [char] (bug#7541).
+
+2011-08-02 Kenichi Handa <handa@m17n.org>
+
+ * lisp.h (uniprop_table): Extern it.
+
+ * chartab.c (uniprop_table): Make it non-static.
+
+2011-08-01 Eli Zaretskii <eliz@gnu.org>
+
+ * xdisp.c (forward_to_next_line_start): Accept additional argument
+ BIDI_IT_PREV, and store into it the state of the bidi iterator had
+ on the newline.
+ (reseat_at_next_visible_line_start): Use the bidi iterator state
+ returned by forward_to_next_line_start to restore the state of
+ it->bidi_it after backing up to previous newline. (Bug#9212)
+
+2011-07-30 Andreas Schwab <schwab@linux-m68k.org>
+
+ * regex.c (re_comp): Protoize.
+ (re_exec): Fix return type.
+ (regexec): Fix type of `ret'. (Bug#9203)
+
+2011-07-29 Paul Eggert <eggert@cs.ucla.edu>
+
+ * image.c (check_image_size): Use 1024x1024 if unknown frame (Bug#9189).
+ This is needed if max-image-size is a floating-point number.
+
2011-07-28 Andreas Schwab <schwab@linux-m68k.org>
* print.c (print_object): Print empty symbol as ##.
@@ -716,8 +805,8 @@
* xdisp.c (move_it_in_display_line_to): Record the best matching
position for TO_CHARPOS while scanning the line, and restore it on
- exit if none of the characters scanned was an exact match. Fixes
- vertical-motion and pos-visible-in-window-p under bidi redisplay
+ exit if none of the characters scanned was an exact match.
+ Fixes vertical-motion and pos-visible-in-window-p under bidi redisplay
when exact match is impossible due to invisible text, and the
lines are truncated.
@@ -902,8 +991,8 @@
(reseat_to_string): Initialize bidi_it->string.s and
bidi_it->string.schars.
(Fcurrent_bidi_paragraph_direction): Initialize itb.string.s to
- NULL (avoids a crash in bidi_paragraph_init). Initialize
- itb.string.lstring.
+ NULL (avoids a crash in bidi_paragraph_init).
+ Initialize itb.string.lstring.
(init_iterator): Call bidi_init_it only of a valid
buffer position was specified. Initialize paragraph_embedding to
L2R.
@@ -919,12 +1008,12 @@
(init_iterator, reseat_1, reseat_to_string): Initialize the
string.bufpos member to 0 (zero, for compatibility with IT_CHARPOS
when iterating on a string not from display properties).
- (compute_display_string_pos, compute_display_string_end): Fix
- calculation of the object to scan. Fixes an error when using
+ (compute_display_string_pos, compute_display_string_end):
+ Fix calculation of the object to scan. Fixes an error when using
arrow keys.
(next_element_from_buffer): Don't abort when IT_CHARPOS is before
- base_level_stop; instead, set base_level_stop to BEGV. Fixes
- crashes in vertical-motion.
+ base_level_stop; instead, set base_level_stop to BEGV.
+ Fixes crashes in vertical-motion.
(next_element_from_buffer): Improve commentary for when
the iterator is before prev_stop.
(init_iterator): Initialize bidi_p from the default value of
@@ -937,8 +1026,8 @@
(next_element_from_string): Support bidi reordering of Lisp
strings.
(handle_stop_backwards): Support Lisp strings as well.
- (display_string): Support display of R2L glyph rows. Use
- IT_STRING_CHARPOS when displaying from a Lisp string.
+ (display_string): Support display of R2L glyph rows.
+ Use IT_STRING_CHARPOS when displaying from a Lisp string.
(init_iterator): Don't initialize it->bidi_p for strings
here.
(reseat_to_string): Initialize it->bidi_p for strings here.
@@ -1020,8 +1109,8 @@
displayed in margins. (Bug#8133) (Bug#8867)
Return MOVE_POS_MATCH_OR_ZV only if iterator position is past
TO_CHARPOS.
- (pos_visible_p): Support positions in bidi-reordered lines. Save
- and restore bidi cache.
+ (pos_visible_p): Support positions in bidi-reordered lines.
+ Save and restore bidi cache.
* bidi.c (bidi_level_of_next_char): clen should be EMACS_NT, not int.
(bidi_paragraph_info): Delete unused struct.
@@ -1041,8 +1130,8 @@
`len' according to what STRING_CHAR_AND_LENGTH expects.
(bidi_paragraph_init, bidi_resolve_explicit_1)
(bidi_resolve_explicit, bidi_resolve_weak)
- (bidi_level_of_next_char, bidi_move_to_visually_next): Support
- iteration over a string.
+ (bidi_level_of_next_char, bidi_move_to_visually_next):
+ Support iteration over a string.
(bidi_set_sor_type, bidi_resolve_explicit_1)
(bidi_resolve_explicit, bidi_type_of_next_char): ignore_bn_limit
can now be zero (for strings); special values 0 and -1 were
@@ -1073,20 +1162,20 @@
(bidi_cache_fetch_state, bidi_cache_search)
(bidi_cache_find_level_change, bidi_cache_ensure_space)
(bidi_cache_iterator_state, bidi_cache_find)
- (bidi_find_other_level_edge, bidi_cache_start_stack): All
- variables related to cache indices are now EMACS_INT.
+ (bidi_find_other_level_edge, bidi_cache_start_stack):
+ All variables related to cache indices are now EMACS_INT.
* dispextern.h (struct bidi_string_data): New structure.
(struct bidi_it): New member `string'. Make flag members be 1-bit
fields, and put them last in the struct.
- (compute_display_string_pos, compute_display_string_end): Update
- prototypes.
+ (compute_display_string_pos, compute_display_string_end):
+ Update prototypes.
(bidi_push_it, bidi_pop_it): Add prototypes.
(struct iterator_stack_entry): New members bidi_p,
paragraph_embedding, and from_disp_prop_p.
(struct it): Member bidi_p is now a bit field 1 bit wide.
- (bidi_shelve_cache, bidi_unshelve_cache): Declare
- prototypes.
+ (bidi_shelve_cache, bidi_unshelve_cache):
+ Declare prototypes.
* .gdbinit (xvectype, xvector, xcompiled, xchartable, xboolvector)
(xpr, xfont, xbacktrace): Use "header.size" when accessing vectors
@@ -1368,7 +1457,7 @@
(char_table_set_range): Adjuted for the above change.
(map_sub_char_table): Delete args default_val and parent. Add arg
top. Give decoded values to a Lisp function.
- (map_char_table): Adjusted for the above change. Give decoded
+ (map_char_table): Adjust for the above change. Give decoded
values to a Lisp function. Gcpro more variables.
(uniprop_table_uncompress)
(uniprop_decode_value_run_length): New functions.
@@ -1385,10 +1474,10 @@
and Sput_unicode_property_internal. Defvar_lisp
char-code-property-alist.
- * composite.c (CHAR_COMPOSABLE_P): Adjusted for the change of
+ * composite.c (CHAR_COMPOSABLE_P): Adjust for the change of
Vunicode_category_table.
- * font.c (font_range): Adjusted for the change of
+ * font.c (font_range): Adjust for the change of
Vunicode_category_table.
2011-07-07 Dan Nicolaescu <dann@ics.uci.edu>
@@ -1417,14 +1506,14 @@
(store_monospaced_changed): Add comment. Call dpyinfo_valid.
(struct xsettings): Move font inside HAVE_XFT.
(GSETTINGS_TOOL_BAR_STYLE, GSETTINGS_FONT_NAME): New defines.
- (GSETTINGS_MONO_FONT): Renamed from SYSTEM_MONO_FONT.
+ (GSETTINGS_MONO_FONT): Rename from SYSTEM_MONO_FONT.
Move inside HAVE_XFT.
- (something_changed_gsettingsCB): Renamed from something_changedCB.
+ (something_changed_gsettingsCB): Rename from something_changedCB.
Check for changes in GSETTINGS_TOOL_BAR_STYLE and GSETTINGS_FONT_NAME
also.
(GCONF_TOOL_BAR_STYLE, GCONF_FONT_NAME): New defines.
- (GCONF_MONO_FONT): Renamed from SYSTEM_MONO_FONT. Move inside HAVE_XFT.
- (something_changed_gconfCB): Renamed from something_changedCB.
+ (GCONF_MONO_FONT): Rename from SYSTEM_MONO_FONT. Move inside HAVE_XFT.
+ (something_changed_gconfCB): Rename from something_changedCB.
Check for changes in GCONF_TOOL_BAR_STYLE and GCONF_FONT_NAME also.
(parse_settings): Move check for font inside HAVE_XFT.
(read_settings, apply_xft_settings): Add comment.
@@ -1437,8 +1526,8 @@
(init_gconf): Add comment. Get values for GCONF_TOOL_BAR_STYLE
and GCONF_FONT_NAME. Move check for fonts within HAVE_XFT.
(xsettings_initialize): Call init_gsettings last.
- (xsettings_get_system_font, xsettings_get_system_normal_font): Add
- comment.
+ (xsettings_get_system_font, xsettings_get_system_normal_font):
+ Add comment.
2011-07-05 Paul Eggert <eggert@cs.ucla.edu>
@@ -1621,7 +1710,7 @@
(syms_of_xsettings): Initialize gsettings_client, gsettings_obj
to NULL.
- * Makefile.in (SETTINGS_CFLAGS, SETTINGS_LIBS): Renamed from
+ * Makefile.in (SETTINGS_CFLAGS, SETTINGS_LIBS): Rename from
GCONF_CFLAGS/LIBS.
2011-06-29 Martin Rudalics <rudalics@gmx.at>
@@ -2368,7 +2457,7 @@
* character.c, coding.c, doprnt.c, editfns.c, eval.c:
All uses of STRING_BYTES_MAX replaced by STRING_BYTES_BOUND.
- * lisp.h (STRING_BYTES_BOUND): Renamed from STRING_BYTES_MAX.
+ * lisp.h (STRING_BYTES_BOUND): Rename from STRING_BYTES_MAX.
* character.c (string_escape_byte8): Fix nbytes/nchars typo.
@@ -2477,8 +2566,8 @@
Qclone_number. Remove external declaration of Qdelete_window.
(Fbuffer_list): Rewrite doc-string. Minor restructuring of
code.
- (Fget_buffer_create, Fmake_indirect_buffer, Frename_buffer): Run
- Qbuffer_list_update_hook if allowed.
+ (Fget_buffer_create, Fmake_indirect_buffer, Frename_buffer):
+ Run Qbuffer_list_update_hook if allowed.
(Fother_buffer): Rewrite doc-string. Major rewrite for new
buffer list implementation.
(other_buffer_safely): New function.
@@ -2489,8 +2578,8 @@
(record_buffer): Inhibit quitting and rewrite using quittable
functions. Run Qbuffer_list_update_hook if allowed.
(Frecord_buffer, Funrecord_buffer): New functions.
- (switch_to_buffer_1, Fswitch_to_buffer): Remove. Move
- switch-to-buffer to window.el.
+ (switch_to_buffer_1, Fswitch_to_buffer): Remove.
+ Move switch-to-buffer to window.el.
(bury-buffer): Move to window.el.
(Vbuffer_list_update_hook): New variable.
@@ -2518,8 +2607,8 @@
(select_window_norecord, select_frame_norecord): Move in front
of run_window_configuration_change_hook. Remove now obsolete
declarations.
- (Fset_window_buffer): Rewrite doc-string. Call
- Qrecord_window_buffer.
+ (Fset_window_buffer): Rewrite doc-string.
+ Call Qrecord_window_buffer.
(keys_of_window): Move binding for other-window to window.el.
2011-06-11 Chong Yidong <cyd@stupidchicken.com>
@@ -2601,8 +2690,8 @@
orig_total_lines.
(Fdelete_window, delete_window): Remove. Window deletion is
handled by window.el.
- (window_loop): Remove DELETE_OTHER_WINDOWS case. Replace
- Fdelete_window calls with calls to Qdelete_window.
+ (window_loop): Remove DELETE_OTHER_WINDOWS case.
+ Replace Fdelete_window calls with calls to Qdelete_window.
(Fdelete_other_windows): Remove. Deleting other windows is
handled by window.el.
(window_fixed_size_p): Remove. Fixed-sizeness of windows is
@@ -2625,8 +2714,8 @@
(grow_mini_window, shrink_mini_window): Implement by calling
Qresize_root_window_vertically, resize_window_check and
resize_window_apply.
- (saved_window, Fset_window_configuration, save_window_save): Do
- not handle orig_top_line, orig_total_lines, and
+ (saved_window, Fset_window_configuration, save_window_save):
+ Do not handle orig_top_line, orig_total_lines, and
resize_proportionally.
(window_min_height, window_min_width): Move to window.el.
(keys_of_window): Move bindings for delete-other-windows,
@@ -2646,8 +2735,8 @@
* xdisp.c (init_xdisp): Don't use set_window_height but set
heights directly.
- * xfns.c (x_set_menu_bar_lines, x_set_tool_bar_lines): Use
- resize_frame_windows instead of change_window_heights and run
+ * xfns.c (x_set_menu_bar_lines, x_set_tool_bar_lines):
+ Use resize_frame_windows instead of change_window_heights and run
run_window_configuration_change_hook.
* w32fns.c (x_set_tool_bar_lines): Use resize_frame_windows
@@ -2669,8 +2758,8 @@
(Frun_window_configuration_change_hook, make_parent_window)
(resize_window_check, resize_window_apply, Fresize_window_apply)
(resize_frame_windows, Fsplit_window_internal)
- (Fdelete_window_internal, Fresize_mini_window_internal): New
- functions.
+ (Fdelete_window_internal, Fresize_mini_window_internal):
+ New functions.
(syms_of_window): New variables Vwindow_splits and Vwindow_nest.
2011-06-08 Martin Rudalics <rudalics@gmx.at>
@@ -2690,8 +2779,8 @@
(Fwindow_nest, Fset_window_nest, Fwindow_new_total)
(Fwindow_normal_size, Fwindow_new_normal, Fwindow_prev_buffers)
(Fset_window_prev_buffers, Fwindow_next_buffers)
- (Fset_window_next_buffers, Fset_window_clone_number): New
- functions.
+ (Fset_window_next_buffers, Fset_window_clone_number):
+ New functions.
(Fwindow_hscroll, Fwindow_at, Fwindow_point, Fwindow_start)
(Fwindow_end, Fwindow_line_height, Fset_window_dedicated_p):
Doc-string fixes.
@@ -2717,10 +2806,10 @@
(Fwindow_top_line, window_body_lines, Fwindow_body_size)
(Fwindow_list_1): New functions.
(window_box_text_cols): Replace with window_body_cols.
- (Fwindow_width, Fscroll_left, Fscroll_right): Use
- window_body_cols instead of window_box_text_cols.
- (delete_window, Fset_window_configuration): Call
- delete_all_subwindows with window as argument.
+ (Fwindow_width, Fscroll_left, Fscroll_right):
+ Use window_body_cols instead of window_box_text_cols.
+ (delete_window, Fset_window_configuration):
+ Call delete_all_subwindows with window as argument.
(delete_all_subwindows): Take a window as argument and not a
structure. Rewrite.
(window_loop): Remove handling of GET_LRU_WINDOW and
@@ -2731,8 +2820,8 @@
window_box_text_cols. delete_all_subwindows now takes a
Lisp_Object as argument.
- * indent.c (compute_motion, Fcompute_motion): Use
- window_body_cols instead of window_box_text_cols.
+ * indent.c (compute_motion, Fcompute_motion):
+ Use window_body_cols instead of window_box_text_cols.
* frame.c (delete_frame): Call delete_all_subwindows with root
window as argument.
diff --git a/src/Makefile.in b/src/Makefile.in
index f68fa5c224..af4d6df9f8 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -130,6 +130,9 @@ START_FILES = @START_FILES@
## -lm, or empty.
LIB_MATH=@LIB_MATH@
+## -lpthreads, or empty.
+LIB_PTHREAD=@LIB_PTHREAD@
+
LIBTIFF=@LIBTIFF@
LIBJPEG=@LIBJPEG@
LIBPNG=@LIBPNG@
@@ -385,7 +388,7 @@ LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \
$(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \
$(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \
$(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
- $(LIBGNUTLS_LIBS) $(LIB_PTHREAD_SIGMASK) \
+ $(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(LIB_PTHREAD_SIGMASK) \
$(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC)
all: emacs$(EXEEXT) $(OTHER_FILES)
diff --git a/src/alloc.c b/src/alloc.c
index a1af0df11f..2d25680046 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -24,7 +24,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <signal.h>
-#ifdef HAVE_GTK_AND_PTHREAD
+#ifdef HAVE_PTHREAD
#include <pthread.h>
#endif
@@ -85,13 +85,15 @@ extern size_t __malloc_extra_blocks;
#endif /* not DOUG_LEA_MALLOC */
#if ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT
-#ifdef HAVE_GTK_AND_PTHREAD
+#ifdef HAVE_PTHREAD
/* When GTK uses the file chooser dialog, different backends can be loaded
dynamically. One such a backend is the Gnome VFS backend that gets loaded
if you run Gnome. That backend creates several threads and also allocates
memory with malloc.
+ Also, gconf and gsettings may create several threads.
+
If Emacs sets malloc hooks (! SYSTEM_MALLOC) and the emacs_blocked_*
functions below are called from malloc, there is a chance that one
of these threads preempts the Emacs main thread and the hook variables
@@ -123,12 +125,12 @@ static pthread_mutex_t alloc_mutex;
} \
while (0)
-#else /* ! defined HAVE_GTK_AND_PTHREAD */
+#else /* ! defined HAVE_PTHREAD */
#define BLOCK_INPUT_ALLOC BLOCK_INPUT
#define UNBLOCK_INPUT_ALLOC UNBLOCK_INPUT
-#endif /* ! defined HAVE_GTK_AND_PTHREAD */
+#endif /* ! defined HAVE_PTHREAD */
#endif /* ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT */
/* Mark, unmark, query mark bit of a Lisp string. S must be a pointer
@@ -1353,7 +1355,7 @@ emacs_blocked_realloc (void *ptr, size_t size, const void *ptr2)
}
-#ifdef HAVE_GTK_AND_PTHREAD
+#ifdef HAVE_PTHREAD
/* Called from Fdump_emacs so that when the dumped Emacs starts, it has a
normal malloc. Some thread implementations need this as they call
malloc before main. The pthread_self call in BLOCK_INPUT_ALLOC then
@@ -1366,7 +1368,7 @@ reset_malloc_hooks (void)
__malloc_hook = old_malloc_hook;
__realloc_hook = old_realloc_hook;
}
-#endif /* HAVE_GTK_AND_PTHREAD */
+#endif /* HAVE_PTHREAD */
/* Called from main to set up malloc to use our hooks. */
@@ -1374,7 +1376,7 @@ reset_malloc_hooks (void)
void
uninterrupt_malloc (void)
{
-#ifdef HAVE_GTK_AND_PTHREAD
+#ifdef HAVE_PTHREAD
#ifdef DOUG_LEA_MALLOC
pthread_mutexattr_t attr;
@@ -1388,7 +1390,7 @@ uninterrupt_malloc (void)
and the bundled gmalloc.c doesn't require it. */
pthread_mutex_init (&alloc_mutex, NULL);
#endif /* !DOUG_LEA_MALLOC */
-#endif /* HAVE_GTK_AND_PTHREAD */
+#endif /* HAVE_PTHREAD */
if (__free_hook != emacs_blocked_free)
old_free_hook = __free_hook;
diff --git a/src/bidi.c b/src/bidi.c
index 27a6645dff..f499ec37b9 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -797,6 +797,7 @@ bidi_init_it (EMACS_INT charpos, EMACS_INT bytepos, int frame_window_p,
bidi_it->prev_for_neutral.orig_type = UNKNOWN_BT;
bidi_it->sor = L2R; /* FIXME: should it be user-selectable? */
bidi_it->disp_pos = -1; /* invalid/unknown */
+ bidi_it->disp_prop_p = 0;
/* We can only shrink the cache if we are at the bottom level of its
"stack". */
if (bidi_cache_start == 0)
@@ -879,14 +880,16 @@ bidi_char_at_pos (EMACS_INT bytepos, const unsigned char *s, int unibyte)
covered characters as a single character u+FFFC, and return their
combined length in CH_LEN and NCHARS. DISP_POS specifies the
character position of the next display string, or -1 if not yet
- computed. When the next character is at or beyond that position,
- the function updates DISP_POS with the position of the next display
- string. STRING->s is the C string to iterate, or NULL if iterating
- over a buffer or a Lisp string; in the latter case, STRING->lstring
- is the Lisp string. */
+ computed. DISP_PROP_P non-zero means that there's really a display
+ string at DISP_POS, as opposed to when we searched till DISP_POS
+ without findingone. When the next character is at or beyond that
+ position, the function updates DISP_POS with the position of the
+ next display string. STRING->s is the C string to iterate, or NULL
+ if iterating over a buffer or a Lisp string; in the latter case,
+ STRING->lstring is the Lisp string. */
static inline int
bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos,
- struct bidi_string_data *string,
+ int *disp_prop_p, struct bidi_string_data *string,
int frame_window_p, EMACS_INT *ch_len, EMACS_INT *nchars)
{
int ch;
@@ -899,7 +902,8 @@ bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos,
if (charpos < endpos && charpos > *disp_pos)
{
SET_TEXT_POS (pos, charpos, bytepos);
- *disp_pos = compute_display_string_pos (&pos, string, frame_window_p);
+ *disp_pos = compute_display_string_pos (&pos, string, frame_window_p,
+ disp_prop_p);
}
/* Fetch the character at BYTEPOS. */
@@ -909,8 +913,9 @@ bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos,
*ch_len = 1;
*nchars = 1;
*disp_pos = endpos;
+ *disp_prop_p = 0;
}
- else if (charpos >= *disp_pos)
+ else if (charpos >= *disp_pos && *disp_prop_p)
{
EMACS_INT disp_end_pos;
@@ -977,10 +982,12 @@ bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos,
/* If we just entered a run of characters covered by a display
string, compute the position of the next display string. */
- if (charpos + *nchars <= endpos && charpos + *nchars > *disp_pos)
+ if (charpos + *nchars <= endpos && charpos + *nchars > *disp_pos
+ && *disp_prop_p)
{
SET_TEXT_POS (pos, charpos + *nchars, bytepos + *ch_len);
- *disp_pos = compute_display_string_pos (&pos, string, frame_window_p);
+ *disp_pos = compute_display_string_pos (&pos, string, frame_window_p,
+ disp_prop_p);
}
return ch;
@@ -1088,6 +1095,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p)
int ch;
EMACS_INT ch_len, nchars;
EMACS_INT pos, disp_pos = -1;
+ int disp_prop_p = 0;
bidi_type_t type;
const unsigned char *s;
@@ -1135,7 +1143,8 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p)
bytepos = pstartbyte;
if (!string_p)
pos = BYTE_TO_CHAR (bytepos);
- ch = bidi_fetch_char (bytepos, pos, &disp_pos, &bidi_it->string,
+ ch = bidi_fetch_char (bytepos, pos, &disp_pos, &disp_prop_p,
+ &bidi_it->string,
bidi_it->frame_window_p, &ch_len, &nchars);
type = bidi_get_type (ch, NEUTRAL_DIR);
@@ -1162,7 +1171,8 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p)
&& bidi_at_paragraph_end (pos, bytepos) >= -1)
break;
/* Fetch next character and advance to get past it. */
- ch = bidi_fetch_char (bytepos, pos, &disp_pos, &bidi_it->string,
+ ch = bidi_fetch_char (bytepos, pos, &disp_pos,
+ &disp_prop_p, &bidi_it->string,
bidi_it->frame_window_p, &ch_len, &nchars);
pos += nchars;
bytepos += ch_len;
@@ -1295,6 +1305,7 @@ bidi_resolve_explicit_1 (struct bidi_it *bidi_it)
bidi_it->ch_len = 1;
bidi_it->nchars = 1;
bidi_it->disp_pos = (string_p ? bidi_it->string.schars : ZV);
+ bidi_it->disp_prop_p = 0;
}
else
{
@@ -1302,8 +1313,8 @@ bidi_resolve_explicit_1 (struct bidi_it *bidi_it)
display string, treat the entire run of covered characters as
a single character u+FFFC. */
curchar = bidi_fetch_char (bidi_it->bytepos, bidi_it->charpos,
- &bidi_it->disp_pos, &bidi_it->string,
- bidi_it->frame_window_p,
+ &bidi_it->disp_pos, &bidi_it->disp_prop_p,
+ &bidi_it->string, bidi_it->frame_window_p,
&bidi_it->ch_len, &bidi_it->nchars);
}
bidi_it->ch = curchar;
@@ -2037,12 +2048,13 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
struct bidi_string_data bs = bidi_it->string;
bidi_type_t chtype;
int fwp = bidi_it->frame_window_p;
+ int dpp = bidi_it->disp_prop_p;
if (bidi_it->nchars <= 0)
abort ();
do {
- ch = bidi_fetch_char (bpos += clen, cpos += nc, &disp_pos, &bs, fwp,
- &clen, &nc);
+ ch = bidi_fetch_char (bpos += clen, cpos += nc, &disp_pos, &dpp, &bs,
+ fwp, &clen, &nc);
if (ch == '\n' || ch == BIDI_EOB /* || ch == LINESEP_CHAR */)
chtype = NEUTRAL_B;
else
diff --git a/src/callproc.c b/src/callproc.c
index 4f6d363d5e..1bdb57a27d 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -603,6 +603,9 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
/* vfork, and prevent local vars from being clobbered by the vfork. */
{
+ Lisp_Object volatile buffer_volatile = buffer;
+ Lisp_Object volatile coding_systems_volatile = coding_systems;
+ Lisp_Object volatile current_dir_volatile = current_dir;
int volatile fd1_volatile = fd1;
int volatile fd_error_volatile = fd_error;
int volatile fd_output_volatile = fd_output;
@@ -611,6 +614,9 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
pid = vfork ();
+ buffer = buffer_volatile;
+ coding_systems = coding_systems_volatile;
+ current_dir = current_dir_volatile;
fd1 = fd1_volatile;
fd_error = fd_error_volatile;
fd_output = fd_output_volatile;
diff --git a/src/chartab.c b/src/chartab.c
index efe23eca83..fb72004356 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -1310,7 +1310,7 @@ uniprop_get_encoder (Lisp_Object table)
function may load a Lisp file and thus may cause
garbage-collection. */
-static Lisp_Object
+Lisp_Object
uniprop_table (Lisp_Object prop)
{
Lisp_Object val, table, result;
diff --git a/src/dispextern.h b/src/dispextern.h
index c43eeb5560..4976131018 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1869,6 +1869,8 @@ struct bidi_it {
bidi_dir_t paragraph_dir; /* current paragraph direction */
EMACS_INT separator_limit; /* where paragraph separator should end */
EMACS_INT disp_pos; /* position of display string after ch */
+ int disp_prop_p; /* if non-zero, there really is a
+ `display' property/string at disp_pos */
unsigned first_elt : 1; /* if non-zero, examine current char first */
unsigned new_paragraph : 1; /* if non-zero, we expect a new paragraph */
unsigned frame_window_p : 1; /* non-zero if displaying on a GUI frame */
@@ -3036,7 +3038,8 @@ extern Lisp_Object lookup_glyphless_char_display (int, struct it *);
extern int calc_pixel_width_or_height (double *, struct it *, Lisp_Object,
struct font *, int, int *);
extern EMACS_INT compute_display_string_pos (struct text_pos *,
- struct bidi_string_data *, int);
+ struct bidi_string_data *,
+ int, int *);
extern EMACS_INT compute_display_string_end (EMACS_INT,
struct bidi_string_data *);
diff --git a/src/emacs.c b/src/emacs.c
index e4c42c3e19..7039f063dc 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1120,7 +1120,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
#if defined (USG5) && defined (INTERRUPT_INPUT)
setpgrp ();
#endif
-#if defined (HAVE_GTK_AND_PTHREAD) && !defined (SYSTEM_MALLOC) && !defined (DOUG_LEA_MALLOC)
+#if defined (HAVE_PTHREAD) && !defined (SYSTEM_MALLOC) && !defined (DOUG_LEA_MALLOC)
{
extern void malloc_enable_thread (void);
@@ -2178,7 +2178,7 @@ You must run Emacs in batch mode in order to dump it. */)
memory_warnings (my_edata, malloc_warning);
}
#endif /* not WINDOWSNT */
-#if defined (HAVE_GTK_AND_PTHREAD) && !defined SYNC_INPUT
+#if defined (HAVE_PTHREAD) && !defined SYNC_INPUT
/* Pthread may call malloc before main, and then we will get an endless
loop, because pthread_self (see alloc.c) calls malloc the first time
it is called on some systems. */
diff --git a/src/fontset.c b/src/fontset.c
index 3091f43d6e..74eb61d266 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -2100,6 +2100,8 @@ DEFUN ("fontset-list", Ffontset_list, Sfontset_list, 0, 0, 0,
#ifdef FONTSET_DEBUG
+Lisp_Object dump_fontset (Lisp_Object) EXTERNALLY_VISIBLE;
+
Lisp_Object
dump_fontset (Lisp_Object fontset)
{
diff --git a/src/gmalloc.c b/src/gmalloc.c
index fa4aa1fdf6..916bb300fe 100644
--- a/src/gmalloc.c
+++ b/src/gmalloc.c
@@ -37,7 +37,7 @@ Fifth Floor, Boston, MA 02110-1301, USA.
#include <config.h>
#endif
-#ifdef HAVE_GTK_AND_PTHREAD
+#ifdef HAVE_PTHREAD
#define USE_PTHREAD
#endif
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 2492ce620b..c39119c815 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1911,12 +1911,12 @@ xg_get_file_name (FRAME_PTR f,
int filesel_done = 0;
xg_get_file_func func;
-#if defined (HAVE_GTK_AND_PTHREAD) && defined (__SIGRTMIN)
+#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN)
/* I really don't know why this is needed, but without this the GLIBC add on
library linuxthreads hangs when the Gnome file chooser backend creates
threads. */
sigblock (sigmask (__SIGRTMIN));
-#endif /* HAVE_GTK_AND_PTHREAD */
+#endif /* HAVE_PTHREAD */
#ifdef HAVE_GTK_FILE_SELECTION_NEW
@@ -1936,7 +1936,7 @@ xg_get_file_name (FRAME_PTR f,
filesel_done = xg_dialog_run (f, w);
-#if defined (HAVE_GTK_AND_PTHREAD) && defined (__SIGRTMIN)
+#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN)
sigunblock (sigmask (__SIGRTMIN));
#endif
@@ -1964,9 +1964,9 @@ xg_get_font_name (FRAME_PTR f, const char *default_name)
char *fontname = NULL;
int done = 0;
-#if defined (HAVE_GTK_AND_PTHREAD) && defined (__SIGRTMIN)
+#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN)
sigblock (sigmask (__SIGRTMIN));
-#endif /* HAVE_GTK_AND_PTHREAD */
+#endif /* HAVE_PTHREAD */
w = gtk_font_selection_dialog_new ("Pick a font");
if (!default_name)
@@ -1978,7 +1978,7 @@ xg_get_font_name (FRAME_PTR f, const char *default_name)
done = xg_dialog_run (f, w);
-#if defined (HAVE_GTK_AND_PTHREAD) && defined (__SIGRTMIN)
+#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN)
sigunblock (sigmask (__SIGRTMIN));
#endif
diff --git a/src/image.c b/src/image.c
index bf7daa24da..2f39b896c0 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1055,9 +1055,13 @@ check_image_size (struct frame *f, int width, int height)
&& height <= XINT (Vmax_image_size));
else if (FLOATP (Vmax_image_size))
{
- xassert (f);
- w = FRAME_PIXEL_WIDTH (f);
- h = FRAME_PIXEL_HEIGHT (f);
+ if (f != NULL)
+ {
+ w = FRAME_PIXEL_WIDTH (f);
+ h = FRAME_PIXEL_HEIGHT (f);
+ }
+ else
+ w = h = 1024; /* Arbitrary size for unknown frame. */
return (width <= XFLOAT_DATA (Vmax_image_size) * w
&& height <= XFLOAT_DATA (Vmax_image_size) * h);
}
diff --git a/src/keyboard.c b/src/keyboard.c
index 622f7ca448..ab93e0ccd2 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -44,7 +44,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "process.h"
#include <errno.h>
-#ifdef HAVE_GTK_AND_PTHREAD
+#ifdef HAVE_PTHREAD
#include <pthread.h>
#endif
#ifdef MSDOS
diff --git a/src/keymap.c b/src/keymap.c
index c968b14d90..32b531daac 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -150,17 +150,6 @@ in case you use it as a menu with `x-popup-menu'. */)
return Fcons (Qkeymap, Qnil);
}
-DEFUN ("make-composed-keymap", Fmake_composed_keymap, Smake_composed_keymap,
- 0, MANY, 0,
- doc: /* Construct and return a new keymap composed of KEYMAPS.
-When looking up a key in the returned map, the key is looked in each
-keymap in turn until a binding is found.
-usage: (make-composed-keymap &rest KEYMAPS) */)
- (ptrdiff_t nargs, Lisp_Object *args)
-{
- return Fcons (Qkeymap, Flist (nargs, args));
-}
-
/* This function is used for installing the standard key bindings
at initialization time.
@@ -1216,13 +1205,20 @@ binding KEY to DEF is added at the front of KEYMAP. */)
keymap = get_keymap (cmd, 0, 1);
if (!CONSP (keymap))
- /* We must use Fkey_description rather than just passing key to
- error; key might be a vector, not a string. */
- error ("Key sequence %s starts with non-prefix key %s",
- SDATA (Fkey_description (key, Qnil)),
- SDATA (Fkey_description (Fsubstring (key, make_number (0),
- make_number (idx)),
- Qnil)));
+ {
+ const char *trailing_esc = ((EQ (c, meta_prefix_char) && metized)
+ ? (idx == 0 ? "ESC" : " ESC")
+ : "");
+
+ /* We must use Fkey_description rather than just passing key to
+ error; key might be a vector, not a string. */
+ error ("Key sequence %s starts with non-prefix key %s%s",
+ SDATA (Fkey_description (key, Qnil)),
+ SDATA (Fkey_description (Fsubstring (key, make_number (0),
+ make_number (idx)),
+ Qnil)),
+ trailing_esc);
+ }
}
}
@@ -3761,7 +3757,6 @@ be preferred. */);
defsubr (&Sset_keymap_parent);
defsubr (&Smake_keymap);
defsubr (&Smake_sparse_keymap);
- defsubr (&Smake_composed_keymap);
defsubr (&Smap_keymap_internal);
defsubr (&Smap_keymap);
defsubr (&Scopy_keymap);
diff --git a/src/lisp.h b/src/lisp.h
index 83cc680b7e..9955511804 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2867,6 +2867,7 @@ extern void map_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Ob
Lisp_Object, Lisp_Object,
Lisp_Object, struct charset *,
unsigned, unsigned);
+extern Lisp_Object uniprop_table (Lisp_Object);
extern void syms_of_chartab (void);
/* Defined in print.c */
diff --git a/src/regex.c b/src/regex.c
index 862f848976..d1b835621d 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -2106,9 +2106,9 @@ re_iswctype (int ch, re_wctype_t cc)
case RECC_UPPER: return ISUPPER (ch) != 0;
case RECC_XDIGIT: return ISXDIGIT (ch) != 0;
case RECC_ASCII: return IS_REAL_ASCII (ch) != 0;
- case RECC_NONASCII: return !IS_REAL_ASCII (ch) != 0;
+ case RECC_NONASCII: return !IS_REAL_ASCII (ch);
case RECC_UNIBYTE: return ISUNIBYTE (ch) != 0;
- case RECC_MULTIBYTE: return !ISUNIBYTE (ch) != 0;
+ case RECC_MULTIBYTE: return !ISUNIBYTE (ch);
case RECC_WORD: return ISWORD (ch) != 0;
case RECC_ERROR: return false;
default:
@@ -6381,8 +6381,7 @@ char *
regcomp/regexec below without link errors. */
weak_function
# endif
-re_comp (s)
- const char *s;
+re_comp (const char *s)
{
reg_errcode_t ret;
@@ -6421,7 +6420,7 @@ re_comp (s)
}
-regoff_t
+int
# ifdef _LIBC
weak_function
# endif
@@ -6558,7 +6557,7 @@ reg_errcode_t
regexec (const regex_t *__restrict preg, const char *__restrict string,
size_t nmatch, regmatch_t pmatch[__restrict_arr], int eflags)
{
- reg_errcode_t ret;
+ regoff_t ret;
struct re_registers regs;
regex_t private_preg;
size_t len = strlen (string);
diff --git a/src/syssignal.h b/src/syssignal.h
index c5c749407c..7533a5a64f 100644
--- a/src/syssignal.h
+++ b/src/syssignal.h
@@ -18,7 +18,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
extern void init_signals (void);
-#if defined (HAVE_GTK_AND_PTHREAD) || defined (HAVE_NS)
+#ifdef HAVE_PTHREAD
#include <pthread.h>
/* If defined, asynchronous signals delivered to a non-main thread are
forwarded to the main thread. */
diff --git a/src/w32term.c b/src/w32term.c
index b7c0d61b63..98c4a39195 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -1439,7 +1439,7 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s)
Nominally, highlight colors for `3d' faces are calculated by
brightening an object's color by a constant scale factor, but this
- doesn't yield good results for dark colors, so for colors who's
+ doesn't yield good results for dark colors, so for colors whose
brightness is less than this value (on a scale of 0-255) have to
use an additional additive factor.
@@ -1618,8 +1618,9 @@ x_setup_relief_colors (struct glyph_string *s)
static void
w32_draw_relief_rect (struct frame *f,
- int left_x, int top_y, int right_x, int bottom_y, int width,
- int raised_p, int top_p, int bot_p, int left_p, int right_p,
+ int left_x, int top_y, int right_x, int bottom_y,
+ int width, int raised_p,
+ int top_p, int bot_p, int left_p, int right_p,
RECT *clip_rect)
{
int i;
@@ -1880,7 +1881,8 @@ x_draw_image_relief (struct glyph_string *s)
if (s->hl == DRAW_IMAGE_SUNKEN
|| s->hl == DRAW_IMAGE_RAISED)
{
- thick = tool_bar_button_relief >= 0 ? tool_bar_button_relief : DEFAULT_TOOL_BAR_BUTTON_RELIEF;
+ thick = tool_bar_button_relief >= 0 ? tool_bar_button_relief
+ : DEFAULT_TOOL_BAR_BUTTON_RELIEF;
raised_p = s->hl == DRAW_IMAGE_RAISED;
}
else
@@ -3486,7 +3488,7 @@ my_destroy_window (struct frame * f, HWND hwnd)
/* Create a scroll bar and return the scroll bar vector for it. W is
the Emacs window on which to create the scroll bar. TOP, LEFT,
- WIDTH and HEIGHT are.the pixel coordinates and dimensions of the
+ WIDTH and HEIGHT are the pixel coordinates and dimensions of the
scroll bar. */
static struct scroll_bar *
@@ -3872,7 +3874,7 @@ w32_scroll_bar_handle_click (struct scroll_bar *bar, W32Msg *msg,
si.fMask = SIF_POS;
si.nPos = y;
/* Remember apparent position (we actually lag behind the real
- position, so don't set that directly. */
+ position, so don't set that directly). */
last_scroll_bar_drag_pos = y;
SetScrollInfo (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, &si, FALSE);
@@ -4771,7 +4773,7 @@ w32_read_socket (struct terminal *terminal, int expected,
pending_autoraise_frame = 0;
}
- /* Check which frames are still visisble, if we have enqueued any user
+ /* Check which frames are still visible, if we have enqueued any user
events or been notified of events that may affect visibility. We
do this here because there doesn't seem to be any direct
notification from Windows that the visibility of a window has
diff --git a/src/xdisp.c b/src/xdisp.c
index b64a2c0cf6..bffb7bcdd7 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -899,7 +899,7 @@ static void init_to_row_start (struct it *, struct window *,
static int init_to_row_end (struct it *, struct window *,
struct glyph_row *);
static void back_to_previous_line_start (struct it *);
-static int forward_to_next_line_start (struct it *, int *);
+static int forward_to_next_line_start (struct it *, int *, struct bidi_it *);
static struct text_pos string_pos_nchars_ahead (struct text_pos,
Lisp_Object, EMACS_INT);
static struct text_pos string_pos (EMACS_INT, Lisp_Object);
@@ -3131,13 +3131,10 @@ next_overlay_change (EMACS_INT pos)
return endpos;
}
-/* Record one cached display string position found recently by
- compute_display_string_pos. */
-static EMACS_INT cached_disp_pos;
-static EMACS_INT cached_prev_pos = -1;
-static struct buffer *cached_disp_buffer;
-static int cached_disp_modiff;
-static int cached_disp_overlay_modiff;
+/* How many characters forward to search for a display property or
+ display string. Enough for a screenful of 100 lines x 50
+ characters in a line. */
+#define MAX_DISP_SCAN 5000
/* Return the character position of a display string at or after
position specified by POSITION. If no display string exists at or
@@ -3149,18 +3146,22 @@ static int cached_disp_overlay_modiff;
on a GUI frame. */
EMACS_INT
compute_display_string_pos (struct text_pos *position,
- struct bidi_string_data *string, int frame_window_p)
+ struct bidi_string_data *string,
+ int frame_window_p, int *disp_prop_p)
{
/* OBJECT = nil means current buffer. */
Lisp_Object object =
(string && STRINGP (string->lstring)) ? string->lstring : Qnil;
- Lisp_Object pos, spec;
+ Lisp_Object pos, spec, limpos;
int string_p = (string && (STRINGP (string->lstring) || string->s));
EMACS_INT eob = string_p ? string->schars : ZV;
EMACS_INT begb = string_p ? 0 : BEGV;
EMACS_INT bufpos, charpos = CHARPOS (*position);
+ EMACS_INT lim =
+ (charpos < eob - MAX_DISP_SCAN) ? charpos + MAX_DISP_SCAN : eob;
struct text_pos tpos;
- struct buffer *b;
+
+ *disp_prop_p = 1;
if (charpos >= eob
/* We don't support display properties whose values are strings
@@ -3168,38 +3169,9 @@ compute_display_string_pos (struct text_pos *position,
|| string->from_disp_str
/* C strings cannot have display properties. */
|| (string->s && !STRINGP (object)))
- return eob;
-
- /* Check the cached values. */
- if (!STRINGP (object))
{
- if (NILP (object))
- b = current_buffer;
- else
- b = XBUFFER (object);
- if (b == cached_disp_buffer
- && BUF_MODIFF (b) == cached_disp_modiff
- && BUF_OVERLAY_MODIFF (b) == cached_disp_overlay_modiff
- && !b->clip_changed)
- {
- if (cached_prev_pos >= 0
- && cached_prev_pos < charpos && charpos <= cached_disp_pos)
- return cached_disp_pos;
- /* Handle overstepping either end of the known interval. */
- if (charpos > cached_disp_pos)
- cached_prev_pos = cached_disp_pos;
- else /* charpos <= cached_prev_pos */
- cached_prev_pos = max (charpos - 1, 0);
- }
-
- /* Record new values in the cache. */
- if (b != cached_disp_buffer)
- {
- cached_disp_buffer = b;
- cached_prev_pos = max (charpos - 1, 0);
- }
- cached_disp_modiff = BUF_MODIFF (b);
- cached_disp_overlay_modiff = BUF_OVERLAY_MODIFF (b);
+ *disp_prop_p = 0;
+ return eob;
}
/* If the character at CHARPOS is where the display string begins,
@@ -3218,22 +3190,24 @@ compute_display_string_pos (struct text_pos *position,
&& handle_display_spec (NULL, spec, object, Qnil, &tpos, bufpos,
frame_window_p))
{
- if (!STRINGP (object))
- cached_disp_pos = charpos;
return charpos;
}
/* Look forward for the first character with a `display' property
that will replace the underlying text when displayed. */
+ limpos = make_number (lim);
do {
- pos = Fnext_single_char_property_change (pos, Qdisplay, object, Qnil);
+ pos = Fnext_single_char_property_change (pos, Qdisplay, object, limpos);
CHARPOS (tpos) = XFASTINT (pos);
+ if (CHARPOS (tpos) >= lim)
+ {
+ *disp_prop_p = 0;
+ break;
+ }
if (STRINGP (object))
BYTEPOS (tpos) = string_char_to_byte (object, CHARPOS (tpos));
else
BYTEPOS (tpos) = CHAR_TO_BYTE (CHARPOS (tpos));
- if (CHARPOS (tpos) >= eob)
- break;
spec = Fget_char_property (pos, Qdisplay, object);
if (!STRINGP (object))
bufpos = CHARPOS (tpos);
@@ -3241,8 +3215,6 @@ compute_display_string_pos (struct text_pos *position,
|| !handle_display_spec (NULL, spec, object, Qnil, &tpos, bufpos,
frame_window_p));
- if (!STRINGP (object))
- cached_disp_pos = CHARPOS (tpos);
return CHARPOS (tpos);
}
@@ -5491,6 +5463,9 @@ back_to_previous_line_start (struct it *it)
continuously over the text). Otherwise, don't change the value
of *SKIPPED_P.
+ If BIDI_IT_PREV is non-NULL, store into it the state of the bidi
+ iterator on the newline, if it was found.
+
Newlines may come from buffer text, overlay strings, or strings
displayed via the `display' property. That's the reason we can't
simply use find_next_newline_no_quit.
@@ -5503,7 +5478,8 @@ back_to_previous_line_start (struct it *it)
leads to wrong cursor motion. */
static int
-forward_to_next_line_start (struct it *it, int *skipped_p)
+forward_to_next_line_start (struct it *it, int *skipped_p,
+ struct bidi_it *bidi_it_prev)
{
EMACS_INT old_selective;
int newline_found_p, n;
@@ -5515,6 +5491,8 @@ forward_to_next_line_start (struct it *it, int *skipped_p)
&& it->c == '\n'
&& CHARPOS (it->position) == IT_CHARPOS (*it))
{
+ if (it->bidi_p && bidi_it_prev)
+ *bidi_it_prev = it->bidi_it;
set_iterator_to_next (it, 0);
it->c = 0;
return 1;
@@ -5536,6 +5514,8 @@ forward_to_next_line_start (struct it *it, int *skipped_p)
if (!get_next_display_element (it))
return 0;
newline_found_p = it->what == IT_CHARACTER && it->c == '\n';
+ if (newline_found_p && it->bidi_p && bidi_it_prev)
+ *bidi_it_prev = it->bidi_it;
set_iterator_to_next (it, 0);
}
@@ -5570,6 +5550,8 @@ forward_to_next_line_start (struct it *it, int *skipped_p)
&& !newline_found_p)
{
newline_found_p = ITERATOR_AT_END_OF_LINE_P (it);
+ if (newline_found_p && it->bidi_p && bidi_it_prev)
+ *bidi_it_prev = it->bidi_it;
set_iterator_to_next (it, 0);
}
}
@@ -5693,8 +5675,9 @@ static void
reseat_at_next_visible_line_start (struct it *it, int on_newline_p)
{
int newline_found_p, skipped_p = 0;
+ struct bidi_it bidi_it_prev;
- newline_found_p = forward_to_next_line_start (it, &skipped_p);
+ newline_found_p = forward_to_next_line_start (it, &skipped_p, &bidi_it_prev);
/* Skip over lines that are invisible because they are indented
more than the value of IT->selective. */
@@ -5705,7 +5688,8 @@ reseat_at_next_visible_line_start (struct it *it, int on_newline_p)
{
xassert (IT_BYTEPOS (*it) == BEGV
|| FETCH_BYTE (IT_BYTEPOS (*it) - 1) == '\n');
- newline_found_p = forward_to_next_line_start (it, &skipped_p);
+ newline_found_p =
+ forward_to_next_line_start (it, &skipped_p, &bidi_it_prev);
}
/* Position on the newline if that's what's requested. */
@@ -5721,11 +5705,14 @@ reseat_at_next_visible_line_start (struct it *it, int on_newline_p)
--IT_STRING_BYTEPOS (*it);
}
else
- /* Setting this flag will cause
- bidi_move_to_visually_next not to advance, but
- instead deliver the current character (newline),
- which is what the ON_NEWLINE_P flag wants. */
- it->bidi_it.first_elt = 1;
+ {
+ /* We need to restore the bidi iterator to the state
+ it had on the newline, and resync the IT's
+ position with that. */
+ it->bidi_it = bidi_it_prev;
+ IT_STRING_CHARPOS (*it) = it->bidi_it.charpos;
+ IT_STRING_BYTEPOS (*it) = it->bidi_it.bytepos;
+ }
}
}
else if (IT_CHARPOS (*it) > BEGV)
@@ -5735,9 +5722,14 @@ reseat_at_next_visible_line_start (struct it *it, int on_newline_p)
--IT_CHARPOS (*it);
--IT_BYTEPOS (*it);
}
- /* With bidi iteration, the call to `reseat' will cause
- bidi_move_to_visually_next deliver the current character,
- the newline, instead of advancing. */
+ else
+ {
+ /* We need to restore the bidi iterator to the state it
+ had on the newline and resync IT with that. */
+ it->bidi_it = bidi_it_prev;
+ IT_CHARPOS (*it) = it->bidi_it.charpos;
+ IT_BYTEPOS (*it) = it->bidi_it.bytepos;
+ }
reseat (it, it->current.pos, 0);
}
}
diff --git a/src/xterm.c b/src/xterm.c
index 2c973d6b96..c07caec6c7 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -442,6 +442,27 @@ x_display_info_for_display (Display *dpy)
return 0;
}
+static Window
+x_find_topmost_parent (struct frame *f)
+{
+ struct x_output *x = f->output_data.x;
+ Window win = None, wi = x->parent_desc;
+ Display *dpy = FRAME_X_DISPLAY (f);
+
+ while (wi != FRAME_X_DISPLAY_INFO (f)->root_window)
+ {
+ Window root;
+ Window *children;
+ unsigned int nchildren;
+
+ win = wi;
+ XQueryTree (dpy, win, &root, &wi, &children, &nchildren);
+ XFree (children);
+ }
+
+ return win;
+}
+
#define OPAQUE 0xffffffff
void
@@ -453,6 +474,7 @@ x_set_frame_alpha (struct frame *f)
double alpha = 1.0;
double alpha_min = 1.0;
unsigned long opac;
+ Window parent;
if (dpyinfo->x_highlight_frame == f)
alpha = f->alpha[0];
@@ -473,6 +495,19 @@ x_set_frame_alpha (struct frame *f)
opac = alpha * OPAQUE;
+ x_catch_errors (dpy);
+
+ /* If there is a parent from the window manager, put the property there
+ also, to work around broken window managers that fail to do that.
+ Do this unconditionally as this function is called on reparent when
+ alpha has not changed on the frame. */
+
+ parent = x_find_topmost_parent (f);
+ if (parent != None)
+ XChangeProperty (dpy, parent, dpyinfo->Xatom_net_wm_window_opacity,
+ XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *) &opac, 1L);
+
/* return unless necessary */
{
unsigned char *data;
@@ -480,7 +515,6 @@ x_set_frame_alpha (struct frame *f)
int rc, format;
unsigned long n, left;
- x_catch_errors (dpy);
rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity,
0L, 1L, False, XA_CARDINAL,
&actual, &format, &n, &left,
@@ -6087,6 +6121,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
/* Perhaps reparented due to a WM restart. Reset this. */
FRAME_X_DISPLAY_INFO (f)->wm_type = X_WMTYPE_UNKNOWN;
FRAME_X_DISPLAY_INFO (f)->net_supported_window = 0;
+
+ x_set_frame_alpha (f);
}
goto OTHER;