1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-03 08:30:09 +00:00
Commit Graph

205 Commits

Author SHA1 Message Date
Stefan Kangas
696c528379 Fix loading wallpaper.el on MS-Windows
* lisp/image/wallpaper.el (wallpaper--find-command)
(wallpaper--find-command-args): Avoid backtrace when
'wallpaper--find-setter' returns nil, e.g. on MS-Windows.
(Bug#58167)
2022-09-29 18:44:03 +02:00
Peter Münster
21fc2b04e9 New command image-dired-do-flagged-delete
* lisp/image/image-dired.el (image-dired-delete-marked): Remove command,
because it was too buggy.
(image-dired-do-flagged-delete): New command that does almost the same
as the above removed command but with flagged images.
(image-dired-thumbnail-mode-map): Bind "x" to
'image-dired-do-flagged-delete'.
2022-09-29 16:32:49 +02:00
Peter Münster
1457c231b5 image-dired-delete-char: Don't disturb formatting
* lisp/image/image-dired.el (image-dired-delete-char): Don't disturb
the expected formatting of the thumbnail buffer (always one
space/newline after a thumbnail).
2022-09-29 16:31:03 +02:00
Stefan Kangas
2c331dbb4e wallpaper-set: Get monitor name on non-graphical display
* lisp/image/wallpaper.el
(wallpaper--format-arg): Break out function from here...
(wallpaper--x-monitor-name): ...to here.  Try to get the monitor name
non-graphical displays, and prompt if that doesn't work.
(wallpaper-default-set-function): Improve debugging output.
Ref. https://lists.gnu.org/r/emacs-devel/2022-09/msg01910.html
2022-09-29 16:10:27 +02:00
Stefan Kangas
b71241742c Prompt for wallpaper width/height only when needed
* lisp/image/wallpaper.el (wallpaper--format-arg): Don't prompt for
width and height unless the values are actually used.
2022-09-29 15:39:58 +02:00
Stefan Kangas
26ef0f1221 ; image-dired: Fix last change
* test/lisp/image/image-dired-util-tests.el
(image-dired-thumb-name/per-directory):
* lisp/image/image-dired-util.el (image-dired-thumb-name): Fix
last change.
2022-09-28 14:29:11 +02:00
Stefan Kangas
ca043773db ; Fix debugging image-dired-dired-toggle-marked-thumbs
* lisp/image/image-dired-dired.el
(image-dired-dired-toggle-marked-thumbs): Fix debugging.
2022-09-28 12:36:42 +02:00
Stefan Kangas
6cffaa3b6d image-dired: End thumbnail file names with ".jpg"
* lisp/image/image-dired-util.el (image-dired-thumb-name): Always
end thumbnail name in ".jpg" and simplify naming to just use the
SHA-1 hash.  (Bug#57961)
* test/lisp/image/image-dired-util-tests.el
(image-dired-thumb-name/image-dired): Adjust test for the above
change.
* etc/NEWS: Announce the above change.
2022-09-28 12:36:42 +02:00
Stefan Kangas
adaa2fc90e ; * lisp/image/image-dired.el: Fix typo. 2022-09-27 23:28:28 +02:00
Stefan Kangas
9e0c21ea73 Make image-dired-dired-toggle-marked-thumbs faster
* lisp/image/image-dired-dired.el
(image-dired-dired-toggle-marked-thumbs): Don't show progress, since
it makes things slower.
2022-09-27 23:26:07 +02:00
Stefan Kangas
42290bf823 image-dired: Fix header line when file is missing
* lisp/image/image-dired.el
(image-dired-format-properties-string): Don't error when file has
been deleted.
2022-09-27 22:59:42 +02:00
Stefan Kangas
49d40cd953 ; Simplify wallpaper--format-arg with let-alist
* lisp/image/wallpaper.el (wallpaper--format-arg): Use let-alist.
2022-09-27 16:12:40 +02:00
Stefan Kangas
1e4f40db3a ; * lisp/image/wallpaper.el (wallpaper--format-arg): Fix typo. 2022-09-27 15:33:09 +02:00
Stefan Kangas
a27e483213 Fix OBOE in image-dired--with-marked
* lisp/image/image-dired.el (image-dired--with-marked): Fix off-by-one
error.
2022-09-27 02:14:54 +02:00
Stefan Kangas
93b9cf4184 Get rid of default wallpaper-setter constructor
* lisp/image/wallpaper.el (wallpaper-setter): Actually get rid of
the default constructor.
2022-09-26 21:32:55 +02:00
Stefan Kangas
bb9df76dc9 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.
2022-09-26 21:26:50 +02:00
Eli Zaretskii
6d0fec5ae0 ; * lisp/image/wallpaper.el (cl-macs): Require, to avoid warnings. 2022-09-26 19:29:47 +03:00
Stefan Kangas
2ec061bf9c Display a message when wallpaper was set
* lisp/image/wallpaper.el (wallpaper-default-set-function): Display a
message when the wallpaper was successfully set.
2022-09-26 17:41:39 +02:00
Stefan Kangas
b0289e7f6d 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.
2022-09-26 17:41:37 +02:00
Stefan Kangas
35d5ad713e 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.
2022-09-26 17:41:09 +02:00
Stefan Kangas
9b73c9edda Autoload image-dired-thumbnail-storage :safe property
* lisp/image/image-dired.el (image-dired-thumbnail-storage):
Autoload :safe property.
2022-09-26 15:36:22 +02:00
Stefan Kangas
e0565e3896 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.
2022-09-25 17:28:04 +02:00
Stefan Kangas
ad88e3e0b5 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.
2022-09-25 16:16:51 +02:00
Stefan Kangas
3502fd9831 wallpaper: URI-encode gsettings argument
* lisp/image/wallpaper.el (wallpaper--default-commands)
(wallpaper-command-args, wallpaper-set): URI-encode gsettings
argument.
2022-09-25 15:05:43 +02:00
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