Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs

This commit is contained in:
Eli Zaretskii 2022-01-21 14:11:22 +02:00
commit 87107b05a1
20 changed files with 218 additions and 130 deletions

View file

@ -80,6 +80,7 @@ The GNU allocators don't work|\
^'\.git/|\
^\^\(\(|\
^'build-aux/git-hooks\
^ANCIENT=yes make\
" | \
while read
do

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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" ""))

View file

@ -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

View file

@ -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

View file

@ -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)

View file

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

View file

@ -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."

View file

@ -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)))

View file

@ -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."

View file

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

View file

@ -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

View file

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

View file

@ -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)

View file

@ -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)")))