Block TLS handshake until TCP connection established
If a TLS handshake is attempted before the completion of an
asynchronous TCP connection has been ascertained, our local state will
not be set up correctly for further progress and the sentinel "open"
event will never be sent. This can occur if sufficient time passes
after the initiation of an async TCP connection so that by the time
`wait_reading_process_output` is called, the connection has already
been established on the TCP level.
This somewhat timing-sensitive bug has plagued HTTPS connections on
some platforms, notably macOS, for a long time (bug#49449).
* src/process.c (wait_reading_process_output): Gate the TLS handshake
by the NON_BLOCKING_CONNECT_FD flag. The flag will be cleared as soon
as the TCP socket is found to be writable.
* test/src/process-tests.el (process-async-https-with-delay):
New test.
Ken Brown [Mon, 12 Jul 2021 13:24:12 +0000 (09:24 -0400)]
Fix portability issue with make-serial-process
* src/sysdep.c (struct speed_struct): New struct.
(speeds): New static array of struct speed_struct.
(convert_speed): New static function to convert a numerical baud
rate (e.g., 9600) to a Bnnn constant defined in termios.h (e.g.,
B9600).
(serial_configure): Use convert_speed to make the call to cfsetspeed
compliant with its advertised API. (Bug#49524)
Paul Eggert [Mon, 12 Jul 2021 07:11:22 +0000 (00:11 -0700)]
Port test module to glibc 2.33
* test/Makefile.in (REPLACE_FREE, FREE_SOURCE_0, FREE_SOURCE_1):
New macros.
($(test_module)): Improve accuracy of test as to whether free.c
should be compiled; glibc 2.33 does not need it compiled and the
compilation breaks if you try, if you build with
--enable-gcc-warnings.
Paul Eggert [Mon, 12 Jul 2021 07:00:20 +0000 (00:00 -0700)]
Pacify gcc 11.1.1 -Wanalyzer-null-argument
* lib-src/etags.c (regexp): Omit member force_explicit_name,
since it’s always true. All uses removed. This lets us
remove calls to strlen (name) where GCC isn’t smart enough
to deduce that name must be nonnull.
* lib-src/movemail.c (main): Fix bug that could cause
link (tempname, NULL) to be called.
* src/emacs.c (argmatch): Break check into two ‘if’s,
since GCC doesn’t seem to be smart enough to check the single ‘if’.
* src/gtkutil.c (xg_update_menu_item): Fix bug where strcmp
could be given a NULL arg.
* src/xfont.c (xfont_list_family): Use nonnull value for dummy
initial value.
Eric Abrahamsen [Sun, 11 Jul 2021 16:00:33 +0000 (09:00 -0700)]
Further tweaks to gnus-search-query-expand-key
* lisp/gnus/gnus-search.el (gnus-search-query-expand-key): It's
possible that KEY could be partially completed (ie no longer string=
to COMP), but not all the way. Use a more accurate test. Add
docstring.
Paul Eggert [Sun, 11 Jul 2021 07:54:32 +0000 (00:54 -0700)]
Make pdumper-marking pickier
Prevent some false-positives in conservative GC marking.
This doesn’t fix any correctness bugs; it’s merely to
reclaim some memory instead of keeping it unnecessarily.
* src/alloc.c (mark_maybe_pointer): New arg SYMBOL_ONLY.
All callers changed. Check that the pointer’s tag, if any,
matches the pdumper-reported type.
Paul Eggert [Sun, 11 Jul 2021 07:27:43 +0000 (00:27 -0700)]
Fix pdumper-related GC bug
* src/alloc.c (mark_maybe_pointer): Also mark pointers
to pdumper objects, even when the pointers are tagged.
Add a FIXME saying why this isn’t enough.
Eric Abrahamsen [Sat, 10 Jul 2021 17:00:32 +0000 (10:00 -0700)]
Rewrite gnus-search-query-expand-key
* lisp/gnus/gnus-search.el (gnus-search-query-expand-key): There was a
misunderstanding about how completion-all-completion works (if the
test string can't be completed, the whole table is returned). Simplify
to use try-completion.
* test/lisp/gnus/gnus-search-tests.el (gnus-s-expand-keyword): Ensure
that an unknown/uncompletable keyword is returned unmolested.
Eric Abrahamsen [Sat, 26 Jun 2021 17:16:19 +0000 (10:16 -0700)]
Rework gnus-search-indexed-parse-output
* lisp/gnus/gnus-search.el (gnus-search-indexed-parse-output): Be more
careful about matching filesystem paths to Gnus group names; make
absolutely sure that we only return valid article numbers.
Ken Brown [Fri, 9 Jul 2021 20:37:52 +0000 (16:37 -0400)]
Skip a process test on Cygwin to avoid hang
* test/src/process-tests.el
(process-tests/fd-setsize-no-crash/make-network-process): Skip
test on Cygwin to avoid hang due to connect/accept handshake.
(Bug#49496)
Michael Albinus [Fri, 9 Jul 2021 16:14:19 +0000 (18:14 +0200)]
Further cleanup for file locks
* doc/misc/tramp.texi (Top, Configuration): Adapt node name for
file locks.
(Auto-save File Lock and Backup): Rename node name and section
title. Add file-lock to @cindex. Describe file locks.
* lisp/dired.el (dired-trivial-filenames): Add lock files.
(dired-font-lock-keywords): Move files suffixed with
`completion-ignored-extensions' up. Add lock files to these checks.
* lisp/net/tramp.el (tramp-get-lock-file, tramp-handle-unlock-file):
Use `when-let'
(tramp-lock-file-info-regexp): Rename from
`tramp-lock-file-contents-regexp'.
(tramp-handle-file-locked-p, tramp-handle-lock-file): Adapt callees.
(tramp-handle-lock-file): Set file modes of lockname.
* src/filelock.c (Qmake_lock_file_name): Declare symbol.
(make_lock_file_name): Use it. Don't check Fboundp, it doesn't
work for interned symbols.
(lock_file): Return a Lisp_Object. Don't check create_lockfiles.
Remove MSDOS version of the function.
(Flock_file): Check create_lockfiles.
(Flock_buffer): Call Flock_file.
Eli Zaretskii [Fri, 9 Jul 2021 11:37:49 +0000 (14:37 +0300)]
Partially restore the lost C-mouse-2 drop-down menu
This allows to pop up the Text Properties menu once facemenu is
loaded. It still doesn't allow C-mouse-2 clicks without manually
loading facemenu; FIXME.
* lisp/facemenu.el (global-map) <C-down-mouse-2>: Add back the
removed binding. (Bug#49466)
* lisp/net/tramp.el (tramp-file-name-for-operation):
Add `make-lock-file-name'.
(tramp-handle-unlock-file): Call `userlock--handle-unlock-error'
in case of error.
* lisp/emacs-lisp/re-builder.el (re-builder): Uses 'display-buffer'
with 'display-buffer-in-direction' to display the reb-buffer. This
allow user-customizations and using it on not splitables windows.
Add a dedication to its window so killing this buffer quit the window.
Michael Albinus [Thu, 8 Jul 2021 05:48:40 +0000 (07:48 +0200)]
Some further adaptions wrt Tramp file name locks
* lisp/files.el (files--transform-file-name): Rename from
`auto-save--transform-file-name'. Wrap with `save-match-data'.
(make-auto-save-file-name): Use it.
(make-lock-file-name): Use it. Call file name handler.
Fix font-lock of Makefile variables at the start of lines
* lisp/progmodes/make-mode.el (makefile-var-use-regex): Match
variables at the beginning of lines correctly (bug#23266). Change
suggested by Anders Lindgren <andlind@gmail.com>.
* src/filelock.c (make_lock_file_name): Protect against the
make-lock-file-name not being defined.
(lock_file, unlock_file_body, Ffile_locked_p): Return early if not
defined.
* doc/misc/efaq.texi (Not writing files to the current directory):
Mention all the three variables needed to not having Emacs writing
files to the current directory in one place.
* lisp/files.el (lock-file-name-transforms): New user option (bug#49261).
(make-auto-save-file-name): Factor out the main logic...
(auto-save--transform-file-name): ... to this new function.
(make-lock-file-name): New function that also calls the
factored-out function.
* src/filelock.c: Remove MAKE_LOCK_NAME and fill_in_lock_file_name.
(make_lock_file_name): New utility function that calls out to Lisp
to heed `lock-file-name-transforms'.
(lock_file): Use it. Also remove likely buggy call to
dostounix_filename.
(unlock_file_body, Ffile_locked_p): Also use make_lock_file_name.
* lisp/emacs-lisp/bytecomp.el (byte-compile--wide-docstring-p):
Avoid constructing an invalid regexp during byte-compilation by
limiting the number of columns to the current RE_DUP_MAX of 65535.
This protects against pathological values of fill-column, for
example (bug#49426).
Eli Zaretskii [Tue, 6 Jul 2021 17:11:51 +0000 (20:11 +0300)]
Fix right-margin display on TTY frames
* src/dispnew.c (prepare_desired_row, adjust_glyph_matrix): Adjust
the glyph pointer of the right-margin area for all windows but the
rightmost ones on TTY frames, to account for the border glyph.
(Bug#48257)
Warn when wrapping index matches with `,' after `i' in Info
* lisp/info.el (Info--current-index-alternative): New internal
variable.
(Info-warn-on-index-alternatives-wrap): New user option (bug#24282).
(Info-index-next): Use the new user option.
* etc/NEWS: Document new faces.
* lisp/net/shr.el (shr-h1, shr-h2, shr-h3, shr-h4, shr-h5, shr-h6):
Define new faces.
(shr-tag-h1): Remove inclusion of 'variable-pitch' face. Fix
bug#49433 by applying a new face directly.
(shr-tag-h2, shr-tag-h3, shr-tag-h4, shr-tag-h5, shr-tag-h6): Apply
new faces.
Allow using `mm-inline-message' from other mail clients than Gnus
* lisp/gnus/mm-view.el (mm-inline-message-prepare-function): New
variable (bug#49380).
(mm-inline-message): Use it to separate out the Gnus-specific code.
* lisp/gnus/gnus-art.el (gnus-mime-display-single): ... which has
been moved here.
* lisp/cus-edit.el (custom--revert-buffer): New function (bug#26871).
(Custom-mode): Set up reversion.
(custom--invocation-options): New variable.
(custom-buffer-create-internal): Set it.
Martin Rudalics [Mon, 5 Jul 2021 08:53:39 +0000 (10:53 +0200)]
Show hand cursor when dragging frame (Bug#49247)
* src/xdisp.c (note_mode_line_or_margin_highlight): Show hand
cursor when dragging frame with mode, tab or header line.
(syms_of_xdisp): Define Qdrag_with_mode_line,
Qdrag_with_header_line and Qdrag_with_tab_line.
Jim Porter [Sun, 4 Jul 2021 13:32:03 +0000 (15:32 +0200)]
Ensure 'call-process' interprets INFILE as a local path
* src/callproc.c (get_current_directory): Rename from
'encode_current_directory' and add boolean ENCODE flag.
(Fcall_process): Interpret INFILE relative to the working directory
from which PROGRAM is run, not 'default-directory'.
(call_process): Use 'get_current_directory'.
* src/process.c (Fmake_process): Use 'get_current_directory'.
* src/process.h (get_current_directory): Rename decl from
'encode_current_directory'.
* src/sysdep.c (sys_subshell): Use 'get_current_directory' (bug#49283).
Update IRC-related references to point to Libera.Chat
Per GNU and FSF's announcements [0, 1] of moving official IRC channels
to the Libera.Chat IRC network, as well as several Emacs-related
channels following suit [2], update IRC-related references to reflect
the migration.
Retain documentation string when customizing theme
* lisp/cus-theme.el (customize-create-theme): When editing an existing
theme, load its doc string into the description widget, instead of
replacing it with a date stamp (Bug#49274).
Don't have desktop-save-mode query on `M-x kill-emacs'
* lisp/desktop.el (noninteractive): Prompting functions should not
be added to `kill-emacs-hook' (bug#28943).
(desktop-kill): Return t so that it can be used from
`kill-emacs-query-functions'.
Peter Oliver [Wed, 9 Jun 2021 11:58:39 +0000 (12:58 +0100)]
Hide emacs-mail.desktop, emacsclient-mail.desktop from menus
These are intended for use as mailto: URL handlers, not for launching
directly, so we can reduce clutter by hiding them from a desktop
environment’s menus.
Peter Oliver [Wed, 9 Jun 2021 11:44:32 +0000 (12:44 +0100)]
Provide an emacsclient-mail.desktop
We provide both an emacs.desktop and an emacsclient.desktop, so for
consistency let’s do the same with mail.
* etc/emacs-mail.desktop: Extract suggestions for using emacsclient
from comments to create emacsclient-mail.desktop.
* etc/emacsclient-mail.desktop: Send mail using an existing Emacs
rather than starting a new one.
Iku Iwasa [Sun, 27 Jun 2021 15:36:00 +0000 (17:36 +0200)]
lisp/auth-source-pass.el: Support multiple hosts in search spec
* lisp/auth-source-pass.el (auth-source-pass-search): Accept a list of
strings for argument HOST.
(auth-source-pass--build-result): Rename argument HOST to HOSTS. Also
return value "host" from entry if it exists.
(auth-source-pass--find-match): Rename argument HOST to HOSTS. Iterate
over each host in HOSTS.
* test/lisp/auth-source-pass-tests.el: Add corresponding tests
Jim Porter [Thu, 1 Jul 2021 11:01:00 +0000 (13:01 +0200)]
Don't pass 'null-device' to 'call-process' in ispell
* lisp/textmodes/ispell.el (ispell-find-hunspell-dictionaries):
Replace 'null-device' with nil (bug#49283). This allows running a
local ispell process when editing a buffer editing a file via Tramp.
Martin Rudalics [Fri, 2 Jul 2021 08:55:42 +0000 (10:55 +0200)]
New frame parameter 'drag-with-tab-line' (Bug#49247)
The new frame parameter 'drag-with-tab-line' allows to move
frames by dragging their topmost windows' tab line with the
mouse thus achieving a behavior similar to that provided by
the 'drag-with-header-line' parameter.
* lisp/mouse.el (mouse-drag-tab-line): New function.
(mouse-drag-frame-resize, mouse-drag-frame-move)
([tab-line down-mouse-1]): Handle tab line dragging in various
keymaps.
* doc/lispref/frames.texi (Mouse Dragging Parameters): Describe
new parameter 'drag-with-tab-line'.
* etc/NEWS: Add entry for 'drag-with-tab-line'.