diff options
author | Eli Zaretskii <eliz@gnu.org> | 2023-04-08 12:43:34 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2023-04-08 12:43:34 +0300 |
commit | 6a2863ca0167a1b4a431dfae3640c97a846d4826 (patch) | |
tree | 531e857f36640640381ab17b56994e6fac86895e /lisp/image.el | |
parent | 5be79fd05a51a42d591833019775cb743aa5055f (diff) | |
download | emacs-6a2863ca0167a1b4a431dfae3640c97a846d4826.tar.gz emacs-6a2863ca0167a1b4a431dfae3640c97a846d4826.tar.bz2 emacs-6a2863ca0167a1b4a431dfae3640c97a846d4826.zip |
Fix handling of sliced images
* lisp/image.el (image-slice-map): New keymap, without some
bindings that make no sense with sliced images.
(insert-image, insert-sliced-image): Use it.
(insert-sliced-image): Make the 'keymap' property rear-nonsticky,
to prevent calling image commands when point is to the right of
the slice. (Bug#62679)
* lisp/image/image-crop.el (image-cut, image-crop): Doc fixes.
(image-crop): Don't try using stock MS-Widows convert.exe
program. Use 'image--get-image' to support sliced images.
Diffstat (limited to 'lisp/image.el')
-rw-r--r-- | lisp/image.el | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/lisp/image.el b/lisp/image.el index 3f878bd4de0..818679a4d7b 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -188,6 +188,19 @@ or \"ffmpeg\") is installed." "C-<wheel-up>" #'image-mouse-increase-size "C-<mouse-4>" #'image-mouse-increase-size) +(defvar-keymap image-slice-map + :doc "Map put into text properties on sliced images." + "i" (define-keymap + "-" #'image-decrease-size + "+" #'image-increase-size + "o" #'image-save + "c" #'image-crop + "x" #'image-cut) + "C-<wheel-down>" #'image-mouse-decrease-size + "C-<mouse-5>" #'image-mouse-decrease-size + "C-<wheel-up>" #'image-mouse-increase-size + "C-<mouse-4>" #'image-mouse-increase-size) + (defun image-load-path-for-library (library image &optional path no-error) "Return a suitable search path for images used by LIBRARY. @@ -665,7 +678,9 @@ is non-nil, this is inhibited." image) rear-nonsticky t inhibit-isearch ,inhibit-isearch - keymap ,image-map)))) + keymap ,(if slice + image-slice-map + image-map))))) ;;;###autoload @@ -701,8 +716,8 @@ The image is automatically split into ROWS x COLS slices." (insert string) (add-text-properties start (point) `(display ,(list (list 'slice x y dx dy) image) - rear-nonsticky (display) - keymap ,image-map)) + rear-nonsticky (display keymap) + keymap ,image-slice-map)) (setq x (+ x dx)))) (setq x 0.0 y (+ y dy)) |