Alan Mackenzie [Sat, 18 Mar 2023 10:12:24 +0000 (10:12 +0000)]
CC Mode: Eliminate duplicate function c-list-of-strings
Replace it with the existing c-string-list-p. Also put an autoload cookie in
front of c-string-list-p so that it will not be signalled as undefined by
loaddefs.el.
lisp/progmodes/cc-vars.el (c-string-list-p): Make this autoload.
(c-list-of-strings): Remove.
(c-font-lock-extra-types, c++-font-lock-extra-types)
(objc-font-lock-extra-types, java-font-lock-extra-types)
(idl-font-lock-extra-types, pike-font-lock-extra-types): In the autoload
cookies, replace c-list-of-strings with c-string-list-p.
Manuel Giraud [Fri, 10 Mar 2023 20:54:00 +0000 (21:54 +0100)]
Fix 'find-ls-option-default-ls' for BSD/MacOS (bug#62096)
* lisp/find-dired.el (find-gnu-find-p): New variable to determine
if "find" is a GNU find.
(find-ls-option-default-ls): Use 'find-gnu-find-p' and adapt to a
value that works with the default "find" on *BSD and Darwin/MacOS.
Tested on OpenBSD and MacOS.
Po Lu [Sat, 18 Mar 2023 03:59:17 +0000 (11:59 +0800)]
Work around pselect lossage on Android
* src/android.c (android_run_select_thread): New flag. Use it
rather than the rc of pselect and errno to determine whether or
not it has been interrupted.
(android_handle_sigusr1): Set said flag.
Po Lu [Sat, 18 Mar 2023 02:54:26 +0000 (10:54 +0800)]
Update Android port
* java/org/gnu/emacs/EmacsView.java (EmacsView)
(prepareForLayout): New function. Call this prior to mapping
the view.
(onGlobalLayout): New function. Register as global layout
listener.
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow)
(notifyContentRectPosition): New function. Use specified
xPosition and yPosition when reporting the offsets of children
of the root window.
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java
(registerWindow): Specify activity launch bounds if necessary.
* src/androidterm.c (handle_one_android_event): Send
MOVE_FRAME_EVENT where necessary.
Jim Porter [Sun, 29 Jan 2023 01:04:11 +0000 (17:04 -0800)]
Simplify usage of 'while' forms in Eshell's iterative evaluation
Now, 'eshell-do-eval' rewrites 'while' forms to let-bind variables for
the command and test bodies. This means that external code, such as
command rewriting hooks, no longer has to worry about this, making it
easier to pass "normal" Lisp forms to 'eshell-do-eval' (bug#61954).
* lisp/eshell/esh-cmd.el (eshell-command-body, eshell-test-body): No
longer used outside of 'eshell-do-eval', so rename to...
(eshell--command-body, eshell--test-body): ... these.
(Command evaluation macros): Remove obsolete description about 'if'
and 'while' forms.
(eshell-rewrite-for-command, eshell-structure-basic-command): Remove
'eshell-command-body' and 'eshell-test-body'.
(eshell-do-eval): Reimplement handling of 'while' forms.
Jim Porter [Sat, 28 Jan 2023 23:06:31 +0000 (15:06 -0800)]
Simplify how Eshell's iterative evaluation handles 'if' forms
The previous implementation used 'eshell-test-body' and
'eshell-command-body' to track the condition and the then/else forms,
but those special variables are only needed for looping. 'if' only
evaluates each form once at most (bug#61954).
* lisp/eshell/esh-cmd.el (Command evaluation macros): Remove 'if' from
the notes about 'eshell-test-body' and 'eshell-command-body'.
(eshell-do-eval): Reimplement evaluation of 'if' forms.
(eshell-eval-command): Don't let-bind 'eshell-command-body' and
'eshell-test-body'; they're no longer needed here.
Jim Porter [Fri, 27 Jan 2023 07:18:42 +0000 (23:18 -0800)]
Simplify iteration in Eshell for loops
The previous code fixed an issue in Eshell's iterative evaluation
where deferred commands caused an infinite loop (see bug#12571).
However, with the fix to unwinding let forms in 'eshell-do-eval' (see
bug#59469), we can just write this code as we normally would
(bug#61954).
Po Lu [Fri, 17 Mar 2023 05:10:23 +0000 (13:10 +0800)]
Improve radio button appearance in Android menus
* java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu):
New field `lastGroupId'.
(Item): New field `isRadio'.
(addItem): New arg `isRadio'.
(inflateMenuItems): Apply an empty radio button group if
required.
* src/androidmenu.c (android_init_emacs_context_menu): Adjust
accordingly.
(android_menu_show): Likewise.
Po Lu [Fri, 17 Mar 2023 02:38:09 +0000 (10:38 +0800)]
Update Android port
* java/org/gnu/emacs/EmacsView.java (cancelPopupMenu): Dismiss
context menu correctly.
(isOpaque): New function.
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java: Make
consumer list public.
* lisp/progmodes/elixir-ts-mode.el: Only require heex-ts-mode once
elixir-ts-mode loads to avoid calling (treesit-ready-p 'heex)
during byte-compilation.
Since NonGNU ELPA has been added to the default value of
'package-archives', this condition is practically never satisfied,
meaning the code can be simplified.
João Távora [Wed, 15 Mar 2023 10:27:24 +0000 (10:27 +0000)]
Unbreak Eglot (as a :core ELPA package) on Emacs 26.3
Because of the lack of regular automated testing on a CI system, many
recent developments in and outside Eglot had wrecked this
compatibility.
The GitHub CI available at https://github.com/joaotavora/eglot/actions
can be used to run this combination of eglot.el + eglot-tests.el on
26.3, 27.2 and 28.2.
* etc/EGLOT-NEWS: Mention new version.
* lisp/progmodes/eglot.el (eglot--reporter-update): New
compatibility shim.
(eglot-handle-notification $/progress): Use it.
(eglot-handle-notification textDocument/publishDiagnostics): Use
two-arg assoc-delete-all.
(Version): Bump to 1.13.
* test/lisp/progmodes/eglot-tests.el
(Commentary): Tweak.
(tramp): Tweak require;
(eglot-test-diagnostic-tags-unnecessary-code): Use
jsonrpc--encode.
(eglot--call-with-tramp-test): Adjust dependency on
ert-remote-temporary-file-directory.
(eglot-test-rust-on-type-formatting)
(eglot-test-project-wide-diagnostics-rust-analyzer): Wait longer.
Po Lu [Wed, 15 Mar 2023 01:46:01 +0000 (09:46 +0800)]
Update Android port
* doc/lispref/commands.texi (Misc Events): Document variable
`disable-inhibit-text-conversion'.
* java/org/gnu/emacs/EmacsDialog.java (display1): Try an
activity that is certain to be focused first.
* lisp/touch-screen.el (touch-screen-track-tap)
(touch-screen-track-drag): Bind
`disable-inhibit-text-conversion'.
* src/keyboard.c (read_key_sequence): Only disable text
conversion if an actual function or numeric key is found in the
key sequence.
(syms_of_keyboard): New variable
`disable-inhibit-text-conversion'.
* src/lread.c (read_filtered_event): Check new variable.
* src/textconv.c (textconv_query): Remove unused label.
João Távora [Wed, 15 Mar 2023 00:36:26 +0000 (00:36 +0000)]
More fixes to Eglot tests
* test/lisp/progmodes/eglot-tests.el
(eglot-test-project-wide-diagnostics-rust-analyzer): Make even more
robust.
(eglot--wait-for): flush-standard-output doesn't exist in older
Emacsen.
(eglot-test-basic-diagnostics): Increase timeout.
João Távora [Tue, 14 Mar 2023 19:50:48 +0000 (19:50 +0000)]
Improve debug output of Eglot tests
* test/lisp/progmodes/eglot-tests.el
(eglot--test-message): New helper.
(eglot--call-with-fixture): Use it.
(eglot--cleanup-after-test): Use it.
(eglot--wait-for): Use it. Clean mistaken docstring.
João Távora [Tue, 14 Mar 2023 19:44:45 +0000 (19:44 +0000)]
Robustify some Eglot tests involving rust-analyzer
* eglot-tests.el (eglot-test-diagnostics-tags-unnecessary-code): Use
clangd instead of rust-analyzer.
(eglot-test-project-wide-diagnostics-rust-analyzer): Don't count
diagnostics, just check they come from unvisited file.
(eglot-test-rust-analyzer-watches-files): Wait a bit more time..
João Távora [Tue, 14 Mar 2023 19:07:23 +0000 (19:07 +0000)]
Better jsonrpc.el workaround for debug-on-error check
Some extensions, notably ert.el, set `debug-on-error' to non-nil,
which makes it hard to test the behaviour catching of the Elisp
error when processing a request and replying to the endpoint with
an JSONRPC-error.
The previous workaround relied on requiring lisp/emacs-lisp/ert.el in
lisp/jsonrpc.el, which really doesn't make sense.
This is better. For the single test of that behaviour, set a new
variable, jsonrpc-inhibit-debug-on-error.
Not only is this cleaner, it allows us to use ert.el's useful
debug-on-error setting.
* lisp/jsonrpc.el (ert): Don't require it.
(jsonrpc-inhibit-debug-on-error): New variable.
(jsonrpc-connection-receive): Use it.
(Package-Requires): Bump to 1.0.17
João Távora [Tue, 14 Mar 2023 18:14:48 +0000 (18:14 +0000)]
Merge from origin/emacs-29
4b6f2a7028b * lisp/progmodes/xref.el: Bump the version. 24c8b146bbc * lisp/progmodes/xref.el (xref--xref-buffer-mode): Split ... 46f9e53c3da Fix import of keys in buffer created by epa-search-keys 36ade0704e1 Fix connection-local variables settings e759905d2e0 ; Minor copyedits in EGLOT-NEWS ba22a2c346b Bump Eglot version to 1.12 54e123a5055 Update Eglot's manual about eglot-workspace-configuration 812597f864c ; * lisp/novice.el (disabled-command-function): Add note ... 4a603c98499 Amend last Eglot commit (bug#62065) b916ec88b2f Make eglot-ensure's post-command-hook run a bit later (bu... 1c05175c21a Fix display of disabled-command help text 3ce37db9882 Remove mention of old dotted-list reader quirk from manual 42335c2c1f1 Fix value history shown for 'gc-cons-percentage' fffbce29349 TRework fix for bug#62106 8bc12a27362 ; * etc/NEWS: Fix last change. 2ac068d294e ; Remove 'ns-popup-font-panel' from documentation 5bc32d008fb Add missing indentation rule for rust-ts-mode (Bug#62109) 0404924930d ; One more improvement to ELisp "internals" appendix. c857775ca61 Fix bug#62106 0fedbfa6a9d ; Minor improvement of documentation of GC thresholds b0b24ad2fc5 Add missing rust-ts-mode highlight query for scoped_type_... c0cf69f7a17 Make "case" keyword a dedenter in Python db178517ce7 ; * lisp/arc-mode.el (w32-get-console-codepage): Declare. 157a91b54be Fix decoding non-ASCII file names in zip archives on MS-W... 4803f972047 Fix copying binary files from zip archives 679f528b953 Skip ruby-ts-syntax-propertize-symbol unless treesitter i... 081cc7aa8e0 ; * doc/misc/eglot.texi (Project-specific configuration):... 1de513a29fa Fix enums and unions appearing as structs in c-ts-base-mo... ecdfd584a52 ruby-ts-mode: Fine-tune s-p-f on symbols (bug#62086) 29228e24f20 python-info-dedenter-opening-block-positions: Fix to supp... 01b65d442ad Autoload Eglot helper funtion eglot--debbugs-or-github-bu... 50a3559c5a7 Add chapter on advanced server configuration to Eglot manual 2e7460c2315 ; * lisp/progmodes/java-ts-mode.el (treesit-query-capture... 255eeee0e06 java-ts-mode: detect if text_block is supported. 6fe9075ff38 Revert workaround introduced in Bug#56271 f175141aead Fix searching for end of string in python-nav-end-of-stat...
Michael Albinus [Tue, 14 Mar 2023 10:38:39 +0000 (11:38 +0100)]
Improve Tramp processes to accept output over the same socket
* lisp/net/tramp.el (tramp-accept-process-output): Don't use TIMEOUT
anymore, default it to 0. When the connection uses a shared
socket possibly, accept also the output from other processes over
the same connection. (Bug#61350)
(tramp-handle-file-notify-rm-watch, tramp-action-process-alive)
(tramp-action-out-of-band, tramp-process-one-action)
(tramp-interrupt-process):
* lisp/net/tramp-adb.el (tramp-adb-handle-make-process):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch):
* lisp/net/tramp-smb.el (tramp-smb-action-get-acl)
(tramp-smb-action-set-acl, tramp-smb-wait-for-output):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-action-sudo):
Adapt callees.
Po Lu [Tue, 14 Mar 2023 01:48:02 +0000 (09:48 +0800)]
Update Android port
* doc/emacs/android.texi (Android Windowing): Document how to
display dialogs when Emacs is in the background.
* java/org/gnu/emacs/EmacsDialog.java (display1): Use system
dialogs if possible.
Alan Mackenzie [Mon, 13 Mar 2023 16:42:02 +0000 (16:42 +0000)]
CC Mode: Allow lists of strings as safe values for *-font-lock-extra-types
* lisp/progmodes/cc-vars.el (c-list-of-strings): New function.
(c-font-lock-extra-types, c++-font-lock-extra-types)
(objc-font-lock-extra-types, java-font-lock-extra-types)
(idl-font-lock-extra-types, pike-font-lock-extra-types): Add a :safe entry
into each of thes defcustoms for c-list-of-string.
(Top level): Add an autoload entry for each of the above.
João Távora [Sun, 12 Mar 2023 19:44:53 +0000 (19:44 +0000)]
Update Eglot's manual about eglot-workspace-configuration
There is a possible use for a global setting
eglot-workspace-configuration, which is to (ab)use it to set
user-specific configuration when the server doesn't permit other
methods. Rearrange the "Advanced server configuration" section and
describe that use in the manual.
* doc/misc/eglot.texi (Project-specific configuration): Correct
mistake about global usefulness of eglot-workspace-configuration.
(Advanced server configuration): Swap order of sections.
(User-specific configuration): Mention possibility of globally
setting eglot-workspace-configuration.
Po Lu [Mon, 13 Mar 2023 05:25:02 +0000 (13:25 +0800)]
Update Android port
* doc/emacs/android.texi (Android Startup): Document changes to
emacsclient wrapper.
* java/org/gnu/emacs/EmacsOpenActivity.java (EmacsOpenActivity)
(startEmacsClient): Open EmacsActivity if the service is not
running.
* java/org/gnu/emacs/EmacsService.java (onCreate):
* java/org/gnu/emacs/EmacsThread.java (EmacsThread, run): Pass
any file to open to Emacs.
* lisp/term/android-win.el (handle-args-function): Implement.
João Távora [Sun, 12 Mar 2023 18:19:40 +0000 (18:19 +0000)]
Make eglot-ensure's post-command-hook run a bit later (bug#62065)
'eglot-ensure', typically used in the major-mode-hook, use
'post-command-hook' to schedule an automated, non-interactive
connection attempt to a server. The goal is to connect when the
buffer is ready, i.e. after the user command that found the file.
However, if there are dir-local or buffer-local variables to confirm,
finding the file will cause a minibuffer prompt to appear.
In that case, 'eglot-ensure's addition to the global post-command-hook
runs before it was intended too and a connection is started
prematurely.
In turn, this means that a call to 'hack-dir-local-variables' -- which
is part of the connection process -- which also needs a minibuffer
prompt, collides with the previous one. This generates an error and
confuses the user, who doesn't know if the directory-local variables
have been applied or not.
This commit fixes the clash by having 'eglot-ensure' set
'post-command-hook' buffer-locally. This causes the automated
connection to take place, as intended, after the user's original
file-finding command has ended.
However, the problem reported in bug#62065 is not completely fixed.
If the user answers "no" to the first "confirm local variables"
"prompt, she will be prompted again in the second one. A subsequent
commit will address this separate problem.
* lisp/progmodes/eglot.el (eglot-ensure): Use buffer-local post-command-hook.
Eli Zaretskii [Sun, 12 Mar 2023 17:32:02 +0000 (19:32 +0200)]
Fix display of disabled-command help text
* lisp/novice.el (disabled-command-function): Improve wording, and
make sure the prompt doesn't exceed one screen line, so that the
mini-window is not resized (which gets in the way of fitting the
window to the size of the help text), and the help text is fully
visible when Emacs prompts for input. (Bug#62146)
* etc/NEWS: Mention the new mode.
* lisp/progmodes/heex-ts-mode.el: New file.
* test/lisp/progmodes/heex-ts-mode-tests.el: New file.
* test/lisp/progmodes/heex-ts-mode-resources/indent.erts: New file.
* admin/notes/tree-sitter/build-module/batch.sh:
* admin/notes/tree-sitter/build-module/build.sh: Add HEEx support.
Eli Zaretskii [Sun, 12 Mar 2023 14:19:49 +0000 (16:19 +0200)]
Fix value history shown for 'gc-cons-percentage'
When Emacs is built, temacs is run in batch mode, so if we enlarge
'gc-cons-percentage' in that case, the enlarged value will be
"remembered" by the dumped Emacs, and will show confusing
information in "C-h v", claiming that the original value was 1.0.
Keeping the value at 0.1 during dumping avoids that.
* src/emacs.c (main): Increase 'gc-cons-percentage' in batch mode
only if we are not initializing (a.k.a. "dumping") Emacs.
Daniel Martín [Sun, 12 Mar 2023 12:38:34 +0000 (13:38 +0100)]
Fix pluralization in shortdoc-help-fns-examples-function
* lisp/emacs-lisp/shortdoc.el (shortdoc-help-fns-examples-function):
Implement a better logic to pluralize "Example", by counting the
number of arrow characters in the example string. (Bug#61877)
* test/lisp/emacs-lisp/shortdoc-tests.el
(shortdoc-help-fns-examples-function-test): Add a test.
Po Lu [Sun, 12 Mar 2023 11:36:09 +0000 (19:36 +0800)]
Update Android port
* src/android.c (android_check_if_event):
* src/androidgui.h: New function.
* src/androidterm.c (android_event_is_for_frame): New function.
(android_reset_conversion): Free and unqueue all text conversion
events for the given frame.
Michael Albinus [Sun, 12 Mar 2023 10:01:22 +0000 (11:01 +0100)]
TRework fix for bug#62106
* lisp/files-x.el (connection-local-set-profiles)
(connection-local-set-profile-variables):
Use `custom-set-variables'. It serves the purpose to not keep
unsaved user options, and it is less invasive than
`customize-save-variable'.
Po Lu [Sun, 12 Mar 2023 09:07:57 +0000 (17:07 +0800)]
Update Android port
* src/androidterm.c (NATIVE_NAME, JNICALL)
(android_build_extracted_text, android_update_selection): Use
0-based indices for Android buffer positions. Also, report
surrounding text relative to the region, not to the cursor.
* src/textconv.c (textconv_query): Accept new values of
position.
(really_set_composing_text): Use ephemeral last point.
Eli Zaretskii [Sun, 12 Mar 2023 08:25:10 +0000 (10:25 +0200)]
; Fix last change
* lisp/emacs-lisp/shortdoc.el (shortdoc-help-fns-examples-function)
(shortdoc-function-examples): Fix compilation warning and add an
empty line before the examples.
* lisp/emacs-lisp/shortdoc.el (shortdoc--insert-group-in-buffer)
(shortdoc-function-examples)
(shortdoc-help-fns-examples-function):
* etc/NEWS:
* doc/lispref/help.texi (Documentation Groups):
* doc/emacs/help.texi (Name Help): Improve documentation of
the last change. (Bug#61877)
Daniel Martín [Tue, 28 Feb 2023 22:15:40 +0000 (23:15 +0100)]
Add functions to query Emacs Lisp examples registered in shortdoc
* lisp/emacs-lisp/shortdoc.el (shortdoc--display-function): Add
a new shortdoc-example text property so that ELisp examples can
be searched for later.
(shortdoc--insert-group-in-buffer): New function extracted from
the buffer insertion code in 'shortdoc-display-group'.
(shortdoc-display-group): Implement in terms of
'shortdoc--insert-group-in-buffer'.
(shortdoc-function-examples): New function that returns an alist
of Emacs Lisp examples from shortdoc.
(shortdoc-help-fns-examples-function): New function to insert
Emacs Lisp function examples in *Help* buffers, if added to
'help-fns-describe-function-functions'.
*
test/lisp/emacs-lisp/shortdoc-tests.el (shortdoc-function-examples-test):
Test it.
* doc/emacs/help.texi (Name Help): Document in the user manual.
* doc/lispref/help.texi (Documentation Groups): Document it.
* etc/NEWS: Advertise it. (Bug#61877)
Po Lu [Sun, 12 Mar 2023 07:43:14 +0000 (15:43 +0800)]
Update Android port
* java/org/gnu/emacs/EmacsOpenActivity.java (EmacsOpenActivity)
(onCancel): New function.
(displayFailureDialog): Handle dialog cancellation.
* src/sfntfont.c (sfnt_parse_languages): Look for SLNG tag if
DLNG is not present.