diff options
author | Eli Zaretskii <eliz@gnu.org> | 2022-01-21 14:11:22 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2022-01-21 14:11:22 +0200 |
commit | 87107b05a17af95e190982a7f62671563405c829 (patch) | |
tree | 9e36e5d93c107e432aa2b595f58383614d555e42 | |
parent | c2e28aabcc370ac32c37c3f31acb1930e0d7cab8 (diff) | |
parent | 1228ec3e1d7657c9eb50184719410f37ed0eb750 (diff) | |
download | emacs-87107b05a17af95e190982a7f62671563405c829.tar.gz |
Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
-rwxr-xr-x | admin/emake | 1 | ||||
-rw-r--r-- | configure.ac | 79 | ||||
-rw-r--r-- | doc/misc/ert.texi | 5 | ||||
-rw-r--r-- | doc/misc/gnus.texi | 17 | ||||
-rw-r--r-- | etc/NEWS | 7 | ||||
-rw-r--r-- | lisp/doc-view.el | 2 | ||||
-rw-r--r-- | lisp/emacs-lisp/edebug.el | 6 | ||||
-rw-r--r-- | lisp/emacs-lisp/ert.el | 6 | ||||
-rw-r--r-- | lisp/emacs-lisp/multisession.el | 14 | ||||
-rw-r--r-- | lisp/eshell/em-basic.el | 13 | ||||
-rw-r--r-- | lisp/eshell/em-script.el | 18 | ||||
-rw-r--r-- | lisp/eshell/esh-cmd.el | 28 | ||||
-rw-r--r-- | lisp/eshell/esh-opt.el | 12 | ||||
-rw-r--r-- | lisp/gnus/mm-view.el | 2 | ||||
-rw-r--r-- | lisp/vc/diff-mode.el | 36 | ||||
-rw-r--r-- | src/xterm.c | 4 | ||||
-rw-r--r-- | src/xwidget.c | 1 | ||||
-rw-r--r-- | test/README | 4 | ||||
-rw-r--r-- | test/lisp/eshell/esh-opt-tests.el | 86 | ||||
-rw-r--r-- | test/lisp/eshell/eshell-tests.el | 7 |
20 files changed, 218 insertions, 130 deletions
diff --git a/admin/emake b/admin/emake index 2ff553289da..bfada1eb3e9 100755 --- a/admin/emake +++ b/admin/emake @@ -80,6 +80,7 @@ The GNU allocators don't work|\ ^'\.git/|\ ^\^\(\(|\ ^'build-aux/git-hooks\ +^ANCIENT=yes make\ " | \ while read do diff --git a/configure.ac b/configure.ac index 6e15c1727ac..515ae825362 100644 --- a/configure.ac +++ b/configure.ac @@ -2913,40 +2913,6 @@ if test "${HAVE_GTK}" = "yes"; then fi fi - -dnl Enable xwidgets if GTK3 and WebKitGTK+ are available. -dnl Enable xwidgets if macOS Cocoa and WebKit framework are available. -HAVE_XWIDGETS=no -XWIDGETS_OBJ= -if test "$with_xwidgets" != "no"; then - if test "$USE_GTK_TOOLKIT" = "GTK3" && test "$window_system" != "none"; then - WEBKIT_REQUIRED=2.12 - WEBKIT_MODULES="webkit2gtk-4.0 >= $WEBKIT_REQUIRED" - EMACS_CHECK_MODULES([WEBKIT], [$WEBKIT_MODULES]) - HAVE_XWIDGETS=$HAVE_WEBKIT - XWIDGETS_OBJ="xwidget.o" - elif test "${NS_IMPL_COCOA}" = "yes"; then - dnl FIXME: Check framework WebKit2 - dnl WEBKIT_REQUIRED=M.m.p - WEBKIT_LIBS="-Wl,-framework -Wl,WebKit" - WEBKIT_CFLAGS="-I/System/Library/Frameworks/WebKit.framework/Headers" - HAVE_WEBKIT="yes" - HAVE_XWIDGETS=$HAVE_WEBKIT - XWIDGETS_OBJ="xwidget.o" - NS_OBJC_OBJ="$NS_OBJC_OBJ nsxwidget.o" - dnl Update NS_OBJC_OBJ with added nsxwidget.o - AC_SUBST(NS_OBJC_OBJ) - else - AC_MSG_ERROR([xwidgets requested, it requires GTK3 as X window toolkit or macOS Cocoa as window system.]) - fi - - test $HAVE_XWIDGETS = yes || - AC_MSG_ERROR([xwidgets requested but WebKitGTK+ or WebKit framework not found.]) - - AC_DEFINE([HAVE_XWIDGETS], 1, [Define to 1 if you have xwidgets support.]) -fi -AC_SUBST(XWIDGETS_OBJ) - CFLAGS=$OLD_CFLAGS LIBS=$OLD_LIBS @@ -3451,6 +3417,51 @@ if test "${HAVE_X11}" = "yes"; then fi fi +dnl Enable xwidgets if GTK3 and WebKitGTK+ are available. +dnl Enable xwidgets if macOS Cocoa and WebKit framework are available. +HAVE_XWIDGETS=no +XWIDGETS_OBJ= +if test "$with_xwidgets" != "no"; then + if test "$USE_GTK_TOOLKIT" = "GTK3" && test "$window_system" != "none"; then + WEBKIT_REQUIRED=2.12 + WEBKIT_MODULES="webkit2gtk-4.0 >= $WEBKIT_REQUIRED" + EMACS_CHECK_MODULES([WEBKIT], [$WEBKIT_MODULES]) + HAVE_XWIDGETS=$HAVE_WEBKIT + XWIDGETS_OBJ="xwidget.o" + if test "$HAVE_X_WINDOWS" = "yes" && test "${with_cairo}" = "no"; then + CAIRO_XLIB_MODULES="cairo >= 1.8.0 cairo-xlib >= 1.8.0" + EMACS_CHECK_MODULES(CAIRO_XLIB, $CAIRO_XLIB_MODULES) + if test $HAVE_CAIRO_XLIB = "yes"; then + CAIRO_CFLAGS="$CAIRO_XLIB_CFLAGS" + CAIRO_LIBS="$CAIRO_XLIB_LIBS" + AC_SUBST(CAIRO_CFLAGS) + AC_SUBST(CAIRO_LIBS) + else + AC_MSG_ERROR([xwidgets requested, but a suitable cairo installation wasn't found]) + fi + fi + elif test "${NS_IMPL_COCOA}" = "yes"; then + dnl FIXME: Check framework WebKit2 + dnl WEBKIT_REQUIRED=M.m.p + WEBKIT_LIBS="-Wl,-framework -Wl,WebKit" + WEBKIT_CFLAGS="-I/System/Library/Frameworks/WebKit.framework/Headers" + HAVE_WEBKIT="yes" + HAVE_XWIDGETS=$HAVE_WEBKIT + XWIDGETS_OBJ="xwidget.o" + NS_OBJC_OBJ="$NS_OBJC_OBJ nsxwidget.o" + dnl Update NS_OBJC_OBJ with added nsxwidget.o + AC_SUBST(NS_OBJC_OBJ) + else + AC_MSG_ERROR([xwidgets requested, it requires GTK3 as X window toolkit or macOS Cocoa as window system.]) + fi + + test $HAVE_XWIDGETS = yes || + AC_MSG_ERROR([xwidgets requested but WebKitGTK+ or WebKit framework not found.]) + + AC_DEFINE([HAVE_XWIDGETS], 1, [Define to 1 if you have xwidgets support.]) +fi +AC_SUBST(XWIDGETS_OBJ) + if test "$window_system" = "pgtk"; then CAIRO_REQUIRED=1.12.0 CAIRO_MODULE="cairo >= $CAIRO_REQUIRED" diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi index 0d01efb0355..91288db45a2 100644 --- a/doc/misc/ert.texi +++ b/doc/misc/ert.texi @@ -444,8 +444,9 @@ emacs -batch -l ert -l my-tests.el \ @vindex EMACS_TEST_VERBOSE@r{, environment variable} By default, ERT test failure summaries are quite brief in batch mode---only the names of the failed tests are listed. If the -@env{EMACS_TEST_VERBOSE} environment variable is set, the failure -summaries will also include the data from the failing test. +@env{EMACS_TEST_VERBOSE} environment variable is set and is non-empty, +the failure summaries will also include the data from the failing +test. @vindex EMACS_TEST_JUNIT_REPORT@r{, environment variable} ERT can produce JUnit test reports in batch mode. If the environment diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index b3efdfbacba..306d66de64e 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -14838,12 +14838,17 @@ mail belongs in that group. The last of these groups should always be a general one, and the regular expression should @emph{always} be @samp{""} so that it matches any mails that haven't been matched by any of the other regexps. (These rules are -processed from the beginning of the alist toward the end. The first rule -to make a match will ``win'', unless you have crossposting enabled. In -that case, all matching rules will ``win''.) If no rule matched, the mail -will end up in the @samp{bogus} group. When new groups are created by -splitting mail, you may want to run @code{gnus-group-find-new-groups} to -see the new groups. This also applies to the @samp{bogus} group. +processed from the beginning of the alist toward the end. + +If multiple rules match (excluding the general @samp{""} group), mail +is crossposted to all these groups. However, if +@code{nnmail-crosspost} is set to @code{nil}, the first rule to make a +match will ``win''. + +If no rule matched, the mail will end up in the @samp{bogus} group. +When new groups are created by splitting mail, you may want to run +@code{gnus-group-find-new-groups} to see the new groups. This also +applies to the @samp{bogus} group. If you like to tinker with this yourself, you can set this variable to a function of your choice. This function will be called without any @@ -104,6 +104,11 @@ files that were compiled with an old EIEIO (Emacs<25). ** 'C-x 8 .' has been moved to 'C-x 8 . .'. This is to open up the 'C-x 8 .' map to bind further characters there. +--- +** 'source' and '.' in Eshell no longer accept the '--help' option. +This is for compatibility with the shell versions of these commands, +which don't handle options like '--help' in any special way. + * Changes in Emacs 29.1 @@ -345,7 +350,7 @@ are met. The conditions are given by the argument, which can be These forms now indent like this: (cl-flet ((bla (x) - (* x x))) + (* x x))) (bla 42)) This change also affects 'cl-macrolet', 'cl-flet*' and diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 5b462b24f5a..5e160f5dff1 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -1189,7 +1189,7 @@ is named like ODF with the extension turned to pdf." "Convert PDF-PS to PNG asynchronously." (funcall (pcase doc-view-doc-type - ('pdf doc-view-pdf->png-converter-function) + ((or 'pdf 'odf) doc-view-pdf->png-converter-function) ('djvu #'doc-view-djvu->tiff-converter-ddjvu) (_ #'doc-view-ps->png-converter-ghostscript)) pdf-ps png nil diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index fe97804ec4a..1720393b3e5 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -98,7 +98,11 @@ This applies to `eval-defun', `eval-region', `eval-buffer', and You can use the command `edebug-all-defs' to toggle the value of this variable. You may wish to make it local to each buffer with \(make-local-variable \\='edebug-all-defs) in your -`emacs-lisp-mode-hook'." +`emacs-lisp-mode-hook'. + +Note that this user option has no effect unless the edebug +package has been loaded." + :require 'edebug :type 'boolean) ;;;###autoload diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 9c6b0e15bbe..b6c5b7d6b91 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -1423,7 +1423,8 @@ Returns the stats object." (message "%9s %S%s" (ert-string-for-test-result result nil) (ert-test-name test) - (if (getenv "EMACS_TEST_VERBOSE") + (if (cl-plusp + (length (getenv "EMACS_TEST_VERBOSE"))) (ert-reason-for-test-result result) "")))) (message "%s" "")) @@ -1435,7 +1436,8 @@ Returns the stats object." (message "%9s %S%s" (ert-string-for-test-result result nil) (ert-test-name test) - (if (getenv "EMACS_TEST_VERBOSE") + (if (cl-plusp + (length (getenv "EMACS_TEST_VERBOSE"))) (ert-reason-for-test-result result) "")))) (message "%s" "")) diff --git a/lisp/emacs-lisp/multisession.el b/lisp/emacs-lisp/multisession.el index e6a2424c518..4a293796a83 100644 --- a/lisp/emacs-lisp/multisession.el +++ b/lisp/emacs-lisp/multisession.el @@ -434,10 +434,16 @@ storage method to list." multisession-edit-mode) (unless id (error "No value on the current line")) - (let* ((object (make-multisession - :package (car id) - :key (cdr id) - :storage multisession-storage)) + (let* ((object (or + ;; If the multisession variable already exists, use + ;; it (so that we update it). + (and (boundp (intern-soft (cdr id))) + (symbol-value (intern (cdr id)))) + ;; Create a new object. + (make-multisession + :package (car id) + :key (cdr id) + :storage multisession-storage))) (value (multisession-value object))) (setf (multisession-value object) (car (read-from-string diff --git a/lisp/eshell/em-basic.el b/lisp/eshell/em-basic.el index d3b15c900b7..ba868cee59e 100644 --- a/lisp/eshell/em-basic.el +++ b/lisp/eshell/em-basic.el @@ -113,11 +113,16 @@ or `eshell-printn' for display." "Implementation of `echo'. See `eshell-plain-echo-behavior'." (eshell-eval-using-options "echo" args - '((?n nil (nil) output-newline "do not output the trailing newline") - (?N nil (t) output-newline "terminate with a newline") - (?h "help" nil nil "output this help screen") + '((?n nil (nil) output-newline + "do not output the trailing newline") + (?N nil (t) output-newline + "terminate with a newline") + (?E nil nil _disable-escapes + "don't interpret backslash escapes (default)") + (?h "help" nil nil + "output this help screen") :preserve-args - :usage "[-n | -N] [object]") + :usage "[OPTION]... [OBJECT]...") (if eshell-plain-echo-behavior (eshell-echo args (if output-newline (car output-newline) t)) ;; In Emacs 28.1 and earlier, "-n" was used to add a newline to diff --git a/lisp/eshell/em-script.el b/lisp/eshell/em-script.el index e8459513f39..e0bcd8b099f 100644 --- a/lisp/eshell/em-script.el +++ b/lisp/eshell/em-script.el @@ -113,27 +113,13 @@ Comments begin with `#'." (defun eshell/source (&rest args) "Source a file in a subshell environment." - (eshell-eval-using-options - "source" args - '((?h "help" nil nil "show this usage screen") - :show-usage - :usage "FILE [ARGS] -Invoke the Eshell commands in FILE in a subshell, binding ARGS to $1, -$2, etc.") - (eshell-source-file (car args) (cdr args) t))) + (eshell-source-file (car args) (cdr args) t)) (put 'eshell/source 'eshell-no-numeric-conversions t) (defun eshell/. (&rest args) "Source a file in the current environment." - (eshell-eval-using-options - "." args - '((?h "help" nil nil "show this usage screen") - :show-usage - :usage "FILE [ARGS] -Invoke the Eshell commands in FILE within the current shell -environment, binding ARGS to $1, $2, etc.") - (eshell-source-file (car args) (cdr args)))) + (eshell-source-file (car args) (cdr args))) (put 'eshell/. 'eshell-no-numeric-conversions t) diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el index 25e3a5a2054..04d65df4f33 100644 --- a/lisp/eshell/esh-cmd.el +++ b/lisp/eshell/esh-cmd.el @@ -107,6 +107,7 @@ (require 'esh-module) (require 'esh-io) (require 'esh-ext) +(require 'generator) (eval-when-compile (require 'cl-lib) @@ -903,6 +904,17 @@ at the moment are: "Completion for the `debug' command." (while (pcomplete-here '("errors" "commands")))) +(iter-defun eshell--find-subcommands (haystack) + "Recursively search for subcommand forms in HAYSTACK. +This yields the SUBCOMMANDs when found in forms like +\"(eshell-as-subcommand SUBCOMMAND)\"." + (dolist (elem haystack) + (cond + ((eq (car-safe elem) 'eshell-as-subcommand) + (iter-yield (cdr elem))) + ((listp elem) + (iter-yield-from (eshell--find-subcommands elem)))))) + (defun eshell--invoke-command-directly (command) "Determine whether the given COMMAND can be invoked directly. COMMAND should be a non-top-level Eshell command in parsed form. @@ -916,8 +928,7 @@ A command can be invoked directly if all of the following are true: * NAME is a string referring to an alias function and isn't a complex command (see `eshell-complex-commands'). -* Any argument in ARGS that calls a subcommand can also be - invoked directly." +* Any subcommands in ARGS can also be invoked directly." (when (and (eq (car command) 'eshell-trap-errors) (eq (car (cadr command)) 'eshell-named-command)) (let ((name (cadr (cadr command))) @@ -931,15 +942,10 @@ A command can be invoked directly if all of the following are true: (throw 'simple nil)))) (eshell-find-alias-function name) (catch 'indirect-subcommand - (dolist (arg args t) - (pcase arg - (`(eshell-escape-arg - (let ,_ - (eshell-convert - (eshell-command-to-value - (eshell-as-subcommand ,subcommand))))) - (unless (eshell--invoke-command-directly subcommand) - (throw 'indirect-subcommand nil)))))))))) + (iter-do (subcommand (eshell--find-subcommands args)) + (unless (eshell--invoke-command-directly subcommand) + (throw 'indirect-subcommand nil))) + t))))) (defun eshell-invoke-directly (command) "Determine whether the given COMMAND can be invoked directly. diff --git a/lisp/eshell/esh-opt.el b/lisp/eshell/esh-opt.el index bba1c4ad25d..c802bee3af5 100644 --- a/lisp/eshell/esh-opt.el +++ b/lisp/eshell/esh-opt.el @@ -257,12 +257,12 @@ triggered to say that the switch is unrecognized." remaining (let ((extcmd (memq ':external options))) (when extcmd - (setq extcmd (eshell-search-path (cadr extcmd))) - (if extcmd - (throw 'eshell-ext-command extcmd) - (error (if (characterp (car switch)) "%s: unrecognized option -%c" - "%s: unrecognized option --%s") - name (car switch)))))))) + (setq extcmd (eshell-search-path (cadr extcmd)))) + (if extcmd + (throw 'eshell-ext-command extcmd) + (error (if (characterp (car switch)) "%s: unrecognized option -%c" + "%s: unrecognized option --%s") + name (car switch))))))) (defun eshell--process-args (name args options) "Process the given ARGS using OPTIONS." diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el index b110750c098..c40c38a95f9 100644 --- a/lisp/gnus/mm-view.el +++ b/lisp/gnus/mm-view.el @@ -504,8 +504,6 @@ If MODE is not set, try to find mode automatically." (setq coding-system (mm-find-buffer-file-coding-system))) (setq text (buffer-string)))) (with-temp-buffer - (buffer-disable-undo) - (mm-enable-multibyte) (insert (cond ((eq charset 'gnus-decoded) (with-current-buffer (mm-handle-buffer handle) (buffer-string))) diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 37eaf254fdb..ae2f545966e 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -2270,23 +2270,27 @@ Return new point, if it was moved." (defun diff--iterate-hunks (max fun) "Iterate over all hunks between point and MAX. -Call FUN with two args (BEG and END) for each hunk." +Call FUN with two args (BEG and END) for each hunk. +If INHIBIT-ERROR, ignore malformed hunks." (save-excursion - (let* ((beg (or (ignore-errors (diff-beginning-of-hunk)) - (ignore-errors (diff-hunk-next) (point)) - max))) - (while (< beg max) - (goto-char beg) - (cl-assert (looking-at diff-hunk-header-re)) - (let ((end - (save-excursion (diff-end-of-hunk) (point)))) - (cl-assert (< beg end)) - (funcall fun beg end) - (goto-char end) - (setq beg (if (looking-at diff-hunk-header-re) - end - (or (ignore-errors (diff-hunk-next) (point)) - max)))))))) + (catch 'malformed + (let* ((beg (or (ignore-errors (diff-beginning-of-hunk)) + (ignore-errors (diff-hunk-next) (point)) + max))) + (while (< beg max) + (goto-char beg) + (unless (looking-at diff-hunk-header-re) + (throw 'malformed nil)) + (let ((end + (save-excursion (diff-end-of-hunk) (point)))) + (unless (< beg end) + (throw 'malformed nil)) + (funcall fun beg end) + (goto-char end) + (setq beg (if (looking-at diff-hunk-header-re) + end + (or (ignore-errors (diff-hunk-next) (point)) + max))))))))) (defun diff--font-lock-refined (max) "Apply hunk refinement from font-lock." diff --git a/src/xterm.c b/src/xterm.c index c7d2dadff18..0f98cc7bec6 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -173,6 +173,10 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #include "../lwlib/xlwmenu.h" #endif +#ifdef HAVE_XWIDGETS +#include <cairo-xlib.h> +#endif + #ifdef USE_X_TOOLKIT /* Include toolkit specific headers for the scroll bar widget. */ diff --git a/src/xwidget.c b/src/xwidget.c index 69e9d5b64be..fb66a17acd8 100644 --- a/src/xwidget.c +++ b/src/xwidget.c @@ -39,6 +39,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #include <webkit2/webkit2.h> #include <JavaScriptCore/JavaScript.h> #include <cairo.h> +#include <cairo-xlib.h> #ifndef HAVE_PGTK #include <X11/Xlib.h> #else diff --git a/test/README b/test/README index e44c4a43eeb..2ab34ba20ee 100644 --- a/test/README +++ b/test/README @@ -111,8 +111,8 @@ debugging. To do that, use By default, ERT test failure summaries are quite brief in batch mode--only the names of the failed tests are listed. If the -$EMACS_TEST_VERBOSE environment variable is set, the failure summaries -will also include the data from the failing test. +$EMACS_TEST_VERBOSE environment variable is set and non-empty, the +failure summaries will also include the data from the failing test. If the $EMACS_TEST_JUNIT_REPORT environment variable is set to a file name, a JUnit test report is generated under this name. diff --git a/test/lisp/eshell/esh-opt-tests.el b/test/lisp/eshell/esh-opt-tests.el index 255768635b1..b76ed8866df 100644 --- a/test/lisp/eshell/esh-opt-tests.el +++ b/test/lisp/eshell/esh-opt-tests.el @@ -27,41 +27,63 @@ (should (equal '(t) (eshell--process-args - "sudo" - '("-a") - '((?a "all" nil show-all ""))))) - (should - (equal '(nil) - (eshell--process-args - "sudo" - '("-g") - '((?a "all" nil show-all ""))))) + "sudo" '("-a") + '((?a "all" nil show-all + "do not ignore entries starting with ."))))) (should (equal '("root" "world") (eshell--process-args - "sudo" - '("-u" "root" "world") - '((?u "user" t user "execute a command as another USER"))))) + "sudo" '("-u" "root" "world") + '((?u "user" t user + "execute a command as another USER"))))) (should (equal '(nil "emerge" "-uDN" "world") (eshell--process-args - "sudo" - '("emerge" "-uDN" "world") - '((?u "user" t user "execute a command as another USER") + "sudo" '("emerge" "-uDN" "world") + '((?u "user" t user + "execute a command as another USER") :parse-leading-options-only)))) (should (equal '("root" "emerge" "-uDN" "world") (eshell--process-args - "sudo" - '("-u" "root" "emerge" "-uDN" "world") - '((?u "user" t user "execute a command as another USER") + "sudo" '("-u" "root" "emerge" "-uDN" "world") + '((?u "user" t user + "execute a command as another USER") :parse-leading-options-only)))) (should (equal '("DN" "emerge" "world") (eshell--process-args - "sudo" - '("-u" "root" "emerge" "-uDN" "world") - '((?u "user" t user "execute a command as another USER")))))) + "sudo" '("-u" "root" "emerge" "-uDN" "world") + '((?u "user" t user + "execute a command as another USER"))))) + + ;; Test :external. + (cl-letf (((symbol-function 'eshell-search-path) #'ignore)) + (should + (equal '(nil "/some/path") + (eshell--process-args + "ls" '("/some/path") + '((?a "all" nil show-all + "do not ignore entries starting with .") + :external "ls"))))) + (cl-letf (((symbol-function 'eshell-search-path) #'identity)) + (should + (equal '(no-catch eshell-ext-command "ls") + (should-error + (eshell--process-args + "ls" '("-u" "/some/path") + '((?a "all" nil show-all + "do not ignore entries starting with .") + :external "ls")) + :type 'no-catch)))) + (cl-letf (((symbol-function 'eshell-search-path) #'ignore)) + (should-error + (eshell--process-args + "ls" '("-u" "/some/path") + '((?a "all" nil show-all + "do not ignore entries starting with .") + :external "ls")) + :type 'error))) (ert-deftest test-eshell-eval-using-options () "Tests for `eshell-eval-using-options'." @@ -190,7 +212,27 @@ '((?u "user" t user "execute a command as another USER") :parse-leading-options-only) (should (eq user nil)) - (should (equal args '("emerge" "-uDN" "world"))))) + (should (equal args '("emerge" "-uDN" "world")))) + + ;; Test unrecognized options. + (should-error + (eshell-eval-using-options + "ls" '("-u" "/some/path") + '((?a "all" nil show-all + "do not ignore entries starting with .")) + (ignore show-all))) + (should-error + (eshell-eval-using-options + "ls" '("-au" "/some/path") + '((?a "all" nil show-all + "do not ignore entries starting with .")) + (ignore show-all))) + (should-error + (eshell-eval-using-options + "ls" '("--unrecognized" "/some/path") + '((?a "all" nil show-all + "do not ignore entries starting with .")) + (ignore show-all)))) (provide 'esh-opt-tests) diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el index c4cb9bf4850..1a7ab0ab06f 100644 --- a/test/lisp/eshell/eshell-tests.el +++ b/test/lisp/eshell/eshell-tests.el @@ -167,6 +167,13 @@ e.g. \"{(+ 1 2)} 3\" => 3" (eshell-command-result-p "echo ${*echo hi}" "hi\n"))) +(ert-deftest eshell-test/interp-cmd-external-concat () + "Interpolate command result from external command with concatenation" + (skip-unless (executable-find "echo")) + (with-temp-eshell + (eshell-command-result-p "echo ${echo hi}-${*echo there}" + "hi-there\n"))) + (ert-deftest eshell-test/window-height () "$LINES should equal (window-height)" (should (eshell-test-command-result "= $LINES (window-height)"))) |