Compare commits

...

41 Commits

Author SHA1 Message Date
Andrea Corallo a39a806012 * doc/lispref/functions.texi (Declare Form): Rename and update 'ftype' entry. 2024-05-14 11:17:25 +02:00
Andrea Corallo e0cbed16b4 * etc/NEWS: Rename 'type' -> 'ftype' and tweak it. 2024-05-14 11:17:25 +02:00
Andrea Corallo b87670b564 * Allow for optional function name parameter in 'ftype' declaration
* lisp/emacs-lisp/byte-run.el (defun-declarations-alist): Allow for
optional function name parameter in 'ftype' declaration.
2024-05-14 11:17:25 +02:00
Andrea Corallo 6e1bb713f6 Change 'type' declaration to 'ftype'
* lisp/window.el (get-lru-window, get-largest-window)
(one-window-p): Update function type declaration.
* lisp/subr.el (ignore, error, zerop, fixnump, bignump, lsh)
(last, eventp, mouse-movement-p, log10, memory-limit)
(internal-pop-keymap): Likewise.
* lisp/simple.el (count-lines, mark, string-empty-p): Likewise.
* lisp/files.el (parse-colon-path): Likewise.
* lisp/env.el (getenv): Likewise.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt): Likewise.
* lisp/emacs-lisp/lisp.el (buffer-end): Likewise.
* lisp/emacs-lisp/comp.el (comp--final): Likewise.
* lisp/custom.el (custom-variable-p): Likewise.
* lisp/emacs-lisp/byte-run.el (defun-declarations-alist): Rename 'type'
-> 'ftype'.
2024-05-14 11:17:25 +02:00
Michael Albinus 041aa3ffc6 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs 2024-05-14 10:50:17 +02:00
Michael Albinus dd13ab0756 Trace Tramp user error
* lisp/net/tramp-androidsu.el (tramp-androidsu-maybe-open-connection):
Use `tramp-user-error' for the traces.
2024-05-14 10:49:52 +02:00
Po Lu becdee7482 ; * lisp/net/tramp-androidsu.el (tramp-androidsu-handle-make-process): Typo. 2024-05-14 16:20:17 +08:00
Michael Albinus 6c45f0b546 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs 2024-05-14 10:18:35 +02:00
Michael Albinus 7ddba8e71e ; Fix whitespace 2024-05-14 10:18:04 +02:00
Po Lu 65b0446633 Port tramp-androidsu to a wider variety of systems
* lisp/net/tramp-androidsu.el
(tramp-androidsu-maybe-open-connection): Search for `su' when
the connection is initiated; replace PATH of inferior shell with
trap-androidsu-remote-path.
(tramp-androidsu-handle-make-process): Do not provide username
if root.
2024-05-14 16:15:14 +08:00
Eli Zaretskii 149c6412df ; * etc/NEWS: Fix wording, again. 2024-05-14 10:53:40 +03:00
Eli Zaretskii e583cc35e4 ; * etc/NEWS: Fix wording. 2024-05-14 10:52:17 +03:00
Juri Linkov 407b88333b Add documentation about sorting Imenu completions (bug#70846)
* doc/emacs/programs.texi (Imenu): Document how Imenu completions
can be sorted.

* lisp/imenu.el (imenu-sort-function): Explain in the docstring
how to sort Imenu completions.
2024-05-14 09:55:52 +03:00
Eli Zaretskii f6d060b39a ; Fix documentation of recently-installed changes
* lisp/emacs-lisp/bytecomp.el (compilation-safety): Doc fix.

* etc/NEWS: Fix wording of the 'compilation-safety' entry.

* doc/lispref/functions.texi (Declare Form): Fix cross-reference
and wording.
* doc/lispref/compile.texi (Native-Compilation Variables): Add the
missing @anchor.  Fix wording.
2024-05-14 08:51:13 +03:00
Po Lu fff245c529 Fix failure of `restart-emacs' to restart Emacs on Android
* src/emacs.c (Fkill_emacs) [HAVE_ANDROID && !ANDROID_STUBIFY]:
Arrange to terminate Emacs upon receipt of a bus error.
2024-05-14 10:16:31 +08:00
Andrea Corallo 8dccc586ea * etc/NEWS (Safety compilation parameter): Add entry. 2024-05-13 23:09:22 +02:00
Andrea Corallo 04e7078d5e Add some 'compilation-safety' documentation
* lisp/emacs-lisp/bytecomp.el (compilation-safety): Better doc.
* doc/lispref/functions.texi (Declare Form): Add 'safety'.
* doc/lispref/compile.texi (Native-Compilation Variables): Add
'compilation-safety'.
2024-05-13 23:09:09 +02:00
Andrea Corallo 9e4e6d0fc9 Add 'safety' function declaration
* lisp/emacs-lisp/comp.el (comp-known-predicates): Use
'comp-func-safety'.
(comp-ctxt, comp-mvar-type-hint-match-p): New 'safety' slot.
(comp-c-func-name): New function.
(comp--spill-lap-function, comp--intern-func-in-ctxt): Update.
* lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Spill safety.
* lisp/emacs-lisp/byte-run.el (byte-run--set-completion): New alias.
(defun-declarations-alist): Update.
2024-05-13 23:01:08 +02:00
Andrea Corallo 13ddfc2011 Introduce 'compilation-safety' variable
* lisp/emacs-lisp/bytecomp.el (compilation-safety): New customize.
* src/comp.c (comp_t): Add func_safety.
(emit_call_with_type_hint, emit_call2_with_type_hint): Make use of.
(compile_function): Set 'comp.func_safety'.
2024-05-13 23:01:08 +02:00
Andrea Corallo 595799edd3 * lisp/emacs-lisp/comp.el (comp--get-function-cstr): Fix it. 2024-05-13 16:49:29 +02:00
Dmitry Gutov e86c4d8bdc ; Fix the xref--group-name-for-display tests 2024-05-13 16:16:39 +03:00
Mattias Engdegård 49e243c0c8 Avoid resizing mutation in subst-char-in-string, take two
This time we take care to preserve properties, and add a test.

* lisp/subr.el (subst-char-in-string):
Use string-replace to avoid resizing mutation and O(n^2) time.
* test/lisp/subr-tests.el (subr--subst-char-in-string): New test.
2024-05-13 12:39:41 +02:00
Michael Albinus 334fb0ddfe Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs 2024-05-13 10:31:45 +02:00
Michael Albinus be31c38359 * doc/misc/tramp.texi: Adapt some markups. 2024-05-13 10:31:13 +02:00
Basil L. Contovounesios af27ecbf15 ; Tweak last docstring addition in lisp/imenu.el. 2024-05-13 09:58:50 +02:00
Michael Albinus af526f8856 Fix bug#70900
* lisp/net/tramp.el (tramp-handle-unlock-file): Be quiet if user
isn't interested in lock files.  Bug#70900
2024-05-13 09:23:58 +02:00
Michael Albinus 66a12698ab Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs 2024-05-13 09:23:32 +02:00
Juri Linkov 431f8ff1e3 * lisp/imenu.el: Support more values for imenu-flatten (bug#70846)
(imenu-flatten): Change type boolean to choice
of more values for prefix/suffix section names.
(imenu--completion-buffer): Add :annotation-function if
'imenu-flatten' is 'annotation'.
(imenu--flatten-index-alist): Put property 'imenu-section' if
'imenu-flatten' is 'annotation'.
2024-05-13 09:59:07 +03:00
Po Lu 9443f8145e Communicate frame titles to the window manager on Android
* java/org/gnu/emacs/EmacsActivity.java (detachWindow)
(attachWindow): Call updateWmName.
(updateWmName): New function; transfer wm name from the window
attached to the task's description.

* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow)
<wmName>: New field.
(setWmName): New function.

* src/android.c (android_init_emacs_window): Link to new
function.
(android_set_wm_name): New function.

* src/android.h (struct android_emacs_service): Delete unused
entries.

* src/androidfns.c (android_set_name_internal, android_set_name)
(android_implicitly_set_name, android_explicitly_set_name)
(android_set_title): Port from X.

* src/androidterm.c (android_term_init): Compute default frame
title.

* src/androidterm.h (struct android_display_info) <x_id_name>:
New field.
2024-05-13 14:42:35 +08:00
Michael Albinus 41ec1d7960 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs 2024-05-13 07:24:30 +02:00
Dmitry Gutov f560e75933 ruby-rubocop-use-bundler: New user option
* lisp/progmodes/ruby-mode.el (ruby-rubocop-use-bundler):
New user option.
(ruby-flymake-rubocop--use-bundler-p): Use it.

* etc/NEWS: Mention it.
2024-05-13 05:37:05 +03:00
Po Lu ad588f8131 ; * src/epaths.in: Declare and use android_game_path. 2024-05-13 08:26:04 +08:00
Po Lu b86359d4ab Complete pacification of build warnings on Android
* build-aux/makecounter.sh: Introduce extern declaration of
emacs_shortlisp_counter.

* src/android.c (android_class_path): Declare static.

* src/androidfont.c (font_driver_class, font_spec_class)
(integer_class, font_metrics_class, font_object_class): Declare
static.

* src/androidterm.c (android_frame_parm_handlers): Move
declaration...

* src/androidterm.h (android_frame_parm_handlers): ... here.
2024-05-13 08:25:39 +08:00
Dmitry Gutov b20d4ab374 Fix 'C-u C-x p g' globally and 'A' in dired-mode
* lisp/progmodes/project.el (project-find-regexp): Ensure the
DEFAULT-DIRECTORY is set correctly for the 'C-u' case (bug#70888).

* lisp/progmodes/project.el (project--files-in-directory):
Ensure that the DIR argument ends with a slash --
'dired-do-find-regexp' passes it differently, for example.

* lisp/progmodes/xref.el (xref--group-name-for-display): Ensure
the project-relative and absolute display modes work well for
groups with "relative" file names.
(xref--analyze, xref--add-log-current-defun): Change accordingly.

* test/lisp/progmodes/project-tests.el
(project-find-regexp-with-prefix): New test.
2024-05-12 20:56:55 +03:00
Michael Albinus e53e8b4cf4 Add Tramp method "nspawn"
* doc/misc/tramp.texi: Adapt some markups.
(Inline methods) <nspawn>: Add.
(Default Host): Mention default host for "nspawn".
(Customizing Methods): Remove tramp-nspawn.
(Password handling): Add "nspawn".

* etc/NEWS: New Tramp method "nspawn".

* lisp/net/tramp-compat.el (tramp-nspawn): Warn, if that package is used.

* lisp/net/tramp-container.el (tramp-nspawn-program): New defcustom.
(tramp-nspawn-method): New defconst.
(tramp-nspawn--completion-function, tramp-enable-nspawn-method):
New defuns.

* lisp/net/tramp.el (tramp-local-host-regexp): Add OpenSUSE host names.
2024-05-12 19:40:08 +02:00
Dmitry Gutov 2c759b9ce6 completion--replace: Fix completion cycling
* lisp/minibuffer.el (completion--replace):
Don't "insert before markers" after all because in some cases
(https://lists.gnu.org/archive/html/emacs-devel/2024-05/msg00701.html)
- like cycling - BEG can be denoted by a marker as well.
(minibuffer-completion-help): Make FIELD-END simply a fixnum.  And
adjust its value manually inside the local
completion-list-insert-choice-function (bug#48356).
2024-05-12 19:02:36 +03:00
Po Lu 6e8bee27a5 Fix offset of reported conversion regions
* src/androidterm.c (request_class, text_class): Pacify new
warning.
(android_update_selection): Don't redundantly subtract 1 from
compose region start.
2024-05-12 21:43:58 +08:00
Mattias Engdegård 9d7b22fcb4 Revert "Avoid resizing mutation in subst-char-in-string"
This reverts commit 184d6e8c02.

It wasn't quite correct: the path through `string-replace` would not
preserve text properties in the input string, which broke Gnus.
2024-05-12 15:18:25 +02:00
Mattias Engdegård 9365feadcc Silence some macOS build warnings
* src/image.c (native_image_type): Declare static.
* src/keyboard.c (lispy_function_keys): Declare static on NS.
* src/nsmenu.m (context_menu_value):
* src/nsterm.m (ns_frame_parm_handlers): Move extern declarations...
* src/nsterm.h: ...here.
* test/src/emacs-module-resources/mod-test.c: Add extern declaration.
2024-05-12 15:04:47 +02:00
Mattias Engdegård 38091e43be Safer and faster string sorting
* lisp/emacs-lisp/cl-seq.el (cl-sort):
Don't use string mutation when sorting the characters in a string.
This avoids O(n^2) run time and makes it future-safe.
2024-05-12 14:58:38 +02:00
Po Lu 86d196c71d Properly deinitialize directory cursors on closedir
* src/androidvfs.c (android_saf_tree_closedir): Call
cursor.close, for deleting the local reference to enable its
garbage collection is not sufficient to release all related
resources.
2024-05-12 20:24:19 +08:00
49 changed files with 728 additions and 199 deletions

View File

@ -36,6 +36,7 @@ cat > $1 <<EOF
#define EXPORT __attribute__ ((visibility ("default")))
#endif /* HAVE_ANDROID */
extern int emacs_shortlisp_counter;
#ifdef EXPORT
EXPORT
#endif /* EXPORT */

View File

@ -378,6 +378,10 @@ they occur in the buffer; if you want alphabetic sorting, use the
symbol @code{imenu--sort-by-name} as the value. You can also
define your own comparison function by writing Lisp code.
You can also customize how Imenu completions are sorted by changing
the variable @code{completion-category-overrides} and setting its
@code{display-sort-function} for the category @code{imenu}.
If Eglot is activated for the current buffer's project
(@pxref{Projects}) and the current buffer's major mode, Eglot provides
its own facility for producing the buffer's index based on the

View File

@ -987,6 +987,26 @@ form, @pxref{Declare Form}.)
The default value is 2.
@end defopt
@anchor{compilation-safety}
@defopt compilation-safety
This variable specifies the safety level to be used for the emitted
native code. The value should be a number, either 0 or 1 with the
following meanings:
@table @asis
@item 0
Emitted code can misbehave (up to even crashing Emacs) if a function's
declaration does not describe correctly what the function does or how it
is called, and the function is natively compiled.
@item 1
Emitted code must be generated in a safe manner even if functions are
mis-declared.
@end table
This can also be controlled at a function granularity, by using the
@code{safety} @code{declare} form, @pxref{Declare Form}.
@end defopt
@defopt native-comp-debug
This variable specifies the level of debugging information produced by
native-compilation. Its value should be a number between zero and 3,

View File

@ -2709,7 +2709,13 @@ native code emitted for the function. In particular, if @var{n} is
@minus{}1, native compilation of the function will emit bytecode
instead of native code for the function.
@item (type @var{type})
@item (safety @var{n})
Specify the value of @code{compilation-safety} in effect for this
function. This allows function-level control of the safety level used
for the code emitted for the function (@pxref{Native-Compilation
Variables}).
@item (ftype @var{type} &optional @var{function})
Declare @var{type} to be the type of this function. This is used for
documentation by @code{describe-function}. Also it can be used by the
native compiler (@pxref{Native Compilation}) for improving code
@ -2721,14 +2727,16 @@ without type declaration.
interleaved with symbols @code{&optional} and @code{&rest} to match the
function's arguments (@pxref{Argument List}).
Here's an example of using @code{type} inside @code{declare} to declare
@var{function} if present should be the name of function being defined.
Here's an example of using @code{ftype} inside @code{declare} to declare
a function @code{positive-p} that takes an argument of type @var{number}
and return a @var{boolean}:
@lisp
@group
(defun positive-p (x)
(declare (type (function (number) boolean)))
(declare (ftype (function (number) boolean)))
(when (> x 0)
t))
@end group
@ -2742,8 +2750,8 @@ argument of type @var{string} and return one of the symbols
@lisp
@group
(defun cons-or-number (x &optional err-msg)
(declare (type (function ((or cons number) &optional string)
(member is-cons is-number))))
(declare (ftype (function ((or cons number) &optional string)
(member is-cons is-number))))
(if (consp x)
'is-cons
(if (numberp x)
@ -2755,10 +2763,12 @@ argument of type @var{string} and return one of the symbols
For description of additional types, see @ref{Lisp Data Types}).
Declaring a function with an incorrect type produces undefined behavior
and could lead to unexpected results or might even crash Emacs when code
is native-compiled and loaded. Note also that when redefining (or
advising) a type declared function the replacement should respect the
original signature to avoid undefined behavior.
and could lead to unexpected results or might even crash Emacs when
natively-compiled code is loaded, if it was compiled with
@code{compilation-safety} level of zero (@pxref{compilation-safety}).
Note also that when redefining (or advising) a type-declared function,
the replacement should respect the original signature to avoid such
undefined behavior.
@item no-font-lock-keyword
This is valid for macros only. Macros with this declaration are

View File

@ -454,7 +454,7 @@ optional, in case of a missing part a default value is assumed. The
default value for an empty local file name part is the remote user's
home directory. The shortest remote file name is thus
@file{@trampfn{-,,}}. The @samp{-} notation for the default method is
used for syntactical reasons, @ref{Default Method}.
used for syntactical reasons, @pxref{Default Method}.
The @code{method} part describes the connection method used to reach
the remote host, see below.
@ -465,7 +465,7 @@ which case it is written as @code{user%domain}.
The @code{host} part must be a host name which can be resolved on
your local host. It could be a short host name, a fully qualified
domain name, an IPv4 or IPv6 address, @ref{File name syntax}. Some
domain name, an IPv4 or IPv6 address, @pxref{File name syntax}. Some
connection methods also support a notation for the port to be used, in
which case it is written as @code{host#port}.
@ -802,7 +802,7 @@ files between different @emph{user identities} on the same host.
usability of one of the commands defined in
@code{tramp-remote-coding-commands}. @value{tramp} uses the first
reliable command it finds. @value{tramp}'s search path can be
customized, see @ref{Remote programs}.
customized, @pxref{Remote programs}.
In case none of the commands are available, @value{tramp} first
transfers a small Perl program to the remote host, and then tries to
@ -866,7 +866,7 @@ equivalent @option{androidsu} method is provided for that system with
workarounds for its many idiosyncrasies, with the exception that
multi-hops are unsupported.
This is an optional method, @ref{Optional methods}. It is enabled by
This is an optional method, @pxref{Optional methods}. It is enabled by
default on @code{android} systems only.
@item @option{sudo}
@ -877,8 +877,8 @@ Similar to @option{su} method, @option{sudo} uses @command{sudo}.
@command{sudo} must have sufficient rights to start a shell.
For security reasons, a @option{sudo} connection is disabled after a
predefined timeout (5 minutes by default). This can be changed, see
@ref{Predefined connection information}.
predefined timeout (5 minutes by default). This can be changed,
@pxref{Predefined connection information}.
@item @option{doas}
@cindex method @option{doas}
@ -896,7 +896,7 @@ This method is used on @code{systemd}-based hosts. Internally, it
uses the @code{systemd-run} command. A @option{run0} connection is
disabled after a predefined timeout as well.
This is an optional method, @ref{Optional methods}.
This is an optional method, @pxref{Optional methods}.
@item @option{sg}
@cindex method @option{sg}
@ -939,7 +939,7 @@ missing shell prompts that confuses @value{tramp}.
This method is also similar to @option{ssh}. It uses the
@command{krlogin -x} command only for remote host login.
This method is an optional method, @ref{Optional methods}.
This method is an optional method, @pxref{Optional methods}.
@item @option{ksu}
@cindex method @option{ksu}
@ -947,7 +947,7 @@ This method is an optional method, @ref{Optional methods}.
@cindex kerberos (with @option{ksu} method)
This is another method from the Kerberos suite. It behaves like
@option{su}. It is an optional method, @ref{Optional methods}.
@option{su}. It is an optional method, @pxref{Optional methods}.
@item @option{plink}
@cindex method @option{plink}
@ -973,7 +973,12 @@ supports changing the remote login shell @command{/bin/sh}.
Check the @samp{Share SSH connections if possible} control for that
session.
@end table
@noindent
The following methods allow to access containers in different ways:
@table @asis
@item @option{docker}
@cindex method @option{docker}
@cindex @option{docker} method
@ -1008,7 +1013,7 @@ a container's name or ID, as returned by @samp{toolbox list -c}.
Without a host name, the default Toolbox container for the host will
be used.
This is an optional method, @ref{Optional methods}. It does not
This is an optional method, @pxref{Optional methods}. It does not
support user names.
@item @option{flatpak}
@ -1019,7 +1024,7 @@ Integration of Flatpak sandboxes. The host name may be either an
application ID, a sandbox instance ID, or a PID, as returned by
@samp{flatpak ps}.
This is an optional method, @ref{Optional methods}. It does not
This is an optional method, @pxref{Optional methods}. It does not
support user names.
@item @option{apptainer}
@ -1029,9 +1034,17 @@ support user names.
Integration of Apptainer instances. The host name is the instance
name, as returned by @samp{apptainer instance list}.
This is an optional method, @ref{Optional methods}. It does not
This is an optional method, @pxref{Optional methods}. It does not
support user names.
@item @option{nspawn}
@cindex method @option{nspawn}
@cindex @option{nspawn} method
Integration of @code{systemd-nspawn} instances. The host name is the
instance name, as returned by @samp{machinectl list --all}.
This is an optional method, @pxref{Optional methods}.
@end table
@ -1170,7 +1183,7 @@ The command used for this connection is: @samp{fsh @var{host} -l
not useful for @value{tramp}. @command{fsh} connects to remote host
and @value{tramp} keeps that one connection open.
This is an optional method, @ref{Optional methods}.
This is an optional method, @pxref{Optional methods}.
@item @option{nc}
@cindex method @option{nc}
@ -1183,7 +1196,7 @@ NAS hosts. These dumb devices have severely restricted local shells,
such as the @command{busybox} and do not host any other encode or
decode programs.
This is an optional method, @ref{Optional methods}.
This is an optional method, @pxref{Optional methods}.
@item @option{sudoedit}
@cindex method @option{sudoedit}
@ -1256,9 +1269,9 @@ domain name). An example:
@trampfn{smb,daniel%BIZARRE@@melancholia,/daniel$$/.emacs}
@end example
where user @code{daniel} connects as a domain user to the SMB host
@code{melancholia} in the MS Windows domain @code{BIZARRE} to edit
@file{.emacs} located in the home directory (share @code{daniel$}).
where user @samp{daniel} connects as a domain user to the SMB host
@samp{melancholia} in the MS Windows domain @samp{BIZARRE} to edit
@file{.emacs} located in the home directory (share @samp{daniel$}).
Alternatively, for local WINS users (as opposed to domain users),
substitute the domain name with the name of the local host in
@ -1268,9 +1281,9 @@ UPPERCASE as shown here:
@trampfn{smb,daniel%MELANCHOLIA@@melancholia,/daniel$$/.emacs}
@end example
where user @code{daniel} connects as local user to the SMB host
@code{melancholia} in the local domain @code{MELANCHOLIA} to edit
@file{.emacs} located in the home directory (share @code{daniel$}).
where user @samp{daniel} connects as local user to the SMB host
@samp{melancholia} in the local domain @samp{MELANCHOLIA} to edit
@file{.emacs} located in the home directory (share @samp{daniel$}).
The domain name and user name are optional for @command{smbclient}
authentication. When user name is not specified, @command{smbclient}
@ -1401,7 +1414,7 @@ Media devices, like cell phones, tablets, cameras, can be accessed via
the @option{mtp} method. Just the device name is needed in order to
specify the host in the file name. However, the device must already
be connected via USB, before accessing it. Possible device names are
visible via host name completion, @ref{File name completion}.
visible via host name completion, @pxref{File name completion}.
Depending on the device type, the access could be read-only. Some
devices are accessible under different names in parallel, offering
@ -1538,7 +1551,7 @@ properties, @xref{Setup of sshfs method}.
@cindex default method
In a remote file name, the use of a default method is indicated by the
pseudo method @option{-}, @ref{File name syntax}.
pseudo method @option{-}, @pxref{File name syntax}.
@defopt tramp-default-method
Default method is for transferring files. The user option
@ -1702,8 +1715,8 @@ follows:
@end group
@end lisp
With all defaults set, @samp{@trampfn{-,,}} will connect @value{tramp}
to John's home directory on @code{target} via @code{ssh}.
With all defaults set, @file{@trampfn{-,,}} will connect @value{tramp}
to John's home directory on @samp{target} via method @option{ssh}.
@end defopt
@defopt tramp-default-host-alist
@ -1712,6 +1725,10 @@ allows multiple default host values based on access method or user
name combinations. The alist can hold multiple values. While
@code{tramp-default-host} is sufficient in most cases, some methods,
like @option{adb}, require defaults overwritten.
The default host name for @option{nspawn} is @samp{.host}. Therefore,
@file{@trampfn{nspawn,,}} and @file{@trampfn{sudo,,}} have the same
effect.
@end defopt
@ -1938,17 +1955,6 @@ Access of a hadoop/hdfs file system. A file is accessed via
the user that you want to use, and @samp{node} is the name of the
hadoop server.
@item tramp-nspawn
@cindex method @option{nspawn}
@cindex @option{nspawn} method
Access to environments provided by systemd-nspawn. A file is accessed
via @file{@trampfn{nspawn,user@@container,/path/to/file}}, where
@samp{user} is the (optional) user that you want to use, and
@samp{container} is the container to connect to. systemd-nspawn and
its container utilities often require super user access to run, use
multi-hop file names with @option{doas} or @option{sudo} to raise your
privileges.
@item vagrant-tramp
@cindex method @option{vagrant}
@cindex @option{vagrant} method
@ -2118,11 +2124,12 @@ file name syntax, must be appended to the machine and login items:
machine melancholia#4711 port davs login daniel%BIZARRE password geheim
@end example
For the methods @option{doas}, @option{sudo} and @option{sudoedit} the
password of the user requesting the connection is needed, and not the
password of the target user@footnote{On the local host, @code{run0}
uses a graphical password agent.}. If these connections happen on the
local host, an entry with the local user and local host is used:
For the methods @option{doas}, @option{sudo}, @option{sudoedit} and
@option{nspawn} the password of the user requesting the connection is
needed, and not the password of the target user@footnote{On the local
host, @code{run0} uses a graphical password agent.}. If these
connections happen on the local host, an entry with the local user and
local host is used:
@example
machine @var{host} port sudo login @var{user} password secret
@ -2450,7 +2457,7 @@ be recomputed. To force @value{tramp} to recompute afresh, call
By default, @value{tramp} uses the command @command{/bin/sh} for
starting a shell on the remote host. This can be changed by setting
the connection property @t{"remote-shell"}; see @ref{Predefined
the connection property @t{"remote-shell"}; @pxref{Predefined
connection information}. If you want, for example, use
@command{/usr/bin/zsh} on a remote host, you might apply
@ -2701,8 +2708,8 @@ its execution of @command{/bin/sh} on the remote host because Bourne
shell does not recognize the export command as entered in
@file{.profile}.
Likewise, (@code{~}) character in paths will cause errors because
Bourne shell does not do (@code{~}) character expansions.
Likewise, (@samp{~}) character in paths will cause errors because
Bourne shell does not do (@samp{~}) character expansions.
One approach to avoiding these incompatibilities is to make all
commands in @file{~/.shrc} and @file{~/.profile} Bourne shell
@ -3057,7 +3064,7 @@ mounted, it will be used as it is. If the mount point does not exist
yet, @value{tramp} creates this directory.
The mount point can be overwritten by the connection property
@t{"mount-point"}, @ref{Predefined connection information}.
@t{"mount-point"}, @pxref{Predefined connection information}.
Example:
@lisp
@ -3417,7 +3424,7 @@ configuration option will be selected, it can be @t{"--standard"}
or @t{"--paranoia"}. See the @samp{encfs(1)} man page for details.
However, @value{tramp} must adapt these configuration sets. The
@code{chainedNameIV} configuration option must be disabled; otherwise
@option{chainedNameIV} configuration option must be disabled; otherwise
@value{tramp} couldn't handle file name encryption transparently.
@end defopt
@ -3446,7 +3453,7 @@ users.
The command @command{encfsctl}, the workhorse for encryption /
decryption, needs the configuration file password every call.
Therefore, it is recommend to cache this password in Emacs. This can
be done using @code{auth-sources}, @ref{Using an authentication file}.
be done using @code{auth-sources}, @pxref{Using an authentication file}.
An entry needs the url-encoded directory name as machine, your local
user name as user, and the password. The port is optional, if given
it must be the string @t{"crypt"}. The example above would require
@ -3536,7 +3543,7 @@ on the remote host @var{host}, using the method @var{method}.
@table @file
@item @value{prefix}ssh@value{postfixhop}melancholia@value{postfix}.emacs
For the file @file{.emacs} located in the home directory, on the host
@code{melancholia}, using method @code{ssh}.
@samp{melancholia}, using method @option{ssh}.
@item @value{prefix}ssh@value{postfixhop}melancholia.danann.net@value{postfix}.emacs
For the file @file{.emacs} specified using the fully qualified domain name of
@ -3546,12 +3553,12 @@ the host.
For the file @file{.emacs} specified using the @file{~}, which is expanded.
@item @value{prefix}ssh@value{postfixhop}melancholia@value{postfix}~daniel/.emacs
For the file @file{.emacs} located in @code{daniel}'s home directory
on the host, @code{melancholia}. The @file{~<user>} construct is
For the file @file{.emacs} located in @samp{daniel}'s home directory
on the host, @samp{melancholia}. The @file{~<user>} construct is
expanded to the home directory of that user on the remote host.
@item @value{prefix}ssh@value{postfixhop}melancholia@value{postfix}/etc/squid.conf
For the file @file{/etc/squid.conf} on the host @code{melancholia}.
For the file @file{/etc/squid.conf} on the host @samp{melancholia}.
@end table
@ -3569,8 +3576,8 @@ different name using the proper syntax will override this default
behavior: @file{@trampfn{method,user@@host,path/to/file}}.
@file{@trampfn{ssh,daniel@@melancholia,.emacs}} is for file
@file{.emacs} in @code{daniel}'s home directory on the host,
@code{melancholia}, accessing via method @code{ssh}.
@file{.emacs} in @samp{daniel}'s home directory on the host,
@samp{melancholia}, accessing via method @option{ssh}.
For specifying port numbers, affix @file{#<port>} to the host
name. For example: @file{@trampfn{ssh,daniel@@melancholia#42,.emacs}}.
@ -3603,8 +3610,8 @@ names. Beside the @code{default} value, @var{syntax} can be
This remote file name syntax is similar to the syntax used by Ange FTP@.
A remote file name has the form
@code{@value{prefix}user@@host@value{postfix}path/to/file}. The
@code{user@@} part is optional, and the method is determined by
@file{@value{prefix}user@@host@value{postfix}path/to/file}. The
@samp{user@@} part is optional, and the method is determined by
@ref{Default Method}.
@item @code{separate}
@ -3615,8 +3622,8 @@ A remote file name has the form
@include trampver.texi
This remote file name syntax originated in the XEmacs text editor.
A remote file name has the form
@code{@trampfn{method,user@@host,path/to/file}}. The @code{method}
and @code{user@@} parts are optional.
@file{@trampfn{method,user@@host,path/to/file}}. The @samp{method}
and @samp{user@@} parts are optional.
@clear separate
@set unified
@include trampver.texi
@ -3799,12 +3806,12 @@ Ad-hoc proxies can take patterns @code{%h} or @code{%u} like in
@code{tramp-default-proxies-alist}. The following file name expands
to user @samp{root} on host @samp{remotehost}, starting with an
@option{ssh} session on host @samp{remotehost}:
@samp{@trampfn{ssh@value{postfixhop}%h|su,remotehost,}}.
@file{@trampfn{ssh@value{postfixhop}%h|su,remotehost,}}.
On the other hand, if a trailing hop does not specify a host name, the
host name of the previous hop is reused. Therefore, the following
file name is equivalent to the previous example:
@samp{@trampfn{ssh@value{postfixhop}remotehost|su,,}}.
@file{@trampfn{ssh@value{postfixhop}remotehost|su,,}}.
@defopt tramp-completion-multi-hop-methods
When this list includes the last method in a multi-hop connection, the
@ -3831,8 +3838,8 @@ The buffer must either visit a file, or a directory
@defopt tramp-file-name-with-method
The method @code{tramp-revert-buffer-with-sudo} shows an alternate
buffer. It defaults to @code{sudo}, other valid methods are
@code{su}, @code{doas}, @code{run0}, and @code{ksu}.
buffer. It defaults to @option{sudo}, other valid methods are
@option{su}, @option{doas}, @option{run0}, and @option{ksu}.
@lisp
(customize-set-variable 'tramp-file-name-with-method "doas")
@ -4066,7 +4073,7 @@ follows in the local @file{.emacs} file:
local host that the remote host can redirect X11 window
interactions. If querying for a recognizable name is not possible for
whatever reason, then replace @code{(getenv "DISPLAY")} with a
hard-coded, fixed name. Note that using @code{:0} for X11 display name
hard-coded, fixed name. Note that using @samp{:0} for X11 display name
here will not work as expected.
@vindex ForwardX11@r{, ssh option}
@ -4511,7 +4518,7 @@ In order to gain even more performance, it is recommended to bind
@code{start-file-process}. Furthermore, you might set
@code{tramp-use-connection-share} to @code{nil} in order to bypass
@value{tramp}'s handling of the @option{ControlMaster} options, and
use your own settings in @file{~/.ssh/config}, @ref{Using ssh
use your own settings in @file{~/.ssh/config}, @pxref{Using ssh
connection sharing}.
@ -4638,7 +4645,7 @@ specifies the target to be applied for renaming buffer file names from
source via @code{tramp-rename-files}. @code{source} is a regular
expressions, which matches a remote file name. @code{target} must be
a directory name, which could be remote (including remote directories
@value{tramp} infers by default, such as @samp{@trampfn{method,user@@host,}}).
@value{tramp} infers by default, such as @file{@trampfn{method,user@@host,}}).
@code{target} can contain the patterns @code{%m}, @code{%u} or
@code{%h}, which are replaced by the method name, user name or host
@ -4667,7 +4674,7 @@ ssh@value{postfixhop}%h@value{postfix}")
@end lisp
routes all connections to a host in @samp{company.org} via
@samp{@trampfn{ssh,multi.hop,}}, which might be useful when using
@file{@trampfn{ssh,multi.hop,}}, which might be useful when using
Emacs outside the company network.
@lisp
@ -4693,7 +4700,7 @@ Whether renaming a buffer file name by @code{tramp-rename-files} or
@value{tramp} offers also transparent access to files inside file
archives. This is possible only on hosts which have installed
@acronym{GVFS, the GNOME Virtual File System}, @ref{GVFS-based
@acronym{GVFS, the GNOME Virtual File System}, @pxref{GVFS-based
methods}. Internally, file archives are mounted via the
@acronym{GVFS} @option{archive} method.
@ -4989,7 +4996,7 @@ help the development team find the best solution and avoid unrelated
detours.
To exclude cache-related problems, flush all caches before running the
test, @ref{Cleanup remote connections}. Alternatively, and often
test, @pxref{Cleanup remote connections}. Alternatively, and often
better for analysis, reproduce the problem in a clean Emacs session
started with @command{emacs -Q}. Then, @value{tramp} does not load
the persistency file (@pxref{Connection caching}), and it does not use
@ -5513,7 +5520,7 @@ Where are remote files trashed to?
@vindex remote-file-name-inhibit-delete-by-moving-to-trash
Emacs can trash files instead of deleting
@ifinfo
them, @ref{Misc File Ops, Trashing , , emacs}.
them, @pxref{Misc File Ops, Trashing , , emacs}.
@end ifinfo
@ifnotinfo
them.
@ -6082,7 +6089,7 @@ can use the @code{without-remote-files} macro.
@end lisp
This improves performance, because many primitive file name operations
don't check any longer for Tramp file name regexps then.
don't check any longer for @value{tramp} file name regexps then.
@item
@findex tramp-unload-tramp

View File

@ -1046,6 +1046,11 @@ point is not in a comment or a string. It is by default bound to
It defines whether to flatten the list of sections in an imenu
or show it nested.
+++
*** The sort order of Imenu completions can now be customized.
You can customize the option 'completion-category-overrides'
and set 'display-sort-function' for the category 'imenu'.
** Which Function mode
+++
@ -1079,9 +1084,11 @@ This connection method is similar to "sudo", but it uses the
These are the external methods counterparts of "docker" and "podman".
+++
*** New optional connection methods "toolbox", "flatpak" and "apptainer".
They allow accessing system containers provided by Toolbox, sandboxes
provided by Flatpak, or instances managed by Apptainer.
*** New optional connection methods for containers.
Tere are new optional connection methods "toolbox", "flatpak",
"apptainer" and "nspawn". They allow accessing system containers
provided by Toolbox, sandboxes provided by Flatpak, instances managed by
Apptainer, or accessing systemd-based light-weight containers..
+++
*** Connection method "kubernetes" supports now optional container name.
@ -1706,6 +1713,11 @@ options of GNU 'ls'.
If non-nil, moving point forward or backward between widgets by typing
'TAB' or 'S-TAB' skips over inactive widgets. The default value is nil.
** Ruby mode
New user option 'ruby-rubocop-use-bundler'. By default it retains the
previous behavior: read the contens of Gemfile and act accordingly. But
you can also set it to t or nil to skip the check.
** Miscellaneous
---
@ -1978,6 +1990,12 @@ unibyte string.
* Lisp Changes in Emacs 30.1
+++
** New user option 'compilation-safety' to control safety of native code.
It's now possible to control how safe is the code generated by native
compilation, by customizing this user option. It is also possible to
control this at function granularity by using the new 'safety' parameter
in the function's 'declare' form.
** New types 'closure' and 'interpreted-function'.
'interpreted-function' is the new type used for interpreted functions,
@ -2470,16 +2488,17 @@ and see if you get only warnings that matter.
** Function 'declare' forms
+++
*** New 'type' function declaration.
The declaration '(type TYPE)' specifies the type of a function.
*** New 'ftype' function declaration.
The declaration '(ftype TYPE)' specifies the type of a function.
Example:
(defun hello (x y)
(declare (type (function (integer boolean) string)))
(declare (ftype (function (integer boolean) string)))
...)
specifies that the function takes two arguments, an integer and a
boolean, and returns a string. This information can be used by the
boolean, and returns a string. If the compilation happens with
'compilation-safety' set to zero, this information can be used by the
native compiler to produce better code, but specifying an incorrect type
may lead to Emacs crashing. See the Info node "(elisp) Declare Form"
for further information.

View File

@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import android.app.Activity;
import android.app.ActivityManager.TaskDescription;
import android.content.ContentResolver;
import android.content.Context;
@ -166,6 +167,10 @@ public class EmacsActivity extends Activity
layout.removeView (window.view);
window = null;
/* Reset the WM name. */
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
updateWmName ();
invalidateFocus (0);
}
}
@ -205,6 +210,11 @@ public class EmacsActivity extends Activity
invalidateFocus (1);
}
});
/* Synchronize the window's window manager name with this activity's
task in the recents list. */
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
updateWmName ();
}
@Override
@ -522,6 +532,29 @@ public class EmacsActivity extends Activity
}
}
/* Update the name of this activity's task description from the
current window, or reset the same if no window is attached. */
@SuppressWarnings ("deprecation")
public final void
updateWmName ()
{
String wmName;
TaskDescription description;
if (window == null || window.wmName == null)
wmName = "Emacs";
else
wmName = window.wmName;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU)
description = new TaskDescription (wmName);
else
description = (new TaskDescription.Builder ()
.setLabel (wmName).build ());
setTaskDescription (description);
}
@Override
public final void
onAttachedToWindow ()

View File

@ -169,6 +169,11 @@ public final class EmacsWindow extends EmacsHandleObject
and whether this window has previously been attached to a task. */
public boolean preserve, previouslyAttached;
/* The window manager name of this window, which supplies the name of
activities in which it is displayed as a toplevel window, or
NULL. */
public String wmName;
public
EmacsWindow (final EmacsWindow parent, int x, int y,
int width, int height, boolean overrideRedirect)
@ -1562,6 +1567,36 @@ public final class EmacsWindow extends EmacsHandleObject
return dontFocusOnMap;
}
public void
setWmName (final String wmName)
{
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
return;
EmacsService.SERVICE.runOnUiThread (new Runnable () {
@Override
public void
run ()
{
EmacsActivity activity;
Object tem;
EmacsWindow.this.wmName = wmName;
/* If an activity is already attached, replace its task
description. */
tem = getAttachedConsumer ();
if (tem != null && tem instanceof EmacsActivity)
{
activity = (EmacsActivity) tem;
activity.updateWmName ();
}
}
});
}
public int[]
translateCoordinates (int x, int y)
{
@ -1631,7 +1666,7 @@ public final class EmacsWindow extends EmacsHandleObject
fullscreen = isFullscreen;
tem = getAttachedConsumer ();
if (tem != null)
if (tem != null && tem instanceof EmacsActivity)
{
activity = (EmacsActivity) tem;
activity.syncFullscreenWith (EmacsWindow.this);

View File

@ -667,7 +667,7 @@ If NOSET is non-nil, don't bother autoloading LOAD when setting the variable."
A customizable variable is either (i) a variable whose property
list contains a non-nil `standard-value' or `custom-autoload'
property, or (ii) an alias for another customizable variable."
(declare (type (function (symbol) t))
(declare (ftype (function (symbol) t))
(side-effect-free t))
(when (symbolp variable)
(setq variable (indirect-variable variable))

View File

@ -193,6 +193,11 @@ So far, FUNCTION can only be a symbol, not a lambda expression."
(list 'function-put (list 'quote f)
''speed (list 'quote val))))
(defalias 'byte-run--set-safety
#'(lambda (f _args val)
(list 'function-put (list 'quote f)
''safety (list 'quote val))))
(defalias 'byte-run--set-completion
#'(lambda (f _args val)
(list 'function-put (list 'quote f)
@ -218,7 +223,11 @@ So far, FUNCTION can only be a symbol, not a lambda expression."
val)))))
(defalias 'byte-run--set-function-type
#'(lambda (f _args val)
#'(lambda (f _args val &optional f2)
(when (and f2 (not (eq f2 f)))
(error
"`%s' does not match top level function `%s' inside function type \
declaration" f2 f))
(list 'function-put (list 'quote f)
''function-type (list 'quote val))))
@ -242,10 +251,11 @@ If `error-free', drop calls even if `byte-compile-delete-errors' is nil.")
(list 'doc-string #'byte-run--set-doc-string)
(list 'indent #'byte-run--set-indent)
(list 'speed #'byte-run--set-speed)
(list 'safety #'byte-run--set-safety)
(list 'completion #'byte-run--set-completion)
(list 'modes #'byte-run--set-modes)
(list 'interactive-args #'byte-run--set-interactive-args)
(list 'type #'byte-run--set-function-type))
(list 'ftype #'byte-run--set-function-type))
"List associating function properties to their macro expansion.
Each element of the list takes the form (PROP FUN) where FUN is
a function. For each (PROP . VALUES) in a function's declaration,

View File

@ -137,6 +137,19 @@
"Emacs Lisp byte-compiler."
:group 'lisp)
(defcustom compilation-safety 1
"Safety level for generated compiled code.
Possible values are:
0 - emitted code can misbehave, even crash Emacs, if declarations of
functions do not correctly describe their actual behavior;
1 - emitted code is to be generated in a safe manner, even if functions
are mis-declared.
This currently affects only code produced by native-compilation."
:type 'integer
:safe #'integerp
:version "30.1")
(defcustom emacs-lisp-file-regexp "\\.el\\'"
"Regexp which matches Emacs Lisp source files.
If you change this, you might want to set `byte-compile-dest-file-function'.
@ -2443,6 +2456,7 @@ With argument ARG, insert value in current buffer after the form."
(when byte-native-compiling
(defvar native-comp-speed)
(push `(native-comp-speed . ,native-comp-speed) byte-native-qualities)
(push `(compilation-safety . ,compilation-safety) byte-native-qualities)
(defvar native-comp-debug)
(push `(native-comp-debug . ,native-comp-debug) byte-native-qualities)
(defvar native-comp-compiler-options)

View File

@ -668,7 +668,10 @@ This is a destructive function; it reuses the storage of SEQ if possible.
\nKeywords supported: :key
\n(fn SEQ PREDICATE [KEYWORD VALUE]...)"
(if (nlistp cl-seq)
(cl-replace cl-seq (apply 'cl-sort (append cl-seq nil) cl-pred cl-keys))
(if (stringp cl-seq)
(concat (apply #'cl-sort (vconcat cl-seq) cl-pred cl-keys))
(cl-replace cl-seq
(apply #'cl-sort (append cl-seq nil) cl-pred cl-keys)))
(cl--parsing-keywords (:key) ()
(if (memq cl-key '(nil identity))
(sort cl-seq cl-pred)

View File

@ -197,12 +197,11 @@ Useful to hook into pass checkers.")
(defun comp--get-function-cstr (function)
"Given FUNCTION return the corresponding `comp-constraint'."
(when (symbolp function)
(let ((f (symbol-function function)))
(or (gethash f comp-primitive-func-cstr-h)
(when-let ((type (or (when-let ((f (comp--symbol-func-to-fun function)))
(comp-func-declared-type f))
(function-get function 'function-type))))
(comp-type-spec-to-cstr type))))))
(or (gethash function comp-primitive-func-cstr-h)
(when-let ((type (or (when-let ((f (comp--symbol-func-to-fun function)))
(comp-func-declared-type f))
(function-get function 'function-type))))
(comp-type-spec-to-cstr type)))))
;; Keep it in sync with the `cl-deftype-satisfies' property set in
;; cl-macs.el. We can't use `cl-deftype-satisfies' directly as the
@ -369,6 +368,8 @@ Returns ELT."
:documentation "Target output file-name for the compilation.")
(speed native-comp-speed :type number
:documentation "Default speed for this compilation unit.")
(safety compilation-safety :type number
:documentation "Default safety level for this compilation unit.")
(debug native-comp-debug :type number
:documentation "Default debug level for this compilation unit.")
(compiler-options native-comp-compiler-options :type list
@ -528,6 +529,8 @@ CFG is mutated by a pass.")
:documentation "t if non local jumps are present.")
(speed nil :type number
:documentation "Optimization level (see `native-comp-speed').")
(safety nil :type number
:documentation "Safety level (see `safety').")
(pure nil :type boolean
:documentation "t if pure nil otherwise.")
(declared-type nil :type list
@ -699,6 +702,11 @@ current instruction or its cell."
(or (comp--spill-decl-spec function-name 'speed)
(comp-ctxt-speed comp-ctxt)))
(defun comp--spill-safety (function-name)
"Return the safety level for FUNCTION-NAME."
(or (comp--spill-decl-spec function-name 'safety)
(comp-ctxt-safety comp-ctxt)))
;; Autoloaded as might be used by `disassemble-internal'.
;;;###autoload
(defun comp-c-func-name (name prefix &optional first)
@ -825,6 +833,7 @@ clashes."
(comp-func-lap func) lap
(comp-func-frame-size func) (comp--byte-frame-size byte-func)
(comp-func-speed func) (comp--spill-speed name)
(comp-func-safety func) (comp--spill-safety name)
(comp-func-declared-type func) (comp--spill-decl-spec name 'function-type)
(comp-func-pure func) (comp--spill-decl-spec name 'pure))
@ -851,6 +860,8 @@ clashes."
(comp-el-to-eln-filename filename native-compile-target-directory)))
(setf (comp-ctxt-speed comp-ctxt) (alist-get 'native-comp-speed
byte-native-qualities)
(comp-ctxt-safety comp-ctxt) (alist-get 'compilation-safety
byte-native-qualities)
(comp-ctxt-debug comp-ctxt) (alist-get 'native-comp-debug
byte-native-qualities)
(comp-ctxt-compiler-options comp-ctxt) (alist-get 'native-comp-compiler-options
@ -3314,12 +3325,12 @@ Prepare every function for final compilation and drive the C back-end."
;; are assumed just to be true. Use with extreme caution...
(defun comp-hint-fixnum (x)
(declare (type (function (t) fixnum))
(declare (ftype (function (t) fixnum))
(gv-setter (lambda (val) `(setf ,x ,val))))
x)
(defun comp-hint-cons (x)
(declare (type (function (t) cons))
(declare (ftype (function (t) cons))
(gv-setter (lambda (val) `(setf ,x ,val))))
x)

View File

@ -534,7 +534,7 @@ major mode's decisions about context.")
"Return the \"far end\" position of the buffer, in direction ARG.
If ARG is positive, that's the end of the buffer.
Otherwise, that's the beginning of the buffer."
(declare (type (function ((or number marker)) integer))
(declare (ftype (function ((or number marker)) integer))
(side-effect-free error-free))
(if (> arg 0) (point-max) (point-min)))

View File

@ -130,7 +130,7 @@ usually more efficient than that of a simplified version:
(concat (car parens)
(mapconcat \\='regexp-quote strings \"\\\\|\")
(cdr parens))))"
(declare (type (function (list &optional t) string))
(declare (ftype (function (list &optional t) string))
(pure t) (side-effect-free t))
(save-match-data
;; Recurse on the sorted list.

View File

@ -207,7 +207,7 @@ parameter.
Otherwise, this function searches `process-environment' for
VARIABLE. If it is not found there, then it continues the search
in the environment list of the selected frame."
(declare (type (function (string &optional frame) (or null string)))
(declare (ftype (function (string &optional frame) (or null string)))
(side-effect-free t))
(interactive (list (read-envvar-name "Get environment variable: " t)))
(let ((value (getenv-internal (if (multibyte-string-p variable)

View File

@ -862,7 +862,7 @@ GNU and Unix systems). Substitute environment variables into the
resulting list of directory names. For an empty path element (i.e.,
a leading or trailing separator, or two adjacent separators), return
nil (meaning `default-directory') as the associated list element."
(declare (type (function (string) list)))
(declare (ftype (function (string) list)))
(when (stringp search-path)
(let ((spath (substitute-env-vars search-path))
(double-slash-special-p

View File

@ -100,7 +100,7 @@ If `on-mouse' use a popup menu when `imenu' was invoked with the mouse."
(other :tag "Always" t)))
(defcustom imenu-eager-completion-buffer t
"If non-nil, eagerly popup the completion buffer."
"If non-nil, eagerly pop up the completion buffer."
:type 'boolean
:version "22.1")
@ -115,7 +115,10 @@ Useful things to use here include `reposition-window', `recenter', and
(defcustom imenu-sort-function nil
"The function to use for sorting the index mouse-menu.
Affects only the mouse index menu.
Affects only the mouse index menu. If you want to change
the sorting order of completions, you can customize
the option `completion-category-overrides' and set
`display-sort-function' for the category `imenu'.
Set this to nil if you don't want any sorting (faster).
The items in the menu are then presented in the order they were found
@ -147,10 +150,16 @@ Used for flattening nested indexes with name concatenation."
(defcustom imenu-flatten nil
"Whether to flatten the list of sections in an imenu or show it nested.
If non-nil, popup the completion buffer with a flattened menu.
If nil, use nested indexes.
If t, pop up the completion buffer with a flattened menu.
If `annotation', use completion annotation as a suffix
to append section names after the index names.
The string from `imenu-level-separator' is used to separate names of
nested levels while flattening nested indexes with name concatenation."
:type 'boolean
:type '(choice (const :tag "Nested" nil)
(const :tag "By prefix" t)
(const :tag "By suffix" annotation))
:version "30.1")
(defcustom imenu-generic-skip-comments-and-strings t
@ -743,7 +752,12 @@ Return one of the entries in index-alist or nil."
;; Display the completion buffer.
(minibuffer-with-setup-hook
(lambda ()
(setq-local completion-extra-properties '(:category imenu))
(setq-local completion-extra-properties
`( :category imenu
,@(when (eq imenu-flatten 'annotation)
`(:annotation-function
,(lambda (s) (get-text-property
0 'imenu-section s))))))
(unless imenu-eager-completion-buffer
(minibuffer-completion-help)))
(setq name (completing-read prompt
@ -787,7 +801,11 @@ Returns t for rescan and otherwise an element or subelement of INDEX-ALIST."
name))))
(cond
((not (imenu--subalist-p item))
(list (cons new-prefix pos)))
(list (cons (if (and (eq imenu-flatten 'annotation) prefix)
(propertize name 'imenu-section
(format " (%s)" prefix))
new-prefix)
pos)))
(t
(imenu--flatten-index-alist pos concat-names new-prefix)))))
index-alist))

View File

@ -1363,7 +1363,7 @@ Moves point to the end of the new text."
(setq newtext (substring newtext 0 (- suffix-len))))
(goto-char beg)
(let ((length (- end beg))) ;Read `end' before we insert the text.
(insert-before-markers-and-inherit newtext)
(insert-and-inherit newtext)
(delete-region (point) (+ (point) length)))
(forward-char suffix-len)))
@ -2594,7 +2594,7 @@ The candidate will still be chosen by `choose-completion' unless
ctable
cpred
(buffer-substring (point) end))))
(point-marker)))
(point)))
(field-char (and (< field-end end) (char-after field-end)))
(all-md (completion--metadata (buffer-substring-no-properties
start (point))
@ -2702,6 +2702,7 @@ The candidate will still be chosen by `choose-completion' unless
(= (aref choice (1- (length choice)))
field-char))
(setq end (1+ end)))
(cl-decf field-end (- end start (length choice)))
;; FIXME: Use `md' to do quoting&terminator here.
(completion--replace start end choice)
(let* ((minibuffer-completion-table ctable)

View File

@ -142,12 +142,25 @@ multibyte mode and waits for the shell prompt to appear."
;; `android-use-exec-loader' off.
tramp-androidsu-local-shell-name "-i"))
(user (tramp-file-name-user vec))
command)
su-binary path command)
;; Set sentinel. Initialize variables.
(set-process-sentinel p #'tramp-process-sentinel)
(tramp-post-process-creation p vec)
;; Replace `login-args' place holders.
(setq command (format "exec su - %s || exit" user))
;; Replace `login-args' place holders. `PATH' must be
;; set to `tramp-androidsu-remote-path', as some `su'
;; implementations propagate their callers' environments
;; to the root session, which might be contaminated with
;; incompatible `ls' binaries or similar.
(setq path (tramp-shell-quote-argument
(string-join tramp-androidsu-remote-path ":"))
su-binary
(shell-quote-argument
(or (executable-find "su")
(tramp-user-error
vec
"No su binary is available in any of `exec-path'")))
command (format "PATH=%s exec %s - %s || exit"
path su-binary user))
;; Attempt to execute the shell inside the global mount
;; namespace if requested.
(when tramp-androidsu-mount-global-namespace
@ -163,12 +176,13 @@ multibyte mode and waits for the shell prompt to appear."
(setq tramp-androidsu-su-mm-supported
;; Detect support for `su -mm'.
(tramp-adb-send-command-and-check
vec "su -mm -c 'exit 24'" 24)))
vec (format "%s -mm -c 'exit 24'" su-binary)
24)))
(when tramp-androidsu-su-mm-supported
(tramp-set-connection-property
vec "remote-namespace" t)
(setq command (format "exec su -mm - %s || exit"
user)))))
(setq command (format "PATH=%s exec %s -mm - %s || exit"
path su-binary user)))))
;; Send the command.
(tramp-message vec 3 "Sending command `%s'" command)
(tramp-adb-send-command vec command t t)
@ -379,9 +393,19 @@ FUNCTION."
:name name
:buffer buffer
:command
(if (tramp-get-connection-property v "remote-namespace")
(append (list "su" "-mm" "-" user "-c") command)
(append (list "su" "-" user "-c") command))
(if (equal user "root")
;; Invoke su in the simplest manner possible, that
;; is to say, without specifying the user, which
;; certain implementations cannot parse when a
;; command is also present, if it may be omitted, so
;; that starting inferior shells on systems with
;; such implementations does not needlessly fail.
(if (tramp-get-connection-property v "remote-namespace")
(append (list "su" "-mm" "-c") command)
(append (list "su" "-c") command))
(if (tramp-get-connection-property v "remote-namespace")
(append (list "su" "-mm" "-" user "-c") command)
(append (list "su" "-" user "-c") command)))
:coding coding
:noquery noquery
:connection-type connection-type

View File

@ -55,6 +55,9 @@
(with-eval-after-load 'kubernetes-tramp
(warn (concat "Package `kubernetes-tramp' has been obsoleted, "
"please use integrated package `tramp-container'")))
(with-eval-after-load 'tramp-nspawn
(warn (concat "Package `tramp-nspawn' has been obsoleted, "
"please use integrated package `tramp-container'")))
;; For not existing functions, obsolete functions, or functions with a
;; changed argument list, there are compiler warnings. We want to

View File

@ -81,8 +81,8 @@
;; C-x C-f /flatpak:SANDBOX:/path/to/file
;;
;; Where:
;; SANDBOX is the running sandbox to connect to.
;; It could be an application ID, an instance ID, or a PID.
;; SANDBOX is the running sandbox to connect to.
;; It could be an application ID, an instance ID, or a PID.
;;
;;
;;
@ -91,7 +91,17 @@
;; C-x C-f /apptainer:INSTANCE:/path/to/file
;;
;; Where:
;; INSTANCE is the running instance to connect to.
;; INSTANCE is the running instance to connect to.
;;
;;
;;
;; Open a file on a running systemd-nspawn container:
;;
;; C-x C-f /nspawn:USER@CONTAINER:/path/to/file
;;
;; Where:
;; USER is the user on the container to connect as (optional)
;; CONTAINER is the container to connect to
;;; Code:
@ -159,6 +169,13 @@ If it is nil, the default context will be used."
:type '(choice (const "apptainer")
(string)))
(defcustom tramp-nspawn-program "machinectl"
"Name of the machinectl program."
:group 'tramp
:version "30.1"
:type '(choice (const "machinectl")
(string)))
;;;###tramp-autoload
(defconst tramp-docker-method "docker"
"Tramp method name to use to connect to Docker containers.")
@ -193,6 +210,10 @@ This is for out-of-band connections.")
(defconst tramp-apptainer-method "apptainer"
"Tramp method name to use to connect to Apptainer instances.")
;;;###tramp-autoload
(defconst tramp-nspawn-method "nspawn"
"Tramp method name to use to connect to systemd-nspawn containers.")
;;;###tramp-autoload
(defmacro tramp-skeleton-completion-function (method &rest body)
"Skeleton for `tramp-*-completion-function' with multi-hop support.
@ -416,6 +437,21 @@ see its function help for a description of the format."
lines)))
(mapcar (lambda (name) (list nil name)) names))))
(defun tramp-nspawn--completion-function (method)
"List systemd-nspawn containers available for connection.
This function is used by `tramp-set-completion-function', please
see its function help for a description of the format."
(tramp-skeleton-completion-function method
(when-let ((raw-list
(shell-command-to-string (concat program " list --all -q")))
;; Ignore header line.
(lines (cdr (split-string raw-list "\n")))
(first-words (mapcar (lambda (line) (car (split-string line)))
lines))
(machines (seq-take-while (lambda (name) name) first-words)))
(mapcar (lambda (m) (list nil m)) machines))))
;;;###tramp-autoload
(defvar tramp-default-remote-shell) ;; Silence byte compiler.
@ -580,6 +616,28 @@ see its function help for a description of the format."
tramp-apptainer-method
`((tramp-apptainer--completion-function ,tramp-apptainer-method))))
;; todo: check tramp-async-args and tramp-direct-async
;;;###tramp-autoload
(defun tramp-enable-nspawn-method ()
"Enable connection to nspawn containers."
(add-to-list 'tramp-methods
`(,tramp-nspawn-method
(tramp-login-program ,tramp-nspawn-program)
(tramp-login-args (("shell")
("-q")
("--uid" "%u")
("%h")))
(tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-i" "-c"))))
(add-to-list 'tramp-default-host-alist `(,tramp-nspawn-method nil ".host"))
(add-to-list 'tramp-completion-multi-hop-methods tramp-nspawn-method)
(tramp-set-completion-function
tramp-nspawn-method
`((tramp-nspawn--completion-function ,tramp-nspawn-method))))
;; Default connection-local variables for Tramp.
(defconst tramp-kubernetes-connection-local-default-variables

View File

@ -562,11 +562,13 @@ host runs a restricted shell, it shall be added to this list, too."
;; Fedora.
"localhost4" "localhost6"
;; Ubuntu.
"ip6-localhost" "ip6-loopback"))
"ip6-localhost" "ip6-loopback"
;; OpenSUSE.
"ipv6-localhost" "ipv6-loopback"))
eos)
"Host names which are regarded as local host.
If the local host runs a chrooted environment, set this to nil."
:version "29.3"
:version "30.1"
:type '(choice (const :tag "Chrooted environment" nil)
(regexp :tag "Host regexp")))
@ -4658,8 +4660,11 @@ Do not set it manually, it is used buffer-local in `tramp-get-lock-pid'.")
((process-live-p (tramp-get-process v)))
(lockname (tramp-compat-make-lock-file-name file)))
(delete-file lockname)
;; Trigger the unlock error.
(signal 'file-error `("Cannot remove lock file for" ,file)))
;; Trigger the unlock error. Be quiet if user isn't
;; interested in lock files. See Bug#70900.
(unless (or (not create-lockfiles)
(bound-and-true-p remote-file-name-inhibit-locks))
(signal 'file-error `("Cannot remove lock file for" ,file))))
;; `userlock--handle-unlock-error' exists since Emacs 28.1. It
;; checks for `create-lockfiles' since Emacs 30.1, we don't need
;; this check here, then.

View File

@ -347,7 +347,8 @@ to find the list of ignores for each directory."
(defun project--files-in-directory (dir ignores &optional files)
(require 'find-dired)
(require 'xref)
(let* ((default-directory dir)
(let* ((dir (file-name-as-directory dir))
(default-directory dir)
;; Make sure ~/ etc. in local directory name is
;; expanded and not left for the shell command
;; to interpret.
@ -989,8 +990,9 @@ requires quoting, e.g. `\\[quoted-insert]<space>'."
(files
(if (not current-prefix-arg)
(project-files pr)
(let ((dir (read-directory-name "Base directory: "
caller-dir nil t)))
(let* ((dir (read-directory-name "Base directory: "
caller-dir nil t)))
(setq default-directory dir)
(project--files-in-directory dir
nil
(grep-read-files regexp))))))

View File

@ -2553,6 +2553,16 @@ If there is no Rubocop config file, Rubocop will be passed a flag
:type 'string
:safe 'stringp)
(defcustom ruby-rubocop-use-bundler 'check
"Non-nil with allow `ruby-flymake-rubocop' to use `bundle exec'.
When the value is `check', it will first see whether Gemfile exists in
the same directory as the configuration file, and whether it mentions
the gem \"rubocop\". When t, it's used unconditionally. "
:type '(choice (const :tag "Always" t)
(const :tag "No" nil)
(const :tag "If rubocop is in Gemfile" check))
:safe 'booleanp)
(defun ruby-flymake-rubocop (report-fn &rest _args)
"RuboCop backend for Flymake."
(unless (executable-find "rubocop")
@ -2614,11 +2624,17 @@ If there is no Rubocop config file, Rubocop will be passed a flag
finally (funcall report-fn diags)))))))
(defun ruby-flymake-rubocop--use-bundler-p (dir)
(let ((file (expand-file-name "Gemfile" dir)))
(and (file-exists-p file)
(with-temp-buffer
(insert-file-contents file)
(re-search-forward "^ *gem ['\"]rubocop['\"]" nil t)))))
(cond
((eq t ruby-rubocop-use-bundler)
t)
((null ruby-rubocop-use-bundler)
nil)
(t
(let ((file (expand-file-name "Gemfile" dir)))
(and (file-exists-p file)
(with-temp-buffer
(insert-file-contents file)
(re-search-forward "^ *gem ['\"]rubocop['\"]" nil t)))))))
(defun ruby-flymake-auto (report-fn &rest args)
(apply

View File

@ -1048,11 +1048,15 @@ beginning of the line."
(defun xref--add-log-current-defun ()
"Return the string used to group a set of locations.
This function is used as a value for `add-log-current-defun-function'."
(xref--group-name-for-display
(if-let (item (xref--item-at-point))
(xref-location-group (xref-match-item-location item))
(xref--imenu-extract-index-name))
(xref--project-root (project-current))))
(let ((project-root (xref--project-root (project-current))))
(xref--group-name-for-display
(if-let (item (xref--item-at-point))
(xref-location-group (xref-match-item-location item))
(xref--imenu-extract-index-name))
project-root
(and
(string-prefix-p project-root default-directory)
(substring default-directory (length project-root))))))
(defun xref--next-error-function (n reset?)
(when reset?
@ -1184,12 +1188,15 @@ GROUP is a string for decoration purposes and XREF is an
(xref--apply-truncation)))
(run-hooks 'xref-after-update-hook))
(defun xref--group-name-for-display (group project-root)
(defun xref--group-name-for-display (group project-root dd-suffix)
"Return GROUP formatted in the preferred style.
The style is determined by the value of `xref-file-name-display'.
If GROUP looks like a file name, its value is formatted according
to that style. Otherwise it is returned unchanged."
to that style. Otherwise it is returned unchanged.
PROJECT-ROOT is the root of the current project, if any. DD-SUFFIX is
the relative name of `default-directory' relative to the project root."
;; XXX: The way we verify that it's indeed a file name and not some
;; other kind of string, e.g. Java package name or TITLE from
;; `tags-apropos-additional-actions', is pretty lax. But we don't
@ -1199,16 +1206,19 @@ to that style. Otherwise it is returned unchanged."
;; values themselves (e.g. by piping through some public function),
;; or adding a new accessor to locations, like GROUP-TYPE.
(cl-ecase xref-file-name-display
(abs group)
(abs (if (file-name-absolute-p group) group (expand-file-name group)))
(nondirectory
(if (file-name-absolute-p group)
(file-name-nondirectory group)
group))
(file-name-nondirectory group))
(project-relative
(if (and project-root
(string-prefix-p project-root group))
(substring group (length project-root))
group))))
(cond
((not (file-name-absolute-p group))
(concat dd-suffix group))
((and project-root
(string-prefix-p project-root group))
(substring group (length project-root)))
;; Default to absolute when there's not project around.
(t
(expand-file-name group))))))
(defun xref--analyze (xrefs)
"Find common groups in XREFS and format group names.
@ -1221,10 +1231,13 @@ Return an alist of the form ((GROUP . (XREF ...)) ...)."
(eq xref-file-name-display 'project-relative)
(project-current)))
(project-root (and project
(expand-file-name (xref--project-root project)))))
(expand-file-name (xref--project-root project))))
(dd-suffix (and project-root
(string-prefix-p project-root default-directory)
(substring default-directory (length project-root)))))
(mapcar
(lambda (pair)
(cons (xref--group-name-for-display (car pair) project-root)
(cons (xref--group-name-for-display (car pair) project-root dd-suffix)
(cdr pair)))
alist)))

View File

@ -1762,7 +1762,7 @@ not at the start of a line.
When IGNORE-INVISIBLE-LINES is non-nil, invisible lines are not
included in the count."
(declare (type (function ((or integer marker) (or integer marker) &optional t)
(declare (ftype (function ((or integer marker) (or integer marker) &optional t)
integer))
(side-effect-free t))
(save-excursion
@ -6884,7 +6884,7 @@ is active, and returns an integer or nil in the usual way.
If you are using this in an editing command, you are most likely making
a mistake; see the documentation of `set-mark'."
(declare (type (function (&optional t) (or integer null)))
(declare (ftype (function (&optional t) (or integer null)))
(side-effect-free t))
(if (or force (not transient-mark-mode) mark-active mark-even-if-inactive)
(marker-position (mark-marker))
@ -11147,7 +11147,7 @@ killed."
(defun lax-plist-get (plist prop)
"Extract a value from a property list, comparing with `equal'."
(declare (type (function (list t) t))
(declare (ftype (function (list t) t))
(pure t) (side-effect-free t) (obsolete plist-get "29.1"))
(plist-get plist prop #'equal))

View File

@ -451,7 +451,7 @@ This function accepts any number of arguments in ARGUMENTS.
Also see `always'."
;; Not declared `side-effect-free' because we don't want calls to it
;; elided; see `byte-compile-ignore'.
(declare (type (function (&rest t) null))
(declare (ftype (function (&rest t) null))
(pure t) (completion ignore))
(interactive)
nil)
@ -481,7 +481,7 @@ for the sake of consistency.
To alter the look of the displayed error messages, you can use
the `command-error-function' variable."
(declare (type (function (string &rest t) nil))
(declare (ftype (function (string &rest t) nil))
(advertised-calling-convention (string &rest args) "23.1"))
(signal 'error (list (apply #'format-message args))))
@ -547,21 +547,21 @@ was called."
"Return t if NUMBER is zero."
;; Used to be in C, but it's pointless since (= 0 n) is faster anyway because
;; = has a byte-code.
(declare (type (function (number) boolean))
(declare (ftype (function (number) boolean))
(pure t) (side-effect-free t)
(compiler-macro (lambda (_) `(= 0 ,number))))
(= 0 number))
(defun fixnump (object)
"Return t if OBJECT is a fixnum."
(declare (type (function (t) boolean))
(declare (ftype (function (t) boolean))
(side-effect-free error-free))
(and (integerp object)
(<= most-negative-fixnum object most-positive-fixnum)))
(defun bignump (object)
"Return t if OBJECT is a bignum."
(declare (type (function (t) boolean))
(declare (ftype (function (t) boolean))
(side-effect-free error-free))
(and (integerp object) (not (fixnump object))))
@ -575,7 +575,7 @@ Most uses of this function turn out to be mistakes. We recommend
to use `ash' instead, unless COUNT could ever be negative, and
if, when COUNT is negative, your program really needs the special
treatment of negative COUNT provided by this function."
(declare (type (function (integer integer) integer))
(declare (ftype (function (integer integer) integer))
(compiler-macro
(lambda (form)
(macroexp-warn-and-return
@ -754,7 +754,7 @@ treatment of negative COUNT provided by this function."
If LIST is nil, return nil.
If N is non-nil, return the Nth-to-last link of LIST.
If N is bigger than the length of LIST, return LIST."
(declare (type (function (list &optional integer) list))
(declare (ftype (function (list &optional integer) list))
(pure t) (side-effect-free t)) ; pure up to mutation
(if n
(and (>= n 0)
@ -1592,7 +1592,7 @@ See also `current-global-map'.")
(defun eventp (object)
"Return non-nil if OBJECT is an input event or event object."
(declare (type (function (t) boolean))
(declare (ftype (function (t) boolean))
(pure t) (side-effect-free error-free))
(or (integerp object)
(and (if (consp object)
@ -1660,7 +1660,7 @@ in the current Emacs session, then this function may return nil."
(defsubst mouse-movement-p (object)
"Return non-nil if OBJECT is a mouse movement event."
(declare (type (function (t) boolean))
(declare (ftype (function (t) boolean))
(side-effect-free error-free))
(eq (car-safe object) 'mouse-movement))
@ -1970,7 +1970,7 @@ be a list of the form returned by `event-start' and `event-end'."
(defun log10 (x)
"Return (log X 10), the log base 10 of X."
(declare (type (function (number) float))
(declare (ftype (function (number) float))
(side-effect-free t) (obsolete log "24.4"))
(log x 10))
@ -3257,7 +3257,7 @@ It can be retrieved with `(process-get PROCESS PROPNAME)'."
(defun memory-limit ()
"Return an estimate of Emacs virtual memory usage, divided by 1024."
(declare (type (function () integer))
(declare (ftype (function () integer))
(side-effect-free error-free))
(let ((default-directory temporary-file-directory))
(or (cdr (assq 'vsize (process-attributes (emacs-pid)))) 0)))
@ -5695,7 +5695,13 @@ Unless optional argument INPLACE is non-nil, return a new string."
(> (max fromchar tochar) 127)
(> tochar 255)))
;; Avoid quadratic behaviour from resizing replacement.
(string-replace (string fromchar) (string tochar) string)
(let ((res (string-replace (string fromchar) (string tochar) string)))
(unless (eq res string)
;; Mend properties broken by the replacement.
;; Not fast, but this case never was.
(dolist (p (object-intervals string))
(set-text-properties (nth 0 p) (nth 1 p) (nth 2 p) res)))
res)
(let ((i (length string))
(newstr (if inplace string (copy-sequence string))))
(while (> i 0)
@ -6486,7 +6492,7 @@ To test whether a function can be called interactively, use
`commandp'."
;; Kept around for now. See discussion at:
;; https://lists.gnu.org/r/emacs-devel/2020-08/msg00564.html
(declare (type (function () boolean))
(declare (ftype (function () boolean))
(obsolete called-interactively-p "23.2")
(side-effect-free error-free))
(called-interactively-p 'interactive))

View File

@ -2515,7 +2515,7 @@ have special meanings:
Any other value of ALL-FRAMES means consider all windows on the
selected frame and no others."
(declare (type (function (&optional t t t) (or window null)))
(declare (ftype (function (&optional t t t) (or window null)))
(side-effect-free error-free))
(let ((windows (window-list-1 nil 'nomini all-frames))
best-window best-time second-best-window second-best-time time)
@ -2595,7 +2595,7 @@ have special meanings:
Any other value of ALL-FRAMES means consider all windows on the
selected frame and no others."
(declare (type (function (&optional t t t) (or window null)))
(declare (ftype (function (&optional t t t) (or window null)))
(side-effect-free error-free))
(let ((best-size 0)
best-window size)
@ -4091,7 +4091,7 @@ with a special meaning are:
Anything else means consider all windows on the selected frame
and no others."
(declare (type (function (&optional t t) boolean))
(declare (ftype (function (&optional t t) boolean))
(side-effect-free error-free))
(let ((base-window (selected-window)))
(if (and nomini (eq base-window (minibuffer-window)))

View File

@ -115,6 +115,7 @@ struct android_emacs_window
jmethodID recreate_activity;
jmethodID clear_window;
jmethodID clear_area;
jmethodID set_wm_name;
};
struct android_emacs_cursor
@ -153,7 +154,7 @@ char *android_cache_dir;
/* The list of archive files within which the Java virtual macine
looks for class files. */
char *android_class_path;
static char *android_class_path;
/* The display's pixel densities. */
double android_pixel_density_x, android_pixel_density_y;
@ -1842,6 +1843,7 @@ android_init_emacs_window (void)
FIND_METHOD (recreate_activity, "recreateActivity", "()V");
FIND_METHOD (clear_window, "clearWindow", "()V");
FIND_METHOD (clear_area, "clearArea", "(IIII)V");
FIND_METHOD (set_wm_name, "setWmName", "(Ljava/lang/String;)V");
#undef FIND_METHOD
}
@ -5603,6 +5605,27 @@ android_set_dont_accept_focus (android_window handle,
android_exception_check ();
}
/* Set the WM name of HANDLE to STRING, a Java string. This name
provides the task description of activities that receive HANDLE. */
void
android_set_wm_name (android_window handle, jstring name)
{
jmethodID method;
jobject window;
window = android_resolve_handle (handle);
method = window_class.set_wm_name;
if (android_get_current_api_level () < 21)
return;
(*android_java_env)->CallNonvirtualVoidMethod (android_java_env, window,
window_class.class, method,
name);
android_exception_check ();
}
void
android_get_keysym_name (int keysym, char *name_return, size_t size)
{

View File

@ -118,6 +118,7 @@ extern bool android_detect_keyboard (void);
extern void android_set_dont_focus_on_map (android_window, bool);
extern void android_set_dont_accept_focus (android_window, bool);
extern void android_set_wm_name (android_window, jstring);
extern int android_verify_jni_string (const char *);
extern jstring android_build_string (Lisp_Object, ...);
@ -275,8 +276,6 @@ struct android_emacs_service
jmethodID draw_rectangle;
jmethodID draw_line;
jmethodID draw_point;
jmethodID clear_window;
jmethodID clear_area;
jmethodID ring_bell;
jmethodID query_tree;
jmethodID get_screen_width;

View File

@ -211,18 +211,90 @@ android_set_parent_frame (struct frame *f, Lisp_Object new_value,
FRAME_TERMINAL (f)->fullscreen_hook (f);
}
/* Set the WM name to NAME for frame F. Also set the icon name.
If the frame already has an icon name, use that, otherwise set the
icon name to NAME. */
static void
android_set_name_internal (struct frame *f, Lisp_Object name)
{
jstring java_name;
if (FRAME_ANDROID_WINDOW (f))
{
java_name = android_build_string (name, NULL);
android_set_wm_name (FRAME_ANDROID_WINDOW (f), java_name);
ANDROID_DELETE_LOCAL_REF (java_name);
}
}
/* Change the name of frame F to NAME. If NAME is nil, set F's name to
x_id_name.
If EXPLICIT is true, that indicates that lisp code is setting the
name; if NAME is a string, set F's name to NAME and set
F->explicit_name; if NAME is Qnil, then clear F->explicit_name.
If EXPLICIT is false, that indicates that Emacs redisplay code is
suggesting a new name, which lisp code should override; if
F->explicit_name is set, ignore the new name; otherwise, set it. */
static void
android_set_name (struct frame *f, Lisp_Object name, bool explicit)
{
/* Make sure that requests from lisp code override requests from
Emacs redisplay code. */
if (explicit)
{
/* If we're switching from explicit to implicit, we had better
update the mode lines and thereby update the title. */
if (f->explicit_name && NILP (name))
update_mode_lines = 37;
f->explicit_name = ! NILP (name);
}
else if (f->explicit_name)
return;
/* If NAME is nil, set the name to the x_id_name. */
if (NILP (name))
{
/* Check for no change needed in this very common case
before we do any consing. */
if (!strcmp (FRAME_DISPLAY_INFO (f)->x_id_name,
SSDATA (f->name)))
return;
name = build_string (FRAME_DISPLAY_INFO (f)->x_id_name);
}
else
CHECK_STRING (name);
/* Don't change the name if it's already NAME. */
if (! NILP (Fstring_equal (name, f->name)))
return;
fset_name (f, name);
/* For setting the frame title, the title parameter should override
the name parameter. */
if (! NILP (f->title))
name = f->title;
android_set_name_internal (f, name);
}
void
android_implicitly_set_name (struct frame *f, Lisp_Object arg,
Lisp_Object oldval)
{
android_set_name (f, arg, false);
}
void
android_explicitly_set_name (struct frame *f, Lisp_Object arg,
Lisp_Object oldval)
{
android_set_name (f, arg, true);
}
/* Set the number of lines used for the tool bar of frame F to VALUE.
@ -2988,6 +3060,8 @@ android_set_title (struct frame *f, Lisp_Object name,
name = f->name;
else
CHECK_STRING (name);
android_set_name_internal (f, name);
}
static void

View File

@ -136,26 +136,26 @@ struct androidfont_entity
/* Method and class identifiers associated with the EmacsFontDriver
class. */
struct android_emacs_font_driver font_driver_class;
static struct android_emacs_font_driver font_driver_class;
/* Field and class identifiers associated with the
EmacsFontDriver$FontSpec class. */
struct android_emacs_font_spec font_spec_class;
static struct android_emacs_font_spec font_spec_class;
/* Method and class identifiers associated with the Integer class. */
struct android_integer integer_class;
static struct android_integer integer_class;
/* Field and class identifiers associated with the
EmacsFontDriver$FontMetrics class. */
struct android_emacs_font_metrics font_metrics_class;
static struct android_emacs_font_metrics font_metrics_class;
/* Field and class identifiers associated with the
EmacsFontDriver$FontObject class. */
struct android_emacs_font_object font_object_class;
static struct android_emacs_font_object font_object_class;
/* The font cache. */

View File

@ -5707,10 +5707,10 @@ struct android_extracted_text_class
/* Fields and methods associated with the `ExtractedTextRequest'
class. */
struct android_extracted_text_request_class request_class;
static struct android_extracted_text_request_class request_class;
/* Fields and methods associated with the `ExtractedText' class. */
struct android_extracted_text_class text_class;
static struct android_extracted_text_class text_class;
/* Return an ExtractedText object corresponding to the extracted text
TEXT. START is a character position describing the offset of the
@ -6273,8 +6273,8 @@ android_update_selection (struct frame *f, struct window *w)
end = marker_position (f->conversion.compose_region_end);
/* Offset and detect underflow. */
start = max (start, field_start) - field_start - 1;
end = min (end, field_end) - field_start - 1;
start = max (start, field_start) - field_start;
end = min (end, field_end) - field_start;
if (end < 0 || start < 0)
end = start = -1;
}
@ -6479,8 +6479,6 @@ static struct textconv_interface text_conversion_interface =
extern frame_parm_handler android_frame_parm_handlers[];
#endif /* !ANDROID_STUBIFY */
static struct redisplay_interface android_redisplay_interface =
@ -6651,6 +6649,26 @@ android_term_init (void)
terminal->name = xstrdup ("android");
{
Lisp_Object system_name = Fsystem_name ();
static char const title[] = "GNU Emacs";
if (STRINGP (system_name))
{
static char const at[] = " at ";
ptrdiff_t nbytes = sizeof (title) + sizeof (at);
if (ckd_add (&nbytes, nbytes, SBYTES (system_name)))
memory_full (SIZE_MAX);
dpyinfo->x_id_name = xmalloc (nbytes);
sprintf (dpyinfo->x_id_name, "%s%s%s", title, at,
SDATA (system_name));
}
else
{
dpyinfo->x_id_name = xmalloc (sizeof (title));
strcpy (dpyinfo->x_id_name, title);
}
}
/* The display "connection" is now set up, and it must never go
away. */
terminal->reference_count = 30000;

View File

@ -90,6 +90,9 @@ struct android_display_info
/* Minimum font height over all fonts in font_table. */
int smallest_font_height;
/* Default name for all frames on this display. */
char *x_id_name;
/* The number of fonts opened for this display. */
int n_fonts;
@ -392,6 +395,7 @@ extern struct android_display_info *x_display_list;
/* From androidfns.c. */
extern frame_parm_handler android_frame_parm_handlers[];
extern void android_free_gcs (struct frame *);
extern void android_default_font_parameter (struct frame *, Lisp_Object);
extern void android_set_preeditarea (struct window *, int, int);

View File

@ -5562,6 +5562,10 @@ android_saf_tree_closedir (struct android_vdir *vdir)
free (dir->name);
/* Yes, DIR->cursor is a local reference. */
(*android_java_env)->CallVoidMethod (android_java_env,
dir->cursor,
cursor_class.close);
(*android_java_env)->ExceptionClear (android_java_env);
ANDROID_DELETE_LOCAL_REF (dir->cursor);
/* If the ``directory file descriptor'' has been opened, close

View File

@ -633,6 +633,7 @@ typedef struct {
gcc_jit_function *func; /* Current function being compiled. */
bool func_has_non_local; /* From comp-func has-non-local slot. */
EMACS_INT func_speed; /* From comp-func speed slot. */
EMACS_INT func_safety; /* From comp-func safety slot. */
gcc_jit_block *block; /* Current basic block being compiled. */
gcc_jit_lvalue *scratch; /* Used as scratch slot for some code sequence (switch). */
ptrdiff_t frame_size; /* Size of the following array in elements. */
@ -2586,7 +2587,8 @@ emit_call_with_type_hint (gcc_jit_function *func, Lisp_Object insn,
Lisp_Object type)
{
bool hint_match =
!NILP (CALL2I (comp-mvar-type-hint-match-p, SECOND (insn), type));
!comp.func_safety
&& !NILP (CALL2I (comp-mvar-type-hint-match-p, SECOND (insn), type));
gcc_jit_rvalue *args[] =
{ emit_mvar_rval (SECOND (insn)),
gcc_jit_context_new_rvalue_from_int (comp.ctxt,
@ -2602,7 +2604,8 @@ emit_call2_with_type_hint (gcc_jit_function *func, Lisp_Object insn,
Lisp_Object type)
{
bool hint_match =
!NILP (CALL2I (comp-mvar-type-hint-match-p, SECOND (insn), type));
!comp.func_safety
&& !NILP (CALL2I (comp-mvar-type-hint-match-p, SECOND (insn), type));
gcc_jit_rvalue *args[] =
{ emit_mvar_rval (SECOND (insn)),
emit_mvar_rval (THIRD (insn)),
@ -4282,6 +4285,7 @@ compile_function (Lisp_Object func)
comp.func_has_non_local = !NILP (CALL1I (comp-func-has-non-local, func));
comp.func_speed = XFIXNUM (CALL1I (comp-func-speed, func));
comp.func_safety = XFIXNUM (CALL1I (comp-func-safety, func));
comp.func_relocs_local =
gcc_jit_function_new_local (comp.func,

View File

@ -493,8 +493,7 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object)
xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt)));
if (!NILP (CDR_SAFE (XD_NEXT_VALUE (elt))))
wrong_type_argument (QD_Bus,
CAR_SAFE (CDR_SAFE (XD_NEXT_VALUE (elt))));
wrong_type_argument (QD_Bus, CAR_SAFE (CDR_SAFE (XD_NEXT_VALUE (elt))));
sprintf (signature, "%c", dtype);
break;
@ -552,8 +551,7 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object)
xd_signature_cat (signature, x);
if (!NILP (CDR_SAFE (XD_NEXT_VALUE (elt))))
wrong_type_argument (QD_Bus,
CAR_SAFE (CDR_SAFE (XD_NEXT_VALUE (elt))));
wrong_type_argument (QD_Bus, CAR_SAFE (CDR_SAFE (XD_NEXT_VALUE (elt))));
/* Closing signature. */
xd_signature_cat (signature, DBUS_DICT_ENTRY_END_CHAR_AS_STRING);

View File

@ -3005,7 +3005,9 @@ killed. */
#if defined HAVE_ANDROID && !defined ANDROID_STUBIFY
if (android_init_gui)
{
/* Calls to exit may be followed by illegal accesses from
struct sigaction sa;
/* Calls to exit may be followed by invalid accesses from
toolkit-managed threads as the thread group is destroyed, which
are inconsequential when the process is being terminated, but
which must be suppressed to inhibit reporting of superfluous
@ -3013,8 +3015,10 @@ killed. */
Execution won't return to Emacs whatever the value of RESTART,
as `android_restart_emacs' will only ever abort or succeed. */
signal (SIGBUS, SIG_IGN);
signal (SIGSEGV, SIG_IGN);
sigemptyset (&sa.sa_mask);
sa.sa_handler = _exit;
sigaction (SIGSEGV, &sa, NULL);
sigaction (SIGBUS, &sa, NULL);
}
#endif /* HAVE_ANDROID && !ANDROID_STUBIFY */

View File

@ -94,10 +94,11 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
# define PATH_DATA "/assets/etc/"
# define PATH_DOC "/assets/etc/"
# define PATH_INFO "/assets/info/"
# define PATH_GAME ""
# define PATH_GAME (android_game_path)
# define PATH_BITMAPS "/assets/bitmaps/"
extern char *android_site_load_path;
extern char *android_lib_dir;
extern char *android_game_path;
#endif

View File

@ -12744,7 +12744,7 @@ static struct image_type const image_types[] =
};
#if HAVE_NATIVE_IMAGE_API
struct image_type native_image_type =
static struct image_type native_image_type =
{ SYMBOL_INDEX (Qnative_image), native_image_p, native_image_load,
image_clear_image };
#endif

View File

@ -5396,6 +5396,10 @@ static const char *const lispy_kana_keys[] =
/* You'll notice that this table is arranged to be conveniently
indexed by X Windows keysym values. */
#ifdef HAVE_NS
/* FIXME: Why are we using X11 keysym values for NS? */
static
#endif
const char *const lispy_function_keys[] =
{
/* X Keysym value */

View File

@ -47,7 +47,6 @@ Carbon version by Yamamoto Mitsuharu. */
#endif
extern long context_menu_value;
EmacsMenu *svcsMenu;
/* Nonzero means a menu is currently active. */
static int popup_activated_flag;

View File

@ -921,6 +921,8 @@ struct ns_display_info
/* This is a chain of structures for all the NS displays currently in use. */
extern struct ns_display_info *x_display_list;
extern long context_menu_value;
struct ns_output
{
#ifdef __OBJC__
@ -1269,6 +1271,8 @@ extern void ns_finish_events (void);
extern double ns_frame_scale_factor (struct frame *);
extern frame_parm_handler ns_frame_parm_handlers[];
#ifdef NS_IMPL_GNUSTEP
extern char gnustep_base_version[]; /* version tracking */
#endif

View File

@ -5438,7 +5438,6 @@ ns_flush_display (struct frame *f)
redisplay interface. In addition, many of the ns_ methods have
code that is shared with all terms, indicating need for further
refactoring. */
extern frame_parm_handler ns_frame_parm_handlers[];
static struct redisplay_interface ns_redisplay_interface =
{
ns_frame_parm_handlers,

View File

@ -188,4 +188,33 @@ When `project-ignores' includes a name matching project dir."
(should (equal (sort (mapcar #'xref-item-summary matches) #'string<)
'("((nil . ((project-vc-ignores . (\"etc\")))))" "etc"))))))
(ert-deftest project-find-regexp-with-prefix ()
"Check the happy path."
(skip-unless (executable-find find-program))
(skip-unless (executable-find "xargs"))
(skip-unless (executable-find "grep"))
(let* ((directory (ert-resource-directory))
(project-find-functions nil)
(project-list-file (expand-file-name "emacs-projects" temporary-file-directory))
(project (cons 'transient (expand-file-name "../elisp-mode-resources/" directory))))
(add-hook 'project-find-functions (lambda (_dir) project))
(should (eq (project-current) project))
(let* ((matches nil)
(xref-search-program 'grep)
(xref-show-xrefs-function
(lambda (fetcher _display)
(setq matches (funcall fetcher))))
(current-prefix-arg t))
(cl-letf (((symbol-function 'read-directory-name)
(lambda (_prompt _default _dirname _mm) directory))
((symbol-function 'grep-read-files) (lambda (_re) "*")))
(project-find-regexp "etc"))
(should (equal (mapcar (lambda (item)
(file-name-base
(xref-location-group (xref-item-location item))))
matches)
'(".dir-locals" "etc")))
(should (equal (sort (mapcar #'xref-item-summary matches) #'string<)
'("((nil . ((project-vc-ignores . (\"etc\")))))" "etc"))))))
;;; project-tests.el ends here

View File

@ -132,6 +132,7 @@
(lambda (loc)
(xref--group-name-for-display
(xref-location-group loc)
nil
nil))
(xref-tests--locations-in-data-dir "\\(bar\\|foo\\)")))
(list
@ -145,6 +146,7 @@
(lambda (loc)
(xref--group-name-for-display
(xref-location-group loc)
nil
nil))
(xref-tests--locations-in-data-dir "\\(bar\\|foo\\)")))
(list
@ -161,7 +163,8 @@
(lambda (loc)
(xref--group-name-for-display
(xref-location-group loc)
data-parent-dir))
data-parent-dir
nil))
(xref-tests--locations-in-data-dir "\\(bar\\|foo\\)")))
(list
"xref-resources/file1.txt"

View File

@ -1330,5 +1330,53 @@ final or penultimate step during initialization."))
(t x) (:success (1+ x)))
'(error "")))))
(ert-deftest subr--subst-char-in-string ()
;; Cross-validate `subst-char-in-string' with `string-replace',
;; which should produce the same results when there are no properties.
(dolist (str '("ananas" "na\x80ma\x80s" "hétérogénéité"
"Ω, Ω, Ω" "é-\x80-\x80"))
(dolist (mb '(nil t))
(unless (and (not mb) (multibyte-string-p str))
(let ((str (if (and mb (not (multibyte-string-p str)))
(string-to-multibyte str)
str)))
(dolist (inplace '(nil t))
(dolist (from '(?a #x80 #x3fff80))
(dolist (to '(?o ?☃ #x1313f #xff #x3fffc9))
;; Can't put a non-byte value in a non-ASCII unibyte string.
(unless (and (not mb) (> to #xff)
(not (string-match-p (rx bos (* ascii) eos) str)))
(let* ((in (copy-sequence str))
(ref (if (and (not mb) (> from #xff))
in ; nothing to replace
(string-replace
(if (and (not mb) (<= from #xff))
(unibyte-string from)
(string from))
(if (and (not mb) (<= to #xff))
(unibyte-string to)
(string to))
in)))
(out (subst-char-in-string from to in inplace)))
(should (equal out ref))
(if inplace
(should (eq out in))
(should (equal in str))))))))))))
;; Verify that properties are preserved.
(dolist (str (list "cocoa" (string-to-multibyte "cocoa") "écalé"))
(dolist (from '(?a ?o ?c ))
(dolist (to '(?i ?☃))
(let ((in (copy-sequence str)))
(put-text-property 0 5 'alpha 1 in)
(put-text-property 1 4 'beta 2 in)
(put-text-property 0 2 'gamma 3 in)
(put-text-property 1 4 'delta 4 in)
(put-text-property 2 3 'epsilon 5 in)
(let* ((props-in (copy-tree (object-intervals in)))
(out (subst-char-in-string from to in))
(props-out (object-intervals out)))
(should (equal props-out props-in))))))))
(provide 'subr-tests)
;;; subr-tests.el ends here

View File

@ -46,6 +46,7 @@ uintptr_t _beginthread (void (__cdecl *) (void *), unsigned, void *);
#include <gmp.h>
#include <emacs-module.h>
extern int plugin_is_GPL_compatible;
int plugin_is_GPL_compatible;
#if INTPTR_MAX <= 0