Jim Porter [Sat, 1 Apr 2023 04:32:44 +0000 (21:32 -0700)]
; Add tests for synchronous processes in Eshell
Normally, Eshell only uses synchronous processes on MS-DOS, so this is
hard to test. To get around this, let the tests explicitly request
synchronous processes.
* lisp/eshell/esh-proc.el (eshell-supports-asynchronous-processes):
New variable...
(eshell-gather-process-output): ... use it, and remove some incorrect
code updating Eshell's internal markers (the async code path doesn't
do this, so neither should the sync path).
* lisp/eshell/esh-cmd.el (eshell-execute-pipeline): Use
'eshell-supports-asynchronous-processes'.
* test/lisp/eshell/esh-proc-tests.el
(esh-proc-test/emacs-command): New function.
(esh-proc-test/emacs-echo, esh-proc-test/emacs-upcase): New variables.
(esh-proc-test/synchronous-proc/simple/interactive)
(esh-proc-test/synchronous-proc/simple/command-result)
(esh-proc-test/synchronous-proc/pipeline/interactive)
(esh-proc-test/synchronous-proc/pipeline/command-result): New tests.
Jim Porter [Sun, 19 Mar 2023 02:18:28 +0000 (19:18 -0700)]
Avoid shadowing variables in some Eshell command forms
* lisp/eshell/esh-cmd.el (eshell-rewrite-for-command): Make
'for-items' an uninterned symbol.
(eshell-as-subcommand): Correct docstring.
(eshell-do-command-to-value): Mark obsolete.
(eshell-command-to-value): Move binding of 'value' outside of the
macro's result, and remove call to 'eshell-do-command-to-value'.
Andrew G Cohen [Thu, 9 Mar 2023 08:05:31 +0000 (16:05 +0800)]
Reset 'gnus-current-window-configuration' on edit-form exit.
* lisp/gnus/gnus.el: New variable gnus-prev-cwc.
* lisp/gnus/gnus-art.el (gnus-article-edit-mode):
New local variable gnus-prev-cwc.
(gnus-article-edit-article): Store original
gnus-current-window-configuration as gnus-prev-cwc.
(gnus-article-edit-done, gnus-article-edit-exit): Restore
gnus-current-window-configuration from gnus-prev-cwc.
* lisp/gnus/gnus-eform.el (gnus-edit-form-mode):
New local variable gnus-prev-cwc.
(gnus-edit-form): Store original
gnus-current-window-configuration as gnus-prev-cwc.
(gnus-edit-form-done, gnus-edit-form-exit): Restore
gnus-current-window-configuration from gnus-prev-cwc.
Andrew G Cohen [Sun, 13 Mar 2022 23:59:25 +0000 (07:59 +0800)]
Use completion when mark limiting in gnus summary buffers
* lisp/gnus/gnus-sum.el (gnus-summary-limit-to-marks)
(gnus-summary-limit-exclude-marks): Use completing-read to complete on
marks in the current summary buffer.
Andrew G Cohen [Sun, 13 Mar 2022 23:47:39 +0000 (07:47 +0800)]
Track article while moving between gnus groups
* lisp/gnus/gnus-sum.el (gnus-current-move-article): New variable to
track article while moving.
(gnus-summary-move-article): Set gnus-current-move-article when
moving/copying/crossposting or respooling.
Use memcpy for loading unaligned words on platforms where this can be
done efficiently. This guards against problems arising from future
compiler autovectorisation improvements that might cause instructions
that require aligned addresses to be emitted, and should also work
with an address sanitiser enabled.
* src/fns.c (HAVE_FAST_UNALIGNED_ACCESS): Only define when optimising.
(load_unaligned_size_t): New.
(Fstring_lessp): Use load_unaligned_size_t.
* src/lisp.h (UNALIGNED_LOAD_SIZE): Remove now unused macro.
Bob Rogers [Fri, 31 Mar 2023 07:57:32 +0000 (09:57 +0200)]
Allow old input to include continuation lines in shell-mode
* lisp/shell.el (shell-get-old-input-include-continuation-lines): New
defcustom (default nil).
(shell-get-old-input): New function. Like
'comint-get-old-input-default' but include all continuation lines if
'shell-get-old-input-include-continuation-lines' is non-nil.
(shell-mode): Install shell-get-old-input. (Bug#61069)
Michael Albinus [Wed, 29 Mar 2023 18:22:04 +0000 (20:22 +0200)]
Rework zeroconf integration into tramp-gvfs.el
* lisp/net/tramp-gvfs.el (tramp-gvfs-enabled): Do not check for
:system bus.
(tramp-gvfs-mounttypes): New defconst.
(tramp-gvfs-maybe-open-connection): Use it.
(top): Call zeroconf only when :system bus is available.
(unwind-protect PROT-FORM) UNWIND-FORMS ; also oops
or entirely forgotten for that matter. Warning about this makes
sense, and the warning can always be silenced by removing the
`unwind-protect` altogether if it shouldn't be there in the first
place.
Dmitry Gutov [Tue, 28 Mar 2023 22:08:55 +0000 (01:08 +0300)]
ruby-ts-mode: Rehash which nodes should be treated as sexps
* lisp/progmodes/ruby-ts-mode.el (ruby-ts-mode): Recognize smaller
syntactic elements as sexps too (bug#62416). Also do that for
heredocs, regexps and symbol arrays. But drop binary expressions
(including assignments) since they led to non-intuitive behavior.
Jim Porter [Tue, 21 Mar 2023 00:25:54 +0000 (17:25 -0700)]
Avoid parsing some Eshell forms when performing completion
During completion, we want to evaluate most Eshell forms
(e.g. variable references), but skip others (e.g. globbing,
subcommands). For globbing, we want to pass the literal glob to
Pcomplete so it can use the glob for selecting completion candidates.
For subcommands (including Lisp forms), we especially want to avoid
evaluation, since they can produce arbitary side effects! (Bug#50470)
* lisp/eshell/esh-cmd.el (eshell-allow-commands): New variable...
(eshell-commands-forbidden): New error...
(eshell-named-command, eshell-lisp-command): ... use them.
* lisp/eshell/em-cmpl.el (eshell-complete--eval-argument-form):
Disallow command forms and handle errors ourselves.
(eshell-complete-parse-arguments): Don't parse glob characters.
* test/lisp/eshell/em-cmpl-tests.el
(em-cmpl-test/parse-arguments/unevaluated-subcommand)
(em-cmpl-test/parse-arguments/unevaluated-lisp-form)
(em-cmpl-test/parse-arguments/unevaluated-inner-subcommand)
(em-cmpl-test/file-completion/glob, em-cmpl-test/command-completion)
(em-cmpl-test/subcommand-completion): New tests.
(em-cmpl-test/parse-arguments/pipeline): Remove superfluous
let-binding.
(em-cmpl-test/file-completion/after-list): Use a list variable rather
than a subexpression; the latter is no longer evaluated during
completion.
(em-cmpl-test/lisp-function-completion): Check "$(func)" syntax.
Jim Porter [Tue, 21 Mar 2023 00:25:24 +0000 (17:25 -0700)]
Simplify parsing subcommands slightly
This mainly reduces some overly-deep indentation, but also fixes some
minor issues with the "$<subcmd>" form: it unnecessarily added " >
TEMP" (we already set this later via 'eshell-create-handles'), and it
didn't properly unescape inner double quotes.
Eli Zaretskii [Tue, 28 Mar 2023 18:08:12 +0000 (21:08 +0300)]
Improve documentation of 'read-choice' and related symbols
* doc/lispref/commands.texi (Reading One Event):
* lisp/subr.el (read-char-choice-use-read-key, read-char-choice)
(read-char-choice-with-read-key, y-or-n-p-use-read-key): Improve
documentation of these functions and variables.
Eli Zaretskii [Tue, 28 Mar 2023 11:08:29 +0000 (14:08 +0300)]
; Fix incompatibility in 'display-buffer-assq-regexp'
* lisp/window.el (display-buffer-assq-regexp): Make it accept a
buffer's name again, as it did in Emacs 28. This makes computing
the buffer's name inside the function unnecessary.
(display-buffer): Always pass the buffer's name to
'display-buffer-assq-regexp'. (Bug#62417)
Jim Porter [Tue, 28 Mar 2023 03:58:55 +0000 (20:58 -0700)]
Fix expansion of globs that contain a ~USER reference
This regressed from the fix to bug#28064, and was discovered here:
<https://lists.gnu.org/archive/html/bug-gnu-emacs/2023-03/msg01744.html>.
* lisp/eshell/em-dirs.el (eshell-expand-user-reference): Let FILE be a
list, and move the implementation to...
(eshell-expand-user-reference-1): ... here.
* lisp/eshell/em-glob.el (eshell-add-glob-modifier): Remove special
handling for expanding user references; it's better to keep it in
"em-dirs.el".
Ken Brown [Sun, 26 Mar 2023 19:02:30 +0000 (15:02 -0400)]
Enable ASLR for dynamic libraries on Cygwin
This seems to avoid the fork failures described in etc/PROBLEMS
("Fork failures in a build with native compilation").
* lisp/treesit.el (treesit--install-language-grammar-1):
* lisp/emacs-lisp/comp.el (native-comp-driver-options): Add the
linker flag "-Wl,-dynamicbase" on Cygwin.
Stefan Monnier [Mon, 27 Mar 2023 21:16:59 +0000 (17:16 -0400)]
Merge from origin/emacs-29
edc460e3b6c Fix accidental backward-incompatible change (bug#62417) cbef1422fe3 ruby-ts-mode: Fix/simplify Imenu index generation a0d5fba74a6 (ruby-ts--align-chain): Use 'equal' to check for an exact...
Stefan Monnier [Mon, 27 Mar 2023 21:16:58 +0000 (17:16 -0400)]
Merge from origin/emacs-29
b08bf828605 ; Fix :version of the new defcustom d941666d859 ; Fix last change e19b7da7b09 Add 'eww-default-download-directory'. 564c26bdbeb ; Fix edebug spec for 'gv-define-simple-setter' (bug#62256)
This change makes it work again, restoring compatibility.
* lisp/subr.el (buffer-match-p): Fix and adjust docstring.
* lisp/window.el (display-buffer-alist): Adjust docstring.
(display-buffer-assq-regexp): Make good on promise of display-buffer-alist.
Dmitry Gutov [Mon, 27 Mar 2023 00:49:13 +0000 (03:49 +0300)]
ruby-ts-mode: Fix/simplify Imenu index generation
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--full-name): Drop '#'
from the end of resulting string when the node is not a method.
Support 'singleton_method' nodes.
(ruby-ts--imenu-helper): Simplify, to create a "flat" list of
entries, rather than a nested one. The previous implementation
had problems (like producing a nested structure of full-qualified
names, thus creating a lot of textual repetition), seems easier to
just follow ruby-mode's example here, at least for Emacs 29's
release.
* test/lisp/progmodes/ruby-ts-mode-tests.el (ruby-ts-imenu-index):
New test.
* lisp/emacs-lisp/package-vc.el (package-vc-register-as-project): Add
new option.
(project-remember-projects-under): Declare function for usage in
'package-vc--clone'.
(package-vc--clone): Respect 'package-vc-register-as-project'.
* etc/NEWS: Document the feature.
Ken Brown [Sat, 25 Mar 2023 20:37:51 +0000 (16:37 -0400)]
Skip failing tests on Cygwin with native compilation (bug#62450)
* test/Makefile.in (TEST_NATIVE_COMP): New variable, used to
determine whether to run tests tagged with :nativecomp. Set it to
"no" on Cygwin and to $(HAVE_NATIVE_COMP) otherwise.
* test/lisp/emacs-lisp/benchmark-tests.el (benchmark-tests): Skip
on Cygwin with native-compilation.
Phil Sainty [Sun, 26 Mar 2023 12:19:19 +0000 (01:19 +1300)]
* lisp/term.el (term-mouse-paste) Do not treat as a yank command (bug#58608)
This command sends the primary selection to the inferior process
rather than inserting it into the buffer, and it's entirely up to the
process as to whether anything at all gets inserted into the buffer as
a result, so this is not a `yank' as far as Emacs is concerned.
Evgeni Kolev [Wed, 8 Feb 2023 15:16:02 +0000 (17:16 +0200)]
Fix 'go-ts-mode's incorrect docstring inserted for methods
The docstring inserted with go-ts-mode's C-c C-d was incorrectly
prefixed with the receiver "(myStruct).":
// (myStruct).act
func (m *myStruct) act () {...}
The above docstring is not correct because the receiver "myStruct"
should not be in the docstring. This commit fixes the incorrect
behavior.
* lisp/progmodes/go-ts-mode.el (go-ts-mode--defun-name): New
optional argument SKIP-PREFIX.
(go-ts-mode-docstring): Call (go-ts-mode--defun-name t)
instead of (treesit-defun-name). (Bug#62371)
Eli Zaretskii [Sun, 26 Mar 2023 11:56:57 +0000 (14:56 +0300)]
; Fix last change
* lisp/net/eww.el (eww-download-directory): Rename from
'eww-default-download-directory'. All users changed. Change
:type to be a directory. Doc fix. (Bug#62435)
Phil Sainty [Sun, 14 Aug 2022 11:17:38 +0000 (23:17 +1200)]
* src/buffer.c (mode-line-format): Reorder and reformat %-construct docs
The original formatting dates back to the earliest commits. It saved
a few lines but was harder to follow. As windows are typically taller
now than the terminals of the time, this reformatting now makes better
sense for readabiity. See bug#57080.
* doc/lispref/modes.texi: Order change for consistency. Add index.
Phil Sainty [Sun, 14 Aug 2022 10:34:41 +0000 (22:34 +1200)]
* src/buffer.c (mode-line-format): Remove docs for obsolete %t construct
This documentation had been previously removed in 1999 in [1]
but was subsequently restored again in a different form in 2006
in [2] as the construct was still supported on some systems.
However it looks like it hasn't done what that documentation
indicated since [3] in 2011, and the final remnant of this
functionality was removed in [4] in 2013; so it seems clear that
it's no longer supported and shouldn't be documented now.
Phil Sainty [Sun, 14 Aug 2022 10:34:41 +0000 (22:34 +1200)]
* src/buffer.c (mode-line-format): Remove docs for obsolete %t construct
This documentation had been previously removed in 1999 in [1]
but was subsequently restored again in a different form in 2006
in [2] as the construct was still supported on some systems.
However it looks like it hasn't done what that documentation
indicated since [3] in 2011, and the final remnant of this
functionality was removed in [4] in 2013; so it seems clear that
it's no longer supported and shouldn't be documented now.
Use string-search instead of string-match[-p] when possible
* lisp/progmodes/c-ts-mode.el
(c-ts-mode--standalone-parent-skip-preproc):
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--align-chain):
* lisp/treesit.el (treesit-max-buffer-size)
(treesit--check-manual-coverage):
Use the much faster string-search when just searching for a substring.
kobarity [Sat, 25 Mar 2023 13:59:05 +0000 (22:59 +0900)]
Improve indenting "case" in Python
* lisp/progmodes/python.el (python-info-dedenter-statement-p): Do not
consider the first "case" in the block as dedenter.
* test/lisp/progmodes/python-tests.el
(python-info-dedenter-opening-block-positions-7)
(python-info-dedenter-statement-p-6): New tests. (Bug#62092)
Fix shortdoc-tests when Unicode arrows can be displayed
New shortdoc functions use Unicode arrows when possible, which caused
some tests to fail if run under such circumstances.
* test/lisp/emacs-lisp/shortdoc-tests.el
(shortdoc-tests--to-ascii): New function.
(shortdoc-function-examples-test)
(shortdoc-help-fns-examples-function-test): Call it.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode):
Accept (stack-set 1) as equivalent to (discardN-preserve-tos 1) in a
rule previously overlooked. This is usually beneficial in code size
and almost always shortens dynamic paths.
Ken Brown [Fri, 24 Mar 2023 15:35:40 +0000 (11:35 -0400)]
Fix failure of fns-tests-collate-strings on Cygwin
* test/src/fns-tests.el (fns-tests-collate-strings): Use
en_XY.UTF-8 instead of en_DE.UTF-8 as an example of an invalid
locale; en_DE.UTF-8 is actually a valid locale on Cygwin.
Note: The test will still fail on Cygwin releases < 3.5
because of a Cygwin bug. (Bug#62420)
This avoids ballooning the size of variables that contain
large text properties, such as the 'yank-handler' installed
by 'evil-yank-rectangle', which contains a list of lines in
the string.
* lisp/savehist.el (savehist-save): Enable 'print-circle'.
(Bug#62364)
Yuan Fu [Fri, 24 Mar 2023 19:19:25 +0000 (12:19 -0700)]
Handle signals gracefully in tree-sitter query predicates
Before this change, predicate functions can signal, which will cause
Ftreesit_query_capture to skip freeing the query and cursor object.
We make predicate functions return the signal data rather than
directly signal.
* src/treesit.c (treesit_predicate_capture_name_to_node)
(treesit_predicate_capture_name_to_text)
(treesit_predicate_equal)
(treesit_predicate_match)
(treesit_predicate_pred)
(treesit_eval_predicates): Return signal rather than signaling
directly.
(Ftreesit_query_capture): Check for returned signal data.
Yuan Fu [Tue, 21 Mar 2023 23:03:08 +0000 (16:03 -0700)]
Refactor Ftreesit_query_capture
Refactor some part of Ftreesit_query_capture out into separate
functions, to pave the way for other query-based functions.
* src/treesit.c (treesit_resolve_node): New function.
(treesit_initialize_query): New function.
(Ftreesit_query_capture): Refactor some part into new functions.