Stefan Kangas [Thu, 15 Sep 2022 20:19:00 +0000 (22:19 +0200)]
image-dired: Fix performance bug with mouse click
* lisp/image/image-dired.el
(image-dired--on-file-in-dired-buffer): Move call to
'image-dired-thumb-update-marks' from here...
(image-dired--do-mark-command): ...to here. Add new optional
argument UPDATE to control calling it. Update callers.
(image-dired-mouse-toggle-mark-1): Fix performance bug by setting
above new optional argument to nil. (Bug#53599)
* lisp/image/wallpaper.el (wallpaper-command):
Include nil in the type since that is a valid value for the variable,
and may be the default value. This should fix test-custom-opts.
Alan Mackenzie [Thu, 15 Sep 2022 19:54:22 +0000 (19:54 +0000)]
CC Mode: Handle C++20 modules
* lisp/progmodes/cc-engine.el (c-before-after-change-check-c++-modules): New
function.
(c-forward-<>-arglist): Add special handling for "import <...>".
* lisp/progmodes/cc-fonts.el (c-preprocessor-face-name): Add extra "fallback"
face after font-lock-reference-face, namely font-lock-constant-face.
(c-cpp-matchers): Don't fontify the <> delimiters for XEmacs in #include <..>.
(c-basic-matchers-before): Add c-font-lock-c++-modules to the C++ value.
(c-forward-c++-module-name, c-forward-c++-module-partition-name)
(c-font-lock-c++-modules): New functions.
* lisp/progmodes/cc-langs.el (c-get-state-before-change-functions)
(c-before-font-lock-functions): Include
c-before-after-change-check-c++-modules in the C++ value of these variables.
(c-module-name-re): New c-lang-const/var.
(c-other-decl-kwds): Add a C++ value "export".
(c-<>-sexp-kwds): Add a new component c-import-<>-kwds.
(c-import-<>-kwds, c-module-kwds): New c-lang-consts.
(c-module-key): New c-lang-const/var.
Stefan Kangas [Thu, 15 Sep 2022 16:27:48 +0000 (18:27 +0200)]
Support macOS in wallpaper.el
* lisp/image/wallpaper.el (wallpaper--default-commands)
(wallpaper-command): Support macOS using "osascript".
(wallpaper-set): Display image name when wallpaper-debug is t.
Eli Zaretskii [Thu, 15 Sep 2022 11:51:31 +0000 (14:51 +0300)]
Implement support for 'wallpaper-set' on MS-Windows
* src/w32fns.c (Fw32_set_wallpaper): New primitive.
(syms_of_w32fns): Defsubr it.
(globals_of_w32fns): Attempt to load SystemParametersInfoW from
its DLL at run time.
* lisp/image/wallpaper.el (wallpaper-set): Support MS-Windows by
calling 'w32-set-wallpaper'.
* etc/NEWS: Update and simplify wording of the 'wallpaper-set'
entry.
For a switch op to be generated, comparisons must be made using `eq`,
`eql` or `equal`, not `=`.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode):
* lisp/files.el (file-modes-char-to-who, file-modes-char-to-right):
* lisp/international/titdic-cnv.el (tit-process-header):
* lisp/language/ethio-util.el (ethio-input-special-character)
(ethio-fidel-to-tex-buffer):
* lisp/language/lao.el (consonant):
Use `eq` or `eql` instead of `=`.
In these cases either `eq` or `eql` would do and the choice does not
affect the resulting code. We compare numbers with `eql` and
characters with `eq` as a matter of style.
A big on-stack buffer in a potentially long-running function can
interact badly with the GC's conservative scanning of the C stack.
It may make the scanning slower (since the stack frame is big) and
risks accidental retention of objects from stack detritus
(because the buffer isn't cleaned on entry).
* src/lread.c (stackbufsize): Remove.
(read_integer, read_string_literal, read_bool_vector): Use a local
buffer instead of piggy-backing on that in read0.
(read0): Reduce buffer to something suitable for most identifiers and
numbers.
mapconcat fast path with `identity` function argument
This makes (mapconcat #'identity SEQ) slightly faster than
(apply #'concat SEQ), which used to be much faster.
Notably, `string-join` benefits from this change as it uses mapconcat.
* src/fns.c (Fmapconcat): Speed up execution when the function
argument is `identity`.
Jim Porter [Tue, 13 Sep 2022 23:14:00 +0000 (16:14 -0700)]
Allow using a symbol as an index into an alist in Eshell
* lisp/eshell/esh-var.el (eshell-index-value): If INDEX is a symbol,
use 'assoc' for indexing.
* test/lisp/eshell/esh-var-tests.el (esh-var-test/interp-var-assoc)
(esh-var-test/quoted-interp-var-assoc): Add checks for indexing via
symbol (bug#57787).
Sean Whitton [Wed, 14 Sep 2022 16:49:27 +0000 (09:49 -0700)]
Use '^' key for detach command bindings
* lisp/tab-bar.el (tab-prefix-map): Move tear-off-window to C-x w ^ f.
Bind tab-window-detach to C-x w ^ t.
* lisp/window.el (window-prefix-map): Bind tab-detach to C-x t ^ f.
Augusto Stoffel [Thu, 8 Sep 2022 09:09:42 +0000 (11:09 +0200)]
pcomplete: Generate completions from --help messages
* lisp/pcomplete.el (pcomplete-from-help): New function (and hash
table) to get pcomplete candidates from help messages.
(pcomplete-here-using-help): Helper function to define pcomplete for
simple commands
(pcomplete-completions-at-point): Provide annotation-function and
company-docsig properties.
* lisp/pcmpl-git.el: New file, provides pcomplete for Git.
* lisp/pcmpl-gnu.el: Add pcomplete for awk, gpg and gdb, emacs and
emacsclient.
* lisp/pcmpl-linux.el: Add pcomplete for systemctl and journalctl.
* lisp/pcmpl-rpm.el: Add pcomplete for dnf.
* lisp/pcmpl-unix.el: Add pcomplete for sudo and most commands found
in GNU Coreutils.
* lisp/pcmpl-x.el: Add pcomplete for tex, pdftex, latex, pdflatex,
rigrep and rclone.
* test/lisp/pcomplete-tests.el (pcomplete-test-parse-gpg-help,
pcomplete-test-parse-git-help): Tests for the new functions.
* lisp/image/image-crop.el (image-crop-elide-command): Adjust to
allow specifying the color.
(image-elide): Prompt for a color.
(image-crop--crop-image-update): Pass the color along.
* lisp/image/image-crop.el (image-crop): New group.
(image-crop-crop-command, image-crop-resize-command)
(image-crop-elide-command, image-crop-crop-command): Make into
defcustoms.
Don't alter the buffer contents in image-crop by default
* lisp/image/image-crop.el (image-crop-buffer-text-function):
Allow modes to alter the textual representation.
(image-crop): Delete the complete image data without assuming it's
all on one line (which isn't the case in image-mode, for instance).
(image-crop--crop-image-update, image-crop--insert-image-data):
Use image-crop-buffer-text-function.
(image-crop--default-buffer-text): New default action -- don't
alter the buffer contents (bug#57793).
Raise default max-specpdl-size and max-lisp-eval-depth
Recent changes have caused bootstrapping to fail for certain
configurations, and it was likely getting close to the limits
for others. This change raises the limits to those previously
used when configured for nativecomp:
max-specpdl-size raised from 1800 to 2500
max-lisp-eval-depth raised from 800 to 1600
Stefan Kangas [Wed, 14 Sep 2022 13:34:38 +0000 (15:34 +0200)]
Rename image transform commands to be less confusing
* lisp/image-mode.el
(image-transform-original): Rename from this...
(image-transform-reset-to-original): ...to this. Make old name
into an obsolete function alias and update all callers.
(image-transform-reset): Rename from this...
(image-transform-reset-to-initial): ...to this. Make old name
into an obsolete function alias and update all callers.
(Bug#51451)
* doc/emacs/files.texi (Image Mode): Update for above change.
* lisp/simple.el (shell-command): Remove save-match-data, since
we're (in many cases) altering the match data earlier in the
function anyway (bug#57795).
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.