Commit graph

281 commits

Author SHA1 Message Date
Stefan Kangas
a256f49f08 Make image-dired-thumb-name more portable
* lisp/image/image-dired-util.el
(image-dired-thumb-name): Create file names in a portable manner.
* test/lisp/image/image-dired-util-tests.el
(image-dired-thumb-name/standard)
(image-dired-thumb-name/image-dired)
(image-dired-thumb-name/per-directory): Expand tests.
2022-09-25 14:27:51 +02:00
Stefan Kangas
97d7f8c737 Add new command image-dired-copy-filename-as-kill
* lisp/image/image-dired.el
(image-dired-copy-filename-as-kill): New command.
(image-dired-thumbnail-mode-map): Bind above new command to "w".
2022-09-25 12:50:12 +02:00
Stefan Kangas
5e26d5f527 ; Simplify image-dired-forward-image
* lisp/image/image-dired.el (image-dired-forward-image): Simplify.
2022-09-24 20:33:00 +02:00
Stefan Kangas
0e6c15bbaf 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.
2022-09-24 20:33:00 +02:00
Stefan Kangas
573f31db96 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.
2022-09-24 20:18:46 +02:00
Stefan Kangas
3a0a0d616e image-dired: Move menu definitions to keymaps
* lisp/image/image-dired.el (image-dired-thumbnail-mode-menu):
* lisp/image/image-dired-dired.el (image-dired-minor-mode-menu):
Delete variables and move menus to...
* lisp/image/image-dired.el (image-dired-thumbnail-mode-map):
* lisp/image/image-dired-dired.el(image-dired-minor-mode-map):
...here.
2022-09-24 18:27:35 +02:00
Stefan Kangas
5be35812ac image-dired: Prefer command remapping
* lisp/image/image-dired.el (image-dired-thumbnail-mode-map):
Prefer command remapping to binding keys directly.
2022-09-24 14:07:57 +02:00
Stefan Kangas
0bca1b4d03 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.
2022-09-24 14:07:57 +02:00
Stefan Kangas
95d4f5d691 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.
2022-09-24 14:07:57 +02:00
Stefan Kangas
16681ba91c 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.
2022-09-24 14:07:57 +02:00
Stefan Kangas
3d75bab0e5 image-dired: Mark 'per-directory' as :safe
* lisp/image/image-dired.el (image-dired-thumbnail-storage): Mark
'per-directory' value as :safe.
2022-09-24 14:07:57 +02:00
Stefan Kangas
61b877237b 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.
2022-09-24 14:07:57 +02:00
Stefan Kangas
7b1c0c3442 ; * lisp/image/image-dired.el: Improve sectioning. 2022-09-24 11:26:06 +02:00
Stefan Kangas
143f23e8c0 ; Make 'M-x image-dired' prompt even clearer
* lisp/image/image-dired.el (image-dired-show-all-from-dir):
Make prompt even clearer.
Suggested by Eli Zaretskii <eliz@gnu.org>.
2022-09-24 11:26:06 +02:00
Stefan Kangas
09711d396a 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.
2022-09-24 11:26:06 +02:00
Stefan Kangas
7bac1d0b60 image-dired: Use command substitution for tags bindings
* lisp/image/image-dired-tags.el
(image-dired-dired-edit-comment-and-tags): Use substitute-command-keys
2022-09-24 11:26:06 +02:00
Stefan Kangas
b74ee91122 image-dired: Various code clean ups
* lisp/image/image-dired.el
(image-dired--display-thumb-properties-fun): Delete function.
(image-dired-forward-image): Immediately update header line.  Improve
docstring.
(image-dired-backward-image, image-dired-next-line)
(image-dired-previous-line, image-dired-beginning-of-buffer)
(image-dired-end-of-buffer, image-dired-display-image): Improve
docstring.
(image-dired-comment-thumbnail): Fix interactive declaration.
2022-09-24 11:26:06 +02:00
Stefan Kangas
759d1145e2 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.
2022-09-23 23:14:14 +02:00
Stefan Kangas
e6f1ad6474 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.
2022-09-23 23:12:24 +02:00
Visuwesh
cf27fe0238 Make bounding box of 'image-crop' more noticeable
* lisp/image/image-crop.el (image-crop--crop-image-1): Darken the
selected region to make the bounding-box more noticable in images
which are mostly white (bug#58004).
2022-09-23 18:11:25 +02:00
Lars Ingebrigtsen
6fb4f4ad80 Inhibit image-crop when there's overlays
* lisp/image/image-crop.el (image-crop): Don't mess with overlays,
because they're a pain to reconstruct (bug#58027).
2022-09-23 17:38:19 +02:00
Lars Ingebrigtsen
f13300e84a Delete the correct region after cropping an image
* lisp/image/image-crop.el (image-crop): Delete the correct region
after editing (bug#58027).
2022-09-23 17:38:19 +02:00
Stefan Kangas
9f4ec56d83 image-dired: Disable 'image-map' in thumbnail buffer
These bindings are more likely to mess up the buffer than to be
helpful here; image manipulation is better done in the display buffer.

* lisp/image/image-dired.el (image-dired-insert-thumbnail): Disable
`image-map' in thumbnail buffer.
2022-09-23 17:22:47 +02:00
Stefan Kangas
c53f5a2176 ; Fix :type of image-dired-thumbnail-storage
* lisp/image/image-dired.el (image-dired-thumbnail-storage): Fix
:type for recent change.
2022-09-23 16:08:52 +02:00
Stefan Kangas
8557ecca53 ; Fix warnings in --without-x build
* lisp/image/image-crop.el (image-scaling-factor)
(image-property, image-size, imagep):
* test/src/image-tests.el (image-size, image-mask-p)
(image-metadata): Declare.
2022-09-23 15:19:00 +02:00
Stefan Kangas
b306bc5e6d Improve prompt of 'image-dired' command
* lisp/image/image-dired.el (image-dired-show-all-from-dir):
Improve prompt.
2022-09-23 15:18:59 +02:00
Stefan Kangas
651c8ab5c5 Rename 'image-dired-db-file' to 'image-dired-tags-db-file'
* lisp/image/image-dired.el (image-dired-tags-db-file): Rename
from 'image-dired-db-file'.  Update all uses and make old name
into an obsolete variable alias.
2022-09-23 15:18:59 +02:00
Stefan Kangas
8892abbaf9 Autoload wallpaper-set
* lisp/image/wallpaper.el (wallpaper-set): Autoload.
* lisp/image-mode.el (wallpaper):
* lisp/image/image-dired.el (wallpaper):
* lisp/thumbs.el (wallpaper): Don't require.
2022-09-23 11:53:07 +02:00
Stefan Kangas
8238d87e15 ; * lisp/image/wallpaper.el: Fix last commit. 2022-09-23 05:42:13 +02:00
Stefan Kangas
f25f4699d7 Support several new DEs in wallpaper.el
* lisp/image/wallpaper.el (wallpaper--default-commands)
(wallpaper--check-command, wallpaper-command): Add support for Unity,
Pantheon, Budgie, LXQt, and LXDE.  Also add support for Lubuntu,
Xubuntu, and Pop!_OS.
2022-09-23 03:27:34 +02:00
Stefan Kangas
4de526edb7 image-dired: Obsolete two unused functions
* lisp/image/image-dired-util.el (image-dired-display-window)
(image-dired-associated-dired-buffer-window): Make obsolete; they are
currently unused.
2022-09-23 03:27:34 +02:00
Stefan Kangas
e9f42b1cba image-dired: Improve minor mode docstring
* lisp/image/image-dired-dired.el (image-dired-minor-mode):
Improve docstring.
2022-09-22 14:30:13 +02:00
Stefan Kangas
b9c06cf94a image-dired: Remove redundant keybindings
* lisp/image/image-dired-dired.el (image-dired-minor-mode-map):
Don't redundantly bind keys that are already bound in dired.
2022-09-22 14:30:13 +02:00
Stefan Kangas
447ff572be Prefer command remapping in image-dired-minor-mode
* lisp/image/image-dired-dired.el (image-dired-minor-mode-map):
Prefer command remapping.
(image-dired-minor-mode): Improve docstring.
2022-09-21 18:02:51 +02:00
Stefan Kangas
cc9acda7d3 image-dired: Support the customize-mode command
* lisp/image/image-dired.el (image-dired-thumbnail-mode)
(image-dired-display-image-mode): Add custom group 'image-dired'.
2022-09-21 08:29:05 +02:00
Stefan Kangas
f735aa0f39 Prefer DE specific commands to set wallpaper
* lisp/image/wallpaper.el (wallpaper--default-commands): Rearrange
order to prioritize desktop environment specific commands before
general Wayland commands like "wbg" or even "swaybg".  (Bug#57781)
2022-09-19 11:39:03 +02:00
Lars Ingebrigtsen
62b1e3b1f3 Restore the point after aborting an image crop
* lisp/image/image-crop.el (image-crop): Restore point after
aborted cropping (bug#57874).
2022-09-18 13:10:02 +02:00
Stefan Kangas
59e887f913 image-dired: Don't require subr-x
* lisp/image/image-dired-dired.el (subr-x):
* lisp/image/image-dired.el (subr-x): Don't require, since string-join
is now autoloaded.
2022-09-18 12:22:52 +02:00
Stefan Kangas
2f7139a15c image-dired: Display image on double click
* lisp/image/image-dired.el (image-dired-thumbnail-mode-map):
Display image on 'double-mouse-1'.
2022-09-18 02:52:51 +02:00
Stefan Kangas
76e67cc85e ; image-dired: Fix last commit
* lisp/image/image-dired-external.el (image-dired-create-thumb-1): Fix
specification for format-spec.
* lisp/image/image-dired-external.el (image-dired-thumb-size):
Declare.
2022-09-18 02:48:47 +02:00
Stefan Kangas
24513b3786 image-dired: Remove spurious message on C-<mouse-1>
* lisp/image/image-dired.el (image-dired-thumbnail-mode-map): Fix
spurious message about C-<down-mouse-1> being undefined.
2022-09-18 02:11:30 +02:00
Stefan Kangas
e59058d574 ; * lisp/image/image-dired.el: Use two spaces after period. 2022-09-18 02:06:21 +02:00
Stefan Kangas
7d3af135b9 ; * lisp/image/image-dired.el: Fix typo in last commit. 2022-09-18 01:53:57 +02:00
Stefan Kangas
5cceb6d6ac Increase image-dired-thumb-size to 128
* lisp/image/image-dired.el (image-dired-thumb-size): Increase default
to 128.
2022-09-18 00:21:12 +02:00
Stefan Kangas
f5f296b080 image-dired: Change some custom types to natnum
* lisp/image/image-dired.el (image-dired-thumb-size)
(image-dired-thumb-relief, image-dired-thumb-margin)
(image-dired-thumbs-per-row, image-dired-thumb-width)
(image-dired-thumb-height): Change :type to natnum.
2022-09-18 00:20:29 +02:00
Stefan Kangas
9aef9e2cb6 Make `image-dired-thumb-(height|width)' obsolete
* lisp/image/image-dired.el (image-dired-thumb-width)
(image-dired-thumb-height): Make obsolete.
(image-dired-thumb-size): Clean up and improve docstring.
* lisp/image/image-dired-external.el (image-dired-thumb-size): Use
'image-dired-thumb-size' instead of above obsolete variables.
(image-dired-create-thumb-1): Support %s format specifier for size.
(image-dired-cmd-create-thumbnail-options): Document %s format
specifier.
(image-dired--thumb-size): Rename function from
'image-dired-thumb-size' and make old name into an obsolete alias.
Update all callers.
2022-09-18 00:18:22 +02:00
Stefan Kangas
44457b3977 Simplify image-dired-thumbnail-storage customization
* lisp/image/image-dired.el (image-dired-dir): Improve docstring.
(image-dired-thumbnail-storage): Change default to `image-dired',
maintain `use-image-dired-dir' for backwards compatibility.
* lisp/image/image-dired-util.el (image-dired-thumb-name): Handle
above new default value.
2022-09-18 00:18:22 +02:00
Stefan Kangas
704cdf5e6c * lisp/image/image-dired.el: Bump version for Emacs 29. 2022-09-17 20:43:20 +02:00
Stefan Kangas
fe7c015b20 Support XFCE in wallpaper.el
* lisp/image/wallpaper.el (wallpaper--default-commands)
(wallpaper-command): Support XFCE.  (Bug#57781)
Thanks to Thierry Volpiatto <thievol@posteo.net>.
2022-09-16 22:39:33 +02:00
Stefan Kangas
aaf39c3878 image-dired: Add support for PDF files (Bug#26432)
* lisp/image/image-dired.el
(image-dired--file-name-regexp): New function.
(image-dired-display-thumbnail-original-image): Clean up.
(image-dired-display-image): Support visiting PDF files.
* lisp/image/image-dired-dired.el
(image-dired-dired-toggle-marked-thumbs):
* lisp/image/image-dired.el (image-dired-get-thumbnail-image)
(image-dired-show-all-from-dir): Use above new function instead of
'image-file-name-regexp'.
2022-09-16 22:28:46 +02:00