diff options
| author | Wolfgang Jenkner | 2012-05-14 01:15:59 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2012-05-14 01:15:59 -0400 |
| commit | 7102e6d0a782c2bc4e74ced93daa27aa0d821bb8 (patch) | |
| tree | 8201e349826f0365bba2ccd59d1cd7f2331e5f18 | |
| parent | 16245de59c74b3219fc4822ae9e2ad10da3c16d2 (diff) | |
| download | emacs-7102e6d0a782c2bc4e74ced93daa27aa0d821bb8.tar.gz emacs-7102e6d0a782c2bc4e74ced93daa27aa0d821bb8.zip | |
* lisp/image-mode.el: Fix scaling.
(image-transform-resize): Doc fix.
(image-transform-properties): Default scale is 1 and height should
be an integer.
Fixes: debbugs:11399
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/image-mode.el | 41 |
2 files changed, 27 insertions, 21 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 03b9a3ba15b..d0811170b4e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2012-05-14 Wolfgang Jenkner <wjenkner@inode.at> | ||
| 2 | |||
| 3 | * image-mode.el: Fix scaling (bug#11399). | ||
| 4 | (image-transform-resize): Doc fix. | ||
| 5 | (image-transform-properties): Default scale is 1 and height should | ||
| 6 | be an integer. | ||
| 7 | |||
| 1 | 2012-05-13 Johan Bockgård <bojohan@gnu.org> | 8 | 2012-05-13 Johan Bockgård <bojohan@gnu.org> |
| 2 | 9 | ||
| 3 | * emacs-lisp/smie.el (smie-next-sexp): Use accessor `op-forw' rather | 10 | * emacs-lisp/smie.el (smie-next-sexp): Use accessor `op-forw' rather |
diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 900cd725b92..80321d6c94d 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el | |||
| @@ -608,23 +608,23 @@ Otherwise it plays once, then stops." | |||
| 608 | 608 | ||
| 609 | 609 | ||
| 610 | ;; Not yet implemented. | 610 | ;; Not yet implemented. |
| 611 | ;;; (defvar image-transform-minor-mode-map | 611 | ;; (defvar image-transform-minor-mode-map |
| 612 | ;;; (let ((map (make-sparse-keymap))) | 612 | ;; (let ((map (make-sparse-keymap))) |
| 613 | ;;; ;; (define-key map [(control ?+)] 'image-scale-in) | 613 | ;; ;; (define-key map [(control ?+)] 'image-scale-in) |
| 614 | ;;; ;; (define-key map [(control ?-)] 'image-scale-out) | 614 | ;; ;; (define-key map [(control ?-)] 'image-scale-out) |
| 615 | ;;; ;; (define-key map [(control ?=)] 'image-scale-none) | 615 | ;; ;; (define-key map [(control ?=)] 'image-scale-none) |
| 616 | ;;; ;; (define-key map "c f h" 'image-scale-fit-height) | 616 | ;; ;; (define-key map "c f h" 'image-scale-fit-height) |
| 617 | ;;; ;; (define-key map "c ]" 'image-rotate-right) | 617 | ;; ;; (define-key map "c ]" 'image-rotate-right) |
| 618 | ;;; map) | 618 | ;; map) |
| 619 | ;;; "Minor mode keymap `image-transform-mode'.") | 619 | ;; "Minor mode keymap `image-transform-mode'.") |
| 620 | ;;; | 620 | ;; |
| 621 | ;;; (define-minor-mode image-transform-mode | 621 | ;; (define-minor-mode image-transform-mode |
| 622 | ;;; "Minor mode for scaling and rotating images. | 622 | ;; "Minor mode for scaling and rotating images. |
| 623 | ;;; With a prefix argument ARG, enable the mode if ARG is positive, | 623 | ;; With a prefix argument ARG, enable the mode if ARG is positive, |
| 624 | ;;; and disable it otherwise. If called from Lisp, enable the mode | 624 | ;; and disable it otherwise. If called from Lisp, enable the mode |
| 625 | ;;; if ARG is omitted or nil. This minor mode requires Emacs to have | 625 | ;; if ARG is omitted or nil. This minor mode requires Emacs to have |
| 626 | ;;; been compiled with ImageMagick support." | 626 | ;; been compiled with ImageMagick support." |
| 627 | ;;; nil "image-transform" image-transform-minor-mode-map) | 627 | ;; nil "image-transform" image-transform-minor-mode-map) |
| 628 | 628 | ||
| 629 | 629 | ||
| 630 | ;; FIXME this doesn't seem mature yet. Document in manual when it is. | 630 | ;; FIXME this doesn't seem mature yet. Document in manual when it is. |
| @@ -634,7 +634,7 @@ Its value should be one of the following: | |||
| 634 | - nil, meaning no resizing. | 634 | - nil, meaning no resizing. |
| 635 | - `fit-height', meaning to fit the image to the window height. | 635 | - `fit-height', meaning to fit the image to the window height. |
| 636 | - `fit-width', meaning to fit the image to the window width. | 636 | - `fit-width', meaning to fit the image to the window width. |
| 637 | - A number, which is a scale factor (the default size is 100).") | 637 | - A number, which is a scale factor (the default size is 1).") |
| 638 | 638 | ||
| 639 | (defvar image-transform-rotation 0.0 | 639 | (defvar image-transform-rotation 0.0 |
| 640 | "Rotation angle for the image in the current Image mode buffer.") | 640 | "Rotation angle for the image in the current Image mode buffer.") |
| @@ -655,8 +655,8 @@ compiled with ImageMagick support." | |||
| 655 | (height | 655 | (height |
| 656 | (cond | 656 | (cond |
| 657 | ((numberp image-transform-resize) | 657 | ((numberp image-transform-resize) |
| 658 | (unless (= image-transform-resize 100) | 658 | (unless (= image-transform-resize 1) |
| 659 | (* image-transform-resize (cdr size)))) | 659 | (floor (* image-transform-resize (cdr size))))) |
| 660 | ((eq image-transform-resize 'fit-height) | 660 | ((eq image-transform-resize 'fit-height) |
| 661 | (- (nth 3 (window-inside-pixel-edges)) | 661 | (- (nth 3 (window-inside-pixel-edges)) |
| 662 | (nth 1 (window-inside-pixel-edges)))))) | 662 | (nth 1 (window-inside-pixel-edges)))))) |
| @@ -669,7 +669,6 @@ compiled with ImageMagick support." | |||
| 669 | ,@(if (not (equal 0.0 image-transform-rotation)) | 669 | ,@(if (not (equal 0.0 image-transform-rotation)) |
| 670 | (list :rotation image-transform-rotation)))))) | 670 | (list :rotation image-transform-rotation)))))) |
| 671 | 671 | ||
| 672 | ;; FIXME 2 works, but eg 1.9 or 0.5 don't? | ||
| 673 | (defun image-transform-set-scale (scale) | 672 | (defun image-transform-set-scale (scale) |
| 674 | "Prompt for a number, and resize the current image by that amount. | 673 | "Prompt for a number, and resize the current image by that amount. |
| 675 | This command has no effect unless Emacs is compiled with | 674 | This command has no effect unless Emacs is compiled with |