emacs.git
19 months agochoose-completion: Retain the suffix after completion boundary
Dmitry Gutov [Thu, 9 May 2024 02:30:32 +0000 (05:30 +0300)]
choose-completion: Retain the suffix after completion boundary

* lisp/minibuffer.el (completion-base-suffix):
Remove as not optimal after all (bug#48356).
(completion--replace): Use insert-before-markers-and-inherit.
(minibuffer-completion-help): Don't set completion-base-affixes,
implement the same logic more optimally by local search and
querying for field boundaries.  Also fix the problem with
completion table, predicate and extra-props being looked up in the
wrong buffer.
(minibuffer-next-completion, minibuffer-choose-completion):
Don't bind completion-use-base-affixes anymore.

* lisp/simple.el (completion-base-affixes)
(completion-use-base-affixes): Remove.
(completion-list-insert-choice-function):
Don't pass them through anymore.

19 months agoDon't report erroneous /content directory on Android 4.3 and earlier
Po Lu [Thu, 9 May 2024 01:00:02 +0000 (09:00 +0800)]
Don't report erroneous /content directory on Android 4.3 and earlier

* src/androidvfs.c (android_content_opendir): Skip two, not one,
elements on Android <= 4.4.

19 months agoPrefer erc--skip property to erc-track--skipped-msgs
F. Jason Park [Tue, 7 May 2024 04:59:48 +0000 (21:59 -0700)]
Prefer erc--skip property to erc-track--skipped-msgs

* lisp/erc/erc-stamp.el (erc-add-timestamp): Honor an overriding
`erc--ts' "msg prop".
(erc-stamp--defer-date-insertion-on-post-modify): Add `erc--skip'
for the `track' module.
* lisp/erc/erc-track.el (erc-track--skipped-msgs): Remove unused
variable.  Originally added as part of bug#60936.
(erc-track-modified-channels): Rely on the `erc--skip' "msg prop"
instead of the now defunct `erc-track--skipped-msgs' variable for
detecting requests to omit `track' mode-line updates during
`erc-display-message'.

19 months agoAvoid shared-ref read syntax in ERC message catalogs
F. Jason Park [Wed, 8 May 2024 22:26:29 +0000 (15:26 -0700)]
Avoid shared-ref read syntax in ERC message catalogs

* lisp/erc/erc.el (erc--message-speaker-ctcp-action-input)
(erc--message-speaker-ctcp-action-statusmsg-input): Don't use
shared/circular references, like #1=foo ... #1#, in literal strings
because it triggers CI validation failures.  These message-format
definitions were originally introduced as part of bug#67677.

19 months agoAdd format-catalog entry for unknown chan mode in ERC
F. Jason Park [Fri, 3 May 2024 03:16:07 +0000 (20:16 -0700)]
Add format-catalog entry for unknown chan mode in ERC

* lisp/erc/erc.el (erc--process-channel-modes): Use format spec
catalog entry, and convert char to string.
(erc-message-english-channel-mode-unknown): New variable.
;; * test/lisp/erc/erc-scenarios-base-renick.el
;; (erc-scenarios-base-renick-queries-solo): Adjust timeout.
;; * test/lisp/erc/erc-scenarios-ignore.el (erc-scenarios-ignore/basic):
;; Adjust timeouts.
;; * test/lisp/erc/erc-scenarios-misc.el (erc-scenarios-base-flood):
;; Adjust timeouts.
;; * test/lisp/erc/resources/base/assoc/bouncer-history/barnet.eld:
;; Adjust timeouts.
;; * test/lisp/erc/resources/base/reuse-buffers/channel/barnet.eld:
;; Adjust timeouts.
;; * test/lisp/erc/resources/erc-d/erc-d-tests.el (erc-d-run-basic):
;; Adjust timeouts.
;; * test/lisp/erc/resources/sasl/plain.eld: Adjust timeouts.
;; * test/lisp/erc/resources/sasl/external.eld: Adjust timeout.
;; * test/lisp/erc/resources/base/auth-source/foonet.eld: Adjust
;; timeout.

19 months ago(repeat-echo-message-string): Reuse 'r-m-c' prompt formatting
Eshel Yaron [Wed, 8 May 2024 16:05:20 +0000 (18:05 +0200)]
(repeat-echo-message-string): Reuse 'r-m-c' prompt formatting

Now that 'repeat-mode' supports adding labels ("hints") next to
available keys, its prompt is very similar in its structure to
what we have in 'read-multiple-choice' (a list of labeled keys).
To make the two interfaces more consistent, reuse the prompt
formatting that 'read-multiple-choice' employs.

See short discussion at
https://lists.gnu.org/archive/html/emacs-devel/2024-05/msg00467.html

* lisp/repeat.el (repeat-echo-message-string): Use
'rmc--add-key-description' to format keys and their labels.

19 months agoDon't mutate strings in cl-substitute
Mattias Engdegård [Wed, 8 May 2024 10:13:48 +0000 (12:13 +0200)]
Don't mutate strings in cl-substitute

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.

19 months agoCorrect documentation relating to tool-bar-position
Po Lu [Wed, 8 May 2024 12:25:47 +0000 (20:25 +0800)]
Correct documentation relating to tool-bar-position

* doc/emacs/android.texi (Android Windowing): Don't claim that
tool-bar-position is unsupported on Android.

* lisp/tool-bar.el (tool-bar-position): Update doc string to
mention that bottom is supported on all systems but Nextstep.

19 months agoCorrect earlier change to map-ynp
Po Lu [Wed, 8 May 2024 12:22:29 +0000 (20:22 +0800)]
Correct earlier change to map-ynp

* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): Don't call
set-text-conversion-style if not bound.

19 months agoMore Tramp optional methods
Michael Albinus [Wed, 8 May 2024 11:44:15 +0000 (13:44 +0200)]
More Tramp optional methods

* doc/misc/tramp.texi (Inline methods) <krlogin, ksu>:
(External methods) <fcp, nc>: These are optional methods.

* etc/NEWS: Mention more optional Tramp methods.

* lisp/net/tramp-androidsu.el (tramp-enable-androidsu-method):
Use proper regexp for `tramp-default-user-alist'.

* lisp/net/tramp-sh.el (tramp-enable-nc-method)
(tramp-enable-ksu-method, tramp-enable-krlogin-method)
(tramp-enable-fcp-method): New defuns.  Move respective
configurations there.

* lisp/net/tramp.el (tramp-enable-method): Implement completion
for interactive use.

* test/lisp/net/tramp-tests.el (tramp-test03-file-name-defaults)
(tramp-test03-file-name-host-rules): Extend tests.

19 months agoFix hang after failed yank-media on Android
Po Lu [Wed, 8 May 2024 08:03:49 +0000 (16:03 +0800)]
Fix hang after failed yank-media on Android

* java/org/gnu/emacs/EmacsClipboard.java (getClipboardTargets)
(getClipboardData):

* java/org/gnu/emacs/EmacsSdk11Clipboard.java
(getClipboardTargets, getClipboardData):

* java/org/gnu/emacs/EmacsSdk8Clipboard.java
(getClipboardTargets, getClipboardData): Return string data as
Strings rather than byte arrays.

* src/androidselect.c (android_init_emacs_clipboard)
(Fandroid_get_clipboard_targets): Adjust to match.
(extract_fd_offsets): Remove duplicated semicolon.
(Fandroid_get_clipboard_data): Call unblock_input before
returning if extract_fd_offsets fails.

19 months agoFix last change in tramp-androidsu.el
Michael Albinus [Tue, 7 May 2024 17:44:19 +0000 (19:44 +0200)]
Fix last change in tramp-androidsu.el

19 months ago; xref-matches-in-files: Fix the previous change (bug#70813)
Dmitry Gutov [Tue, 7 May 2024 16:09:28 +0000 (19:09 +0300)]
; xref-matches-in-files: Fix the previous change (bug#70813)

19 months ago; * doc/misc/reftex.texi (Options - Creating Citations): Minor fix.
Arash Esbati [Tue, 7 May 2024 14:21:24 +0000 (16:21 +0200)]
; * doc/misc/reftex.texi (Options - Creating Citations): Minor fix.

19 months agoSupport biblatex field in `reftex-cite-format'
Arash Esbati [Tue, 7 May 2024 13:50:03 +0000 (15:50 +0200)]
Support biblatex field in `reftex-cite-format'

* lisp/textmodes/reftex-cite.el (reftex-format-citation):
Recognize the alternative "journaltitle" field which is preferred
by biblatex.  (bug#38762)

* test/lisp/textmodes/reftex-tests.el
(reftex-format-citation-test): Adjust test.

19 months ago; * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): Add commentary.
Eli Zaretskii [Tue, 7 May 2024 12:00:31 +0000 (15:00 +0300)]
; * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): Add commentary.

19 months ago; * lib-src/emacsclient.c (local_sockname): Whitespace.
Eli Zaretskii [Tue, 7 May 2024 11:24:40 +0000 (14:24 +0300)]
; * lib-src/emacsclient.c (local_sockname): Whitespace.

19 months ago* etc/NEWS: Elaborate `type` declare entry and regroup.
Mattias Engdegård [Tue, 7 May 2024 10:17:39 +0000 (12:17 +0200)]
* etc/NEWS: Elaborate `type` declare entry and regroup.

19 months agoUse clear-string instead of fillarray to clobber secret strings
Mattias Engdegård [Tue, 7 May 2024 07:19:09 +0000 (09:19 +0200)]
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.

19 months agoDo not report text conversion information from tooltip frames
Po Lu [Tue, 7 May 2024 08:50:14 +0000 (16:50 +0800)]
Do not report text conversion information from tooltip frames

* src/xdisp.c (mark_window_display_accurate_1): Skip
report_point_change if FRAME_WINDOW_P (WINDOW_XFRAME (w)).

19 months agoAdd Tramp method "apptainer"
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.

* test/lisp/net/tramp-tests.el (tramp--test-container-p):
Add "apptainer".
(tramp--test-supports-processes-p): Extend function.

19 months agoSimplify Emacs server detection on Android
Po Lu [Tue, 7 May 2024 01:21:59 +0000 (09:21 +0800)]
Simplify Emacs server detection on Android

* lib-src/emacsclient.c (set_local_socket) [HAVE_ANDROID]: Do
not consider XDG_RUNTIME_DIR or test the ownership or
accessibility of TMPDIR.

19 months agoDisable text-conversion in map-ynp
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.

19 months agoFix bug#66151
Po Lu [Tue, 7 May 2024 00:51:25 +0000 (08:51 +0800)]
Fix bug#66151

* src/fontset.c (free_realized_fontsets): Never call
recompute_basic_faces on dead frames.  (bug#66151)

19 months ago`read': give fuller error message for errors following "#".
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.

19 months agoedebug.el: Fix `edebug-remove-instrumentation` (bug#70791)
Stefan Monnier [Mon, 6 May 2024 18:33:43 +0000 (14:33 -0400)]
edebug.el: Fix `edebug-remove-instrumentation` (bug#70791)

* lisp/emacs-lisp/edebug.el (edebug-unwrap*): Traverse interpreted
functions.

19 months ago; * lisp/kmacro.el (kmacro-add-counter): cut useless variable ref
Mattias Engdegård [Mon, 6 May 2024 14:09:08 +0000 (16:09 +0200)]
; * lisp/kmacro.el (kmacro-add-counter): cut useless variable ref

19 months ago* lisp/tab-bar.el (tab-bar-mouse-1): Avoid infinite recursion (bug#70086).
Juri Linkov [Mon, 6 May 2024 17:10:43 +0000 (20:10 +0300)]
* lisp/tab-bar.el (tab-bar-mouse-1): Avoid infinite recursion (bug#70086).

19 months ago* lisp/emacs-lisp/warnings.el (display-warning): Add guardrails for window.
Juri Linkov [Mon, 6 May 2024 17:00:23 +0000 (20:00 +0300)]
* lisp/emacs-lisp/warnings.el (display-warning): Add guardrails for window.

Check for non-nil 'window' returned from 'display-buffer' for the case when
users decide to use 'allow-no-window' in 'display-buffer-alist' (#70795).

19 months ago* lisp/tab-bar.el (tab-bar-select-restore-windows): Use 'special-mode'.
Juri Linkov [Mon, 6 May 2024 16:48:04 +0000 (19:48 +0300)]
* lisp/tab-bar.el (tab-bar-select-restore-windows): Use 'special-mode'.

19 months ago* lisp/tab-bar.el: Support mouse clicks for multi-item 'global-mode-string'.
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).

19 months ago(Fkey_description): Fix corner (bug#59305)
Stefan Monnier [Mon, 6 May 2024 15:19:11 +0000 (11:19 -0400)]
(Fkey_description): Fix corner (bug#59305)

* src/keymap.c (Fkey_description): Don't mistake latin-1 chars for
ASCII-chars-with-meta.

19 months agoExpressly disable large file APIs on Android 4.4 and earlier
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>.

19 months agoRevert "Disable text conversion in map-ynp"
Eli Zaretskii [Mon, 6 May 2024 12:02:37 +0000 (15:02 +0300)]
Revert "Disable text conversion in map-ynp"

This reverts commit f50a58123a3d386b9bba7c4ba14df62479887bd4.
Please don't make such changes without discussing them.

19 months ago; Avoid byte-compiler warning in comp.el
Eli Zaretskii [Mon, 6 May 2024 10:54:19 +0000 (13:54 +0300)]
; Avoid byte-compiler warning in comp.el

* lisp/emacs-lisp/comp.el (comp--symbol-func-to-fun): Move to
before its first use.

19 months ago; * java/org/gnu/emacs/EmacsTileObject.java: Fix copyright dates.
Po Lu [Mon, 6 May 2024 09:23:57 +0000 (17:23 +0800)]
; * java/org/gnu/emacs/EmacsTileObject.java: Fix copyright dates.

19 months agoDisable text conversion in map-ynp
Po Lu [Mon, 6 May 2024 07:53:49 +0000 (15:53 +0800)]
Disable text conversion in map-ynp

* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): Read response with
read-key, not read-char.

19 months agoOptimize stipples on Android
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.

19 months agoRemove unnecessary cons in function-type property
Andrea Corallo [Sun, 5 May 2024 21:39:01 +0000 (23:39 +0200)]
Remove unnecessary cons in function-type property

* lisp/emacs-lisp/comp-common.el (comp-function-type-spec): Remove
unnecessary car.
* lisp/emacs-lisp/comp.el (comp--intern-func-in-ctxt): Likewise.
* lisp/emacs-lisp/byte-run.el (byte-run--set-function-type): Update
lambda list.

19 months agoFix intra compilation unit function type declaration
Andrea Corallo [Sun, 5 May 2024 21:16:20 +0000 (23:16 +0200)]
Fix intra compilation unit function type declaration

* lisp/emacs-lisp/comp.el (comp-func): Add 'slot'.
(comp--intern-func-in-ctxt): Update.
(comp--get-function-cstr): Update.

19 months agoeglot.el: Require `track-changes` unconditionally
Stefan Monnier [Sun, 5 May 2024 21:23:29 +0000 (17:23 -0400)]
eglot.el: Require `track-changes` unconditionally

* lisp/emacs-lisp/track-changes.el: Bump version.

* lisp/progmodes/eglot.el: Require `track-changes` unconditionally.
(Package-Requires:): Add `track-changes`.
(eglot--track-changes-signal, eglot--signal-textDocument/didChange)
(eglot--managed-mode): Remove non-track-changes alternative code.
(eglot--before-change, eglot--after-change): Delete functions.

19 months agoFix Eshell handling of remote files like "/ssh:remote:~/file.txt"
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.

19 months agoFix tab-line-tabs-buffer-groups (bug#59438)
Gabriel do Nascimento Ribeiro [Sun, 5 May 2024 18:37:23 +0000 (21:37 +0300)]
Fix tab-line-tabs-buffer-groups (bug#59438)

* lisp/tab-line.el (tab-line-tabs-buffer-groups): Handle case
when variable 'tab-line-tabs-buffer-groups-sort-function' is nil.

19 months ago* lisp/tab-line.el: Use defcustom for group sort variables (bug#59438).
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).

19 months agoFix lock-file format in Tramp
Michael Albinus [Sun, 5 May 2024 17:54:07 +0000 (19:54 +0200)]
Fix lock-file format in Tramp

* lisp/net/tramp.el (tramp-lock-file-info-regexp): BOOT_TIME can
be negative.  (Bug#70415)

19 months agoproject--vc-list-files: Use vc-git-command for better error reporting
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).

19 months agoproject-find-regexp: Fix test
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).

19 months agoFix lock files on some versions of Cygwin
Eli Zaretskii [Sun, 5 May 2024 16:30:57 +0000 (19:30 +0300)]
Fix lock files on some versions of Cygwin

* src/filelock.c (current_lock_owner): Support negative boot-time
on rare systems.  (Bug#70415)

19 months ago(read-passwd-toggle-visibility): Fix some loose ends
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.

19 months ago; * etc/NEWS: Move 'Miscellaneous' subtopics last.
Mattias Engdegård [Sun, 5 May 2024 14:20:58 +0000 (16:20 +0200)]
; * etc/NEWS: Move 'Miscellaneous' subtopics last.

19 months agoRetract lexical cookie source load warning
Mattias Engdegård [Sat, 4 May 2024 14:18:09 +0000 (16:18 +0200)]
Retract lexical cookie source load warning

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.

19 months agoRun c-unmark-<>-around-region in after-change-functions always.
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.

19 months ago; Improve documentation of a recent change
Eli Zaretskii [Sun, 5 May 2024 05:20:39 +0000 (08:20 +0300)]
; Improve documentation of a recent change

* lisp/progmodes/project.el (project-files-relative-names):
* etc/NEWS: Improve documentation of 'project-files-relative-names'.

19 months agoNew variable 'project-files-relative-names'
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.

* etc/NEWS: Mention it.

19 months agoDon't permit C-x 8 RET &c in isearch.el to contaminate search string
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.

19 months agoFix cursor misalignment on truncated RTL rows
Po Lu [Sun, 5 May 2024 01:38:27 +0000 (09:38 +0800)]
Fix cursor misalignment on truncated RTL rows

* src/xdisp.c (set_cursor_from_row): Begin computing the
position of the rightmost glyph from row->x, not 0.

19 months agoFix inadvertent removal in EmacsWindow
Po Lu [Sun, 5 May 2024 01:03:57 +0000 (09:03 +0800)]
Fix inadvertent removal in EmacsWindow

* java/org/gnu/emacs/EmacsWindow.java (onKeyUp): Send KeyPress
events upon deferred KEYCODE_BACK.

19 months ago(eglot--track-changes-signal): Improve last fix (bug#70541)
Stefan Monnier [Sat, 4 May 2024 21:14:46 +0000 (17:14 -0400)]
(eglot--track-changes-signal): Improve last fix (bug#70541)

* lisp/progmodes/eglot.el (eglot--add-one-shot-hook): New function.
(eglot--track-changes-signal): Use it.

19 months agotextsec: handle email address without domain part
Andreas Schwab [Fri, 28 Jul 2023 09:53:03 +0000 (11:53 +0200)]
textsec: handle email address without domain part

* lisp/international/textsec.el
(textsec-email-address-suspicious-p): Handle missing domain part.
(textsec-email-address-header-suspicious-p): Likewise.

19 months ago(ruler-mode-ruler): Minor optimization
Stefan Monnier [Sat, 4 May 2024 16:06:16 +0000 (12:06 -0400)]
(ruler-mode-ruler): Minor optimization

* lisp/ruler-mode.el (ruler-mode-ruler): Don't compute
`line-number-display-width` redundantly.  Use `add-text-properties`.
Remove redundant `local-map` property.

19 months agoAllow `letrec` binding without init expression
Mattias Engdegård [Sat, 4 May 2024 12:09:23 +0000 (14:09 +0200)]
Allow `letrec` binding without init expression

For example, (letrec (... (x) ...) ...) is now allowed.

* lisp/subr.el (letrec): Allow omitted init expression.
* test/lisp/subr-tests.el (subr--tests-letrec): Add test case.

19 months agoMerge from origin/emacs-29
Eli Zaretskii [Sat, 4 May 2024 12:10:54 +0000 (08:10 -0400)]
Merge from origin/emacs-29

b392169e541 ; * doc/lispref/commands.texi (Event Mod): Add motivation...
e272fd3da92 ; Update description of 'mail-mode'

19 months ago; Fix last change
Eli Zaretskii [Sat, 4 May 2024 11:51:05 +0000 (14:51 +0300)]
; Fix last change

* lisp/progmodes/python.el
(python-shell-compilation-regexp-alist): Add :version.
(Bug#70653)

19 months agoLocate error source of ExceptionGroup in Python shell
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.

19 months agoFix implementation of the --terminal command-line switch
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)

19 months agoOnly issue lexical cookie warning for elisp files
Mattias Engdegård [Sat, 4 May 2024 08:08:19 +0000 (10:08 +0200)]
Only issue lexical cookie warning for elisp files

* 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.

19 months agoSimplify handling of command-line arguments on Android
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/EmacsThread.java (EmacsThread)
<extraStartupArguments>: Ditto.
<fileToOpen>: Delete field.
(run): Adjust correspondingly.

19 months agoDelete redundant backquotes in android-win.el
Po Lu [Sat, 4 May 2024 06:54:12 +0000 (14:54 +0800)]
Delete redundant backquotes in android-win.el

* lisp/term/android-win.el (android-encode-jni)
(android-decode-jni): Replace redundant backquotes with ordinary
quotes.

19 months ago; * etc/NEWS: Fix last change.
Eli Zaretskii [Sat, 4 May 2024 06:57:05 +0000 (09:57 +0300)]
; * etc/NEWS: Fix last change.

19 months ago; * etc/NEWS: Fix a recently-added entry.
Eli Zaretskii [Sat, 4 May 2024 06:34:18 +0000 (09:34 +0300)]
; * etc/NEWS: Fix a recently-added entry.

19 months agoSimplify management of Android handle IDs
Po Lu [Sat, 4 May 2024 03:36:09 +0000 (11:36 +0800)]
Simplify management of Android handle IDs

* java/org/gnu/emacs/EmacsCursor.java (EmacsCursor):

* java/org/gnu/emacs/EmacsGC.java (EmacsGC):

* java/org/gnu/emacs/EmacsHandleObject.java (EmacsHandleObject):
Remove HANDLE argument to constructor.

* java/org/gnu/emacs/EmacsPixmap.java (EmacsPixmap):

* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow):

* java/org/gnu/emacs/EmacsInputConnection.java
(EmacsInputConnection) <windowHandle>: Change type to long.

* java/org/gnu/emacs/EmacsNative.java (EmacsNative)
(sendConfigureNotify, sendKeyPress, sendKeyRelease, sendFocusIn)
(sendFocusOut, sendWindowAction, sendEnterNotify)
(sendLeaveNotify, sendMotionNotify, sendButtonPress)
(sendButtonRelease, sendTouchDown, sendTouchUp, sendTouchMove)
(sendWheel, sendIconified, sendDeiconified, sendContextMenu)
(sendExpose, sendDndDrag, sendDndUri, sendDndText)
(beginBatchEdit, commitCompletion, endBatchEdit, commitText)
(deleteSurroundingText, finishComposingText, replaceText)
(getSelectedText, getTextAfterCursor, getTextBeforeCursor)
(setComposingText, setComposingRegion, setSelection)
(performEditorAction, performContextMenuAction, getExtractedText)
(requestSelectionUpdate, requestCursorUpdates, clearInputFlags)
(getSurroundingText, takeSnapshot, getSelection): Accept handles
as longs, rather than shorts.  All callers changed.

* 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.

19 months ago; * src/lread.c (warn_missing_cookie): Fix typo.
Po Lu [Sat, 4 May 2024 03:12:16 +0000 (11:12 +0800)]
; * src/lread.c (warn_missing_cookie): Fix typo.

19 months ago* src/lread.c (warn_missing_cookie): Exempt the user init file.
Po Lu [Sat, 4 May 2024 03:11:36 +0000 (11:11 +0800)]
* src/lread.c (warn_missing_cookie): Exempt the user init file.

19 months ago* lisp/progmodes/eglot.el (eglot--track-changes-signal): More typo
Stefan Monnier [Fri, 3 May 2024 20:51:57 +0000 (16:51 -0400)]
* lisp/progmodes/eglot.el (eglot--track-changes-signal): More typo

19 months ago* lisp/emacs-lisp/track-changes.el (track-changes-inconsistent-state-p): Typo
Stefan Monnier [Fri, 3 May 2024 20:39:10 +0000 (16:39 -0400)]
* lisp/emacs-lisp/track-changes.el (track-changes-inconsistent-state-p): Typo

19 months agoQuery Eglot version via package.el
Philip Kaludercic [Thu, 7 Mar 2024 09:21:45 +0000 (10:21 +0100)]
Query Eglot version via package.el

* lisp/progmodes/eglot.el (eglot--version): Remove constant.
(eglot--connect): Use 'package-get-version'.

19 months agoWarn when loading .el files without lexical-binding declaration
Mattias Engdegård [Fri, 3 May 2024 15:58:44 +0000 (17:58 +0200)]
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.

19 months agotrack-changes.el: Add a workaround for bug#70541
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.

19 months agomhtml-mode: Use `run-mode-hook' to run `prog-mode-hook' (bug#70671)
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.

19 months ago* doc/lispref/keymaps.texi (Creating Keymaps): Add :repeat :hints (bug#70576).
Juri Linkov [Fri, 3 May 2024 06:22:39 +0000 (09:22 +0300)]
* doc/lispref/keymaps.texi (Creating Keymaps): Add :repeat :hints (bug#70576).

19 months agoFix bug#70711
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.

19 months agoOnly run 'eshell-first-time-mode-hook' once per Emacs session
Lin Sun [Sat, 27 Apr 2024 06:55:49 +0000 (06:55 +0000)]
Only run 'eshell-first-time-mode-hook' once per Emacs session

* lisp/eshell/esh-mode.el (eshell-mode): Set 'eshell-first-time-p' to
nil (bug#70610).

19 months agoPrevent reporting of crashes when Emacs is restarted on Android
Po Lu [Fri, 3 May 2024 02:43:31 +0000 (10:43 +0800)]
Prevent reporting of crashes when Emacs is restarted on Android

* src/emacs.c (Fkill_emacs): Ignore SIGBUS and SIGSGEV
immediately before calling exit.

19 months ago; Set explicit hook depth for erc-once-with-server-event
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.

19 months agoEliminate string data mutation in ruler-mode
Mattias Engdegård [Thu, 2 May 2024 19:49:40 +0000 (21:49 +0200)]
Eliminate string data mutation in ruler-mode

* lisp/ruler-mode.el (ruler-mode-ruler):
Mutate a vector instead of a string.

19 months ago* lisp/tab-bar.el: Support mouse clicks bound in keymap properties.
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.

19 months agoMake the buffer displayed by tab-bar-select-restore-windows internal
Juri Linkov [Thu, 2 May 2024 17:44:04 +0000 (20:44 +0300)]
Make the buffer displayed by tab-bar-select-restore-windows internal

* lisp/tab-bar.el (tab-bar-select-restore-windows): Make the buffer
" *Old buffer %s*" internal with the leading space in its name.

19 months ago; Fix last change
Eli Zaretskii [Thu, 2 May 2024 16:30:40 +0000 (19:30 +0300)]
; Fix last change

* etc/NEWS: Fix wording of a recently-added item.

* doc/lispref/functions.texi (Declare Form): Fix markup.

19 months agoMerge branch 'lisp-func-type-decls' into 'master'
Andrea Corallo [Thu, 2 May 2024 15:06:07 +0000 (17:06 +0200)]
Merge branch 'lisp-func-type-decls' into 'master'

19 months agoetc/NEWS (Function type declaration): Mark it +++.
Andrea Corallo [Thu, 2 May 2024 14:42:45 +0000 (16:42 +0200)]
etc/NEWS (Function type declaration): Mark it +++.

19 months ago* doc/lispref/functions.texi (Declare Form): Improve again declare type.
Andrea Corallo [Thu, 2 May 2024 14:38:14 +0000 (16:38 +0200)]
* doc/lispref/functions.texi (Declare Form): Improve again declare type.

19 months ago* doc/lispref/functions.texi (Declare Form): Better warn about UB.
Andrea Corallo [Thu, 2 May 2024 10:15:30 +0000 (12:15 +0200)]
* doc/lispref/functions.texi (Declare Form): Better warn about UB.

19 months agoAdd lexical cookie to new init files
Mattias Engdegård [Thu, 2 May 2024 11:34:22 +0000 (13:34 +0200)]
Add lexical cookie to new init files

* lisp/cus-edit.el (custom-save-all):
Add lexical cookie if the file is empty.

19 months ago; Fix last change
Eli Zaretskii [Thu, 2 May 2024 10:04:15 +0000 (13:04 +0300)]
; Fix last change

* lisp/progmodes/python.el (python-shell-send-block): Doc fix.

* test/lisp/progmodes/python-tests.el
(python-test--shell-send-block): Avoid byte-compiler warnings.
(Bug#70609)

19 months agoNew function 'python-shell-send-block' for python-mode
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)

19 months agoImprove performance of `file-truename' (bug#70036)
Ihor Radchenko [Tue, 30 Apr 2024 11:27:04 +0000 (14:27 +0300)]
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

19 months agoAdd ExceptionGroup as a Python keyword
kobarity [Tue, 30 Apr 2024 05:10:57 +0000 (14:10 +0900)]
Add ExceptionGroup as a Python keyword

* lisp/progmodes/python.el
(python-font-lock-keywords-maximum-decoration)
(python--treesit-exceptions): Add ExceptionGroup.  (Bug#70653)

19 months agoFix display of stipples on NS with respect to cursor highlight
Po Lu [Thu, 2 May 2024 08:56:26 +0000 (16:56 +0800)]
Fix display of stipples on NS with respect to cursor highlight

* src/nsfont.m (nsfont_draw): Delete redundant code.

* 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>.

19 months ago; * doc/lispref/commands.texi (Event Mod): Add motivation (bug#70596).
Eli Zaretskii [Thu, 2 May 2024 09:20:09 +0000 (12:20 +0300)]
; * doc/lispref/commands.texi (Event Mod): Add motivation (bug#70596).

19 months ago; Fix python test case for testing completion with ipython
Lin Sun [Thu, 25 Apr 2024 06:54:27 +0000 (06:54 +0000)]
; Fix python test case for testing completion with ipython

* test/lisp/progmodes/python-tests.el
(python-shell-completion-at-point-ipython): Fix value of
'python-test-shell-interpreter'.  (Bug#70578)