Stefan Kangas [Wed, 2 Dec 2020 14:56:54 +0000 (15:56 +0100)]
Remove redundant requires of 'help'
* lisp/emacs-lisp/advice.el (ad-read-advised-function):
* lisp/emacs-lisp/ert.el:
* lisp/facemenu.el: Don't require 'help'; it is preloaded since
version 18.59.
Roland Winkler [Wed, 2 Dec 2020 21:08:25 +0000 (15:08 -0600)]
bibtex-autokey-get-year: Allow both a year or date field.
* lisp/textmodes/bibtex.el (bibtex-text-in-field): Allow arg field
to be a list of fields.
(bibtex-autokey-get-year): Look for year and date field. Allow
the extended date format used by biblatex.
Stefan Kangas [Wed, 2 Dec 2020 14:43:26 +0000 (15:43 +0100)]
Remove redundant requires of faces
* lisp/htmlfontify.el:
* lisp/term/ns-win.el:
* lisp/term/w32-win.el:
* lisp/term/x-win.el:
* test/lisp/faces-tests.el: Don't require 'faces'; it is preloaded
since version 19.34.
Michael Albinus [Wed, 2 Dec 2020 15:09:20 +0000 (16:09 +0100)]
Add test to autorevert-tests.el
* test/lisp/autorevert-tests.el (auto-revert--wait-for-revert):
Handle `auto-revert--messages' being nil.
(auto-revert-test07-auto-revert-several-buffers): New test.
Stefan Kangas [Wed, 2 Dec 2020 11:50:05 +0000 (12:50 +0100)]
Remove some references to fast-lock and lazy-lock
* lisp/htmlfontify.el (hfy-copy-and-fontify-file):
* lisp/progmodes/antlr-mode.el: Remove some references to obsolete
libraries fast-lock and lazy-lock.
Fix xsdre-range-list-to-char-alternative problem with {P}
* lisp/nxml/xsd-regexp.el (xsdre-range-list-to-char-alternative):
Make (string-match (xsdre-translate "\\p{P}") "a-b") work
(bug#24093) -- the "forbidden" characters don't have to be the
first elements in a range.
Stefan Kangas [Wed, 2 Dec 2020 09:19:16 +0000 (10:19 +0100)]
Remove specific byte-compiler warnings for cl.el
* lisp/emacs-lisp/bytecomp.el (byte-compile-warning-types)
(byte-compile-warnings, byte-compile-cl-file-p)
(byte-compile-eval, byte-compile-eval-before-compile)
(byte-compile-arglist-warn, byte-compile-find-cl-functions)
(byte-compile-cl-warn, displaying-byte-compile-warnings)
(byte-compile-file-form-require, byte-compile-form): Remove all
specific cl.el warnings, as that library is now obsolete. The
regular obsoletion warnings are sufficiently discouraging.
* lisp/emacs-lisp/advice.el (ad-compile-function): Don't try to
silence the now removed warning.
* doc/lispref/tips.texi (Coding Conventions):
* doc/misc/cl.texi (Organization): Make recommendation to not use
cl.el and cl-compat.el stronger.
* lisp/obsolete/cl.el: Make alias help say that they are obsolete.
* lisp/obsolete/cl-compat.el (build-klist, safe-idiv)
(pair-with-newsyms): Silence byte-compiler.
Dmitry Gutov [Wed, 2 Dec 2020 02:28:35 +0000 (04:28 +0200)]
Improve .gitignore and project-vc-ignores handling
* lisp/progmodes/project.el (project-ignores):
Convert .gitignore entries more faithfully.
(project--vc-list-files): Convert "our" ignore entries to
"proper" globs, which is what Git pathspec requires.
Glenn Morris [Tue, 1 Dec 2020 15:50:09 +0000 (07:50 -0800)]
Merge from origin/emacs-27
9939c435c1 Return the correct suffix in eww-make-unique-file-name 17fa17be3d Save bookmarks by using `write-file' (bug#12507) 2cdf1fd261 Fix filing messages when 'rmail-output-reset-deleted-flag'... a72db8ab8b Make file copying in tramp-gvfs more robust f31cacd1ff Revert "Fix incorrect handling of module runtime and envir... cdc632fbe6 Fix incorrect handling of module runtime and environment p... c9160bda78 CC Mode: Fix error in cache handling. This fixes bug #43481
Eli Zaretskii [Mon, 30 Nov 2020 18:44:11 +0000 (20:44 +0200)]
Don't show in 'view-lossage' responses to xterm feature queries
* lisp/term/xterm.el (xterm--read-event-for-query): Prevent
recording the characters read as the xterm response to a query,
so as not to show them in 'view-lossage'. (Bug#44908)
Michael Albinus [Mon, 30 Nov 2020 12:54:29 +0000 (13:54 +0100)]
Some adaptions to tramp-tests.el
* test/lisp/net/tramp-tests.el (tramp-test-vec): Check for remote
`tramp-test-temporary-file-directory'.
(tramp-test11-copy-file, tramp-test12-rename-file):
Do not skip for tramp-gvfs.el.
(tramp--test-sh-p): Use `tramp-test-vec'.
Juri Linkov [Sun, 29 Nov 2020 19:48:01 +0000 (21:48 +0200)]
Fix MINIBUF 'nomini' arg for windmove/window-in-direction (bug#44932)
* lisp/windmove.el (windmove-display-in-direction)
(windmove-delete-in-direction, windmove-swap-states-in-direction):
Add 'nomini' as MINIBUF arg of window-in-direction.
* lisp/window.el (window-in-direction): Rename arg MINI to MINIBUF.
Update docstring from walk-window-tree.
Send MINIBUF arg to walk-window-tree unchanged.
* lisp/vc/log-view.el (log-view-commit-body): Inherit from
font-lock-comment-face. This makes expanded commit messages in
log-view look the same as they did prior to commit 1f0b929430 (consult
bug#44424) (bug#44937).
Karl Fogel [Sun, 29 Nov 2020 00:17:46 +0000 (18:17 -0600)]
Save bookmarks by using `write-file' (bug#12507)
Go back to using `write-file' to save bookmarks, instead of using
`write-region'. This means numbered backups of the bookmark file may
get made again, depending on the value of `bookmark-version-control'.
Thanks especially to Drew Adams and Eli Zaretskii for their
persistence in tracking down information relevant to this change.
Eli Zaretskii [Sat, 28 Nov 2020 17:05:18 +0000 (19:05 +0200)]
Fix filing messages when 'rmail-output-reset-deleted-flag' is non-nil
* lisp/mail/rmailout.el (rmail-output): Fix off-by-one error in
deciding when to advance to the next message under non-nil
'rmail-output-reset-deleted-flag'. (Bug#44839)
Eli Zaretskii [Sat, 28 Nov 2020 07:21:33 +0000 (09:21 +0200)]
Revert "Fix incorrect handling of module runtime and environment pointers."
This reverts commit cdc632fbe6e149318147a98cccf1b7af191f2ce8.
Those changes are too significant and non-trivial to be
suitable for a release branch at this time.
Philipp Stephani [Fri, 27 Nov 2020 18:08:55 +0000 (19:08 +0100)]
Fix incorrect handling of module runtime and environment pointers.
We used to store module runtime and environment pointers in the static
lists Vmodule_runtimes and Vmodule_environments. However, this is
incorrect because these objects have to be kept per-thread. With this
naive approach, interleaving module function calls in separate threads
leads to environments being removed in the wrong order, which in turn
can cause local module values to be incorrectly garbage-collected.
Instead, turn Vmodule_runtimes and Vmodule_environments into
hashtables keyed by the thread objects. The fix is relatively
localized and should therefore be safe enough for the release branch.
Module assertions now have to walk the pointer list for the current
thread, which is more correct since they now only find environments
for the current thread.
Also add a unit test that exemplifies the problem. It interleaves two
module calls in two threads so that the first call ends while the
second one is still active. Without this change, this test triggers
an assertion failure.
* src/emacs-module.c (Fmodule_load, initialize_environment)
(finalize_environment, finalize_runtime_unwind): Store runtime and
environment pointers in per-thread lists.
(syms_of_module): Initialize runtimes and environments hashtables.
(module_assert_runtime, module_assert_env, value_to_lisp): Consider
only objects for the current thread.
(module_gc_hash_table_size, module_hash_push, module_hash_pop): New
generic hashtable helper functions.
(module_objects, module_push_pointer, module_pop_pointer): New helper
functions to main thread-specific lists of runtime and environment
pointers.
(mark_modules): Mark all environments in all threads.
* test/data/emacs-module/mod-test.c (Fmod_test_funcall): New test
function.
(emacs_module_init): Bind it.
* test/src/emacs-module-tests.el (emacs-module-tests--variable): New
helper type to guard access to state in a thread-safe way.
(emacs-module-tests--wait-for-variable)
(emacs-module-tests--change-variable): New helper functions.
(emacs-module-tests/interleaved-threads): New unit test.
Philipp Stephani [Fri, 27 Nov 2020 18:08:55 +0000 (19:08 +0100)]
Fix incorrect handling of module runtime and environment pointers.
We used to store module runtime and environment pointers in the static
lists Vmodule_runtimes and Vmodule_environments. However, this is
incorrect because these objects have to be kept per-thread. With this
naive approach, interleaving module function calls in separate threads
leads to environments being removed in the wrong order, which in turn
can cause local module values to be incorrectly garbage-collected.
The fix isn't completely trivial: specbinding the lists wouldn't work
either, because then the garbage collector wouldn't find the
environments in other threads than the current ones, again leading to
objects being garbage-collected incorrectly. While introducing custom
pseudovector types would fix this, it's simpler to put the runtime and
environment pointers into the specbinding list as new specbinding
kinds. This works since we need to unwind them anyway, and we only
ever treat the lists as a stack. The thread switching machinery
ensures that the specbinding lists are thread-local, and that all
elements of the specbinding lists in all threads are marked during
garbage collection.
Module assertions now have to walk the specbinding list for the
current thread, which is more correct since they now only find
environments for the current thread. As a result, we can now remove
the faulty Vmodule_runtimes and Vmodule_environments variables
entirely.
Also add a unit test that exemplifies the problem. It interleaves two
module calls in two threads so that the first call ends while the
second one is still active. Without this change, this test triggers
an assertion failure.
* src/lisp.h (enum specbind_tag): Add new tags for module runtimes and
environments.
* src/eval.c (record_unwind_protect_module): New function to record a
module object in the specpdl list.
(do_one_unbind): Unwind module objects.
(backtrace_eval_unrewind, default_toplevel_binding, lexbound_p)
(Fbacktrace__locals): Deal with new specbinding types.
(mark_specpdl): Mark module environments as needed.
* src/alloc.c (garbage_collect): Remove call to 'mark-modules'.
Garbage collection of module values is now handled as part of marking
the specpdl of each thread.
* src/emacs-module.c (Fmodule_load, funcall_module): Use specpdl to
record module runtimes and environments.
(module_assert_runtime, module_assert_env, value_to_lisp): Walk
through specpdl list instead of list variables.
(mark_module_environment): Rename from 'mark_modules'. Don't attempt
to walk though current thread's environments only, since that would
miss other threads.
(initialize_environment, finalize_environment): Don't change
Vmodule_environments variable; environments are now in the specpdl
list.
(finalize_environment_unwind, finalize_runtime_unwind): Make 'extern'
since do_one_unbind now calls them.
(finalize_runtime_unwind): Don't change Vmodule_runtimes variable;
runtimes are now in the specpdl list.
(syms_of_module): Remove Vmodule_runtimes and Vmodule_environments.
* test/data/emacs-module/mod-test.c (Fmod_test_funcall): New test
function.
(emacs_module_init): Bind it.
* test/src/emacs-module-tests.el (emacs-module-tests--variable): New
helper type to guard access to state in a thread-safe way.
(emacs-module-tests--wait-for-variable)
(emacs-module-tests--change-variable): New helper functions.
(emacs-module-tests/interleaved-threads): New unit test.
Make the 'cucumber' compilation pattern work without 'omake'
When 'omake' is included in compilation-error-regexp-alist, which it
still is by default, then all other rules are modified to match with
an extra leading 6 spaces as well. The 'cucumber' pattern relied on
this in order to work as intended.
* lisp/progmodes/compile.el (compilation-error-regexp-alist-alist):
Extend the 'cucumber' pattern so that it works even when 'omake'
is not included. Move it below the 'gnu' rule so that it doesn't
match anything else.
Juri Linkov [Fri, 27 Nov 2020 09:17:12 +0000 (11:17 +0200)]
Add completion-tab-width to align prefix chars with names in read-char-by-name
* lisp/international/mule-cmds.el (mule--ucs-names-affixation):
Replace mule--ucs-names-annotation to display chars in prefixes
that implements two FIXME items.
(read-char-by-name): Let-bind completion-tab-width to 4.
Use affixation-function instead of annotation-function.
* lisp/minibuffer.el (completion-tab-width): New variable.
(completion--insert-strings): Align colwidth to tab positions
when completion-tab-width is non-nil.
* lisp/simple.el (completion-setup-function): Set tab-width to
completion-tab-width when completion-tab-width is non-nil.
* lisp/cus-edit.el (custom-variable-modified-p): Quote the value when
custom form is 'lisp (or 'mismatch) prior to comparing in order to
accommodate `custom-variable-value-create' (bug#44852).
* etc/tutorials/TUTORIAL: Don't keep referring to EDIT as if it were a
common name for the Meta key; since a few decades back it's labelled
Alt (or Option or ⌥ but those keys usually also have 'alt' engraved on
them). Similarly, CTL is practically extinct and not worth
mentioning.
Fix replace-regexp-in-string substring match data translation
For certain patterns, re-matching the same regexp on the matched
substring does not produce correctly translated match data
(bug#15107 and bug#44861).
Using a new builtin function also improves performance since the
number of calls to string-match is halved.
Reported by Kevin Ryde and Shigeru Fukaya.
* lisp/subr.el (replace-regexp-in-string): Translate the match data
using match-data--translate instead of trusting a call to string-match
on the matched string to do the job.
* test/lisp/subr-tests.el (subr-replace-regexp-in-string):
Add test cases.
* src/search.c (Fmatch_data__translate): New internal function.
(syms_of_search): Register it as a subroutine.
Alan Mackenzie [Thu, 26 Nov 2020 11:37:38 +0000 (11:37 +0000)]
CC Mode: Fix error in cache handling. This fixes bug #43481
* lisp/progmodes/cc-engine.el (c-full-pp-to-literal): Handle correctly END
being before HERE by using parse-partial-sexp to get the end of the literal
containing HERE.
Keep point in the *eldoc* buffer in eldoc-display-in-echo-area
* lisp/emacs-lisp/eldoc.el (eldoc-display-in-echo-area): Use
'save-excursion' to keep point position in *eldoc* buffer.
Suggested by Andrii Kolomoiets <andreyk.mad@gmail.com>.
Eric Abrahamsen [Wed, 25 Nov 2020 23:26:06 +0000 (15:26 -0800)]
Add "replied" -> "answered" for gnus-search imap searches
* lisp/gnus/gnus-search.el (gnus-search-imap-handle-flag): This allows
"mark:A" to be translated into "ANSWERED" and "-mark:A" to be
translated into "UNANSWERED".
Eric Abrahamsen [Sat, 14 Nov 2020 21:37:08 +0000 (13:37 -0800)]
Assume default imap TEXT search even when not using parsed queries
This behavior both better matches the previous nnir behavior, reducing
confusion for new users, and matches behavior when using parsed
queries.
* lisp/gnus/gnus-search.el (gnus-search-imap-search-keys): Make sure
this variable contains all known IMAP search keys.
(gnus-search-run-search): If the search query doesn't start with a
known search key, prepend "TEXT " to the query.
Michael Albinus [Wed, 25 Nov 2020 11:18:23 +0000 (12:18 +0100)]
Merge from origin/emacs-27
6442cdc0e4 Revert extra focus redirection in do_switch_frame (Bug#24803) fc4379f1ae Minor cleanup of tramp-tests.el on MS Windows dea3d6aa18 Fix handling of defcustom :local tag