Kévin Le Gouguec [Mon, 18 Mar 2024 18:47:59 +0000 (19:47 +0100)]
Fix vc-git test when no identities are configured
Reported by john muhl <jm@pub.pink>.
* test/lisp/vc/vc-git-tests.el (vc-git-test--with-repo): Set
some environment variables (lifted from vc-tests.el) to let
'git commit' compute dummy author and committer identities.
Andrea Corallo [Tue, 19 Mar 2024 09:41:52 +0000 (10:41 +0100)]
* Use 'cl-type-of' in comp-cstr.el
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-homogeneous-no-range)
(comp-cstr-union-1-no-mem, comp-cstr-intersection-no-hashcons):
Make use of 'cl-type-of' in place of 'type-of'.
Po Lu [Tue, 19 Mar 2024 04:08:17 +0000 (12:08 +0800)]
Respect display names of Android content URIs
* java/org/gnu/emacs/EmacsNative.java (displayNameHash): New
function.
* java/org/gnu/emacs/EmacsService.java (buildContentName): New
argument RESOLVER. Generate names holding URI's display name if
available. All callers changed.
* lisp/international/mule-cmds.el (set-default-coding-systems):
Fix file name coding system as utf-8-unix on Android as on Mac
OS.
* src/androidvfs.c (enum android_vnode_type): New enum
ANDROID_VNODE_CONTENT_AUTHORITY_NAMED.
(android_content_name): Register root directories for this new
type.
(displayNameHash): New function.
(android_get_content_name): New argument WITH_CHECKSUM. If
present, treat the final two components as a pair of checksum
and display name, and verify and exclude the two.
(android_authority_name): Provide new argument as appropriate.
(android_authority_initial_name): New function.
Tweak regexp for object initializers in csharp-mode (bug#69571)
* lisp/progmodes/csharp-mode.el (csharp-guess-basic-syntax): Add
handling to not consider ended statements as object init openers.
* test/lisp/progmodes/csharp-mode-resources/indent.erts: New test
resources.
* test/lisp/progmodes/csharp-mode-tests.el: Add test for this particular
issue.
`term-mode': mention the keymap to add keybindings to
A user typically expects a keymap for mode `foo' to be called
`foo-mode-map'. term-mode has `term-mode-map' too, but for
user-defined bindings to have effect they have to be put to
`term-raw-map' instead. So let's mention that.
* lisp/term.el (term-mode) (term-mode-map) (term-raw-map): Mention
the keymaps to add keybindings to for `term-mode'. (Bug#69786)
Stefan Monnier [Thu, 14 Mar 2024 16:49:08 +0000 (12:49 -0400)]
Followup changes to `cl-type-of`
These changes came up while working on `cl-type-of` but are not
directly related to the new `cl-type-of`.
The BASE_PURESIZE bump was needed at some point on one of my
machine, not sure why.
* src/puresize.h (BASE_PURESIZE): Bump up.
* src/sqlite.c (bind_value): Don't use `Ftype_of`.
* lisp/emacs-lisp/seq.el (seq-remove-at-position): Simplify.
* lisp/emacs-lisp/cl-preloaded.el (finalizer):
New (previously missing) type.
* doc/lispref/objects.texi (Type Predicates): Minor tweaks.
Stefan Monnier [Sun, 17 Mar 2024 21:29:02 +0000 (17:29 -0400)]
(primitive-function): New type
The type hierarchy and `cl-type-of` code assumed that `subr-primitive`
only applies to functions, but since it also accepts special-forms it makes
it an unsuitable choice since it can't be a subtype of `compiled-function`.
So, use a new type `primitive-function` instead.
* lisp/subr.el (subr-primitive-p): Fix docstring (bug#69832).
(primitive-function-p): New function.
* lisp/emacs-lisp/cl-preloaded.el (primitive-function): Rename
from `subr-primitive` since `subr-primitive-p` means something else.
* src/data.c (Fcl_type_of): Return `primitive-function` instead
of `subr-primitive` for C functions.
(syms_of_data): Adjust accordingly.
Stefan Monnier [Tue, 12 Mar 2024 13:26:24 +0000 (09:26 -0400)]
(cl-type-of): New function to return more precise types (bug#69739)
* src/data.c (Fcl_type_of): New function, extracted from `Ftype_of`.
Make it return more precise types for symbols, integers, and subrs.
(Ftype_of): Use it.
(syms_of_data): Define the corresponding new symbols and defsubr
the new function.
* doc/lispref/objects.texi (Type Predicates): Document it.
* src/comp.c (emit_limple_insn): Use `Fcl_type_of`.
* lisp/emacs-lisp/cl-preloaded.el (subr): Demote it to `atom`.
(subr-native-elisp, subr-primitive): Add `compiled-function` as
parent instead.
(special-form): New type.
Kévin Le Gouguec [Mon, 12 Feb 2024 07:29:19 +0000 (08:29 +0100)]
; Re-apply accidentally reverted commit
This re-applies:
2024-03-17 "Fix vc-dir when "remote" Git branch is local"
(21828f288ef)
reverted as part of the unrelated:
2024-03-17 "Update modus-themes to their 4.4.0 version"
(67b0c1c09ea)
The original commit message follows:
Fix vc-dir when "remote" Git branch is local
While in there, add that "tracking" branch to the vc-dir
buffer. For bug#68183.
* lisp/vc/vc-git.el (vc-git-dir-extra-headers): Reduce
boilerplate with new function 'vc-git--out-ok'; stop calling
vc-git-repository-url when REMOTE is "." to avoid throwing an
error; display tracking branch; prefer "none (<details...>)" to
"not (<details...>)" since that reads more grammatically
correct.
(vc-git--out-ok): Add documentation.
(vc-git--out-str): New function to easily get the output from a
Git command.
* test/lisp/vc/vc-git-tests.el (vc-git-test--with-repo)
(vc-git-test--run): New helpers, defined to steer clear of
vc-git-- internal functions.
(vc-git-test-dir-track-local-branch): Check that vc-dir does
not crash.
Juri Linkov [Sun, 17 Mar 2024 17:57:05 +0000 (19:57 +0200)]
* lisp/tab-bar.el (tab-bar-select-restore-windows): New defcustom.
(tab-bar-select-restore-windows): New function.
(tab-bar-select-tab): Let-bind window-restore-killed-buffer-windows
to tab-bar-select-restore-windows (bug#68235).
* doc/misc/modus-themes.org: Update the manual to better document
existing functionality and cover the new features.
* etc/themes/modus-operandi-deuteranopia-theme.el:
* etc/themes/modus-operandi-theme.el:
* etc/themes/modus-operandi-tinted-theme.el:
* etc/themes/modus-operandi-tritanopia-theme.el:
* etc/themes/modus-vivendi-deuteranopia-theme.el:
* etc/themes/modus-vivendi-theme.el:
* etc/themes/modus-vivendi-tinted-theme.el:
* etc/themes/modus-vivendi-tritanopia-theme.el: Update the
palette of each theme.
* etc/themes/modus-themes.el (require): Remove call to cl-lib
and do not use relevant functions.
(modus-themes-operandi-colors, modus-themes-vivendi-colors)
(modus-themes-version, modus-themes-report-bug): Remove old
calls to 'make-obsolete' and related.
(modus-themes--annotate-theme): Tweak the completion annotation function.
(modus-themes--org-block): Deprecate the user option 'modus-themes-org-blocks'.
(modus-themes-faces): Update faces.
(modus-themes-custom-variables): Update the list of custom
variables.
Detailed release notes are available here:
<https://protesilaos.com/codelog/2024-03-17-modus-themes-4-4-0/>.
Kévin Le Gouguec [Mon, 12 Feb 2024 07:29:19 +0000 (08:29 +0100)]
Fix vc-dir when "remote" Git branch is local
While in there, add that "tracking" branch to the vc-dir
buffer. For bug#68183.
* lisp/vc/vc-git.el (vc-git-dir-extra-headers): Reduce
boilerplate with new function 'vc-git--out-ok'; stop calling
vc-git-repository-url when REMOTE is "." to avoid throwing an
error; display tracking branch; prefer "none (<details...>)" to
"not (<details...>)" since that reads more grammatically
correct.
(vc-git--out-ok): Add documentation.
(vc-git--out-str): New function to easily get the output from a
Git command.
* test/lisp/vc/vc-git-tests.el (vc-git-test--with-repo)
(vc-git-test--run): New helpers, defined to steer clear of
vc-git-- internal functions.
(vc-git-test-dir-track-local-branch): Check that vc-dir does
not crash.
* cross/ndk-build/ndk-build.mk.in (NDK_BUILD_CXX_STL)
(NDK_BUILD_CXX_LDFLAGS): New variables.
* cross/ndk-build/ndk-resolve.mk (NDK_SYSTEM_LIBRARIES):
Introduce several other C++ libraries sometimes present on
Android.
(NDK_SO_EXTRA_FLAGS_$(LOCAL_MODULE)): Insert NDK_BUILD_CXX_STL
when any of these new C++ libraries are requested.
* m4/ndk-build.m4: Completely rewrite C++ compiler and library
detection.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): Attempt to
load more libraries from static initializer.
Stefan Monnier [Sun, 17 Mar 2024 03:10:48 +0000 (23:10 -0400)]
debug.el: Prevent re-entering the debugger for the same error
We can have several active `handler-bind`s that all want to invoke the
debugger, in which case we can have the following sequence:
- The more deeply nested handler calls the debugger.
- After a while the user invokes `debugger-continue`.
- `signal_or_quit` propagates the error up the stack to the
second handler, which calls the debugger again.
- The user thus ends up right back at the same place, as if
`debugger-continue` had not be processed.
Fix this by remembering the last processed error and skipping
the debugger if we bump into it again.
* lisp/emacs-lisp/debug.el (debugger--last-error): New var.
(debugger--duplicate-p): New function.
(debug): Use them.
Martin Rudalics [Fri, 15 Mar 2024 09:35:27 +0000 (10:35 +0100)]
Further adjustments for restoring killed buffer windows (Bug#68235)
* etc/NEWS: Announce 'window-restore-killed-buffer-windows'.
* src/buffer.h (struct buffer) : New field last_name_.
* src/buffer.c (Fbuffer_last_name): New function to return last
name of buffer before it was killed or renamed.
(bset_last_name, Fget_buffer_create, Fmake_indirect_buffer)
(Frename_buffer, Fkill_buffer, init_buffer_once): Set buffer's
last_name_ field accordingly.
* src/window.c (window_restore_killed_buffer_windows): New
variable replacing Vwindow_kept_windows_functions.
(Fset_window_configuration): Use
window_restore_killed_buffer_windows instead of
Vwindow_kept_windows_functions.
* lisp/window.el (window--state-put-2, window-state-put): Use
'window-restore-killed-buffer-windows' instead of
'window-kept-windows-functions'.
* doc/lispref/windows.texi (Window Configurations): Describe
'window-restore-killed-buffer-windows' which replaces
'window-kept-windows-functions'.
Keep indenting text when 'shr-fill-text' is nil (bug#69555)
The 'shr-fill-...' functions handle both hard-filling (adding
newlines to break long lines) and indentation. Setting
'shr-fill-text' to nil currently causes these functions to be
short-circuited completely, so e.g. blockquotes are no longer
indented, whereas the intent of this user option is only to
prevent hard-filling to let visual-line-mode reflow text.
* lisp/net/shr.el (shr-fill-lines): Document that the function
handles more than just filling; move the 'shr-fill-text' check...
(shr-fill-line): ... here, after indentation has been taken care
of.
* test/lisp/net/shr-resources/blockquote.html:
* test/lisp/net/shr-resources/blockquote.txt: New test resources.
* test/lisp/net/shr-tests.el (shr-test--rendering-check): Rename
from 'shr-test', to make the relationship with the 'rendering'
testcase clearer; prefer 'file-name-concat' to 'format'; raise
ERT failure if need be, calling (ert-fail ...) directly instead
of (should (not (list ...))).
(shr-test--rendering-extra-configs): New variable to easily check
that user customizations do not degrade rendering.
(rendering): Consult that new variable; delegate failure-raising
to reduce duplication.
Dmitry Gutov [Fri, 15 Mar 2024 02:28:45 +0000 (04:28 +0200)]
(project--value-in-dir): Ensure that the global value is still honored
* lisp/progmodes/project.el (project--value-in-dir):
Ensure that the global value of the variable is still honored,
when the variable is not in dir-locals.
Stefan Monnier [Fri, 15 Mar 2024 02:15:41 +0000 (22:15 -0400)]
(set-auto-mode): Streamline to fix bug#67795
The old code tested if the mode function is `fboundp` but in an
inconsistent way and without paying attention to
`major-mode-remap`.
* lisp/files.el (set-auto-mode-0): Return `:keep` rather than nil if
the mode was already set. And emit a warning when the mode function
doesn't exist.
(set-auto-mode): Remove checks that the mode function exists now that
`set-auto-mode-0` does it for us. Adjust to the new return values of
that function, and simplify the code using a big `or` instead of
a sequence of steps each setting&testing `done`.
(hack-local-variables--find-variables): Use `major-mode-remap`
when skipping the "mode:" entries that specify modes we don't have.
Also, when (eq handle-mode t), don't bother building a list of results
only to return a single element in the end.
Juri Linkov [Thu, 14 Mar 2024 18:11:33 +0000 (20:11 +0200)]
* lisp/textmodes/flyspell.el (flyspell-check-changes): New user option.
(flyspell--mode-on): Add flyspell-check-changes to post-command-hook
when flyspell-check-changes is non-nil.
(flyspell--mode-off): Remove flyspell-check-changes from post-command-hook.
(flyspell-check-changes): New function (bug#61874).
Juri Linkov [Thu, 14 Mar 2024 17:37:44 +0000 (19:37 +0200)]
* lisp/progmodes/project.el: Don't run modes from .dir-locals.el.
(project--value-in-dir): Use 'alist-get' on 'file-local-variables-alist'
to avoid calling 'hack-local-variables-apply' via
'hack-dir-local-variables-non-file-buffer' because it might enable
undesirable modes such as flyspell-mode in a temporary buffer (bug#69740).
Liu Hui [Mon, 26 Feb 2024 10:46:36 +0000 (18:46 +0800)]
Detect the readline support for Python shell completion
* lisp/progmodes/python.el
(python-shell-comint-watch-for-first-prompt-output-filter):
Detect the readline support.
(python-shell-readline-completer-delims): Update docstring.
(python-shell-completion-native-setup): Move the readline
detection code to ...
(python-shell-readline-detect): ... new function.
(python-shell-completion-native-turn-on-maybe): Skip if Python
has no readline support.
(python-shell-completion-at-point): Respect the delimiter of
readline completer in non-native completion.
* test/lisp/progmodes/python-tests.el
(python-shell-completion-at-point-1)
(python-shell-completion-at-point-native-1)
(python-completion-at-point-1, python-completion-at-point-2)
(python-completion-at-point-pdb-1)
(python-completion-at-point-while-running-1)
(python-completion-at-point-native-1)
(python-completion-at-point-native-2)
(python-completion-at-point-native-with-ffap-1)
(python-completion-at-point-native-with-eldoc-1): Skip tests if
Python has no readline support.
(python-shell-completion-at-point-jedi-completer): Add test for
non-native Python shell completion. (bug#68559)
Visuwesh [Sat, 9 Mar 2024 09:47:26 +0000 (15:17 +0530)]
Add bounds-of-thing-at-point property for 'number'
* lisp/thingatpt.el (thing-at-point-decimal-regexp)
(thing-at-point-hexadecimal-regexp): Extract regexps from...
(number-at-point): ...here. Use them in 'number-at-point'.
(number): Add 'bounds-of-thing-at-point' property as
`forward-word' does not always return the right boundary,
e.g., in latex-mode buffers. (Bug#69239)
Raffael Stocker [Mon, 4 Mar 2024 18:06:07 +0000 (19:06 +0100)]
Fix resetting keyboard hook state on MS-Windows
Register session notifications so Emacs is notified when the
computer is being locked, as required to reset the low level
keyboard hook state. (Bug#69083).
* src/w32term.h:
* src/w32fns.c (setup_w32_kbdhook, remove_w32_kbdhook)
(w32_wnd_proc, globals_of_w32fns, maybe_pass_notification):
Register and manage session notifications in GUI Emacs.
* src/w32console.c (initialize_w32_display, find_ime_window):
* src/w32xfns.c (drain_message_queue): Register notifications
and reset keyboard hook state in console Emacs.
* src/w32.c (term_ntproc): Un-register session notifications
when terminating.
Po Lu [Thu, 14 Mar 2024 05:45:48 +0000 (13:45 +0800)]
Improve /proc/self/exe substitution on Android
* exec/configure.ac (USER_SWORD): New macro.
* exec/exec.c (format_pid): Export this function.
* exec/exec.h:
* exec/trace.c (canon_path): New function.
(handle_readlinkat, handle_openat): Test complete file name
against /proc/self/exe, and further check for /proc/pid/exe.
Po Lu [Wed, 13 Mar 2024 02:59:39 +0000 (10:59 +0800)]
Port more notification senders to non-XDG systems
* doc/lispref/os.texi (Desktop Notifications): Document that
`:timeout' is now implemented.
* java/org/gnu/emacs/EmacsDesktopNotification.java
(EmacsDesktopNotification): New field delay.
(display1): Set delay on Android 8.0 and up.
* lisp/erc/erc-desktop-notifications.el
(erc-notifications-notify): Call Android or Haiku notification
functions on those systems.
* lisp/gnus/gnus-notifications.el (gnus-notifications-action)
(gnus-notification-close): Remove dismissed notifications from
the notification to message map.
(gnus-notifications-notify): Call android-notifications-notify
if possible.
* src/androidselect.c (android_init_emacs_desktop_notification):
Update accordingly.
(android_notifications_notify_1): New argument TIMEOUT.
(Fandroid_notifications_notify): New argument QCtimeout.
(syms_of_androidselect) <QCtimeout>: New symbol.
Stefan Monnier [Tue, 12 Mar 2024 20:09:23 +0000 (16:09 -0400)]
Try and avoid hardcoding lists of function types
* lisp/bind-key.el (bind-key--get-binding-description):
Show docstrings for compiled functions also. Don't hardcode knowledge
about various particular kinds of functions.
* lisp/emacs-lisp/bytecomp.el (display-call-tree): Remove special
support for functions with a `byte-code` body since we never generate
that nowadays. Don't hardcode knowledge
about various particular kinds of functions.
Stefan Monnier [Tue, 12 Mar 2024 19:43:43 +0000 (15:43 -0400)]
Cleanup some type predicates
Use the new `cl--define-built-in-type` to reduce the manually
maintained list of built-in type predicates.
Also tweak docstrings to use "supertype" rather than "super type",
since it seems to be what we use elsewhere.
* lisp/subr.el (special-form-p): Remove redundant `fboundp` test.
(compiled-function-p): Don'Return nil for subrs that aren't functions.
* lisp/emacs-lisp/cl-macs.el (type predicates): Trim down the list.
* lisp/emacs-lisp/cl-preloaded.el (cl--define-built-in-type):
Register the corresponding predicate if applicable.
(atom, null): Specify the predicate name explicitly.
Stefan Monnier [Tue, 12 Mar 2024 16:00:17 +0000 (12:00 -0400)]
cl-generic: Signal an error when a type specializer won't work
* lisp/emacs-lisp/cl-generic.el (cl--generic--unreachable-types): New var.
(cl-generic-generalizers :extra "typeof"): Use it to signal an
error for those types we can't handle.
Jsonrpc: improve performance of process filter function
`run-at-time' keeps `timer-list' list sorted by inserting each
timer based on the timer value. This means that
`timer--time-less-p' needs is executed ~N*N/2 times for each N
pending messages. This means that jsonrpc becomes unusable
for connections that generate a lot messages at the same time.
* lisp/jsonrpc.el (Version): Bump to 1.0.25.
(jsonrpc--process-filter): Improve performance by activating
timers in a different order. (Bug#69241)