diff options
| author | Juri Linkov | 2024-05-28 19:51:21 +0300 |
|---|---|---|
| committer | Juri Linkov | 2024-05-28 19:51:21 +0300 |
| commit | 730b61c64b5d86cc3b38ee15d4530fdd2194619b (patch) | |
| tree | 1310ea3f891ea2178e11a06659fc04585b9efb5a | |
| parent | ebac4d4872829c44f65966b3268ceaf7ecbf43d9 (diff) | |
| download | emacs-730b61c64b5d86cc3b38ee15d4530fdd2194619b.tar.gz emacs-730b61c64b5d86cc3b38ee15d4530fdd2194619b.zip | |
* lisp/image-mode.el (image-transform-fill-window): New command (bug#69565).
(image-mode-menu): Add image-transform-fill-window to the menu.
| -rw-r--r-- | lisp/image-mode.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/image-mode.el b/lisp/image-mode.el index fa64f1ac03e..7cf7845e935 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el | |||
| @@ -559,6 +559,8 @@ image as text, when opening such images in `image-mode'." | |||
| 559 | :help "Resize image to match the window height and width"] | 559 | :help "Resize image to match the window height and width"] |
| 560 | ["Fit Image to Window (Scale down only)" image-transform-fit-both | 560 | ["Fit Image to Window (Scale down only)" image-transform-fit-both |
| 561 | :help "Scale image down to match the window height and width"] | 561 | :help "Scale image down to match the window height and width"] |
| 562 | ["Fill Window with Image" image-transform-fill-window | ||
| 563 | :help "Resize image to fill either width or height of the window"] | ||
| 562 | ["Zoom In" image-increase-size | 564 | ["Zoom In" image-increase-size |
| 563 | :help "Enlarge the image"] | 565 | :help "Enlarge the image"] |
| 564 | ["Zoom Out" image-decrease-size | 566 | ["Zoom Out" image-decrease-size |
| @@ -1592,6 +1594,18 @@ The percentage is in relation to the original size of the image." | |||
| 1592 | (setq image-transform-resize 'fit-window) | 1594 | (setq image-transform-resize 'fit-window) |
| 1593 | (image-toggle-display-image)) | 1595 | (image-toggle-display-image)) |
| 1594 | 1596 | ||
| 1597 | (defun image-transform-fill-window () | ||
| 1598 | "Fill the window with the image while keeping image proportions. | ||
| 1599 | This means filling the window with the image as much as possible | ||
| 1600 | without leaving empty space around image edges. Then you can use | ||
| 1601 | either horizontal or vertical scrolling to see the remaining parts | ||
| 1602 | of the image." | ||
| 1603 | (interactive nil image-mode) | ||
| 1604 | (let ((size (image-display-size (image-get-display-property) t))) | ||
| 1605 | (setq image-transform-resize | ||
| 1606 | (if (> (car size) (cdr size)) 'fit-height 'fit-width))) | ||
| 1607 | (image-toggle-display-image)) | ||
| 1608 | |||
| 1595 | (defun image-transform-set-rotation (rotation) | 1609 | (defun image-transform-set-rotation (rotation) |
| 1596 | "Prompt for an angle ROTATION, and rotate the image by that amount. | 1610 | "Prompt for an angle ROTATION, and rotate the image by that amount. |
| 1597 | ROTATION should be in degrees." | 1611 | ROTATION should be in degrees." |