Philipp Stephani [Wed, 30 Dec 2020 23:05:14 +0000 (00:05 +0100)]
Fix a potential unit test breakage on GNU/Linux.
* test/src/process-tests.el
(process-tests/fd-setsize-no-crash/make-process): Allow special exit
codes that can happen if terminal setup fails in the child process.
Philipp Stephani [Wed, 30 Dec 2020 21:33:22 +0000 (22:33 +0100)]
Consistently check for FD_SETSIZE overflow.
Previously this was only checked in a few places. Now assert that
file descriptors are within the expected range whenever we'd otherwise
introduce undefined behavior.
* src/process.c (add_read_fd, add_process_read_fd, delete_read_fd)
(recompute_max_desc, delete_write_fd, compute_input_wait_mask)
(compute_non_process_wait_mask, compute_non_keyboard_wait_mask)
(compute_write_mask, clear_waiting_thread_info)
(update_processes_for_thread_death, Fset_process_thread)
(create_process, create_pty, Fmake_pipe_process)
(Fprocess_datagram_address, Fset_process_datagram_address)
(Fmake_serial_process, finish_after_tls_connection)
(connect_network_socket, deactivate_process)
(server_accept_connection, wait_reading_process_output)
(read_process_output, read_and_dispose_of_process_output)
(send_process, Fcontinue_process, Fprocess_send_eof)
(Fprocess_filter_multibyte_p, keyboard_bit_set)
(add_timer_wait_descriptor, setup_process_coding_systems): Add
assertions to document and check that file descriptors are within the
expected range when used as file descriptor set elements or array
subscripts.
Philipp Stephani [Wed, 30 Dec 2020 21:28:06 +0000 (22:28 +0100)]
Extend and overhaul FD_SETSIZE overflow tests.
Instead of trying to generate the right number of processes,
pre-create lots of unused pipe processes until creation fails. Extend
the tests to the 'pty' connection type and other kinds of process
objects.
* test/src/process-tests.el (process-tests--ignore-EMFILE)
(process-tests--with-buffers, process-tests--with-processes)
(process-tests--with-many-pipes, process-tests--with-temp-file)
(process-tests--with-temp-directory): New helper macros.
(process-tests/fd-setsize-no-crash/make-process): Renamed from
'process-tests/fd-setsize-no-crash'. Fail on timeout. Also test the
'pty' connection type. Pre-create lots of pipe processes so we reach
the FD_SETSIZE limit faster. Ignore EMFILE more precisely, if
possible.
(process-tests/fd-setsize-no-crash/make-pipe-process)
(process-tests/fd-setsize-no-crash/make-network-process)
(process-tests/fd-setsize-no-crash/make-serial-process): New tests
that test FD_SETSIZE limits for other kinds of processes.
(process-tests--EMFILE-message): New helper function and cache
variable.
(process-tests--new-pty): New helper function.
Dmitry Gutov [Wed, 30 Dec 2020 11:48:45 +0000 (13:48 +0200)]
Add 'project-relative' as value for 'xref-file-name-display'
* lisp/progmodes/xref.el (xref-file-name-display): Document new value.
(xref-location-group ((l xref-file-location))): Handle the new value.
(xref--project-root): Extract from the default method of
'xref-backend-references' so it can be used in above's new code.
Also fix an old bug in the "backward compat" branch.
* lisp/progmodes/xref.el (xref--project-root-memo): New variable.
* test/lisp/progmodes/xref-tests.el: Add test cases for the three
possible settings of 'xref-file-name-display'.
Juri Linkov [Wed, 30 Dec 2020 09:54:01 +0000 (11:54 +0200)]
Add variables read-char-choice-use-read-key and y-or-n-p-use-read-key
* lisp/subr.el (read-char-choice-use-read-key): New variable.
(read-char-choice): Use read-char-from-minibuffer when
read-char-choice-use-read-key is nil.
(y-or-n-p-use-read-key): New variable.
(y-or-n-p): Restore old code that calls read-key to use it when
y-or-n-p-use-read-key is non-nil.
* lisp/dired-aux.el (dired--no-subst-ask, dired-query):
* lisp/files.el (files--ask-user-about-large-file)
(hack-local-variables-confirm):
* lisp/userlock.el (ask-user-about-supersession-threat):
* lisp/wid-edit.el (widget-choose): Revert to use read-char-choice
instead of read-char-from-minibuffer.
Juri Linkov [Wed, 30 Dec 2020 09:30:57 +0000 (11:30 +0200)]
In Isearch bind 'C-s M-y' to isearch-yank-pop-only with old code (bug#45483)
* lisp/isearch.el (isearch-menu-bar-yank-map, isearch-mode-map):
(isearch-forward): Use isearch-yank-pop-only instead of isearch-yank-pop.
(isearch-yank-pop): Mention isearch-yank-pop-only.
(isearch-yank-pop-only): New command with old body from Emacs 27.
* test/lisp/progmodes/xref-tests.el (xref-tests-data-dir):
Rename to 'xref-tests--data-dir'.
(xref-tests--matches-in-data-dir, xref-tests--locations-in-data-dir):
New functions. Factored out from test cases and updated usage sites
to use them.
Eli Zaretskii [Tue, 29 Dec 2020 19:30:59 +0000 (21:30 +0200)]
A better fix for process-tests on MS-Windows
* src/w32.c (pipe2): When forcibly closing pipe handles due to
overflow of FD_SETSIZE, set the handles to -1, to avoid assertion
violations in emacs_close.
* test/src/process-tests.el (process-tests/fd-setsize-no-crash):
No need to skip this test anymore.
Eli Zaretskii [Tue, 29 Dec 2020 18:41:46 +0000 (20:41 +0200)]
Fix process-tests on MS-Windows
* test/src/process-tests.el (process-tests/fd-setsize-no-crash):
Skip this test on windows-nt systems, as we cannot use more than
FD_SETSIZE file descriptors there: if we try, we crash.
Each menu entry now has the key binding in a right-aligned column, as
an attempt to improve readability. Previously the keys were given in
brackets immediately following the menu string.
* src/nsmenu.m ([EmacsMenu parseKeyEquiv:]): Remove.
(skipspc): New helper function.
([EmacsMenu addItemWithWidgetValue:]): Add attributes argument.
Use attributed title string. Don't special-case Super bindings.
([EmacsMenu fillWithWidgetValue:]): Compute maximum width. Prepare
attributes for title.
Michael Albinus [Tue, 29 Dec 2020 14:36:38 +0000 (15:36 +0100)]
Sync with Tramp 2.5.0
* doc/misc/trampver.texi:
* lisp/net/trampver.el: Change version to "2.5.0".
* test/lisp/net/tramp-tests.el
(tramp--test--deftest-direct-async-process): Check, that
`make-process' supports file name handlers. Suppress
`internal-default-process-sentinel'.
(tramp--test-async-shell-command): Set `proc' proper.
(tramp-test32-shell-command-direct-async): Tag it :unstable.
* src/xdisp.c (display_string): Revert adding the additional
ignore_text_properties parameter -- it was already covered by the
other mix of parameters.
* lisp/progmodes/cc-langs.el (c-vsemi-status-unknown-p-fn): Reword
docstring to fit within 80 columns and silence the corresponding
byte-compiler warning (bug#44858).
Allow mixing attributes and comments in the diary file
* lisp/calendar/diary-lib.el (diary-face-attrs): The attributes
don't have to be at the end of the line -- there may be ##warntime
or other comments (bug#19965).
João Távora [Mon, 28 Dec 2020 09:20:17 +0000 (09:20 +0000)]
Robustify completion match scoring for optimized patterns
Fixes: bug#42149
The function completion-pcm--hilit-commonality, which propertizes and
scores a previously confirmed match, expected its PATTERN argument to
match the strings of COMPLETIONS entirely (i.e. up to the string's
very end). But sometimes the ending wildcard, represented by the
'any' atom in PATTERN, is optimized away by
completion-pcm--optimize-pattern. Although this is mostly benign in
terms of highlighting commonality, it leads to incorrect score values.
In this change, we ensure that completion-pcm--hilit-commonality is
aware of this exception and isn't affected by it. We also document
the function a bit better and simplify its workings.
Originally reported by Dario Gjorgjevski <dario.gjorgjevski@gmail.com>
Alan Mackenzie [Mon, 28 Dec 2020 20:42:25 +0000 (20:42 +0000)]
CC Mode: Add newish AWK Mode facilities, as used in gawk-4.
* lisp/progmodes/cc-awk.el (c-awk-font-lock-invalid-namespace-separators):
New function.
(c-awk-context-expand-fl-region): New function.
(awk-font-lock-keywords): Enhance handling of function declarations to include
:: tokens. Fontify new system variable names FPAT, FUNCTAB, PREC, ROUNDMODE,
SYNTAB. Fontify new keywords BEGINFILE and ENDFILE. Fontify new system
functions asorti, dcngettext, isarray, patsplit, typeof. Fontify the new
directives @include, @load, @namespace. Call
c-awk-font-lock-invalid-namespace-separators as a matcher.
* lisp/progmodes/cc-fonts.el (top level): No longer require 'cc-awk.
* lisp/progmodes/cc-langs.el (c-before-context-fontification-functions): Give
AWK the value c-awk-context-expand-fl-region rather than nil.
* lisp/progmodes/cc-mode.el (top level): Declare awk-mode-syntax-table as a
variable.
Stefan Monnier [Mon, 28 Dec 2020 19:58:39 +0000 (14:58 -0500)]
* lisp/minibuffer.el: Avoid consecutive `any` in completion patterns
(completion-pcm--optimize-pattern): Turn multiple consecutive
occurrences of `any` into just a single one.
Suggested by Dario Gjorgjevski <dario.gjorgjevski@gmail.com>.
Glenn Morris [Mon, 28 Dec 2020 19:03:30 +0000 (11:03 -0800)]
Fix package tests for tetris no longer existing as a package
* test/lisp/emacs-lisp/package-tests.el
(package-test-list-filter-by-name, package-test-list-clear-filter):
Use ansi-color instead of tetris, which no longer has a version:.
Alan Third [Mon, 28 Dec 2020 15:02:39 +0000 (15:02 +0000)]
Fix crash in NS menu code
* src/nsmenu.m (ns_update_menubar): Don't assume that the top level
menus are correct when populating the submenus.
(free_frame_menubar): Clear the menu.
([EmacsMenu removeAllItems]): Actually remove all menu items.
Stefan Kangas [Sun, 6 Dec 2020 11:44:19 +0000 (12:44 +0100)]
Make byte-compiler warn about wide docstrings
* lisp/emacs-lisp/bytecomp.el (byte-compile--wide-docstring-p):
(byte-compile-docstring-length-warn): New defuns.
(byte-compile-docstring-max-column): New defcustom.
(byte-compile--wide-docstring-substitution-len): New variable.
(byte-compile-warning-types, byte-compile-warnings): New value
'docstrings'.
(byte-compile-file-form-autoload, byte-compile-file-form-defvar):
(byte-compile-file-form-defvar-function, byte-compile-lambda):
(byte-compile-defvar, byte-compile-file-form-defalias): Warn about too
wide docstrings. (Bug#44858)
Dmitry Gutov [Mon, 28 Dec 2020 00:30:09 +0000 (02:30 +0200)]
Rename and document the built-in xref-show-definitions-function's
* lisp/progmodes/xref.el (xref-show-definitions-buffer): Rename
from 'xref--show-defs-buffer'.
(xref-show-definitions-buffer-at-bottom): Rename from
'xref--show-defs-buffer-at-bottom'.
Alan Third [Wed, 23 Dec 2020 20:12:02 +0000 (20:12 +0000)]
Remove NS menu synthesized events (bug#44333)
Remove the frame tracking stuff as it's not used for anything, and
move the update tracking into the EmacsMenu class.
* src/nsmenu.m (ns_update_menubar): Copy the parsing code from xmenu.c
and rework the NS specific code around to update the existing menus
instead of rebuilding them completely.
(ns_activate_menubar):
([EmacsMenu trackingNotification:]):
([EmacsMenu menuWillOpen:]):
([EmacsMenu menuDidClose:]): Remove unused functions.
([EmacsMenu menuNeedsUpdate:]): Remove menu tracking code and add code
to check whether an update is required.
([EmacsMenu fillWithWidgetValue:]):
([EmacsMenu addSubmenuWithTitle:]):
([EmacsMenu initWithTitle:]): Remove references to frame.
([EmacsMenu setFrame:]): Remove method.
([EmacsMenu clear]): Rename to removeAllItems.
([EmacsMenu removeAllItems]): Use built-in removeAllItems, if
available.
(syms_of_nsmenu): Remove tracking code.
* src/nsterm.m (ns_check_menu_open):
(ns_check_pending_open_menu):
(ns_create_terminal): Remove unused functions.
(ns_term_init): Get rid of menu tracking.
* src/nsterm.h (EmacsMenu): Remove frame, add needsUpdate and update
method definitions.
Daniel Martín [Sun, 27 Dec 2020 08:04:56 +0000 (09:04 +0100)]
Improve "find definition" in *Help* buffers
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol): If
our regexp algorithm could not find a location for the symbol
definition, resort to find-function--search-by-expanding-macros.
* test/lisp/emacs-lisp/find-func-tests.el: Add a automatic test for a
function and variable generated by a macro.
* etc/NEWS: Advertise the improved functionality (bug#45443).
* src/fns.c (Flength): Mention them in the doc string.
(length_internal): New function.
(Flength_less, Flength_greater, Flength_equal): New defuns.
(syms_of_fns): Sym them.
Stefan Monnier [Sat, 26 Dec 2020 17:21:17 +0000 (12:21 -0500)]
* lisp/forms.el (forms--run-functions): New function
(forms--intuit-from-file, forms-save-buffer): Use it.
(forms-mode): Use it to fix regression.
Remove always-true test. Fix incorrect uses of `fboundp`.
(forms--iif-hook): Use `add-hook`.
(forms--iif-post-command-hook): Use `remove-hook` and fix typo.
(forms--debug): Use `mapconcat`.
Eli Zaretskii [Sat, 26 Dec 2020 08:23:04 +0000 (10:23 +0200)]
Fix messages with plural forms in todo-mode.el
* lisp/calendar/todo-mode.el (todo-move-item, todo-item-undone)
(todo-category-completions): Use 'ngettext' instead of hard-coding
plural forms by hand.
Paul Eggert [Sat, 26 Dec 2020 03:16:27 +0000 (19:16 -0800)]
Fix issues with lib/malloc out-of-dir builds
Problem reported by Mattias Engdegård in:
https://lists.gnu.org/r/emacs-devel/2020-12/msg01626.html
* configure.ac: If the scratch_buffer module is enabled, create
lib/malloc and (if doing dependencies) lib/deps/malloc.
* lib/Makefile.in (DEPFLAGS) [AUTO_DEPEND]: No longer any need to
squash lib dependencies into a single directory.
(clean): Also remove */*.o and $(DEPDIR)/*/*.d, to clean out
malloc/*.o and deps/malloc/*.d. Just remove *.d files in
dependencies so that rm does not complain about not being able to
remove deps/malloc.
(extraclean): Also remove malloc, if it is empty.
Fix package reloading problems on systems with symlinks
* lisp/emacs-lisp/package.el (package--files-load-history): We're
comparing the truenames, so ensure that we've using that
everywhere. This fixes problems when there's symlinks in the paths.
Refactor package--list-loaded-files for easier debuggability
* lisp/emacs-lisp/package.el (package--files-load-history)
(package--list-of-conflicts): Factor out from...
(package--list-loaded-files): ... this function for easier
debuggability.
Glenn Morris [Fri, 25 Dec 2020 18:36:48 +0000 (10:36 -0800)]
Merge from origin/emacs-27
5d46593568 Support build of Emacs on ARM Macos machines 7f8793e5f1 Update to Org 9.4.4 7b3367a0b5 * lisp/so-long.el: Decrease use of passive voice. a90836c638 * doc/misc/efaq.texi (New in Emacs 27): Add section. 711fe70dd8 * doc/misc/efaq.texi (Latest version of Emacs): Bump version. 52b30834fb * lisp/face-remap.el (face-remap-set-base): Doc fix. (Bug... b3fe0ac62e Correct argument order in comment