diff options
| author | Po Lu | 2024-07-12 12:15:50 +0800 |
|---|---|---|
| committer | Po Lu | 2024-07-12 12:15:50 +0800 |
| commit | 38fa3e9350134fb69655e1e9b8e6d95a2dbcf3db (patch) | |
| tree | aa591c4a1b14c45d6f4a68f9646b4668c0b91199 | |
| parent | dc8cde2b6f3e7c55a85439c771284df2b4fa0e37 (diff) | |
| parent | a5ef9e25680d490e2a453e5ed518aba8f4560b2d (diff) | |
| download | emacs-38fa3e9350134fb69655e1e9b8e6d95a2dbcf3db.tar.gz emacs-38fa3e9350134fb69655e1e9b8e6d95a2dbcf3db.zip | |
Merge from savannah/emacs-30
a5ef9e25680 Document means of executing Emacs from unrelated Android ...
0de0056fd6b Don't emit a prompt in Eshell when a background command i...
ec1e300a215 Fix reference from buffer-stale-function docstring
| -rw-r--r-- | doc/emacs/android.texi | 63 | ||||
| -rw-r--r-- | lisp/eshell/esh-cmd.el | 11 | ||||
| -rw-r--r-- | lisp/files.el | 2 | ||||
| -rw-r--r-- | test/lisp/eshell/esh-cmd-tests.el | 14 |
4 files changed, 75 insertions, 15 deletions
diff --git a/doc/emacs/android.texi b/doc/emacs/android.texi index 606c5e719cb..2d95f5c8fef 100644 --- a/doc/emacs/android.texi +++ b/doc/emacs/android.texi | |||
| @@ -364,17 +364,58 @@ consult the values of the variables @code{ctags-program-name}, | |||
| 364 | @code{ebrowse-program-name}, and @code{rcs2log-program-name}. | 364 | @code{ebrowse-program-name}, and @code{rcs2log-program-name}. |
| 365 | @xref{Subprocess Creation,,, elisp, the Emacs Lisp Reference Manual}. | 365 | @xref{Subprocess Creation,,, elisp, the Emacs Lisp Reference Manual}. |
| 366 | 366 | ||
| 367 | The @file{/assets} directory containing Emacs start-up files is | 367 | The @file{/assets} directory containing Emacs start-up files is meant |
| 368 | meant to be inaccessible to processes not directly created by | 368 | to be inaccessible to processes not directly created by @code{zygote}, |
| 369 | @code{zygote}, the system service responsible for starting | 369 | the system service responsible for starting applications. Since |
| 370 | applications. Since required Lisp is found in the @file{/assets} | 370 | required Lisp is found in the @file{/assets} directory, it would thus |
| 371 | directory, it would thus follow that it is not possible for Emacs to | 371 | follow that it is not possible for Emacs to start itself as a |
| 372 | start itself as a subprocess. A special binary named | 372 | subprocess. A special binary named @command{libandroid-emacs.so} is |
| 373 | @command{libandroid-emacs.so} is provided with Emacs, which tries its | 373 | provided with Emacs, which is installed into the library directory, and |
| 374 | best to start Emacs for the purpose of running Lisp in batch mode. | 374 | which tries its best to start Emacs for the purpose of running Lisp in |
| 375 | However, the approach it takes was devised by reading Android source | 375 | batch mode. The approach it takes was devised by reference to Android |
| 376 | code, and is not sanctioned by the Android compatibility definition | 376 | source code, and is not sanctioned by the Android compatibility |
| 377 | documents, so your mileage may vary. | 377 | definition documents, so your mileage may vary. |
| 378 | |||
| 379 | @cindex EMACS_CLASS_PATH environment variable, Android | ||
| 380 | Even when the location of the @command{libandroid-emacs.so} command is | ||
| 381 | known in advance, special configuration is required to run Emacs from | ||
| 382 | elsewhere than a subprocess of an existing Emacs session, as it must be | ||
| 383 | made to understand the location of resources and shared libraries in or | ||
| 384 | extracted from the installed application package. The OS command | ||
| 385 | @command{pm path org.gnu.emacs} will print the location of the | ||
| 386 | application package, and the adjacent @file{lib} directory will hold | ||
| 387 | shared libraries extracted from the same, though the said command must | ||
| 388 | be invoked in a peculiar manner to satisfy system restrictions on | ||
| 389 | communication between pseudoterminal devices created by user | ||
| 390 | applications and system services such as the package manager, which is | ||
| 391 | to say, with the standard IO streams redirected to a real file or a | ||
| 392 | pipe. Such values, once established, must be specified in the | ||
| 393 | environment variables @code{EMACS_CLASS_PATH} and | ||
| 394 | @code{EMACS_LD_LIBRARY_PATH}, so that this sample shell script may be | ||
| 395 | installed as @code{emacs} in any location that is accessible: | ||
| 396 | |||
| 397 | @example | ||
| 398 | #!/system/bin/sh | ||
| 399 | |||
| 400 | package_name=`pm path org.gnu.emacs 2>/dev/null </dev/null \ | ||
| 401 | | sed 's/^package://'` | ||
| 402 | emacs= | ||
| 403 | ld_path= | ||
| 404 | EMACS_CLASS_PATH=$package_name | ||
| 405 | |||
| 406 | for libdir in `dirname $package_name`/lib/*; do | ||
| 407 | ld_path=$@{ld_path:+$@{ld_path@}:@}$libdir | ||
| 408 | test -x "$libdir"/libandroid-emacs.so \ | ||
| 409 | && emacs="$libdir"/libandroid-emacs.so | ||
| 410 | done | ||
| 411 | |||
| 412 | EMACS_LD_LIBRARY_PATH=$ld_path | ||
| 413 | |||
| 414 | export EMACS_CLASS_PATH | ||
| 415 | export EMACS_LD_LIBRARY_PATH | ||
| 416 | test -x "$emacs" || exit 1 | ||
| 417 | exec $emacs "$@@" | ||
| 418 | @end example | ||
| 378 | 419 | ||
| 379 | @cindex call-process, Android | 420 | @cindex call-process, Android |
| 380 | @vindex android-use-exec-loader | 421 | @vindex android-use-exec-loader |
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el index b936f68a57a..c8579c83405 100644 --- a/lisp/eshell/esh-cmd.el +++ b/lisp/eshell/esh-cmd.el | |||
| @@ -1030,6 +1030,9 @@ process(es) in a cons cell like: | |||
| 1030 | PROC is the process that invoked this from its sentinel, and | 1030 | PROC is the process that invoked this from its sentinel, and |
| 1031 | STATUS is its status." | 1031 | STATUS is its status." |
| 1032 | (when proc | 1032 | (when proc |
| 1033 | ;; Iterate over all the commands associated with this process. Each | ||
| 1034 | ;; element is a list of the form (BACKGROUND FORM PROCESSES) (see | ||
| 1035 | ;; `eshell-add-command'). | ||
| 1033 | (dolist (command (eshell-commands-for-process proc)) | 1036 | (dolist (command (eshell-commands-for-process proc)) |
| 1034 | (unless (seq-some #'eshell-process-active-p (nth 2 command)) | 1037 | (unless (seq-some #'eshell-process-active-p (nth 2 command)) |
| 1035 | (setf (nth 2 command) nil) ; Clear processes from command. | 1038 | (setf (nth 2 command) nil) ; Clear processes from command. |
| @@ -1040,8 +1043,12 @@ STATUS is its status." | |||
| 1040 | (not (string-match eshell-reset-signals status))) | 1043 | (not (string-match eshell-reset-signals status))) |
| 1041 | (eshell-resume-eval command) | 1044 | (eshell-resume-eval command) |
| 1042 | (eshell-remove-command command) | 1045 | (eshell-remove-command command) |
| 1043 | (declare-function eshell-reset "esh-mode" (&optional no-hooks)) | 1046 | ;; Check if the command we just aborted is marked as a |
| 1044 | (eshell-reset)))))) | 1047 | ;; background command. If not, we need to reset the prompt so |
| 1048 | ;; the user can enter another command. | ||
| 1049 | (unless (car command) | ||
| 1050 | (declare-function eshell-reset "esh-mode" (&optional no-hooks)) | ||
| 1051 | (eshell-reset))))))) | ||
| 1045 | 1052 | ||
| 1046 | (defun eshell-resume-eval (command) | 1053 | (defun eshell-resume-eval (command) |
| 1047 | "Destructively evaluate a COMMAND which may need to be deferred. | 1054 | "Destructively evaluate a COMMAND which may need to be deferred. |
diff --git a/lisp/files.el b/lisp/files.el index 66f47b4aa39..ca2d5b30cb4 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -6857,7 +6857,7 @@ For historical reasons, a value of nil means to use the default function. | |||
| 6857 | This should not be relied upon. | 6857 | This should not be relied upon. |
| 6858 | 6858 | ||
| 6859 | For more information on how this variable is used by Auto Revert mode, | 6859 | For more information on how this variable is used by Auto Revert mode, |
| 6860 | see Info node `(emacs)Supporting additional buffers'.") | 6860 | see Info node `(elisp)Reverting'.") |
| 6861 | 6861 | ||
| 6862 | (defvar-local buffer-auto-revert-by-notification nil | 6862 | (defvar-local buffer-auto-revert-by-notification nil |
| 6863 | "Whether a buffer can rely on notification in Auto-Revert mode. | 6863 | "Whether a buffer can rely on notification in Auto-Revert mode. |
diff --git a/test/lisp/eshell/esh-cmd-tests.el b/test/lisp/eshell/esh-cmd-tests.el index 70e1901c169..d8124a19af6 100644 --- a/test/lisp/eshell/esh-cmd-tests.el +++ b/test/lisp/eshell/esh-cmd-tests.el | |||
| @@ -113,7 +113,7 @@ bug#59469." | |||
| 113 | (with-temp-eshell | 113 | (with-temp-eshell |
| 114 | (eshell-match-command-output | 114 | (eshell-match-command-output |
| 115 | (format "*echo hi > #<%s> &" bufname) | 115 | (format "*echo hi > #<%s> &" bufname) |
| 116 | (rx "[echo" (? ".exe") "] " (+ digit) "\n")) | 116 | (rx bos "[echo" (? ".exe") "] " (+ digit) "\n")) |
| 117 | (eshell-wait-for-subprocess t)) | 117 | (eshell-wait-for-subprocess t)) |
| 118 | (should (equal (buffer-string) "hi\n")))) | 118 | (should (equal (buffer-string) "hi\n")))) |
| 119 | 119 | ||
| @@ -129,6 +129,18 @@ bug#59469." | |||
| 129 | (eshell-wait-for-subprocess t)) | 129 | (eshell-wait-for-subprocess t)) |
| 130 | (should (equal (buffer-string) "olleh\n")))) | 130 | (should (equal (buffer-string) "olleh\n")))) |
| 131 | 131 | ||
| 132 | (ert-deftest esh-cmd-test/background/kill () | ||
| 133 | "Make sure that a background command that gets killed doesn't emit a prompt." | ||
| 134 | (skip-unless (executable-find "sleep")) | ||
| 135 | (let ((background-message (rx bos "[sleep" (? ".exe") "] " (+ digit) "\n"))) | ||
| 136 | (with-temp-eshell | ||
| 137 | (eshell-match-command-output "*sleep 10 &" background-message) | ||
| 138 | (kill-process (caar eshell-process-list)) | ||
| 139 | (eshell-wait-for-subprocess t) | ||
| 140 | ;; Ensure we didn't emit another prompt after killing the | ||
| 141 | ;; background process. | ||
| 142 | (should (eshell-match-output background-message))))) | ||
| 143 | |||
| 132 | 144 | ||
| 133 | ;; Lisp forms | 145 | ;; Lisp forms |
| 134 | 146 | ||