Stefan Kangas [Fri, 16 Sep 2022 12:17:14 +0000 (14:17 +0200)]
Improve HTML export of NEWS file
* admin/admin.el (admin--org-export-headers-format)
(admin--org-html-postamble): New variables.
(admin--require-external-package): New function.
(make-news-html-file): Improve HTML export.
* lisp/subr.el (list-of-strings-p): Speed up by a factor 4 (approx.)
and don't crash on dotted lists.
* test/lisp/subr-tests.el (test-list-of-strings-p): Extend test.
Stefan Kangas [Fri, 16 Sep 2022 13:16:43 +0000 (15:16 +0200)]
Delete "etc/NEWS*.html" from .gitignore
We actually do want to see it when preparing a release, so that we
don't include it in a tarball by mistake.
* .gitignore: Don't ignore "etc/NEWS*.html".
Fix *Help* output for native-comp functions from IELM
* lisp/help-fns.el (find-lisp-object-file-name): Don't claim that
native-comp functions that are defined outside of files (for
instance, created by calling `native-compile' in IELM) are in C
source (bug#57819).
* lisp/image/image-crop.el (image-crop-cut-command): Rename.
(image-cut-color): New user option.
(image-cut): Rename and remove prefix.
(image-crop): Remove prefix.
(image-crop--crop-image-update): Add commands to switch to
move/square modes.
Po Lu [Fri, 16 Sep 2022 09:01:41 +0000 (17:01 +0800)]
Fix wrong source window being generated for XDND leave events
* src/xterm.c (x_dnd_update_state, handle_one_xevent): Let
x_dnd_last_seen_toplevel remain at its old value until any
XdndLeave event was definitely sent.
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".