This fixes cl-substitute, cl-substitute-if, cl-substitute-if-not,
cl-nsubstitute, cl-nsubstitute-if and cl-nsubstitute-if-not,
when called with a string sequence argument.
* lisp/emacs-lisp/cl-seq.el (cl-nsubstitute):
Avoid running in O(n^2) time and make future-safe.
Use clear-string instead of fillarray to clobber secret strings
* lisp/net/sasl-cram.el (sasl-cram-md5-response):
* lisp/net/sasl-digest.el (sasl-digest-md5-response-value):
* lisp/net/sasl.el (sasl-plain-response):
`fillarray` signals an error for strings that contain multibyte chars;
`clear-string` always works for this purpose.
Michael Albinus [Tue, 7 May 2024 07:56:05 +0000 (09:56 +0200)]
Add Tramp method "apptainer"
* doc/misc/tramp.texi (Top, Configuration): Add "Optional methods".
(Optional methods): New section.
(Inline methods) <androidsu, toolbox, flatpak>: These are optional
methods.
(Inline methods) <apptainer>: Add.
* etc/NEWS: New Tramp method "apptainer".
Some Tramp methods are optional.
Fix typos.
* lisp/net/tramp-androidsu.el (tramp-enable-androidsu-method):
New defun. Call it when `system-type' is `android'.
* lisp/net/tramp-container.el (tramp-apptainer-program): New defcustom.
(tramp-apptainer-method): New defconst.
(tramp-apptainer--completion-function)
(tramp-enable-toolbox-method, tramp-enable-flatpak-method)
(tramp-enable-apptainer-method): New defuns.
* lisp/net/tramp.el (tramp-enable-method): New defun.
Po Lu [Tue, 7 May 2024 01:02:00 +0000 (09:02 +0800)]
Disable text-conversion in map-ynp
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): Bind
overriding-text-conversion-style to nil around read-event and
arrange that the input method be reset.
Alan Mackenzie [Mon, 6 May 2024 20:14:57 +0000 (20:14 +0000)]
`read': give fuller error message for errors following "#".
This solves bug#70702.
* src/lread.c (READ_AND_BUFFER, INVALID_SYNTAX_WITH_BUFFER):
New macros.
(read0): For errors in characters sequences beginning with "#",
output the entire character sequence rather than just "#".
* test/src/lread-tests.el (lread-test-bug70702): New test.
Juri Linkov [Mon, 6 May 2024 16:43:50 +0000 (19:43 +0300)]
* lisp/tab-bar.el: Support mouse clicks for multi-item 'global-mode-string'.
(tab-bar-format-global): Split elements of 'global-mode-string'
to separate items of the tab bar, so events for each item are
handled separately (bug#70086).
Po Lu [Mon, 6 May 2024 12:55:49 +0000 (20:55 +0800)]
Expressly disable large file APIs on Android 4.4 and earlier
* configure.ac (CFLAGS): Add -D_FILE_OFFSET_BITS=32 on SDK 20
and earlier that unserviceable functions may not be selected.
Problem reported by Ruth Elburn <ruth@noreply.invalid>.
Po Lu [Mon, 6 May 2024 04:09:21 +0000 (12:09 +0800)]
Optimize stipples on Android
* java/org/gnu/emacs/EmacsGC.java (EmacsGC) <tileObject>:
Change type to EmacsTileObject.
(markDirty): Create an EmacsTileObject rather than a
BitmapDrawable.
* java/org/gnu/emacs/EmacsTileObject.java: New file,
significantly leaner than BitmapDrawable.
Jim Porter [Sun, 5 May 2024 20:09:08 +0000 (13:09 -0700)]
Fix Eshell handling of remote files like "/ssh:remote:~/file.txt"
* lisp/eshell/em-glob.el (eshell-glob-convert): Use 'concat' instead of
'file-name-concat' to avoid extraneous slashes.
(eshell-extended-glob): Bail out if we didn't find a glob after all.
* test/lisp/eshell/em-glob-tests.el (tramp): Require.
(em-glob-test/convert/remote-start-directory): Use the mock remote
connection.
(em-glob-test/remote-user-directory): New test.
Juri Linkov [Sun, 5 May 2024 18:32:22 +0000 (21:32 +0300)]
* lisp/tab-line.el: Use defcustom for group sort variables (bug#59438).
(tab-line-tabs-buffer-group-sort-function)
(tab-line-tabs-buffer-groups-sort-function): Turn defvar into defcustom.
Suggested by Gabriel do Nascimento Ribeiro <gabriel376@hotmail.com>.
(tab-line-tabs-buffer-group-name): Fall back to
'tab-line-tabs-buffer-group-by-mode' when
'tab-line-tabs-buffer-group-function' is nil (its previous default value).
Dmitry Gutov [Sun, 5 May 2024 17:19:48 +0000 (20:19 +0300)]
project--vc-list-files: Use vc-git-command for better error reporting
* lisp/progmodes/project.el (project--vc-list-files):
Use 'vc-git-command' for better error reporting
(https://lists.gnu.org/archive/html/emacs-devel/2024-05/msg00399.html).
Dmitry Gutov [Sun, 5 May 2024 16:42:05 +0000 (19:42 +0300)]
project-find-regexp: Fix test
* test/lisp/progmodes/project-tests.el (project-find-regexp):
Add binding for project-list-file, to fix the test when running
in the terminal (reported on the mailing list).
Stefan Monnier [Sun, 5 May 2024 14:43:37 +0000 (10:43 -0400)]
(read-passwd-toggle-visibility): Fix some loose ends
* lisp/auth-source.el (read-passwd-toggle-visibility): Make sure
we operate on the minibuffer even if some other window was
selected when the little icon was pressed. Don't hardcode the
keymap representation. Use the `keymap` property rather than
the `local-map` property so it can't be accidentally shadowed
by something like a minor-mode map.
On balance it seems likely that the warning would annoy more people than
it would help, so let them deal with any actual problems when the
default is changed instead. See discussion at:
https://lists.gnu.org/archive/html/emacs-devel/2024-05/msg00250.html
* src/lread.c (string_suffix_p, warn_missing_cookie, Fload)
(Feval_buffer):
* lisp/international/mule.el (load-with-code-conversion):
* lisp/startup.el (command-line--load-script):
* etc/NEWS:
Revert all changes, except for the generalised
`lisp_file_lexical_cookie` which may prove useful in the future.
Alan Mackenzie [Sun, 5 May 2024 11:34:14 +0000 (11:34 +0000)]
Run c-unmark-<>-around-region in after-change-functions always.
This fixes bug#70435.
* lisp/progmodes/cc-engine.el (c-unmark-<>-around-region): Run
its contents in after-change-functions for a deletion, so that
c-new-BEG and c-new-END get set. Add a new test (> end beg)
in a check for unterminated string handling.
Dmitry Gutov [Sun, 5 May 2024 03:27:39 +0000 (06:27 +0300)]
New variable 'project-files-relative-names'
* lisp/progmodes/project.el (project-files-relative-names):
New variable (bug#69233).
(project--files-in-directory): Honor it.
(project--vc-list-files): Here too.
(project-find-regexp): Use it to improve performance.
(project-or-external-find-regexp): Add a TODO.
(project-find-file): Use it here too.
(project--read-file-cpd-relative, project--read-file-absolute):
Try to handle file lists with absolute and relative files names.
(project-find-file-in): Set default-directory, so relative names
are interpreted correctly.
* lisp/progmodes/xref.el (xref-matches-in-files):
Consider that the first in FILES can be a relative file name.
* test/lisp/progmodes/project-tests.el (project-find-regexp):
New test.
Po Lu [Sun, 5 May 2024 01:49:09 +0000 (09:49 +0800)]
Don't permit C-x 8 RET &c in isearch.el to contaminate search string
* lisp/isearch.el (isearch-char-by-name, isearch-emoji-by-name):
Concatenate new character to the query string saved by
with-isearch-suspended, not the current string, which might have
been modified by recursive I-search sessions within
completing-read.
shynur [Fri, 3 May 2024 11:40:23 +0000 (19:40 +0800)]
Locate error source of ExceptionGroup in Python shell
The Python shell recognizes the line containing a file path and
a line number when an exception is raised up to the top-level,
in order to locate the source of error. It's supposed to
recognize the built-in ExceptionGroup as well. (Bug#70653)
* lisp/progmodes/python.el (python-shell-compilation-regexp-alist):
Take the single leading vertical line into account.
* etc/NEWS: Announce this change.
Eli Zaretskii [Sat, 4 May 2024 10:12:21 +0000 (13:12 +0300)]
Fix implementation of the --terminal command-line switch
It sounds like this has been broken ever since multi-tty was
added to Emacs.
* src/keyboard.c (dev_tty): New global variable.
* src/keyboard.h: Declare 'dev_tty'.
* src/emacs.c (main): Initialize 'dev_tty'.
* src/term.c (Fcontrolling_tty_p, Fresume_tty, init_tty):
* src/process.c (dissociate_controlling_tty):
* src/keyboard.c (handle_interrupt_signal, handle_interrupt)
(Fset_quit_char): Use 'dev_tty' instead of 'DEV_TTY'. (Bug#70519)
* src/lread.c (string_suffix_p): New.
(warn_missing_cookie): Suppress warning for files not ending in ".el",
except ".emacs".
* etc/NEWS: Update accordingly, and mention how the warning can be
suppressed.
Po Lu [Sat, 4 May 2024 08:06:00 +0000 (16:06 +0800)]
Simplify handling of command-line arguments on Android
* java/org/gnu/emacs/EmacsActivity.java
(EXTRA_STARTUP_ARGUMENTS): New constant.
(onCreate): Read a string array, not a string extra from the
intent with this key.
* java/org/gnu/emacs/EmacsOpenActivity.java (EmacsOpenActivity)
<fileToOpen>: Delete field.
(onCreate): Provide file name as a command line argument when
starting the Emacs service.
* java/org/gnu/emacs/EmacsPreferencesActivity.java (startEmacsQ)
(startEmacsDebugInit): In like manner, replace ad-hoc
command-line argument extra with a proper array.
* java/org/gnu/emacs/EmacsService.java (EmacsService): Rename
extraStartupArgument to extraStartupArguments, and change its
type to a string array.
(onCreate): Adjust to match.
* java/org/gnu/emacs/EmacsService.java (queryTree): Return
handles as longs rather than shorts.
(viewGetSelection): Take long WINDOW, not short.
* src/android.c (struct android_emacs_handle): New structure.
(handle_class): New variable.
(android_init_emacs_service, android_init_emacs_pixmap)
(android_init_emacs_gc_class, android_init_emacs_cursor): Adjust
to match signature changes in constructors.
(android_init_emacs_handle): New function.
(initEmacs): Initialize the handle class, its fields and metods.
(sendConfigureNotify, sendKeyPress, sendKeyRelease, sendFocusIn)
(sendFocusOut, sendWindowAction, sendEnterNotify)
(sendLeaveNotify, sendMotionNotify, sendButtonPress)
(sendButtonRelease, sendTouchDown, sendTouchUp, sendTouchMove)
(sendWheel, sendIconified, sendDeiconified, sendContextMenu)
(sendExpose, sendDndDrag, sendDndUri, sendDndText): Update for
changes to handle type.
(android_alloc_id, android_resolve_handle)
(android_resolve_handle2): Remove functions; replace the second
with a macro that accepts one fewer argument. All callers
changed.
(android_destroy_handle): Cease indexing the handle list for the
handle object.
(android_globalize_reference): New function.
(android_create_window, android_create_gc, android_create_pixmap)
(android_create_font_cursor): Call android_globalize_reference
to convert global references into handles.
(android_free_cursor, android_destroy_window): Cease verifying
the handle type.
(android_copy_area): Check destination object type rather than
handle entry.
(android_query_tree): Adjust for changes to return types.
(likely): Define __builtin_expect variant unconditionally.
* src/android.h (android_resolve_handle): New macro.
* src/androidgui.h (android_handle): Define to intptr_t.
* src/androidterm.c (deleteSurroundingText, finishComposingText)
(performEditorAction, performContextMenuAction, getExtractedText)
(getSelectedText, requestSelectionUpdate, requestCursorUpdates)
(clearInputFlags, getSurroundingText)
(android_get_surrounding_text_internal): Accept handles as
longs, not jshorts.
Warn when loading .el files without lexical-binding declaration
This corresponds to the byte-compiler warning for the same issue,
here emitted for files that aren't compiled but loaded from source.
It should make the planned change to enable lexical binding by default
in Emacs 31 go smoother.
* src/lread.c (lexical_cookie_t): New type.
(lisp_file_lexically_bound_p): Renamed to...
(lisp_file_lexical_cookie): ...this, with the return value retyped.
* src/lread.c (warn_missing_cookie): New.
(Fload): Warn when loading source file and cookie missing.
(Feval_buffer): Add LOADING arg; warn when set and cookie missing.
* lisp/international/mule.el (load-with-code-conversion):
* lisp/startup.el (command-line--load-script):
Call eval-buffer with LOADING arg set.
* etc/NEWS: Announce.
Stefan Monnier [Fri, 3 May 2024 17:23:00 +0000 (13:23 -0400)]
track-changes.el: Add a workaround for bug#70541
* lisp/emacs-lisp/track-changes.el (track-changes-inconsistent-state-p):
New function.
* lisp/progmodes/eglot.el (eglot--track-changes-signal): Use it.
Ihor Radchenko [Fri, 3 May 2024 07:46:22 +0000 (10:46 +0300)]
mhtml-mode: Use `run-mode-hook' to run `prog-mode-hook' (bug#70671)
* lisp/textmodes/mhtml-mode.el (mhtml-mode): When running hooks
simulating inheritance from `prog-mode', use `run-mode-hooks' that
honors `delay-mode-hooks' macro. Note that `delay-mode-hooks' is bound
to non-nil when major mode body is evaluated, so there is no chance that
any major mode-related hooks are executed twice.
Elias G. Perez [Thu, 2 May 2024 16:33:43 +0000 (10:33 -0600)]
Fix bug#70711
* lisp/progmodes/flymake.el (flymake--indicator-overlay-spec):
Check if `flymake-fringe-indicator-position' or
`flymake-margin-indicator-position' are non-nil for allow no
indicators.
F. Jason Park [Thu, 25 Apr 2024 12:09:50 +0000 (05:09 -0700)]
; Set explicit hook depth for erc-once-with-server-event
* lisp/erc/erc.el (erc-once-with-server-event): Set hook depth to -95.
* test/lisp/erc/erc-scenarios-base-association-nick.el: Improve
comment.
* test/lisp/erc/resources/erc-d/erc-d-tests.el
(erc-d--render-entries): Remove do-nothing assertion since its purpose
was unclear and likely dubious, as was incidentally highlighted by the
addition of a function not present on older Emacsen, which this test
still needs to run on.
Juri Linkov [Thu, 2 May 2024 17:55:03 +0000 (20:55 +0300)]
* lisp/tab-bar.el: Support mouse clicks bound in keymap properties.
(tab-bar--event-to-item): Handle mouse bindings for commands
bound in keymap properties of global-mode-string (bug#70086).
(tab-bar-mouse-down-1, tab-bar-mouse-1, tab-bar-touchscreen-begin):
Add the symbol 'global' to the list of handled items.
Lin Sun [Sat, 27 Apr 2024 06:54:27 +0000 (06:54 +0000)]
New function 'python-shell-send-block' for python-mode
* lisp/progmodes/python.el (python-shell-send-block): New
function.
* test/lisp/progmodes/python-tests.el
(python-test--shell-send-block): Test case for the new
function.
* etc/NEWS: Document 'python-shell-send-block'.
(Bug#70609)
Improve performance of `file-truename' (bug#70036)
* lisp/files.el (file-truename): Avoid repetitive calls to
`file-name-nondirectory'. These calls contribute
significantly to CPU time. See the benchmarks in
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=70036#47
* src/nsterm.m (ns_maybe_dumpglyphs_background): Conform logic
to X version by always displaying the background if s->stipple_p
should be set.
(ns_draw_stretch_glyph_string): Set stipple background as
appropriate.
(ns_set_glyph_string_gc): New function.
(ns_draw_glyph_string): Call it, as on X. Reported by Arash
Esbati <arash@gnu.org>.
Augusto Stoffel [Sun, 21 Apr 2024 09:21:58 +0000 (11:21 +0200)]
Eglot: Add 'command-modes' property to all suitable commands
Those are the commands that call 'eglot--current-server-or-lose'.
* lisp/progmodes/eglot.el (eglot--managed-mode),
(eglot-list-connections-mode): Make non-interactive. (Bug#70554)
Yuan Fu [Thu, 2 May 2024 04:21:00 +0000 (21:21 -0700)]
Fix fontification for else in macro body in rust-ts-mode
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--font-lock-settings):
Add a rule for else in macro body. Also added the same rule for "in"
and "move" keyword, as they seems to have the same problem.