João Távora [Sun, 16 Dec 2018 16:55:09 +0000 (16:55 +0000)]
Jsonrpc error handlers can now safely call jsonrpc-shutdown
Previously, if an error handler called jsonrpc-shutdown, and if that
error handler was being called from the process sentinel,
jsonrpc-shutdown would infloop waiting for jsonrpc-sentinel-done to be
set.
Rename the process property jsonrpc-sentinel-done to
jsonrpc-sentinel-cleanup-started, arrange for it to be set earlier
in the sentinel, and also check for it earlier in jsonrpc-shutdown.
* lisp/jsonrpc.el (Version): Bump to 1.0.7.
(jsonrpc--process-sentinel): Set jsonrpc-sentinel-cleanup-started
a bit earlier than previous jsonrpc-sentinel-done.
(jsonrpc-shutdown): Query jsonrpc-sentinel-cleanup-started
Paul Eggert [Sun, 16 Dec 2018 16:11:35 +0000 (08:11 -0800)]
Update from Gnulib
This incorporates:
2018-12-16 regex: propagate fix for glibc bug 18040
2018-12-16 obstack, libc-config: Support HP-UX cc in C99 mode
2018-12-15 regex: work around a bug in glibc-2.27 and prior
2018-12-13 localtime-buffer: Avoid endless recursion
* build-aux/config.guess, build-aux/config.sub, lib/cdefs.h:
* lib/gettext.h, lib/localtime-buffer.c, lib/regexec.c, m4/regex.m4:
Copy from Gnulib.
Stefan Monnier [Sun, 16 Dec 2018 15:32:53 +0000 (10:32 -0500)]
* lisp/net/tramp: Rework mutual dependencies
Functionally split tramp-loaddefs.el into two parts: one part run
while loading it at the very beginning of loading tramp.el (holding plain
autoloads and declarations), and another run at the very end of loading
tramp.el (holding setup code).
This should reduce infinite-recursion problems while loading.
* lisp/net/tramp.el: Require tramp-loaddefs at beginning.
Run (new and internal) tramp--startup-hook at the end.
Remove all tramp-autoloads. Prefer tramp--with-startup over
eval-after-load.
(tramp--with-startup): New macro.
(tramp-set-syntax): Show the new value rather than the old value in the
error message.
(tramp-syntax-values): Explicitly return 'values'.
(tramp-prefix-format, tramp-prefix-regexp, tramp-method-regexp)
(tramp-postfix-method-format, tramp-postfix-method-regexp)
(tramp-prefix-ipv6-format, tramp-prefix-ipv6-regexp)
(tramp-postfix-ipv6-format, tramp-postfix-ipv6-regexp)
(tramp-postfix-host-format, tramp-postfix-host-regexp)
(tramp-remote-file-name-spec-regexp, tramp-file-name-structure)
(tramp-completion-file-name-regexp): Don't initialize in the declaration,
since it's recomputed at the end anyway.
(tramp-time-dont-know, tramp-time-doesnt-exist): Move before first use.
* lisp/net/tramp-compat.el: Don't require tramp-loaddefs any more.
(tramp-compat-tramp-syntax): Declare tramp-syntax.
* lisp/net/tramp-smb.el:
* lisp/net/tramp-rclone.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-ftp.el:
* lisp/net/tramp-adb.el: Wrap all autoloaded setup operations within
tramp--with-startup.
* lisp/net/tramp-sh.el: Wrap all autoloaded setup operations within
tramp--with-startup.
(tramp-display-escape-sequence-regexp)
(tramp-device-escape-sequence-regexp): Don't tramp-autoload any more.
(tramp-stat-marker): Use eval-and-compile rather than tramp-autoload.
* lisp/net/tramp-sudoedit.el: Wrap all autoloaded setup operations within
tramp--with-startup.
Require tramp-sh at compile-time to precompute some regexps based on
tramp-stat-marker.
* lisp/net/tramp-sh.el (tramp-sh-handle-set-file-uid-gid): Rename from
`tramp-sh-handle-set-file-uid-gid'. Handle only remote file names.
* lisp/net/tramp-sudoedit.el: New file.
* lisp/net/tramp.el (tramp-file-name-for-operation): Handle also
`tramp-set-file-uid-gid'.
(tramp-set-file-uid-gid): New defun.
(tramp-get-local-uid, tramp-get-local-gid): Cache result.
* test/lisp/net/tramp-tests.el (tramp--test-sudoedit-p): New defun.
(tramp-test20-file-modes, tramp-test22-file-times)
(tramp--test-sudoedit-p): Use it.
Glenn Morris [Sat, 15 Dec 2018 23:19:25 +0000 (15:19 -0800)]
Merge from origin/emacs-26
fa953b5 (origin/emacs-26) Fix an epg test for recent GnuPG versions (... 3015636 Document font structure layout constraints f14d574 Document font structure layout constraints f519aa1 Fix display of line numbers in empty lines beyond EOB 24b5026 Fix redisplay when a window's scroll bar or fringes are changed 5d1b158 Tiny markup fix in Elisp manual
(map-empty-p): Add method for lists which avoids computing their
entire length.
(map-contains-key): Check for alist membership by comparing against
DEFAULT argument returned by alist-get.
(map-put!): Reconcile argument name with that used in docstring.
Eli Zaretskii [Fri, 14 Dec 2018 08:43:37 +0000 (10:43 +0200)]
Fix display of line numbers in empty lines beyond EOB
* src/xdisp.c (maybe_produce_line_number): When the current
line is at EOB, use the 'line-number-current-line' face only
on that single line, but not on the rest of empty lines beyond
EOB. (Bug#33732)
Stephen Leake [Thu, 13 Dec 2018 22:45:05 +0000 (14:45 -0800)]
Get long package description for installed packages from installed files
* doc/lispref/package.texi (Archive Web Server): New; document web
server interface.
* lisp/emacs-lisp/package.el (package--get-description): New; get long
description from installed files.
(describe-package-1): Use it, improve comments. No longer writing
NAME-readme.txt.
* test/lisp/emacs-lisp/package-tests.el:
(package-test-describe-package): There is now a description for an
installed package.
(package-test-describe-installed-multi-file-package): New test.
João Távora [Thu, 13 Dec 2018 00:09:01 +0000 (00:09 +0000)]
Allow per-diagnostic overlay properties in Flymake
* lisp/progmodes/flymake.el (Version): Bump to 1.0.3.
(flymake--diag): Add new field overlay-properties.
(flymake-make-diagnostic): New optional arg overlay-properties.
(flymake--highlight-line): Use it.
Juri Linkov [Wed, 12 Dec 2018 23:17:05 +0000 (01:17 +0200)]
* lisp/vc/vc.el (vc-find-revision-no-save): Use decode-coding-inserted-region
and after-insert-file-set-coding. Don't let-bind coding-system-for-read
and coding-system-for-write. For non-interactive use, let-bind
enable-local-variables to :safe and ignore errors from set-auto-mode call.
(Bug#33567)
Paul Eggert [Wed, 12 Dec 2018 17:54:42 +0000 (09:54 -0800)]
Simplify validate_interval_range and callers
* src/textprop.c (validate_interval_range):
Remove useless code. Fix comment to match current behavior.
(set_text_properties, copy_text_properties): Simplify, as
validate_interval_range has not incremented START or END for
quite some time.
(copy_text_properties): Assume C99. Fix an unlikely
integer overflow bug if WIDE_EMACS_INT.
Stefan Monnier [Tue, 11 Dec 2018 22:54:13 +0000 (17:54 -0500)]
* lisp/emacs-lisp/map.el: Make the functions generic
Make them document their delegation relationship, to clarify when
a method is needed.
(map--dispatch): Give more info in the error message.
(map-elt): Make it generic and deprecate the 'testfn' arg.
(map-put): Make it obsolete.
(map-length): Make it work on hash-tables.
(map-apply): Define it in terms of map-do.
(map-do, map-into): Use cl-generic dispatch instead of map--dispatch.
(map-empty-p): Define it in terms of map-length.
(map-contains-key): Deprecate 'testfn'. Make it return a boolean, so
it can return non-nil even if 'key' is nil. Improve implementation to
avoid constructing an intermediate list of all keys.
(map-merge-with): Use 'eql' rather than `eq'.
(map-put!): Rename from map--put and make it generic, to replace map-put.
(map--apply-alist, map--apply-hash-table, map--apply-array):
Turn them into methods of map-apply.
(map--do-alist, map--do-array): Turn them into methods of map-do.
(map--into-hash-table): Turn it into a method of map-into.
Eli Zaretskii [Tue, 11 Dec 2018 10:32:11 +0000 (12:32 +0200)]
Fix redisplay when a window's scroll bar or fringes are changed
* src/window.c (set_window_fringes, set_window_scroll_bars):
Set windows_or_buffers_changed flag to cause immediate
thorough redisplay of a window when scroll bars or fringes are
changed. (Bug#33694)
Nobuyoshi Nakada [Tue, 11 Dec 2018 01:12:46 +0000 (03:12 +0200)]
Support Ruby block arguments ending with , or *
* lisp/progmodes/ruby-mode.el (ruby-smie--forward-token):
Recognize punctuation before "closing-|" as a separate token.
(ruby-smie--backward-token): Same (bug#33487).
* lisp/vc/vc-git.el (vc-git-log-edit-toggle-no-verify): New function.
(vc-git-log-edit-mode-map): Add binding.
(vc-git-checkin): Add an entry for that header.
Paul Eggert [Mon, 10 Dec 2018 21:40:43 +0000 (13:40 -0800)]
Fix bug when hashing reversed buffer regions
* src/fns.c (extract_data_from_object): When checking
file-coding-system-alist, calculate the coding system
correctly even if START and END are out of order.
Use bool for booleans.
Alan Mackenzie [Mon, 10 Dec 2018 14:30:40 +0000 (14:30 +0000)]
CC Mode: stop extra parens on expression causing false fontification as type
* lisp/progmodes/cc-fonts.el (c-get-fontification-context): recognize
arithmetic operator followed by several open parentheses, not just one, as not
being an argument list.
Alan Mackenzie [Mon, 10 Dec 2018 12:12:02 +0000 (12:12 +0000)]
CC Mode: stop wrongly recognizing "func(a * 9)" as "pointer to type a"
* lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): When testing for an
identifier after "a *", on failure additionally check for a digit, setting a
new flag variable got-number if one is found. In the test for CASE 18, check
this flag.
Paul Eggert [Mon, 10 Dec 2018 01:07:16 +0000 (17:07 -0800)]
Remove CHECK_FIXNUM_CAR etc.
* src/coding.c (CHECK_FIXNAT_CAR, CHECK_FIXNAT_CDR):
* src/lisp.h (CHECK_FIXNUM_CAR, CHECK_FIXNUM_CDR):
Remove. All uses removed. These seem to have been based on
the assumption that the argument cons needs to be modified,
an assumption that is incorrect for fixnums.
(Fdefine_coding_system_internal): Use CHECK_RANGED_INTEGER
instead of a special diagnostic for graphic register numbers.
Raimon Grau [Sun, 9 Dec 2018 23:42:41 +0000 (01:42 +0200)]
Guard occur against an undefined orig-line
; Not to be merged to master
* lisp/replace.el (occur-engine): Avoid inserting the current line if
orig-line is nil. This happens, for example, when reverting an occur
buffer with `list-matching-lines-jump-to-current-line' set to t.
(Bug#33476)
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.