* doc/lispref/elisp.texi (Top): Add new menu item "Outline Minor Mode"
after "Imenu".
* doc/lispref/modes.texi (Modes): Add new menu item "Outline Minor Mode"
after "Imenu".
(Major Mode Conventions): Mention "Outline Minor Mode" with @pxref.
(Outline Minor Mode): New node.
* doc/lispref/parsing.texi (Tree-sitter Major Modes): Mention
'treesit-outline-predicate' with @pxref.
* lisp/treesit.el (treesit-outline-predicate): New buffer-local variable.
(treesit-outline-predicate--from-imenu): New internal function.
(treesit-outline-search, treesit-outline-level): New functions.
(treesit-major-mode-setup): Set up treesit-outline-predicate,
outline-search-function and outline-level.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--outline-predicate):
New internal function.
(c-ts-base-mode): Set 'treesit-outline-predicate' to
'c-ts-mode--outline-predicate'.
* lisp/progmodes/heex-ts-mode.el (heex-ts-mode): Kill inherited
local variables 'outline-heading-end-regexp', 'outline-regexp',
'outline-level'.
* lisp/progmodes/lua-ts-mode.el (lua-ts-mode): Remove 'outline-regexp'.
Suggested by john muhl <jm@pub.pink>.
* lisp/textmodes/html-ts-mode.el (html-ts-mode): Kill inherited
local variables 'outline-heading-end-regexp', 'outline-regexp',
'outline-level'.
Make minibuf-tests independent of obarray hash order
* test/src/minibuf-tests.el (minibuf-tests--set-equal): New.
(minibuf-tests--all-completions)
(minibuf-tests--all-completions-pred)
(minibuf-tests--all-completions-regexp): Use it.
Eshel Yaron [Mon, 12 Feb 2024 17:38:36 +0000 (18:38 +0100)]
Support bookmarking 'project-find-regexp' results buffer
* lisp/progmodes/project.el (xref-backend-apropos)
(xref-backend-context, xref-backend-restore): New methods.
(project-find-regexp, project-or-external-find-regexp): Use
'xref-make-fetcher' instead of a bespoke fetcher function to
facilitate bookmarking the results buffer.
* lisp/progmodes/xref.el (xref-bookmark-make-record): Use
strings for 'format-spec' specifications.
(xref-bookmark-jump): Autoload it.
(xref-show-xrefs): Make DISPLAY-ACTION argument optional.
(xref-make-fetcher): Autoload, and make BUFFER and POINT
arguments optional, default to the current buffer and point.
Stefan Monnier [Mon, 12 Feb 2024 03:00:44 +0000 (22:00 -0500)]
(pcase): New `_` syntax in pred/app functions
The current syntax for functions in `app` and `pred` patterns
allows a shorthand (F ARGS) where the object being matched is
added as an extra last argument. This is nice for things like
(pred (< 5)) but sometimes the object needs to be at
another position.
Until now you had to use (pred (lambda (x) (memq x my-list)))
or (pred (pcase--flip memq my-list)) in those cases.
So, introduce a new shorthand where `_` can be used to indicate
where the object should be passed: (pred (memq _ my-list))
* lisp/emacs-lisp/pcase.el (pcase--split-pred): Document new syntax
for pred/app functions.
(pcase--funcall): Support new syntax.
(pcase--flip): Declare obsolete.
(pcase--u1, \`): Use `_` instead.
(pcase--split-pred): Adjust accordingly.
* doc/lispref/control.texi (pcase Macro): Document new syntax
for pred/app functions.
Stefan Monnier [Sun, 11 Feb 2024 23:13:27 +0000 (18:13 -0500)]
(cl--generic-describe): Fix regression introduced by fix to bug#54628
Since that fix, we made other changes (put arg names in allcaps)
which also happen to fix bug#54628, so we can remove the original fix
which was suboptimal when the type includes quotes.
* lisp/emacs-lisp/cl-generic.el (cl--generic-describe):
Don't rebind `print-quoted` to nil.
* test/lisp/emacs-lisp/cl-generic-tests.el
(cl-generic-tests--print-quoted): New test.
Stefan Monnier [Sun, 11 Feb 2024 22:43:37 +0000 (17:43 -0500)]
(pcase): Add buttons to the macros' defs in the docstring of `pcase`
* lisp/emacs-lisp/pcase.el (pcase--find-macro-def-regexp): New var.
(find-function-regexp-alist): Add entry for `pcase-macro`s.
(help-fns--signature): Move declaration to where we know it is valid.
(pcase--make-docstring): Add buttons to jump to the definition
of Pcase macros.
* lisp/emacs-lisp/compat.el: Add stub file with minimal definitions,
so that core packages, that haven't been installed from ELPA, can make
use of the public API and use more recent function signatures.
* lisp/progmodes/python.el (compat): Remove 'noerror flag, because
Compat can now be required without the real package being available.
* doc/lispref/package.texi (Forwards-Compatibility): Mention Compat
and link to the manual.
* etc/NEWS: Document change. (Bug#66554)
Eli Zaretskii [Sun, 11 Feb 2024 13:21:14 +0000 (15:21 +0200)]
Fix 'min-width' display property in 'buffer-text-pixel-size'
* src/xdisp.c (display_min_width): Don't return without doing
anything when called from the move_it_* functions. This is needed
to have functions that simulate display layout handle the
min-width display property correctly. (Bug#68374)
Mekeor Melire [Fri, 9 Feb 2024 22:30:52 +0000 (23:30 +0100)]
In Info-url-alist, add .html extension to %e format-sequence
* lisp/info.el (Info-url-for-node): Implement the change. (Bug#68970)
(Info-url-alist): Document the change.
* test/lisp/info-tests.el (test-info-urls): Adjust tests to account for
the change and add a test for the "Top" node.
* src/xdisp.c (get_glyph_string_clip_rects, remember_mouse_glyph)
(expose_area, expose_window, gui_intersect_rectangles): Cast
width or height fields in Emacs_Rectangles to int before summing
with or subtracting them from their coordinate fields, as they
are unsigned outside X, and the sign of the coordinates is thus
not preserved.
Eric Abrahamsen [Sat, 10 Feb 2024 18:33:51 +0000 (10:33 -0800)]
Fix behavior of gnus-summary-very-wide-reply with prefix arg
* lisp/gnus/gnus-msg.el (gnus-summary-very-wide-reply): If a prefix
argument has been given, the value of YANK will be a list containing the
current article number. This should not be used to retrieve a number of
work articles; that should be derived from the value of the
current-prefix-arg (or marked articles).
* doc/misc/gnus.texi: The interplay of prefix arg and marked articles is
complex; attempt to clarify.
Juri Linkov [Sat, 10 Feb 2024 17:56:39 +0000 (19:56 +0200)]
* lisp/buff-menu.el: Force other-window commands to use other window.
(Buffer-menu-other-window, Buffer-menu-switch-other-window):
Let-bind 'display-buffer-overriding-action' to
'(nil (inhibit-same-window . t))' that will force the buffer
to be displayed in another window in any case (bug#68978).
The menu item "Outlines" toggles 'outline-minor-mode' when one
of outline-search-function/outline-regexp/outline-level is defined
in the current buffer.
Michael Albinus [Sat, 10 Feb 2024 08:50:12 +0000 (09:50 +0100)]
Fix warning in tramp-register-archive-autoload-file-name-handler
* lisp/net/tramp-archive.el
(tramp-register-archive-autoload-file-name-handler): Do not use
read syntax #' for `tramp-archive-file-name-handler', it isn't
autoloaded.
Eshel Yaron [Sun, 11 Feb 2024 15:18:48 +0000 (16:18 +0100)]
Use buffer local value of 'history-add-new-input' in minibuffer
Avoid let-binding 'history-add-new-input', since that affects all nested
recursive minibuffers, and instead use a buffer-local setting in the
appropriate minibuffer.
* doc/lispref/minibuf.texi (Minibuffer History): Update.
* lisp/emacs-lisp/crm.el (completing-read-multiple): Use
'history-add-new-input' instead of manually removing raw input from
minibuffer history.
* lisp/isearch.el (isearch-edit-string)
* lisp/replace.el (query-replace-read-from)
(query-replace-read-to, read-regexp)
* lisp/simple.el (read-from-kill-ring): Set 'history-add-new-input'
locally in the minibuffer, instead of let-binding it.
* src/minibuf.c (read_minibuf): Use 'history-add-new-input' local value.
Eshel Yaron [Sat, 10 Feb 2024 16:30:27 +0000 (17:30 +0100)]
; Fix 'thing-at-point' edge case involving overlapping matches
* lisp/thingatpt.el (thing-at-point-looking-at): When finding a match
that ends before point, continue searching from the beginning of that
match, not its end, in case the match we're looking is overlapping with
this one.
* test/lisp/thingatpt-tests.el
(thing-at-point-looking-at-overlapping-matches): New test.
Mekeor Melire [Wed, 7 Feb 2024 22:00:08 +0000 (23:00 +0100)]
Add option gnus-mode-line-logo
* lisp/gnus/gnus.el (gnus-mode-line-logo): New option specifying
whether and which logo will be displayed in the mode-line.
* etc/NEWS: Announce the change.
Jim Porter [Thu, 8 Feb 2024 01:58:31 +0000 (17:58 -0800)]
Put the list of built-in Eshell commands in its own manual node
* doc/misc/eshell.texi (Built-ins): Fix capitalization of node to be
more consistent with the rest of the manual. Fix a cross reference.
List child nodes.
(List of Built-ins): New section and node.
(Defining New Built-ins): Make this a node. Fix capitalization.
* lisp/net/tramp-sh.el (tramp-actions-before-shell)
(tramp-actions-copy-out-of-band):
Use `tramp-security-key-pin-regexp'.
* lisp/net/tramp.el (tramp-security-key-pin-regexp): New defcustom.
(tramp-action-otp-password, tramp-read-passwd): Trim password prompt.
(tramp-action-show-and-confirm-message): Expand for PIN requests.
Problem reported by Collin Funk (Bug#68996).
* GNUmakefile (.): New macro.
(help): Use ‘$.’ instead of ‘$ ’.
* cross/verbose.mk.android, src/verbose.mk.in (.): New macro.
(AM_V_AR, AM_V_CC, AM_V_CXX, AM_V_CCLD, AM_V_CXXLD, AM_V_GEN):
Use ‘$.’ instead of ‘$ ’.
* lib-src/Makefile.in (install): Use ‘$.’ instead of ‘$ ’.
Liu Hui [Thu, 18 Jan 2024 04:00:00 +0000 (12:00 +0800)]
Respect the delimiter of completer in Python shell completion
* lisp/progmodes/python.el: (python-shell-completion-setup-code): Fix
the completion code of IPython. Change the return value to JSON string
and ...
(python-shell-completion-get-completions): ... simplify parsing.
(inferior-python-mode): Update docstring.
(python-shell-readline-completer-delims): New variable indicating the
word delimiters of readline completer.
(python-shell-completion-native-setup): Set the completer delimiter.
(python-shell-completion-native-get-completions): Convert output string
to completions properly.
(python-shell--get-multiline-input)
(python-shell--extra-completion-context)
(python-shell-completion-extra-context): New functions.
(python-shell-completion-at-point): Send text beginning from the line
start if the completion backend does not need word splitting. Remove
the detection of import statement because it is not needed anymore.
Create proper completion table based on completions returned from
different backends.
* test/lisp/progmodes/python-tests.el (python-tests--completion-module)
(python-tests--completion-parameters)
(python-tests--completion-extra-context): New helper functions.
(python-shell-completion-at-point-jedi-completer)
(python-shell-completion-at-point-ipython): New tests. (bug#68559)
Eshel Yaron [Fri, 9 Feb 2024 10:15:24 +0000 (11:15 +0100)]
Remove minibuffer up-to-one-word completion
Deprecate 'minibuffer-complete-word', and cease binding 'SPC' during
minibuffer completion altogether.
* lisp/minibuffer.el (minibuffer-complete-word): Turn it into an
obsolete alias of 'minibuffer-complete'.
(minibuffer-confirm-exit-commands): Remove 'minibuffer-complete-word'.
(completion--try-word-completion): Drop it.
(minibuffer-local-completion-map): Cease binding 'SPC'.
(minibuffer-local-filename-completion-map)
(completion-pcm-complete-word-inserts-delimiters): Deprecate.
(completion-pcm--string->pattern, completing-read-default): Simplify.
Paul Eggert [Wed, 7 Feb 2024 21:17:57 +0000 (13:17 -0800)]
Port better to Autoconf 2.72
* configure.ac: Set ac_cv_type_gid_t=yes to pacify Autoconf 2.72
AC_TYPE_GETGROUPS. Problem reported by Nick Bowler in:
https://lists.gnu.org/r/autoconf-patches/2024-02/msg00001.html
Stefan Monnier [Wed, 7 Feb 2024 16:20:46 +0000 (11:20 -0500)]
(file-notify--test-wait-event): Rename from `file-notify--test-read-event`
* test/lisp/filenotify-tests.el (file-notify--test-wait-event):
Rename to better reflect its purpose rather than
its implementation. Also make it return nil so callers won't be
tempted to use the return value.
* etc/NEWS: Remove superfluous mention of key binding.
* lisp/buff-menu.el (Buffer-menu--selection-message): Go back to
previous wording. It's not about what is hidden but what is shown;
the message is displayed in response to different actions.
Eli Zaretskii [Wed, 7 Feb 2024 13:33:51 +0000 (15:33 +0200)]
Don't compile lib/copy-file-range.c on MS-Windows
* nt/gnulib-cfg.mk (OMIT_GNULIB_MODULE_copy-file-range): Set to
true to avoid compiling copy-file-range.c on MS-Windows. The
function 'copy_file_range' is not used on MS-Windows, while
compiling the file triggers warnings because lib/unistd.h, where
its prototype is declared, is omitted in the MS-Windows build.
Po Lu [Wed, 7 Feb 2024 13:09:18 +0000 (21:09 +0800)]
Fix DEBUG_THREADS in the Android port
* java/org/gnu/emacs/EmacsService.java (EmacsService): New field
`mainThread'.
(onCreate): Set `mainThread' to the thread where the service's
looper executes.
(checkEmacsThread): Compare against SERVICE.mainThread.
* lisp/progmodes/elixir-ts-mode.el (elixir-ts--font-lock-settings):
Also highlight method definitions where the arguments are literal
values, not identifiers (bug#67246).
Dmitry Gutov [Wed, 7 Feb 2024 01:54:29 +0000 (03:54 +0200)]
elixir-ts-mode: Bring the faces' use closer to other ts modes
* lisp/progmodes/elixir-ts-mode.el (elixir-ts--font-lock-settings):
Rename feature 'elixir-function-name' to 'elixir-definition' and
update all deferences. Add parameters' highlighting with
font-lock-variable-name-face. Change variable references'
highlighting to use font-lock-variable-use-face.
Move the feature 'elixir-variable' from feature level 3 to level 4, to
match other ts modes (bug#67246).
Stefan Monnier [Tue, 6 Feb 2024 18:21:22 +0000 (13:21 -0500)]
(loaddefs-generate--parse-file): Be a bit more defensive
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--parse-file):
Don't fail in case of an error while generating the prefixes.
(loaddefs-generate--compute-prefixes): Don't burp when
`read-from-string` returns something else than a symbol.
Change hash range reduction from remainder to multiplication
This makes both lookups and rehashing cheaper. The index vector size
is now always a power of 2. The first table size is reduced to
6 (from 8), because index vectors would become excessively big
otherwise.
* src/lisp.h (struct Lisp_Hash_Table): Replace index_size with
index_bits. All references adapted.
(hash_table_index_size): New accessor; use it where applicable.
* src/fns.c (hash_index_size): Replace with...
(compute_hash_index_bits): ...this new function, returning the log2 of the
index size. All callers adapted.
(hash_index_index): Knuth multiplicative hashing instead of remainder.
(maybe_resize_hash_table): Reduce first table size from 8 to 6.
Optionally show internal buffers in Buffer Menu mode
Internal buffers were never shown before but they can be of interest
to Elisp developers, especially since there is no general mechanism to
remove unused buffers.
Po Lu [Tue, 6 Feb 2024 09:52:33 +0000 (17:52 +0800)]
Implement Lisp threading on Android
Much like the NS port, only the main thread receives input from
the user interface, which is fortunately not a major problem for
packages such as lsp-mode that create Lisp threads.
* configure.ac: Enable with_threads under Android.
* src/android.c (android_init_events): Set `main_thread_id' to
the ID of the main thread.
(setEmacsParams): Set new global variable `android_jvm' to the
JVM object, for the purpose of attaching Lisp threads to the
JVM.
(android_select): [THREADS_ENABLED]: If the caller isn't the
main thread, resort to pselect. Don't check query before select
returns.
(android_check_query): Export.
* src/android.h (_ANDROID_H_): Define new macro and update
prototypes.
* src/process.c (android_select_wrapper): New function.
(wait_reading_process_output): If THREADS_ENABLED, call
thread_select through the Android select wrapper.
* src/thread.c (post_acquire_global_lock): Call
android_check_query; replace android_java_env with the incoming
Lisp thread's.
(run_thread): Attach and detach the thread created to the JVM.
(init_threads): Set the main thread's JNI environment object.
* src/thread.h (struct thread_state) <java_env>: New field.