Ken Raeburn [Sat, 10 Oct 2015 07:26:42 +0000 (03:26 -0400)]
Handle an opaque-move X11 window manager operation more efficiently.
* src/xterm.c (handle_one_xevent): If a ConfigureNotify event is
followed by more ConfigureNotify events for the same window, process
only the last one.
Ken Raeburn [Thu, 8 Oct 2015 08:13:06 +0000 (04:13 -0400)]
Fix cursor setting for tip frame; re-enable cursor generation.
* src/xfns.c (x_create_tip_frame): Include the cursor in the window
attributes sent when creating the new X window. Don't skip setting
the pointerColor parameter.
Ken Raeburn [Sat, 3 Oct 2015 03:36:31 +0000 (23:36 -0400)]
Rewrite x_set_mouse_color to sync less.
We can track serial numbers of X requests and correlate error events
with the associated requests. This way we can identify errors for
specific calls without having to use XSync after every one.
* src/xfns.c (enum mouse_cursor): New type.
(struct mouse_cursor_types, struct mouse_cursor_data): New types.
(mouse_cursor_types): New array listing the Lisp variables and default
cursor appearances for each cursor type.
(x_set_mouse_color_handler): New function; checks error event serial
number against submitted requests.
(x_set_mouse_color): Updated to use the new error handler callback,
and to be more table-driven, to simplify repetitious code.
Ken Raeburn [Fri, 2 Oct 2015 09:00:23 +0000 (05:00 -0400)]
Add x_catch_errors_with_handler.
* src/xterm.c (struct x_error_message_stack): Add new fields for a
callback function and associated data pointer.
(x_error_catcher): If the callback function is set, call it after
saving the error message string.
(x_catch_errors_with_handler): Renamed from x_catch_errors but now
accepts a callback function and data pointer.
(x_catch_errors): Now a wrapper function.
* src/xterm.h (x_special_error_handler): New typedef.
(x_catch_errors_with_handler): Declare.
Ken Raeburn [Wed, 7 Oct 2015 10:04:01 +0000 (06:04 -0400)]
Introduce x_uncatch_errors_after_check to reduce XSync calls.
Both x_had_errors_p and x_check_errors call XSync, so if they're
immediately followed by x_uncatch_errors, its XSync call will be
redundant, resulting in a wasted round trip to the X server.
* src/xterm.c (x_uncatch_errors_after_check): New routine; a copy of
x_uncatch_errors without the XSync call.
(XTmouse_position, x_wm_supports):
* src/xfns.c (x_set_mouse_color):
* src/xmenu.c (Fx_menu_bar_open_internal):
* src/xselect.c (x_own_selection, x_get_foreign_selection):
(Fx_get_atom_name): Call it instead of x_uncatch_errors.
* src/xterm.h (x_uncatch_errors_after_check): Declare.
Jay Belanger [Sun, 11 Oct 2015 03:08:33 +0000 (22:08 -0500)]
Document the optional prefix to `calc-yank'.
* doc/misc/calc.texi (Yanking into the Stack): Document the optional
prefix to `calc-yank'.
* lisp/calc/calc-yank.el (calc-yank): Ensure that things killed from
the Calc buffer are yanked back unchanged.
Mark Oteiza [Sun, 11 Oct 2015 02:23:59 +0000 (22:23 -0400)]
* lisp/calendar/calendar.el: Display buffer before executing body.
In each use of this macro, the modeline is derived from a window width
calculation, which will be wrong if (display-buffer) splits the window
horizontally.
Paul Eggert [Sun, 11 Oct 2015 01:03:49 +0000 (18:03 -0700)]
Use ‘echo’ safely with ‘\’ or leading ‘-’
POSIX says that ‘echo FOO’ produces implementation-defined output
if FOO contains leading ‘-’, or ‘\’ anywhere, so don’t assume GNU
behavior in that case.
* Makefile.in (removenullpaths): Remove.
(epaths-force): Rewrite to avoid the need for ‘echo’.
(install-etc): Be clearer about escaping the shell metacharacters
‘\’ and ‘$’.
* Makefile.in (install-arch-indep, install-etcdoc):
* admin/charsets/mapconv, admin/merge-gnulib, admin/merge-pkg-config:
* admin/quick-install-emacs, build-aux/gitlog-to-emacslog:
* configure.ac, lib-src/rcs2log, make-dist:
* src/Makefile.in (lisp.mk):
Don’t assume ‘echo’ outputs ‘\’ and leading ‘-’ unscathed.
For example, use ‘printf '%s\n' "$foo"’ rather than ‘echo "$foo"’
if $foo can contain arbitrary characters.
* lisp/Makefile.in (TAGS): Use ‘ls’, not ‘echo’, to avoid ‘\’ issues.
* doc/lispref/two-volume.make (vol1.pdf):
* test/etags/make-src/Makefile (web ftp publish):
Use ‘printf’ rather than ‘echo -e’.
Eli Zaretskii [Sat, 10 Oct 2015 17:01:00 +0000 (20:01 +0300)]
Fix vertical-motion in truncated lines that end in a stretch
* src/indent.c (Fvertical_motion): Expect overshoot when point is
beyond window margin and lines are truncated, even if we have a
stretch at point. (Bug#21468)
Paul Eggert [Sat, 10 Oct 2015 07:17:11 +0000 (00:17 -0700)]
CHECK_IMPURE and PURE_P speedup
* src/intervals.c (create_root_interval):
Do CHECK_IMPURE only for strings; not needed for buffers.
Prefer ! STRINGP to BUFFERP, for a tad more speed.
* src/puresize.h (CHECK_IMPURE, PURE_P):
Now inline functions instead of macros.
(PURE_P): Don’t use XPNTR; that is now the caller’s responsibility.
All callers changed.
(CHECK_IMPURE): New argument PTR, to save us the work of running XPNTR.
All callers changed.
Stefan Monnier [Fri, 9 Oct 2015 19:55:31 +0000 (15:55 -0400)]
* lisp/cedet/ede: Silence some compiler warnings
* lisp/cedet/ede.el: Require cl-lib. Silence some compiler warnings.
(ede-menu-obj-of-class-p): Use cl-some rather than `eval'.
(ede-apply-object-keymap, ede-reset-all-buffers)
(ede-auto-add-to-target): Use dolist.
(ede-new, ede-flush-deleted-projects, ede-global-list-sanity-check):
Use field names rather than initarg names in `oref'.
(ede-load-project-file): Remove unused var `file'.
(ede-map-any-target-p): Use cl-some rather than ede-map-targets.
(ede-set): Remove unused var `a'.
* lisp/cedet/ede/emacs.el: Silence some compiler warnings.
(ede-project-autoload): Avoid the old-style "name" argument.
(ede-emacs-find-matching-target): Use field names rather than initarg
names in `oref'.
* lisp/cedet/ede/linux.el: Silence some compiler warnings.
(ede-linux-load, ede-project-autoload): Avoid the old-style "name" argument.
(ede-linux-find-matching-target): Use field names rather than initarg
names in `oref'.
Eli Zaretskii [Fri, 9 Oct 2015 18:33:20 +0000 (21:33 +0300)]
Update case-table and categories of recently added characters
* lisp/international/characters.el: Update information about Latin
Extended-C, Latin Extended-D, Latin Extended-E, Cyrillic Extended,
Georgian, Glagolitic, Deseret, Old Hungarian, and Warang Citi
blocks. (Byug#21654)
Eli Zaretskii [Fri, 9 Oct 2015 08:12:58 +0000 (11:12 +0300)]
Avoid inflooping in font-lock
* lisp/font-lock.el (font-lock-extend-region-wholelines): Bind
inhibit-field-text-motion around the call to
line-beginning-position, to avoid inflooping. (Bug#21615)
Tassilo Horn [Fri, 9 Oct 2015 07:56:40 +0000 (09:56 +0200)]
Refactor duplicated code; ensure default is in completions
* lisp/textmodes/reftex-cite.el (reftex--query-search-regexps): New function.
(reftex-extract-bib-entries): Use it.
(reftex-extract-bib-entries-from-thebibliography): Use it.
Daiki Ueno [Thu, 8 Oct 2015 03:43:37 +0000 (12:43 +0900)]
Use g_clear_error instead of g_error_free
* src/image.c: Define g_clear_error instead of g_error_free.
(init_svg_functions): Resolve symbol g_clear_error instead of
g_error_free.
(svg_load_image): Use g_clear_error instead of g_error_free, to
suppress GLib warnings when ERR is not set. See bug#21641.
Jay Belanger [Thu, 8 Oct 2015 13:32:00 +0000 (08:32 -0500)]
Format initial input uniformly.
* lisp/calc/calc.el (calc-digit-start-entry): New function.
* lisp/calc/calc.el (calcDigit-start):
* lisp/calc/calc-aent.el (calc-alg-digit-entry):
Use `calc-digit-start-entry' to format input.
Ken Raeburn [Mon, 5 Oct 2015 15:11:32 +0000 (11:11 -0400)]
Disable non-working pointerColor setting for X tooltip frame.
It generates a bunch of server traffic, but there's some bug wherein
the new mouse cursor settings don't seem to get used. In most
situations the cursor isn't likely to be seen anyway, so it's not
urgent to fix.
* src/xfns.c (x_create_tip_frame): Don't set pointerColor.
Ken Raeburn [Sun, 4 Oct 2015 13:54:44 +0000 (09:54 -0400)]
Reduce some unnecessary X calls.
* src/xfns.c (x_real_pos_and_offsets): Remove a redundant XGetGeometry
call. If border width is wanted, get it from the XGetGeometry call
instead of calling XGetWindowAttributes on the same window. Skip some
X calls if we've already detected an error from the X server.
* src/xterm.c (x_wm_supports): Delete x_sync before x_had_errors_p.
(handle_one_xevent): Delete XSync call before x_uncatch_errors.
Ken Raeburn [Sat, 3 Oct 2015 04:18:50 +0000 (00:18 -0400)]
Reduce color allocation/query traffic in the TrueColor case.
When working with an X visual with TrueColor class, pixel values can
be generated from the RGB values according to mask value provided by
the server on connection. Some of the image-handling code was already
doing this.
* src/xterm.h (x_make_truecolor_pixel): New function; code taken from
lookup_rgb_color.
(x_mutable_colormap): New function.
* src/image.c (lookup_rgb_color): Move pixel composition code to
x_make_truecolor_pixel.
(x_kill_gs_process): Call x_mutable_colormap.
* src/xfaces.c (x_free_colors, x_free_dpy_colors): Call
x_mutable_colormap.
* src/xftfont.c (xftfont_get_colors): Call x_query_colors.
* src/xterm.c (x_query_colors): For a TrueColor display, decompose the
pixel value into RGB values directly, and don't send a request to the
server.
(x_alloc_nearest_color): For a TrueColor display, construct the pixel
value with x_make_truecolor_pixel.
(x_copy_color): For an immutable color map, just return the provided
pixel value.
Ken Raeburn [Sat, 3 Oct 2015 04:15:54 +0000 (00:15 -0400)]
Cache XParseColor results in the X display info structure.
With repeated lookups of foreground and background colors for multiple
faces per frame, we issue a lot of redundant color name lookups to the
X server, waiting every time for the response. On a remote network
with, say, 30ms round-trip time, this can add nearly a full second to
creation of a new frame.
* src/gtkutil.c (xg_check_special_colors): Call x_parse_color.
* src/image.c (get_spec_bg_or_alpha_as_argb):
(xpm_init_color_cache, xpm_lookup_color):
* src/xfns.c (x_defined_color):
* src/xterm.c (x_parse_color): New function; caches color names not
starting with "#" in the display-info structure.
(x_delete_display): Delete the cache content.
* src/xterm.h (struct color_name_cache_entry): New type.
(x_parse_color): Declare.
(struct x_display_info): Add a new field for the cache.
Paul Eggert [Tue, 6 Oct 2015 20:33:50 +0000 (13:33 -0700)]
Fix bug in GC_CHECK_MARKED_OBJECTS check
* src/alloc.c (mark_object): Fix bug in checking code.
When GC_CHECK_MARKED_OBJECTS is defined, the bug caused
CHECK_ALLOCATED_AND_LIVE_SYMBOL to repeatedly do the
CHECK_ALLOCATED and CHECK_LIVE tests for the first symbol in each
bucket. The bug did not affect behavior either in the normal case
where GC_CHECK_MARKED_OBJECTS is not defined, or where Emacs does
not have an internal error that a properly-written
CHECK_ALLOCATED_AND_LIVE_SYMBOL would detect.
Eli Zaretskii [Tue, 6 Oct 2015 16:08:21 +0000 (19:08 +0300)]
Fix display of characters adjacent to ZWJ and ZWNJ
* src/bidi.c (bidi_resolve_neutral): Treat all Bn (a.k.a. "control")
characters the same as directional formatting controls.
(bidi_level_of_next_char): Include all Bn characters in rule L1,
as mandated by the UBA.
Eli Zaretskii [Mon, 5 Oct 2015 07:22:08 +0000 (10:22 +0300)]
Remove redundant redisplay code
* src/xdisp.c (redisplay_internal, try_cursor_movement)
(try_window_reusing_current_matrix, try_window_id): Remove
redundant restrictions on redisplay optimizations based on the
frame's 'redisplay' flag. See
http://osdir.com/ml/general/2015-10/msg02110.html for the relevant
discussions.
Michael Albinus [Sun, 4 Oct 2015 11:00:33 +0000 (13:00 +0200)]
Improve XEmacs compatibility of Tramp
* lisp/net/tramp-compat.el (directory-listing-before-filename-regexp):
Declare if it doesn't exist.
(file-remote-p): Remove defalias, which was necessary for GNU Emacs 21.
(redisplay): Make it an alias if it doesn't exist.
* lisp/net/tramp.el (tramp-get-remote-tmpdir): Don't use
`file-remote-p' (due to XEmacs compatibility).
* lisp/net/trampver.el (locate-dominating-file)
(tramp-compat-replace-regexp-in-string): Autoload.
(tramp-repository-get-version): Do not dupe byte-compiler.
Eli Zaretskii [Thu, 9 Jul 2015 02:38:29 +0000 (05:38 +0300)]
shr: fix too long lines in rendered buffers (Bug#21012)
Co-authored-by: Michael Heerdegen <michael_heerdegen@web.de>
* lisp/net/shr.el (shr-insert-document, shr-fill-text):
Correct calculation of available width.
(shr-find-fill-point): Don't overflow window edge if shr-kinsoku-shorten
is nil.
Restore blank line before next section, erroneously erased in my previous commit
* etc/compilation.txt (symbol ant): add an additional trailing blank line to this section, so that there are two of them immediately before the next section
* lisp/json.el (json-object-type): Mention order handling in doc-string.
(json--plist-reverse): New utility function.
(json-read-object): Maintain ordering for alists and plists.
(json-pretty-print): Ensure that ordering is maintained.
* test/automated/json-tests.el (test-json-plist-reverse): New test for
`json--plist-reverse'.
(json-read-simple-alist): Update test to accommodate for changes in
`json-read-object'.
* etc/NEWS: Document the new behavior of the pretty printing functions.
Eli Zaretskii [Sat, 3 Oct 2015 11:49:16 +0000 (14:49 +0300)]
More validatation of coding system in 'write-region'
* src/coding.c (choose_write_coding_system): More validation of
coding-system from various sources. Suggested by Andreas Schwab
<schwab@linux-m68k.org>. (Bug#21602)
Eli Zaretskii [Sat, 3 Oct 2015 10:44:44 +0000 (13:44 +0300)]
Avoid crashes due to invalid coding-system
* src/fileio.c (choose_write_coding_system)
(Finsert_file_contents): Check validity of coding-system-for-write
and coding-system-for-read bound by the caller. (Bug#21602)