Stefan Kangas [Wed, 14 Sep 2022 10:12:46 +0000 (12:12 +0200)]
Make it easier to customize wallpaper command
* lisp/image/wallpaper.el
(wallpaper--default-commands): New defvar.
(wallpaper--find-command): Use above new defvar.
(wallpaper--find-command-arguments): New defun.
(wallpaper-command): Rename from 'wallpaper-commands' and change
type to string. Use 'wallpaper--find-command' to set it.
(wallpaper-command-args): New defcustom. Use
'wallpaper--find-command-arguments' to set it.
(wallpaper--set-wallpaper-command): New defun. Use as :set property
for 'wallpaper-command'.
(wallpaper-set): Use above new defcustoms to set the wallpaper.
Suggested by Eli Zaretskii <eliz@gnu.org>.
Stefan Kangas [Wed, 14 Sep 2022 08:52:39 +0000 (10:52 +0200)]
Allow setting wallpaper from TTY
* lisp/image/wallpaper.el (wallpaper-set): Allow setting wallpaper
when 'display-graphic-p' is nil.
(wallpaper-default-width, wallpaper-default-height):
New variables.
(wallpaper--get-height-or-width): New helper function.
Stefan Kangas [Wed, 14 Sep 2022 08:26:07 +0000 (10:26 +0200)]
Fix desktop environment check on Ubuntu
* lisp/image/wallpaper.el (xdg): Require.
(wallpaper--check-command): Use xdg-current-desktop instead of reading
XDG_CURRENT_DESKTOP directly. This fixes things on e.g. Ubuntu, where
XDG_CURRENT_DESKTOP might contain a string like "ubuntu:GNOME".
Paul Eggert [Tue, 13 Sep 2022 17:41:34 +0000 (12:41 -0500)]
Port alignas definition to C23
* src/lisp.h (alignas): C23 is removing the __alignas_is_defined
macro, so do not rely on it. Instead, do not define alignas if C23
or later, or if C++11 or later.
Stefan Kangas [Tue, 13 Sep 2022 16:02:21 +0000 (18:02 +0200)]
Use wallpaper-set in thumbs.el
* lisp/thumbs.el (wallpaper): Require.
(thumbs-setroot-command): Make defcustom obsolete.
(thumbs-call-setroot-command): Make obsolete in favor of
wallpaper-set.
(thumbs-set-image-at-point-to-root-window, thumbs-set-root)
(thumbs-dired-setroot): Use wallpaper-set instead of
thumbs-call-setroot-command.
(thumbs-before-setroot-hook, thumbs-after-setroot-hook): Make
obsolete.
Stefan Kangas [Tue, 13 Sep 2022 15:56:22 +0000 (17:56 +0200)]
Add new command image-dired-set-wallpaper
* lisp/image/image-dired.el (wallpaper): Require.
(image-dired-set-wallpaper): New command.
(image-dired-thumbnail-mode-map): Bind above new command to "W".
Philipp Stephani [Tue, 13 Sep 2022 15:12:57 +0000 (17:12 +0200)]
Have 'cl-case' warn about suspicious cases
* lisp/emacs-lisp/cl-macs.el (cl-case): Warn if the user passes a nil
key list (which would never match). Warn about quoted symbols that
should probably be unquoted.
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-case-warning): New unit
test (bug#51368).
Philipp Stephani [Tue, 13 Sep 2022 15:11:53 +0000 (17:11 +0200)]
Signal an error if a fallback cl-case is misplaced
* lisp/emacs-lisp/cl-macs.el (cl-case): Warn if the user passes a nil
key list (which would never match). Warn about quoted symbols that
should probably be unquoted.
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-case-warning): New unit
test (bug#51368).
Eli Zaretskii [Tue, 13 Sep 2022 13:49:02 +0000 (16:49 +0300)]
; Add commentary to comp-tests.el
Sigh... why do people insist on removing useful comments and leave
their tricky code more obfuscated than it must be??
* test/src/comp-tests.el (comp-tests-type-spec-tests): Add a
comment explaining why the expressions are quoted. (Bug#51104)
Stefan Monnier [Tue, 13 Sep 2022 13:36:21 +0000 (09:36 -0400)]
comp-tests.el: Enable compilation again
Rather than disable byte-compilation to circumvent bug#51104,
change the ELisp code so that `most-positive/negative-fixnum` does
not end up hardcoded in the `.elc` file.
* test/src/comp-tests.el (comp-tests-define-type-spec-test):
Don't quote the type expressions.
(comp-tests-type-spec-tests): Quote them here instead.
Eli Zaretskii [Tue, 13 Sep 2022 13:26:50 +0000 (16:26 +0300)]
Fix last change in image.c
* src/image.c (svg_load_image): Don't call Lisp to remove trailing
whitespace from librsvg error messages, do it in C instead; this
reduces consing and is much cleaner. Don't display empty error
reason if librsvg happens to return an empty message text.
(syms_of_image): Don't DEFSYM string-trim-right. (Bug#57755)
* lisp/net/eww.el (eww-render): Enable undo after rendering. This
allows using `undo' in text input boxes.
(eww-setup-buffer): Disable undo before rendering (bug#57750).
* doc/emacs/buffers.texi (Indirect Buffers): There's no point in
mentioning both clone-indirect-buffer and
clone-indirect-buffer-other-window here since they do the pretty
much the same (bug#57753).
* src/image.c (svg_load_image): Use g_error_free directly instead
of the helder g_clear_error (since we're only calling it with
non-nil values).
(svg_load_image): Avoid segfault and double reporting errors.
* test/manual/image-tests.el (image-tests-load-image/svg-too-big)
(image-tests-load-image/svg-invalid): Test it (bug#57755).
Juri Linkov [Mon, 12 Sep 2022 19:12:50 +0000 (22:12 +0300)]
Document the recently added branch commands (bug#50344)
* doc/emacs/maintaining.texi (VC Directory Commands): Change the
prefix key from "B" to "b". Replace vc-create-tag with vc-create-branch,
and vc-retrieve-tag with vc-switch-branch.
(Switching Branches): Mention vc-switch-branch bound to 'C-x v b s'.
(Creating Branches): Mention vc-create-branch bound to 'C-x v b c'.
* lisp/vc/vc-dir.el (vc-dir-mode-map): In branch keymap 'b' rebind
"c" from vc-create-tag to vc-create-branch, and "s" from
vc-retrieve-tag to vc-switch-branch.
Juri Linkov [Mon, 12 Sep 2022 18:07:05 +0000 (21:07 +0300)]
'C-x v b' prefix key is used for branch commands to create/switch/print branch
* lisp/vc/vc.el (vc-create-branch): New command.
(vc-retrieve-tag): Add new optional arg 'branchp'.
(vc-switch-branch): New command (bug#50344).
* lisp/vc/vc-hooks.el (vc-prefix-map): Bind "b c" to vc-create-branch,
"b l" to vc-print-branch-log, "b s" to vc-switch-branch. Remove obsolete
and suppressed "b" from vc-switch-backend.
* lisp/vc/vc-dir.el (vc-dir-mode-map): Rebind 'branch-map' from "B" to "b"
for consistency with 'vc-prefix-map'.
* lisp/vc/vc-git.el (vc-git-create-tag): For a new branch read
its start-point. Ask a confirmation if modified files exist.
Stefan Kangas [Mon, 12 Sep 2022 13:14:42 +0000 (15:14 +0200)]
Skip manual GIF metadata test on MS-Windows
* test/manual/image-tests.el
(image-skip-unless): Add new arg CONDITION.
(image-tests-image-metadata/gif): Skip test on MS-Windows when
using native image API. (Bug#57691)
Don't overwrite error message in `x' in package.el
* lisp/emacs-lisp/package.el (package-menu--perform-transaction):
Return whether there were errors.
(package-menu-execute): Don't overwrite the error message(s) with
a success message (bug#51201).
* doc/lispref/keymaps.texi (Tool Bar): Document what :vert-only
does (bug#51049). This is not what it was intended to do -- but
what it intended to do didn't really make that much sense either,
so perhaps the prop should just be renamed :image-only?
Arthur Miller [Mon, 12 Sep 2022 10:38:09 +0000 (12:38 +0200)]
Remove edebug props in edebug-remove-instrumentation
* lisp/emacs-lisp/edebug.el (edebug--strip-plist): New function
(bug#51026).
(edebug-remove-instrumentation): Use it to remove pros added while
running edebug.
* lisp/textmodes/reftex-global.el (reftex-translate): Recognize
key=val labels given in the optional or mandatory argument of
environments (AUCTeX bug#57720).
* test/lisp/textmodes/reftex-tests.el
(reftex-renumber-simple-labels): New Test.
Restrict replace-*-in-region to the bounds defined by caller
* lisp/subr.el (replace-string-in-region, replace-regexp-in-region):
Narrow to region before iterating over matches, instead of giving a
bound to the search functions.
* test/lisp/subr-tests.el (test-replace-string-in-region): Add
regression tests (bug#57733).
Richard Hansen [Tue, 28 Jun 2022 20:25:43 +0000 (16:25 -0400)]
whitespace: Redo BoB/EoB empty line highlighting
* lisp/whitespace.el (whitespace--empty-at-bob-matcher,
whitespace--empty-at-eob-matcher, whitespace--update-bob-eob,
whitespace-color-off, whitespace-color-on,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-looking-back, whitespace-post-command-hook): Redo the
`empty' line highlighting logic to ensure that a buffer change causes
all affected `empty' lines to become (un)highlighted (bug#37467).
Also, for improved UX, don't highlight BoB empty lines at or below
point (not just when point is at 1), or EoB empty lines at or above
point (not just when point is `eobp').
(whitespace-bob-marker, whitespace-eob-marker): Clarify documentation.
* test/lisp/whitespace-tests.el (whitespace--with-test-buffer,
whitespace--fu, whitespace-tests--empty-bob,
whitespace-tests--empty-eob): Add tests.
Richard Hansen [Tue, 28 Jun 2022 19:05:04 +0000 (15:05 -0400)]
whitespace: Include empty final line in BoB empty match
* lisp/whitespace.el (whitespace-empty-at-bob-regexp): Include any
last line trailing whitespace in the BoB empty line match to ensure
that those characters get highlighted.
Richard Hansen [Tue, 28 Jun 2022 05:10:48 +0000 (01:10 -0400)]
ert-x: New `ert-with-test-buffer-selected' convenience macro
* lisp/emacs-lisp/ert-x.el (ert-with-test-buffer-selected): New
convenience macro that extends `ert-with-test-buffer' by displaying
the test buffer in a temporary selected window. This makes it easier
to simulate user input in the body via `execute-kbd-macro'.
* test/lisp/emacs-lisp/ert-x-tests.el
(ert-test-test-buffer-selected/*): Add tests.
Po Lu [Sun, 11 Sep 2022 08:50:16 +0000 (16:50 +0800)]
Make it easier to clear the Motif drag window for debugging
* src/xterm.c (xm_get_drag_window_1): Add comment explaining
side effect of x_special_window_exists_p.
(handle_one_xevent): Clear Motif drag window upon DestroyNotify.
In addition to debugging, it also reduces syncs necessary to
communicate via the Motif protocol after a defective/old client
sets the drag window without setting the disconnect mode.
Po Lu [Sat, 10 Sep 2022 10:49:53 +0000 (18:49 +0800)]
Fix compliance with the XDND specification when dropping on a proxy
* src/xterm.c (x_dnd_send_enter, x_dnd_send_position)
(x_dnd_send_leave, x_dnd_send_drop, x_dnd_do_drop): New
parameter `toplevel'. Use it as the window in sent client
messages.
(x_dnd_cancel_dnd_early, x_dnd_cleanup_drag_and_drop)
(x_dnd_process_quit, x_dnd_update_state, handle_one_xevent)
(x_connection_closed): Give the right toplevel to the client
message sending functions.
Make `format-prompt' use `substitute-command-keys'
* doc/lispref/minibuf.texi (Text from Minibuffer): Mention it.
* lisp/minibuffer.el (format-prompt): Run through
`substitute-command-keys' (bug#51040).