Stephen Berman [Sat, 24 Jun 2023 08:45:10 +0000 (10:45 +0200)]
Apply quote substitution to popup choice menus
* lisp/wid-edit.el (widget-choose): Iteratively apply
substitute-command-keys to choice item text before building popup
or text buffer menu. Also fix two unnecessary uses of let*.
* etc/NEWS: Describe changes in Tramp kubernetes method.
* lisp/net/tramp-container.el (tramp-kubernetes-context)
(tramp-kubernetes-namespace): New defcustoms.
(tramp-kubernetes--completion-function): Extend for CONTAINER.POD
syntax.
(tramp-kubernetes--host-name-regexp): New defconst.
(tramp-kubernetes--container, tramp-kubernetes--pod)
(tramp-kubernetes--current-context): New defuns.
(tramp-kubernetes--current-context-data): Simplify.
(tramp-kubernetes--context-namespace): New defun.
(tramp-methods) <kubernetes>: Respect container, context and
namespace. (Bug#59797)
(tramp-container-connection-local-default-kubernetes-variables):
New defconst. Set respective connection-local variables.
* lisp/net/tramp-sh.el (tramp-config-check): New variable.
(tramp-open-connection-setup-interactive-shell): Use it.
* lisp/net/tramp.el (tramp-methods): Adapt docstring.
(tramp-extra-expand-args): New defvar.
(tramp-expand-args): Use it.
Stefan Monnier [Fri, 23 Jun 2023 15:37:12 +0000 (11:37 -0400)]
cl-defsubst: Use static scoping for args
* lisp/emacs-lisp/cl-macs.el (cl--slet): New function, partly extracted
from `cl--slet*`.
(cl--slet*): Use it.
(cl--defsubst-expand): Use it to fix bug#47552.
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-defstruct-dynbound-label):
New test.
Eli Zaretskii [Fri, 23 Jun 2023 10:50:15 +0000 (13:50 +0300)]
Revert "Avoid header line with some empty non-nil formats"
This reverts commit 4f66cbbfe520ee31ef26676e09a926217d9736fe.
This is part of removing the recently-added feature whereby
certain non-nil values of 'header-line-format' could signal
that the header line shall not be displayed. The feature is
being reverted because its advantages are very minor, whereas
the complications it causes are serious.
Eli Zaretskii [Fri, 23 Jun 2023 10:47:53 +0000 (13:47 +0300)]
Revert "; Fix last change"
This reverts commit 05c2be28a3e97bd920d0bf8c8b59ec682a420cce.
This is part of removing the recently-added feature whereby
certain non-nil values of 'header-line-format' could signal
that the header line shall not be displayed. The feature is
being reverted because its advantages are very minor, whereas
the complications it causes are serious.
Eli Zaretskii [Fri, 23 Jun 2023 10:47:33 +0000 (13:47 +0300)]
Revert "; Fix coding style in just installed change"
This reverts commit 229f0b8dd3b92827b6e0c6fc105508e8b80858f5.
This is part of removing the recently-added feature whereby
certain non-nil values of 'header-line-format' could signal
that the header line shall not be displayed. The feature is
being reverted because its advantages are very minor, whereas
the complications it causes are serious.
Eli Zaretskii [Fri, 23 Jun 2023 10:47:05 +0000 (13:47 +0300)]
Revert "; * src/window.c (window_wants_header_line): Shut up bogus GCC warning."
This reverts commit ef8485ad05dd9200b68ea8141fd44c7b976140cd.
This is part of removing the recently-added feature whereby
certain non-nil values of 'header-line-format' could signal
that the header line shall not be displayed. The feature is
being reverted because its advantages are very minor, whereas
the complications it causes are serious.
Eli Zaretskii [Fri, 23 Jun 2023 10:44:59 +0000 (13:44 +0300)]
Revert "Avoid infinite recursion in 'window_wants_header_line'"
This reverts commit 3de8ed09ab46b9922e15aaf0cc8884b41087c996.
This is part of removing the recently-added feature whereby
certain non-nil values of 'header-line-format' could signal
that the header line shall not be displayed. The feature is
being reverted because its advantages are very minor, whereas
the complications it causes are serious.
Michael Albinus [Thu, 22 Jun 2023 09:01:23 +0000 (11:01 +0200)]
Merge from origin/emacs-29
0154f5885e3 Merge branch 'emacs-29' of git.sv.gnu.org:/srv/git/emacs ... 111efb0dd7f Merge branch 'emacs-29' of git.sv.gnu.org:/srv/git/emacs ... 948b471756e Require ls-lisp in Tramp only when needed 90c03ffcd4b After minibuffer action, don't make the minibuffer current
Eli Zaretskii [Thu, 22 Jun 2023 05:32:16 +0000 (08:32 +0300)]
; Minor fixes of recently-installed regexp documentation changes
* doc/emacs/search.texi (Regexps):
* doc/lispref/searching.texi (Regexp Special): Keep the old
terminology as "a.k.a.".
(Char Classes, POSIX Regexps, POSIX Regexps): Add cross-references
to where "bracket expression" is defined. (Bug#64128)
* lisp/net/tramp.el (tramp-show-ad-hoc-proxies): New defcustom.
(tramp-make-tramp-file-name): Use it.
(tramp-make-tramp-hop-name): Don't add hop twice.
Previously (+ X 0) was reduced to (+ X) which became (* X 1) in
codegen, but this is wrong for X = -0.0 and also slightly slower.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-plus): Don't reduce an
addition to (+ X) by eliminating zeros; retain one 0 argument.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
Add test case.
* lisp/progmodes/elisp-mode.el (elisp-mode-syntax-propertize):
Use prefix syntax for ,@ to avoid the @ becoming part of a symbol
that follows.
* test/lisp/emacs-lisp/edebug-tests.el (edebug-tests-with-normal-env):
Propertise inserted Lisp code to keep the test working.
Straighten regexp postfix operator after zero-width assertion parse
The zero-width assertions \` \' \b \B were parsed in a sloppy way so
that a following postfix repetition operator could yield surprising
results. For instance, "\\b*" would act as "\\b\\*", and "xy\\b*"
would act as "\\(?:xy\\b\\)*".
Except for \` and ^, any following postfix operator now applies to the
zero-width assertion itself only, which is predictable and consistent
with other assertions, if useless in practice.
For historical compatibility, an operator character following \` and ^
always becomes a literal. (Bug#64128)
* src/regex-emacs.c (regex_compile):
Set `laststart` appropriately for each zero-width assertion instead
of leaving it with whatever value it had before.
Remove a redundant condition.
* test/src/regex-emacs-tests.el
(regexp-tests-zero-width-assertion-repetition): New test.
* doc/lispref/searching.texi (Regexp Special):
Say that repetition operators are not special after \`,
and that they work as expected after other backslash escapes.
* etc/NEWS: Announce.
Alan Mackenzie [Wed, 21 Jun 2023 15:36:56 +0000 (15:36 +0000)]
Correct handling of template markers on deletion/insertion
This fixes bug#62841.
In particular, correct the syntax-table text properties on the
remaining <...>s.
* lisp/progmodes/cc-align.el
(c-lineup-template-args-indented-from-margin): New lineup
function.
* lisp/progmodes/cc-defs.el (c-put-char-properties): New macro.
(c-search-forward-non-nil-char-property): Handle terminating
limit correctly.
* lisp/progmodes/cc-engine.el
(c-clear-<-pair-props-if-match-after)
(c-clear->-pair-props-if-match-before): Return the position
outside the matching < or >, not merely t.
(c-end-of-literal): New function.
(c-unmark-<>-around-region): New function.
(c-before-change-check-<>-operators): Refactor, calling
c-unmark-<>-around-region.
(c-<>-get-restricted): New function, extracted from
c-restore-<>-properties.
(c-restore-<>-properties): Handle ">" characters whose matching
"<" has not yet been encountered.
(c-ml-string-opener-at-or-around-point): Fix an off by one
error.
(c-backward-<>-arglist): New parameter restricted-function, a
function which calculates c-restricted-<>-arglists for the
current operation.
* lisp/progmodes/cc-fonts.el (c-font-lock-c++-using): Check
point is less than limit in the loop.
* lisp/progmodes/cc-langs.el
(c-get-state-before-change-functions)
(c-before-font-lock-functions): Add the new function
c-unmark-<>-around-region into the C++ and Java values of the
variable.
* lisp/progmodes/cc-mode.el (c-clear-string-fences)
(c-restore-string-fences): Neutralize and restore the
syntax-table properties between an unbalanced " and EOL.
* lisp/progmodes/cc-vars.el (c-offsets-alist): Put new lineup
function c-lineup-template-args-indented-from-margin into entry
for template-args-cont.
Eli Zaretskii [Wed, 21 Jun 2023 13:58:32 +0000 (16:58 +0300)]
Extend handling of prefix arg in some kmacro.el commands
* lisp/kmacro.el (kmacro-call-ring-2nd)
(kmacro-call-ring-2nd-repeat, kmacro-end-macro)
(kmacro-end-and-call-macro): Accept just "C-u" and interpret it as
a numeric argument of 4. Suggested by Al Petrofsky
<al@petrofsky.org>. (Bug#64138)
Eli Zaretskii [Wed, 21 Jun 2023 13:27:42 +0000 (16:27 +0300)]
Allow --debug-init to debug all errors in init files
* lisp/startup.el (startup--load-user-init-file): Ignore the value
of 'debug-ignored-errors' when loading init files if we were
invoked interactively with --debug-init. (Bug#64163)
Po Lu [Wed, 21 Jun 2023 02:04:31 +0000 (10:04 +0800)]
Allow displaying tool bar on the bottom of the frame
* src/xterm.c (x_clear_under_internal_border): Subtract bottom
margins before clearing bottom border.
(XTflash): Subtract bottom margins before flashing mini window.
* src/xfns.c (x_set_tool_bar_position): Allow setting different
values outside of GTK+.
(frame_geometry): Adjust inner width and height for tool bars
placed on the bottom.
* src/xdisp.c (init_xdisp): Calculate using top margins only.
* src/w32fns.c (Fw32_frame_geometry): Report tool bar position
correctly.
(w32_clear_under_internal_border): Subtract bottom margins
prior to clearing bottom border.
(w32_set_tool_bar_position): New function.
(Fw32_frame_edges): Subtract bottom tool bar from inner width and
height.
(w32_frame_parm_handlers): Add `set_tool_bar_position' parameter
handler.
* src/pgtkterm.c (pgtk_flash): Subtract bottom
margins before clearing bottom border.
(XTflash): Subtract bottom margins before flashing mini window.
* src/pgtkfns.c (frame_geometry): Set `inner_top' correctly.
(Fpgtk_set_mouse_absolute_pixel_position):
(Fpgtk_mouse_absolute_pixel_position):
(Fpgtk_page_setup_dialog):
(Fpgtk_get_page_setup): Wrap lines which cause C Mode to hang.
* src/nsterm.m (ns_clear_under_internal_border): Subtract bottom
margins before clearing bottom border.
* src/nsfns.m (ns_set_tool_bar_position): New function. Error if
arg is not top.
(ns_frame_parm_handlers): Add that as the handler for
`tool-bar-position', to prevent it from being set to an invalid
value.
* src/haikuterm.c (haiku_flash): Subtract bottom margins before
flashing mini window.
(haiku_clear_under_internal_border): Subtract bottom margins
before clearing bottom border.
* src/haikufns.c (haiku_set_tool_bar_position): Allow setting
values other than `top'.
(frame_geometry): Take bottom margin into account when calculating
inner dimensions.
* src/frame.h (struct frame): Always define `tool_bar_position'.
(fset_tool_bar_position): Define function everywhere.
(FRAME_TOOL_BAR_POSITION): Define correctly on all toolkits.
(FRAME_TOOL_BAR_TOP_HEIGHT):
(FRAME_TOOL_BAR_TOP_LINES):
(FRAME_TOOL_BAR_BOTTOM_HEIGHT):
(FRAME_TOOL_BAR_BOTTOM_LINES): New macros. Each pair returns the
tool bar dimensions only if the tool bar position is set
appropriately.
(FRAME_TOP_MARGIN, FRAME_TOP_MARGIN_HEIGHT): Only add tool bar
height if it is placed at the top of the frame.
(FRAME_BOTTOM_MARGIN, FRAME_BOTTOM_MARGIN_HEIGHT): Add ``bottom
margins''.
(FRAME_MARGINS, FRAME_MARGIN_HEIGHT): Move original margin macro
here.
(FRAME_PIXEL_HEIGHT_TO_TEXT_LINES):
(FRAME_TEXT_TO_PIXEL_HEIGHT):
(FRAME_PIXEL_TO_TEXT_HEIGHT):
(FRAME_INNER_HEIGHT): Subtract both vertical margins.
* src/frame.c (adjust_frame_size): Subtract both top and bottom
margins to determine the inner height.
(make_frame): Initialize `f->tool_bar_position' unconditionally.
* src/dispnew.c (adjust_frame_glyphs_for_window_redisplay): Place
internal tool bar on bottom if requested.
* doc/lispref/frames.texi (Frame Layout): Describe the possibility
of the tool bar being placed below the inner area of the frame.
(Layout Parameters): Describe that `tool-bar-position' is now
supported almost everywhere.
Filipp Gunbin [Tue, 20 Jun 2023 17:43:32 +0000 (20:43 +0300)]
Fix ldap-search when WITHDN is non-nil (bug#64089)
* lisp/net/ldap.el (ldap-search): Apply ldap-decode-attribute only to
attribute pairs.
(ldap-search-internal): Parse dn with the same regexp as other attrs;
use its value instead of the whole line. Include entry into result
only if valid dn is present, to avoid treating process sentinel
messages like an entry. Fix accidental match data clobbering.
Document return value format.
Andrew G Cohen [Mon, 19 Jun 2023 23:59:51 +0000 (07:59 +0800)]
Don't read all headers in gnus thread referral (bug#63842)
Gnus thread referral tries to add newly found articles to an existing
summary buffer. When the list of such articles is known from searching
we can speed things up by only entering these specific headers into
the dependencies table.
* lisp/gnus/gnus-sum.el (gnus-summary-refer-thread): Don't set
`gnus-read-all-available-headers' when finding articles by searching.
Paul Eggert [Mon, 19 Jun 2023 18:09:00 +0000 (11:09 -0700)]
Call them “bracket expressions” more consistently
Emacs comments and doc were inconsistent about the name used for
regexps like [a-z]. Sometimes it called them “character
alternatives”, sometimes “character sets”, sometimes “bracket
expressions”. Prefer “bracket expressions” as it is less confusing:
POSIX and most other programs’ doc uses “bracket expressions”,
“alternative” is also used in the Emacs documentation to talk about
...\|... in regexps, and “character set” normally has a different
meaning in Emacs.
Paul Eggert [Mon, 19 Jun 2023 18:09:00 +0000 (11:09 -0700)]
Document Emacs vs POSIX REs
* doc/lispref/searching.texi (Longest Match):
Rename from POSIX Regexps, as this section
is about longest-match functions, not about POSIX regexps.
(POSIX Regexps): New section.
This condition didn't have any visible effect (as ^ is not a
repetition operator); all it did was to generate slightly worse regexp
bytecode for out-of-place (literal) ^ in the midst of literal
characters (bug#64128).
Stefan Monnier [Sat, 17 Jun 2023 22:05:33 +0000 (18:05 -0400)]
pp-fill: Fix tests breakage
* lisp/emacs-lisp/pp.el (pp-to-string, pp-buffer, pp): Preserve old
behavior of (almost always) returning a trailing newline.
* test/lisp/emacs-lisp/pp-tests.el (pp-print-quote): Adjust tests, now
that `pp-to-string` always returns a trailing newline, rather than only
most of the time.
* test/lisp/emacs-lisp/backtrace-tests.el
(backtrace-tests--single-and-multi-line): Make the test less sensitive
to the choice of what is "pretty".
Stefan Monnier [Fri, 16 Jun 2023 17:31:13 +0000 (13:31 -0400)]
pp.el (pp-default-function): New custom var
* lisp/emacs-lisp/pp.el (pp-use-max-width): Make obsolete.
(pp-default-function): New custom var.
(pp--object, pp--region): New helper functions.
(pp-29): New function, extracted from `pp-to-string`.
(pp-to-string): Add `pp-function` arg and obey `pp-default-function`.
(pp-28): New function, extracted from `pp-buffer`.
(pp-buffer): Rewrite, to obey `pp-default-function`.
(pp): Obey `pp-default-function`.
(pp-emacs-lisp-code): Add new calling convention to apply it to a region.
(nth 2 ppss) can be absent but not incorrect, so don't recompute ppss
for (nth 2 ppss) when (nth 2 ppss) is already provided.
When calling `lisp-indent-line` on all the lines in a region, this
sometimes introduced a gratuitous O(N²) complexity.
This was originally installed on 2023-06-17 in the emacs-29 release
branch and later reverted. The intention is to backport it after
Emacs 29.1 is released.
The shy groups were caught by modified versions of the GNU ELPA
packages xr and relint:
- https://github.com/mattiase/xr/pull/6
- https://github.com/mattiase/relint/pull/14
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--s-p-query): Quote special
character in regexp.
* lisp/progmodes/java-ts-mode.el (java-ts-mode--font-lock-settings):
* lisp/progmodes/js.el (js--plain-method-re):
(js--treesit-font-lock-settings):
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--font-lock-settings):
* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--font-lock-settings): Replace character
alternative [\\d], which matches '\' or 'd', with the most likely
intention [0-9]. Fix shy groups mistyped as optional colons.
Remove unneeded numbered :match group in rust-ts-mode (bug#64019).
Alan Mackenzie [Sat, 17 Jun 2023 16:14:14 +0000 (16:14 +0000)]
After minibuffer action, don't make the minibuffer current
This fixes bug#63967.
* src/minibuf.c (minibuffer_unwind): After restoring the next
minibuffer outwards to the mini window (when
enable-recursive-minibuffers is non-nil), don't call
Fset_frame_selected_window, which used to set the current
window to be the mini window.
The shy groups were caught by modified versions of the GNU ELPA
packages xr and relint:
- https://github.com/mattiase/xr/pull/6
- https://github.com/mattiase/relint/pull/14
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--s-p-query): Quote special
character in regexp.
* lisp/progmodes/java-ts-mode.el (java-ts-mode--font-lock-settings):
* lisp/progmodes/js.el (js--plain-method-re):
(js--treesit-font-lock-settings):
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--font-lock-settings):
* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--font-lock-settings): Replace character
alternative [\\d], which matches '\' or 'd', with the most likely
intention [0-9]. Fix shy groups mistyped as optional colons.
Remove unneeded numbered :match group in rust-ts-mode (bug#64019).
These issues were caught by modified versions of the GNU ELPA
packages xr and relint:
- https://github.com/mattiase/xr/pull/6
- https://github.com/mattiase/relint/pull/14
* lisp/gnus/gnus-art.el (gnus-parse-news-url): Remove redundant
numbered group and calls to match-string.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--c-or-c++-regexp): Fix shy
group mistyped as optional colon (bug#64019#29).
* lisp/vc/vc-git.el (vc-git-annotate-time): Ditto. Also fix
timezone parsing by using iso8601-parse (bug#64069).
* test/lisp/vc/vc-git-tests.el (vc-git-test-annotate-time): New
test.
Jens Schmidt [Thu, 15 Jun 2023 22:04:04 +0000 (00:04 +0200)]
Fix parsing of dn line if WITHDN is non-nil
Function `ldap-search' errors out with `wrong-type-argument listp'
when called with WITHDN non-nil.
* lisp/net/ldap.el (ldap-search-internal): Parse the dn line
correctly so that `ldap-search' can grok it. (Bug#64089)
Correct conversion of strings to tree-sitter query syntax
The treesitter query syntax for string literals differs from that of
Elisp so we cannot just use the Lisp printer (bug#64017).
* src/treesit.c (treesit_query_string_string): New function.
(Ftreesit_pattern_expand): Use it.
* test/src/treesit-tests.el (treesit-query-api): Add test case.
Tony Zorman [Sat, 3 Jun 2023 12:23:19 +0000 (14:23 +0200)]
eshell-next-prompt: More precisely navigate to the prompt (bug#63748)
* lisp/eshell/em-prompt.el (eshell-next-prompt): Navigate to the
current prompt more accurately by using text properties instead of
going to the beginning of the line. This is important for multiline
prompts, as they don't necessarily start at the beginning of the
current line.
* test/lisp/eshell/em-prompt-tests.el
(em-prompt-test--with-multiline):
Execute a given body with a multiline prompt.
(em-prompt-test/next-previous-prompt-with):
(em-prompt-test/forward-backward-matching-input-with):
Helper functions for code reuse.
(em-prompt-test/forward-backward-matching-input):
(em-prompt-test/next-previous-prompt):
Rewrite in terms of the appropriate helper functions.
(em-prompt-test/next-previous-prompt-multiline):
(em-prompt-test/forward-backward-matching-input-multiline):
Add multiline variants of existing tests.
Eli Zaretskii [Thu, 15 Jun 2023 07:08:55 +0000 (10:08 +0300)]
Fix subscripts in the Calc manual
* doc/misc/calc.texi (Musical Notes): Use @sub instead of TeX-only
'_' notation. For the details, see the discussion in
https://lists.gnu.org/archive/html/emacs-devel/2023-06/msg00096.html.
Handle point not at EOB in minibuffer-choose-completion
Without this change, only the minibuffer contents before point are
cleared when a completion is chosen, which results in stray text when
point is in the middle of the minibuffer.
After this change, we heuristically decide either to clear the whole
buffer or only part of it, taking into account the location of point.
* lisp/minibuffer.el (minibuffer-completion-help): Use point when
calculating completion-base-affixes. (Bug#62700)
* doc/lispref/positions.texi (List Motion): Incorporate more
accurate description of treesit-defun-type-regexp from
'(elisp) Tree-sitter Major Modes', replacing that duplicate
entry (bug#64018).
* doc/lispref/parsing.texi (Parsing Program Source)
(Language Grammar, Using Parser, Retrieving Nodes)
(Accessing Node Information, Pattern Matching, Multiple Languages):
(Tree-sitter Major Modes):
* doc/lispref/modes.texi (Parser-based Font Lock): Improve wording,
grammar, punctuation, and markup. Fix typos.
(Parser-based Indentation): Ditto. Document indent rule presets
field-is, catch-all, nth-sibling, grand-parent, and
great-grand-parent.
Move quoted lambda funarg check and expand coverage
* lisp/emacs-lisp/macroexp.el (macroexp--expand-all):
Move check for incorrectly quoted lambda arguments from here...
* lisp/emacs-lisp/bytecomp.el (byte-compile-form):
... to here, which should provide more detection opportunities.
Expand the set of functions for which this check is performed, now
also for some keyword arguments.
Robert Pluim [Mon, 5 Jun 2023 09:57:03 +0000 (11:57 +0200)]
Don't feed the awk scripts into themselves
* admin/unidata/Makefile.in (${unidir}/charscript.el,
${unidir}/emoji-zwj.el): Define variables for the required sources and
pass those to awk instead of $^, since the latter includes the awk
script itself.