* lisp/doc-view.el (doc-view-imenu-enabled): user option to disable
imenu generation.
* lisp/doc-view.el (doc-view--outline-rx):
(doc-view--pdf-outline, doc-view--imenu-subtree, doc-view-imenu-index):
functions implementing the imenu index generation via mutool.
* lisp/doc-view.el (doc-view-imenu-setup, doc-view-mode): setup of the
new functionality in doc-view mode.
* lisp/imenu.el (imenu-submenus-on-top):
(imenu--split-menu): new local variable to optionally inhibit
grouping of entries with children at the top of imenu menus.
* doc/emacs/misc.texi: documentation for the new functionality
(bug#58103).
Richard Hansen [Mon, 26 Sep 2022 21:07:52 +0000 (17:07 -0400)]
ert-x: Improve realism of `ert-with-test-buffer-selected'
* lisp/emacs-lisp/ert-x.el (ert-with-test-buffer-selected): Set
`inhibit-read-only' and `buffer-read-only' to nil when executing the
body to provide a more realistic test environment.
Po Lu [Tue, 27 Sep 2022 02:50:34 +0000 (10:50 +0800)]
Optimize coordinate translation during event handling
These changes noticeably improve turning the mouse wheel on top of
scroll bars etc over slow network connections.
* src/xterm.c (x_dnd_note_self_position, x_dnd_note_self_wheel)
(x_dnd_note_self_drop): Use x_translate_coordinates.
(x_compute_root_window_offset): New function for calculating and
caching root window offsets of edit window.
(x_translate_coordinates): New function. Use cached values
whenever possible.
(xi_compute_root_window_offset)
(xi_compute_root_window_offset_pinch): New wrappers for XI2
events.
(x_construct_mouse_click, handle_one_xevent): Use
x_translate_coordinates wherever appropriate.
* src/xterm.h (struct x_output): New fields for keeping track of
the root window offset of the edit window.
Adjust zero-width grapheme clusters so they are displayed (Bug#50951)
* src/composite.c (composition_gstring_adjust_zero_width): New function.
* src/composite.h: Declare it.
* src/font.c (Ffont_shape_gstring): Use it before putting gstring to cache.
Stefan Kangas [Mon, 26 Sep 2022 19:26:50 +0000 (21:26 +0200)]
Set XFCE wallpaper also in single-workspace-mode
This fixes setting the wallpaper on XFCE whether or not the
"/backdrop/single-workspace-mode" setting is true or false.
That XFCE setting controls whether or not the same wallpaper is used
on all workspaces or not.
* lisp/image/wallpaper.el (wallpaper-setter)
(wallpaper-command-args, wallpaper-default-set-function): Allow
using a function for getting the command line arguments.
(wallpaper-xfce-command-args): New function.
(wallpaper--default-setters): Use above new function for XFCE.
Alan Mackenzie [Mon, 26 Sep 2022 19:16:33 +0000 (19:16 +0000)]
CC Mode: Handle C++20 concepts
* lisp/progmodes/cc-align.el (c-lineup-topmost-intro-cont): Amend so as not to
indent lines following a requires line.
* lisp/progmodes/cc-engine.el (c-forward-primary-expression)
(c-forward-c++-requires-clause): New functions.
(c-forward-declarator): Skip forward over any trailing requires clause.
(c-forward-decl-or-cast-1): Skip requires clauses before and after the type.
Amend the second element of the return list to include information on two
consecutive identifiers in <...>.
(c-looking-at-or-maybe-in-bracelist): Don't recognize braces in requires
expressions as brace lists.
(c-guess-basic-syntax): CASE 5D.7: New case to handle the continuation of a
"concept foo = " line.
* lisp/progmodes/cc-fonts.el (c-basic-matchers-before): Add a new clause to
handle the declaration of a concept.
(c-get-fontification-context): Treat the arglist of a requires construct as a
declaration arglist.
* lisp/progmodes/cc-langs.el (c-equals-nontype-decl-kwds/key)
(c-fun-name-substitute-kwds/key, c-pre-concept-<>-kwds/key): New
c-lang-consts/vars.
(c-constant-key): New c-lang-var.
(c-type-decl-suffix-key): Include "requires" in the keywords matched.
* lisp/progmodes/cc-mode.el (c-fl-decl-start): Fix an off by one error. Use
equal rather than eq to compare two syntax contexts.
Stefan Kangas [Mon, 26 Sep 2022 12:38:25 +0000 (14:38 +0200)]
Fix setting the wallpaper in XFCE
* lisp/image/wallpaper.el (wallpaper-command-args)
(wallpaper-default-set-function): Support new format specifiers
%S for screen, %W for workspace, and %M for monitor.
(wallpaper--default-setters): Use above new specifiers for XFCE.
(wallpaper--format-arg): New defun broken out from...
(wallpaper-default-set-function): ...here.
(wallpaper--get-height-or-width): Support noninteractive use.
* test/lisp/image/wallpaper-tests.el (wallpaper--format-arg/filename)
(wallpaper--format-arg/filename-hex)
(wallpaper--format-arg/width, wallpaper--format-arg/screen)
(wallpaper--format-arg/monitor, wallpaper--format-arg/workspace):
New tests.
Stefan Kangas [Sun, 18 Sep 2022 09:48:24 +0000 (11:48 +0200)]
Rewrite wallpaper.el to use a cl-defstruct
* lisp/image/wallpaper.el
(wallpaper--default-commands): Delete variable.
(wallpaper-setter): New cl-defstruct.
(wallpaper--default-methods-create): New macro.
(wallpaper--default-setters):
(wallpaper--current-setter): New variables.
(wallpaper--find-setter): New defun to pick a wallpaper-setter.
(wallpaper--find-command, wallpaper--find-command-args):
Use 'wallpaper--find-setter'.
(wallpaper-command): Doc fix.
* test/lisp/image/wallpaper-tests.el
(wallpaper--find-command/return-string)
(wallpaper--find-command-args/return-list)
(wallpaper--image-file-regexp/return-string): New tests.
* lisp/vc/log-edit.el (log-edit-summary-separator): Add new face.
(log-edit-font-lock-keywords): Replace hardcoded face attributes with
named face.
* etc/NEWS: Announce the new face.
* lisp/net/eww.el (eww-tag-input): Don't claim to have an URL here
(bug#58091).
* lisp/net/shr.el (shr-next-link, shr-previous-link): Search for
shr-tab-stop instead of shr-url so that we can be more general.
(shr-urlify): Mark all links as tabbable-to.
Stefan Monnier [Sun, 25 Sep 2022 17:51:30 +0000 (13:51 -0400)]
tex-mode.el: Don't override AUCTeX modes
* lisp/textmodes/tex-mode.el (TeX-mode, plain-TeX-mode, LaTeX-mode):
Only define them as aliases in `lisp/loaddefs.el` so we don't
override AUCTeX's own definitions when we load `tex-mode.el`.
* lisp/emacs-lisp/byte-opt.el (byte-opt--bool-value-form):
`set` is boolean identity in its second argument.
(byte-compile-trueconstp): `set-marker` is always true.
Stefan Kangas [Sun, 25 Sep 2022 15:27:20 +0000 (17:27 +0200)]
Refactor system specific code in wallpaper.el
* lisp/image/wallpaper.el (wallpaper-set-function): New defvar
containing system specific function for setting wallpaper.
(wallpaper-default-set-function): Factor out function from...
(wallpaper-set): ...here. Use above new defvar.
(wallpaper-default-file-name-regexp): Delete defvar.
(wallpaper-image-file-extensions): New defvar.
(wallpaper--image-file-regexp): New defun that returns a regexp to
match for completion purposes.
(wallpaper--use-default-set-function-p): New defun.
(wallpaper--find-command, wallpaper--find-command-arguments):
Do nothing on MS-Windows and Haiku.
Stefan Kangas [Sun, 25 Sep 2022 14:16:51 +0000 (16:16 +0200)]
Add reasonable default to wallpaper-set
* lisp/image/wallpaper.el
(wallpaper-default-file-name-regexp): New variable.
(wallpaper--get-default-file): New function.
(wallpaper-set): Use above new function to set a default.
* test/lisp/image/wallpaper-tests.el: New file.
Stefan Kangas [Sun, 25 Sep 2022 14:16:30 +0000 (16:16 +0200)]
Add :buffer argument to ert-with-temp-file
* lisp/emacs-lisp/ert-x.el (ert-with-temp-file): Add new keyword
argument :buffer SYMBOL to visit the file with `find-file-literally'
before running the body, and cleaning up after.
Po Lu [Sun, 25 Sep 2022 13:22:45 +0000 (13:22 +0000)]
Implement font-use-system-font on Haiku
* doc/emacs/frames.texi (Fonts): Update documentation to say
what font-use-system-font really does and where it can be used.
* src/haiku_font_support.cc (language_code_points): Fix coding
style.
(font_style_to_flags, be_font_style_to_flags): Accept const char
*.
(be_send_font_settings, be_listen_font_settings)
(be_lock_font_defaults, be_unlock_font_defaults)
(be_get_font_default, be_get_font_size): New functions used to
retrieve default font data.
* src/haiku_io.c (haiku_len): Handle FONT_CHANGE_EVENT.
* src/haiku_support.h (enum haiku_event_type): New event type
FONT_CHANGE_EVENT.
(enum haiku_what_font): New enum.
(struct haiku_font_change_event): New struct.
* src/haikufont.c (Ffont_get_system_normal_font)
(Ffont_get_system_font, haiku_handle_font_change_event): New
functions.
(syms_of_haikufont): Provide `dynamic-setting' and define new
variables and subrs.
* src/haikuterm.c (haiku_default_font_parameter): Use system font.
(haiku_read_socket): Handle FONT_CHANGE_EVENTS.
(haiku_term_init): Start listening for font configuration changes.
* src/haikuterm.h: Update prototypes.
* src/xsettings.c (Ffont_get_system_normal_font)
(Ffont_get_system_font): Update doc string.
(syms_of_xsettings): Replace calls to intern with a static
string.
Stefan Kangas [Sat, 24 Sep 2022 18:08:25 +0000 (20:08 +0200)]
image-dired: Add faces for header line
* lisp/image/image-dired.el (image-dired-thumb-header-file-name)
(image-dired-thumb-header-directory-name)
(-image-dired-thumb-header-file-size)
(image-dired-thumb-header-image-count): New faces.
(image-dired-format-properties-string): Use above new faces.
(image-dired-thumb-mark, image-dired-thumb-flagged): Move
definition further down.
Stefan Kangas [Sat, 24 Sep 2022 08:45:37 +0000 (10:45 +0200)]
image-dired: Add new %-format specifiers for header line
* lisp/image/image-dired.el
(image-dired-format-properties-string): Add new specifiers "%n", "%d",
and "%s".
(image-dired-display-properties-format): Change default format to use
above new specifiers.
(image-dired--number-of-thumbnails): New variable.
(image-dired-insert-thumbnail, image-dired-display-thumbs): Keep
track of file number when appending it into the thumbnail buffer.
(image-dired--update-header-line): Support above new format
specifiers. Rename from 'image-dired-update-header-line' and
update callers.
* lisp/image/image-dired-dired.el
(image-dired-dired-display-properties): Support above new format
specifiers.
Sean Whitton [Sat, 24 Sep 2022 17:39:52 +0000 (10:39 -0700)]
Generalize & simplify implementation of user edits to VC commands
* lisp/vc/vc-dispatcher.el (vc-pre-command-functions)
(vc-want-edit-command-p): Delete.
(vc-filter-command-function): New variable.
(vc-user-edit-command): Factor out of vc-do-command.
(vc-do-command, vc-do-async-command)
* lisp/vc/vc-git.el (vc-git--pushpull)
* lisp/vc/vc.el (vc-print-branch-log): Use vc-filter-command-function
in place of vc-pre-command-functions and vc-want-edit-command-p.
* lisp/progmodes/hideshow.el
(hs-find-block-beginning-match): New function to be used in
`hs-already-hidden-p'.
(hs-already-hidden-p): Add check if beginning of line is inside a
block.
(hs-toggle-hiding): Don't change to selected-window's buffer when
event arg is absent.
* test/lisp/progmodes/hideshow-tests.el
(hideshow-tests-with-temp-buffer-selected): New helper macro.
(hideshow-tests-make-event-at): New helper function.
(hideshow-already-hidden-p-1): New test.
(hideshow-toggle-hiding-1): New test.
(hideshow-mouse-toggle-hiding-1): New test (bug#52092).
* lisp/emacs-lisp/nadvice.el:
* lisp/emacs-lisp/cl-generic.el: Don't push to
package--builtin-versions "manually", because loaddefs-gen does
this correctly now.
* lisp/vc/vc-svn.el (vc-exec-after):
* lisp/vc/vc-hg.el (vc-exec-after):
* lisp/vc/vc-git.el (vc-exec-after):
* lisp/vc/vc-cvs.el (vc-exec-after):
* lisp/vc/vc-bzr.el (vc-exec-after):
* lisp/org/org-macro.el (vc-exec-after):
* lisp/obsolete/vc-mtn.el (vc-exec-after):
* lisp/obsolete/vc-arch.el (vc-exec-after): Update declaration.
* lisp/vc/vc-dispatcher.el (vc--process-sentinel): Allow running
code only on success.
(vc-exec-after): Ditto.
(vc--inhibit-change-window-start): New variable.
(vc-do-async-command): Use it to allow chaining commands without
moving window point. Return the process instead of the buffer,
since the process may have exited already, and then we can't get
at the process.
* lisp/vc/vc-git.el (vc-git--pushpull): Return the process object.
(vc-git-pull-and-push): New function.
* lisp/vc/vc.el (vc-pull-and-push): New command (bug#51964).
Alan Mackenzie [Sat, 24 Sep 2022 12:23:32 +0000 (12:23 +0000)]
CC Mode. Make AWK Mode work with electric-pair-mode
Also fix some minor anomalies with other CC Mode modes in electric-pair-mode.
This fixes bug #53446.
* lisp/progmodes/cc-mode.el (c-open-string-opener): New buffer local
variable.
(c-after-change-mark-abnormal-strings): Set c-open-string-opener when an
unbalanced string is detected.
(c-before-change): Initilize c-open-string-opener to nil, each buffer change.
(c-electric-pair-inhibit-predicate): Use the value of c-open-string-opener to
flag an unbalaced string rather than trying to calculate it again.
* lisp/progmodes/cc-awk.el (c-awk-syntax-tablify-string): Set
c-open-string-opener when an unbalanced string is detected.
docview: Use svg images when using mupdf for conversion
* lisp/doc-view.el (doc-view-mupdf-use-svg, doc-view-svg-background)
(doc-view-svg-foreground): New user options.
(doc-view-insert-image): Add :background and :foreground image
attributes when display svg images.
(doc-view-set-up-single-converter): Produce svg images when using
mupdf (bug#58041).
Stefan Kangas [Sat, 24 Sep 2022 11:36:39 +0000 (13:36 +0200)]
image-dired: Fix C-a/C-e in thumbnail buffer
* lisp/image/image-dired.el
(image-dired--movement-ensure-point-pos): New function, and...
(image-dired--movement-command): ...new macros broken out from...
(image-dired-next-line, image-dired-previous-line)
(image-dired-beginning-of-buffer, image-dired-end-of-buffer):
...here.
(image-dired-move-beginning-of-line)
(image-dired-move-end-of-line): New commands.
(image-dired-thumbnail-mode-map): Remap 'move-beginning-of-line'
and 'move-beginning-of-line' to above new commands.
Stefan Kangas [Sat, 24 Sep 2022 11:08:11 +0000 (13:08 +0200)]
image-dired: Regenerate old thumbnails when needed
* lisp/image/image-dired.el
(image-dired--get-create-thumbnail-file): Rename from
'image-dired-get-thumbnail-image'. Update callers and make old
name into an obsolete alias.
(image-dired-display-thumbs): Use above function to simplify and
regenerate the thumbnail if it's outdated.
Stefan Kangas [Sat, 24 Sep 2022 10:44:11 +0000 (12:44 +0200)]
image-dired: Improve performance of marking commands
* lisp/image/image-dired.el (image-dired-thumbnail-storage): Mark
(image-dired--thumb-update-mark-at-point): New function.
(image-dired--thumb-update-marks):
(image-dired--do-mark-command): Use it.
(image-dired--thumb-update-marks): Rename from
'image-dired-thumb-update-marks'. Update all callers and make the
old name into an obsolete alias.
Stefan Kangas [Sat, 24 Sep 2022 09:49:46 +0000 (11:49 +0200)]
Add new macro image-dired--with-dired-buffer
* lisp/image/image-dired-util.el
(image-dired--with-dired-buffer): New macro.
* lisp/image/image-dired.el (image-dired-track-original-file)
(image-dired--on-file-in-dired-buffer)
(image-dired--do-mark-command)
(image-dired--on-file-in-dired-buffer)
(image-dired-jump-original-dired-buffer)
(image-dired-thumb-file-marked-p, image-dired-delete-marked):
Use above new macro to simplify and improve error handling.
(image-dired-show-all-from-dir): Simplify removing Dired marks.
(image-dired-thumb-update-marks): Avoid triggering above new error
handling.
Stefan Kangas [Sat, 24 Sep 2022 09:06:51 +0000 (11:06 +0200)]
Improve image-dired-thumbnail-display-external
* lisp/image/image-dired.el: (image-dired-external-viewer): Add more
image viewers and slightly re-arrange.
(image-dired-thumbnail-display-external): Correctly handle
external viewers with spaces or flags.
Po Lu [Sat, 24 Sep 2022 08:27:42 +0000 (16:27 +0800)]
Reduce complexity of scroll bar window protection code
It turns out my previous theories of why ClientMessages were
generated were wrong, and they are just generated so we can set
finish to X_EVENT_GOTO_OUT to have them delivered immediately.
This allows for the code to be simplified greatly, by not
unpacking pointers to the raw window into the client messages.
* src/xterm.c (x_unprotect_window_for_callback): Return the
window removed from the queue, or nil if none.
(x_scroll_bar_to_input_event)
(x_horizontal_scroll_bar_to_input_event): Use window provided by
x_unprotect_window_for_callback.
(handle_one_xevent): Pass dpyinfo to functions that need it.
(x_free_frame_resources): Remove "first scroll bar request"
code.
Augusto Stoffel [Sat, 17 Sep 2022 16:30:04 +0000 (18:30 +0200)]
New Flymake backend using the shellcheck program
See bug#57884.
* lisp/progmodes/sh-script.el: Require let-alist and subr-x when
compiling.
(sh--json-read): Helper function to deal with possible absence of
json-parse-buffer.
(sh-shellcheck-program, sh--shellcheck-process,
sh-shellcheck-flymake): Variables and function defining a Flymake
backend.
(sh-mode): Add it to 'flymake-diagnostic-functions'.
Sean Whitton [Fri, 23 Sep 2022 17:43:31 +0000 (10:43 -0700)]
vc-git--pushpull: Restore handling of vc-git-program
* lisp/vc/vc-git.el (vc-git--pushpull): Restore handling of
vc-git-program before recent change: respect a buffer-local value of
vc-git-program, and don't ignore user edits to the git program name
when PROMPT.
Stefan Kangas [Fri, 23 Sep 2022 21:12:10 +0000 (23:12 +0200)]
image-dired: Rewrite and extend slideshow feature
* lisp/image/image-dired.el
(image-dired--slideshow-start-timer)
(image-dired--slideshow-stop-timer)
(image-dired--slideshow-show-message): New functions.
(image-dired--slideshow-current-delay): New variable.
(image-dired--slideshow-initial): Delete variable.
(image-dired-slideshow-start): Simplify and ensure we display the
image at start.
* lisp/image/image-dired.el (image-dired--slideshow-stop): Add support
for pausing, and going backwards and forwards during slideshow.
Stefan Kangas [Fri, 23 Sep 2022 18:18:17 +0000 (20:18 +0200)]
image-dired: Mark two slideshow defuns as internal
* lisp/image/image-dired.el (image-dired--slideshow-step)
(image-dired--slideshow-stop): Rename from
'image-dired--slideshow-step' and 'image-dired--slideshow-stop'.
Update callers and make old names into obsolete aliases.