Khaled Hosny [Sat, 5 Jan 2019 21:01:02 +0000 (23:01 +0200)]
Always set explicit HarfBuzz buffer direction
If no direction was given by the caller, I assume the text will be drawn
left to right, if this is not the case then callers must provide
sensible direction. Letting HarfBuzz guess the direction is not
appropriate since shaping and drawing must use the same direction.
Also move hb_buffer_guess_segment_properties() call to the end, so it
only guessing unset properties, until we completely get rid of it.
Eli Zaretskii [Wed, 2 Jan 2019 15:55:45 +0000 (17:55 +0200)]
Fix text direction of the HarfBuzz shaping buffer
* src/indent.c (scan_for_column, compute_motion):
* src/xdisp.c (CHAR_COMPOSED_P): Pass PDIR argument to
composition_reseat_it.
* src/composite.c (composition_reseat_it): Accept an
additional argument PDIR that provides the current paragraph's
base direction; all callers changed. Use PDIR to fix
calculation of the DIRECTION argument to autocmp_chars.
(Bug#33944)
* src/composite.h: Include dispextern.h.
(composition_reseat_it): Update prototype.
Khaled Hosny [Sat, 22 Dec 2018 09:02:40 +0000 (11:02 +0200)]
Subclass default HarfBuzz Unicode functions
Instead of creating new functions from scratch, subclass the default
implementation and override the selected functions we want/can
override. (Bug#33729)
Mike Kupfer [Mon, 17 Dec 2018 05:18:04 +0000 (21:18 -0800)]
More fixes for build without libotf
* src/xftfont.c (xftfont_driver):
* src/ftxfont.c (ftxfont_driver):
* src/ftcrfont.c (ftcrfont_driver): Set the .shape member only
if HAVE_LIBOTF is defined. (Bug#33771)
Eli Zaretskii [Mon, 17 Dec 2018 17:01:43 +0000 (19:01 +0200)]
Fix compilation errors when building without libotf
* src/ftfont.c (ftfont_shape): Only compile if HAVE_LIBOTF is
defined.
(ftfont_driver): Set the .shape member only if HAVE_LIBOTF is
defined. (Bug#33771)
Paul Eggert [Sat, 15 Dec 2018 00:40:44 +0000 (16:40 -0800)]
Assume hb_ft_font_create_referenced if HarfBuzz
* configure.ac (HAVE_HB_FT_FONT_CREATE_REFERENCED):
Remove test, since we now require 0.9.42 and
hb_ft_font_create_referenced has been present since 0.9.38.
* src/ftfont.c (ft_face_destroy, hb_ft_font_create_referenced):
Remove; no longer needed.
Paul Eggert [Thu, 13 Dec 2018 19:58:09 +0000 (11:58 -0800)]
Simplify mainline Harfbuzz-using code
* src/ftfont.c (ft_face_destroy): Omit unnecessary cast.
(hb_ft_font_create_referenced) [!HAVE_HB_FT_FONT_CREATE_REFERENCED]:
New function.
(ftfont_get_hb_font): Use it.
Alan Mackenzie [Sun, 9 Dec 2018 12:59:03 +0000 (12:59 +0000)]
Don't create *Compile-Log* due to byte-compile. Amend message to it.
This fixes bug #33602 and is a partial reversion of a commit from
2018-11-28T13:15:50.
* lisp/emacs-lisp/bytecomp.el (byte-compile-log-file): Don't create buffer
*Compile-Log* because it doesn't already exist. Amend message "Compiling no
file" to be clearer (?and less irritating).
Paul Eggert [Sun, 9 Dec 2018 06:53:15 +0000 (22:53 -0800)]
Port VECTOR_ELTS_MAX to older GCC etc.
Problem reported by Eli Zaretskii in:
https://lists.gnu.org/r/emacs-devel/2018-12/msg00182.html
* src/alloc.c (VECTOR_ELTS_MAX): Now a macro.
Needed for portability to older GCC and non-GCC.
Paul Eggert [Sun, 9 Dec 2018 00:56:32 +0000 (16:56 -0800)]
Streamline and fix vector-size checks
* src/alloc.c (VECTOR_ELTS_MAX): New constant.
(allocate_vectorlike): LEN now must be positive. Assume LEN
is in range. All callers changed.
(allocate_vector): Arg is now ptrdiff_t, not EMACS_INT.
All callers changed. Return zero vector here, not in
allocate_vectorlike.
* src/lisp.h (make_uninit_vector): Simplify.
* src/xwidget.c (webkit_js_to_lisp):
Check for overflow in ptrdiff_t calculations.
Martin Rudalics [Sat, 8 Dec 2018 08:18:28 +0000 (09:18 +0100)]
Adjust windows' previous buffers when reverting dired buffers (Bug#33458)
* lisp/dired.el (dired-save-positions, dired-restore-positions):
For each window that showed the reverted buffer before, fix the
point positions in its list of previously shown buffers the way
these routines handle window point for all windows currently
showing the buffer (Bug#33458).
Martin Rudalics [Sat, 8 Dec 2018 08:01:23 +0000 (09:01 +0100)]
Improve how 'balance-windows' handles fixed-size windows (Bug#33254)
* lisp/window.el (balance-windows-2): When a child window has
fixed size, don't count it as resizable (Bug#33254).
Handle case where a window has no resizable child windows.
Alan Mackenzie [Fri, 7 Dec 2018 17:38:03 +0000 (17:38 +0000)]
CC Mode: Compensate for backward-sexp ignoring trailing commas after {...}
This fixes bug #32808.
* lisp/progmodes/cc-engine.el (c-beginning-of-statement-1): New variable
comma-delimited, set when we're about to scan backward over a comma. Do not
reckon a brace block as bounding a statement when it is followed or preceded
by a comma (except when argument comma-delim is non-nil).
(c-guess-basic-syntax, CASE 9C): Call c-beginning-of-statement-1 with argument
comma-delim changed to non-nil.
Michael Albinus [Fri, 7 Dec 2018 16:21:03 +0000 (17:21 +0100)]
Refactor some Tramp functions
* lisp/net/tramp-compat.el (tramp-compat-file-local-name): New defsubst.
(tramp-compat-file-name-quoted-p, tramp-compat-file-name-quote)
(tramp-compat-file-name-unquote):
* lisp/net/tramp.el (tramp-handle-file-name-case-insensitive-p)
(tramp-handle-file-truename, tramp-get-remote-tmpdir):
* lisp/net/tramp-adb.el (tramp-adb-handle-copy-file)
(tramp-adb-handle-rename-file, tramp-adb-handle-exec-path):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-directly)
(tramp-sh-handle-exec-path, tramp-find-inline-encoding)
(tramp-get-remote-touch): Use it.
* lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist):
Use `tramp-handle-expand-file-name'.
(tramp-adb-handle-expand-file-name): Move to tramp.el.
(tramp-adb-handle-file-writable-p): Adapt docstring.
* lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist):
Use `tramp-handle-file-local-copy', `tramp-handle-file-writable-p'
and `tramp-handle-write-region'.
(tramp-gvfs-handle-file-local-copy)
(tramp-gvfs-handle-file-writable-p)
(tramp-gvfs-handle-write-region): Move to tramp.el.
* lisp/net/tramp-rclone.el: Dont't require `tramp-adb' and
`tramp-gvfs' anymore.
(tramp-rclone-file-name-handler-alist):
Use `tramp-handle-expand-file-name', `tramp-handle-file-local-copy',
`tramp-handle-file-writable-p' and `tramp-handle-write-region'.
(tramp-rclone-handle-directory-files): Simplify.
Eli Zaretskii [Fri, 7 Dec 2018 08:54:57 +0000 (10:54 +0200)]
Fix the value of default-directory upon startup on MS-Windows
* src/w32.c (w32_get_current_directory): New function.
(GetCachedVolumeInformation, init_environment): Use it.
(w32_init_current_directory): New function.
* src/w32.h (w32_init_current_directory): Add prototype.
* src/emacs.c (main) [WINDOWSNT]: Use w32_init_current_directory
to get the accurate value of cwd. This is needed to record
the correct directory in emacs_wd, which is now initialized
way earlier in the startup process, when init_environment was
not yet called. For details, see the problems reported in
http://lists.gnu.org/archive/html/emacs-devel/2018-12/msg00068.html.
Reported by Angelo Graziosi <angelo.g0@libero.it>.
Paul Eggert [Thu, 6 Dec 2018 18:46:06 +0000 (10:46 -0800)]
emacsclient: avoid background chatter
* lib-src/emacsclient.c (process_grouping): New function.
(act_on_signals, main): Use it.
(main): Omit "Waiting for Emacs..." and later "\n" messages
if in background, since that messes up the screen.
Paul Eggert [Thu, 6 Dec 2018 16:54:00 +0000 (08:54 -0800)]
Fix emacsclient hang when backgrounded
Problem reported by Kaushal Modi in:
https://lists.gnu.org/r/emacs-devel/2018-12/msg00083.html
The tcdrain call replaced an fdatasync call which had no
effect on the tty, so removing it entirely shouldn’t cause
problems. The fdatasync call replaced an fsync call which
also had no effect on the tty, and the fsync call seems to be
badly-merged revenant of emacsclient’s old (circa 2004) way of
communicating to and from Emacs via FILE * streams, where
fsync was apparently needed when talking to sockets.
* lib-src/emacsclient.c [!DOS_NT]: Don’t include termios.h.
(flush_stdout): Remove. All callers removed.
(main): Do not drain the tty after "Waiting for Emacs..."
message. There should be no need to drain, and draining it
might send us a SIGTTOU. Do not fflush stdout just before
exiting, as exiting does that for us.
Michael Albinus [Thu, 6 Dec 2018 15:11:27 +0000 (16:11 +0100)]
Add missing handler to tramp-rclone.el, improve robustness
* lisp/net/tramp-rclone.el (tramp-adb): Require.
(tramp-rclone-file-name-handler-alist):
Use `tramp-adb-handle-expand-file-name'.
(tramp-rclone-flush-directory-cache): New defun, derived from
`tramp-rclone-flush-mount'.
(tramp-rclone-do-copy-or-rename-file)
(tramp-rclone-handle-delete-directory)
(tramp-rclone-handle-delete-file)
(tramp-rclone-handle-make-directory): Use it.
(tramp-rclone-handle-directory-files)
(tramp-rclone-local-file-name):
Use `tramp-compat-file-name-quoted-p', `tramp-compat-file-name-quote'
and ´tramp-compat-file-name-unquote'.
(tramp-rclone-handle-file-executable-p)
(tramp-rclone-handle-file-readable-p): Cache result.
(tramp-rclone-handle-file-name-all-completions)
(tramp-rclone-mounted-p, tramp-rclone-remote-file-name)
(tramp-rclone-maybe-open-connection): Rewrite.
* test/lisp/net/tramp-tests.el (tramp--test-rclone-p): New defun.
(tramp-test05-expand-file-name-relative)
(tramp--test-special-characters): Use it.
Michael Albinus [Thu, 6 Dec 2018 14:25:22 +0000 (15:25 +0100)]
Make stronger tests for Tramp multi hops
* lisp/net/tramp.el (tramp-dissect-file-name, tramp-dissect-hop-name):
Check, that method is capable of multi hops.
* test/lisp/net/tramp-tests.el (tramp-test02-file-name-dissect)
(tramp-test02-file-name-dissect-simplified)
(tramp-test02-file-name-dissect-separate): Suppress check for multihops.
(tramp-test03-file-name-method-rules): Check for error if multi
hops cannot be applied.
Eli Zaretskii [Tue, 4 Dec 2018 18:27:20 +0000 (20:27 +0200)]
Support IBM038 (a.k.a. "EBCDIC-INT") encoding
* lisp/international/mule-conf.el (ibm038): New charset.
(ebcdic-int, cp038): Alias charsets of ibm038.
* lisp/language/english.el (ibm038): New coding-system.
(ebcdic-int, cp038): Alias coding-systems of ibm038.
(Bug#33612)
* etc/NEWS: Announce the new coding system ibm038.
Juri Linkov [Tue, 4 Dec 2018 00:41:54 +0000 (02:41 +0200)]
* lisp/isearch.el (isearch-yank-on-move): New defcustom
with shift-move related options extracted from `search-exit-option'.
(isearch-pre-command-hook): Rename search-exit-option to
isearch-yank-on-move in shift-move related places.
(isearch-post-command-hook): Check for isearch-pre-move-point
instead of search-exit-option. (Bug#15839)
* doc/emacs/search.texi (Not Exiting Isearch): Rename
search-exit-option to isearch-yank-on-move.
* lisp/menu-bar.el (menu-bar-i-search-menu): Add more isearch commands.
Juri Linkov [Tue, 4 Dec 2018 00:24:29 +0000 (02:24 +0200)]
* lisp/isearch.el (isearch-allow-scroll): New option `unlimited'.
(isearch-pre-command-hook): Call isearch-pre-scroll-point unless
isearch-allow-scroll is 'unlimited'.
(isearch-post-command-hook): Use `when' instead of `cond'.
Call isearch-lazy-highlight-new-loop when isearch-allow-scroll is
'unlimited'. (Bug#15839)
Paul Eggert [Mon, 3 Dec 2018 16:06:46 +0000 (08:06 -0800)]
emacsclient: fix typo on recent socket-leak change
This ports to POSIXish platforms like macOS that lack SOCK_CLOEXEC.
Fix suggested by Eli Zaretskii in:
https://lists.gnu.org/r/emacs-devel/2018-12/msg00055.html
* lib-src/emacsclient.c (set_local_socket):
Don’t use SOCK_CLOEXEC; that’s cloexec_socket’s job.
Eli Zaretskii [Mon, 3 Dec 2018 10:29:34 +0000 (12:29 +0200)]
Fix WINDOWSNT/DOS_NT build
Recent changes in sysdep.c and emacsclient unnecessarily
removed useful code from DOS_NT builds. This changeset
reinstates that code.
* nt/inc/ms-w32.h (tcdrain): Redirect to _commit.
(fdatasync): No need to redirect anymore.
* lib-src/emacsclient.c (flush_stdout): Don't avoid calling
tcdrain on DOS_NT platforms.
* src/sysdep.c (reset_sys_modes): Don't ifdef away the call to
tcdrain on DOS_NT platforms.
Paul Eggert [Mon, 3 Dec 2018 07:11:09 +0000 (23:11 -0800)]
Use tcdrain, not fdatasync, to drain ttys
fdatasync is for storage devices, not ttys.
* admin/merge-gnulib (GNULIB_MODULES): Remove fdatasync.
* lib/fdatasync.c, m4/fdatasync.m4: Remove.
* lib-src/Makefile.in (LIB_FDATASYNC):
* src/Makefile.in (LIB_FDATASYNC):
Remove. All uses removed.
* lib-src/emacsclient.c [!DOS_NT]:
Include <termios.h>, for tcdrain.
* lib-src/emacsclient.c (flush_stdout):
* src/sysdep.c (reset_sys_modes): On ttys, use tcdrain instead
of fdatasync (except don’t use either function if DOS_NT).
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
Paul Eggert [Mon, 3 Dec 2018 06:32:28 +0000 (22:32 -0800)]
emacsclient: fix symlink/socket race
* lib-src/emacsclient.c (socket_status): New arg UID.
All uses changed.
(set_local_socket): Don’t create the unbound socket unless the
initial sanity checks on the socket file succeed; this
simplifies cleaning it up. Check socket ownership again
after connecting, to fix a race (Bug#33366).
Eli Zaretskii [Sun, 2 Dec 2018 18:04:05 +0000 (20:04 +0200)]
Revert "Revert "Fix infloop in GC mark_kboards""
This reverts commit c418c85617babbe7b63730fefb71e2c87a0141af.
This reinstates the original fix, as it had nothing to do
with the behavior reported in bug#33571, which seems to be
the expected behavior.
Paul Eggert [Sun, 2 Dec 2018 07:06:06 +0000 (23:06 -0800)]
emacsclient: prefer XDG_RUNTIME_DIR (Bug#33367)
* lib-src/emacsclient.c: Disable -Wformat-truncation=2,
to avoid false alarms about the new snprintf calls.
(local_sockname): New function.
(set_local_socket): Use it. Prefer XDG_RUNTIME_DIR (if set)
for location of socket directory. Avoid unnecessary memory
allocation by using snprintf to destination.
* lisp/server.el (server-socket-dir): Prefer XDG_RUNTIME_DIR if set.