diff options
| author | Tassilo Horn | 2013-09-27 08:46:49 +0200 |
|---|---|---|
| committer | Tassilo Horn | 2013-09-27 08:46:49 +0200 |
| commit | 529fb53f7ef1f8f6dbc97b8c41efbc542a9bef3b (patch) | |
| tree | 00b9338859420d76b036a524af66d727ba256600 | |
| parent | 0550c95a51cc2861c33980b87c21edbb3415a58c (diff) | |
| download | emacs-529fb53f7ef1f8f6dbc97b8c41efbc542a9bef3b.tar.gz emacs-529fb53f7ef1f8f6dbc97b8c41efbc542a9bef3b.zip | |
* doc-view.el (doc-view-scale-reset): Rename from
`doc-view-reset-zoom-level'.
(doc-view-scale-adjust): New command.
(doc-view-mode-map): Remap `text-scale-adjust' bindings to
`doc-view-scale-adjust'.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/doc-view.el | 25 |
2 files changed, 29 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 512fff9988e..21bcfc0d9fb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2013-09-27 Tassilo Horn <tsdh@gnu.org> | ||
| 2 | |||
| 3 | * doc-view.el (doc-view-scale-reset): Rename from | ||
| 4 | `doc-view-reset-zoom-level'. | ||
| 5 | (doc-view-scale-adjust): New command. | ||
| 6 | (doc-view-mode-map): Remap `text-scale-adjust' bindings to | ||
| 7 | `doc-view-scale-adjust'. | ||
| 8 | |||
| 1 | 2013-09-26 Tassilo Horn <tsdh@gnu.org> | 9 | 2013-09-26 Tassilo Horn <tsdh@gnu.org> |
| 2 | 10 | ||
| 3 | * doc-view.el (doc-view-reset-zoom-level): New command. | 11 | * doc-view.el (doc-view-reset-zoom-level): New command. |
diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 9f3ac3293bc..e59aecc8773 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el | |||
| @@ -407,9 +407,8 @@ Typically \"page-%s.png\".") | |||
| 407 | (define-key map "+" 'doc-view-enlarge) | 407 | (define-key map "+" 'doc-view-enlarge) |
| 408 | (define-key map "=" 'doc-view-enlarge) | 408 | (define-key map "=" 'doc-view-enlarge) |
| 409 | (define-key map "-" 'doc-view-shrink) | 409 | (define-key map "-" 'doc-view-shrink) |
| 410 | (define-key map [remap text-scale-adjust] 'doc-view-enlarge) | 410 | (define-key map "0" 'doc-view-scale-reset) |
| 411 | (define-key map (kbd "C-x C--") 'doc-view-shrink) | 411 | (define-key map [remap text-scale-adjust] 'doc-view-scale-adjust) |
| 412 | (define-key map (kbd "C-x C-0") 'doc-view-reset-zoom-level) | ||
| 413 | ;; Fit the image to the window | 412 | ;; Fit the image to the window |
| 414 | (define-key map "W" 'doc-view-fit-width-to-window) | 413 | (define-key map "W" 'doc-view-fit-width-to-window) |
| 415 | (define-key map "H" 'doc-view-fit-height-to-window) | 414 | (define-key map "H" 'doc-view-fit-height-to-window) |
| @@ -757,7 +756,7 @@ OpenDocument format)." | |||
| 757 | (interactive (list doc-view-shrink-factor)) | 756 | (interactive (list doc-view-shrink-factor)) |
| 758 | (doc-view-enlarge (/ 1.0 factor))) | 757 | (doc-view-enlarge (/ 1.0 factor))) |
| 759 | 758 | ||
| 760 | (defun doc-view-reset-zoom-level () | 759 | (defun doc-view-scale-reset () |
| 761 | "Reset the document size/zoom level to the initial one." | 760 | "Reset the document size/zoom level to the initial one." |
| 762 | (interactive) | 761 | (interactive) |
| 763 | (if (and doc-view-scale-internally | 762 | (if (and doc-view-scale-internally |
| @@ -771,6 +770,24 @@ OpenDocument format)." | |||
| 771 | (kill-local-variable 'doc-view-resolution) | 770 | (kill-local-variable 'doc-view-resolution) |
| 772 | (doc-view-reconvert-doc))) | 771 | (doc-view-reconvert-doc))) |
| 773 | 772 | ||
| 773 | (defun doc-view-scale-adjust (factor) | ||
| 774 | "Adjust the scale of the DocView page images by FACTOR. | ||
| 775 | FACTOR defaults to `doc-view-shrink-factor'. | ||
| 776 | |||
| 777 | The actual adjustment made depends on the final component of the | ||
| 778 | key-binding used to invoke the command, with all modifiers removed: | ||
| 779 | |||
| 780 | +, = Increase the image scale by FACTOR | ||
| 781 | - Decrease the image scale by FACTOR | ||
| 782 | 0 Reset the image scale to the initial scale" | ||
| 783 | (interactive (list doc-view-shrink-factor)) | ||
| 784 | (let ((ev last-command-event) | ||
| 785 | (echo-keystrokes nil)) | ||
| 786 | (pcase (event-basic-type ev) | ||
| 787 | ((or ?+ ?=) (doc-view-enlarge factor)) | ||
| 788 | (?- (doc-view-shrink factor)) | ||
| 789 | (?0 (doc-view-scale-reset))))) | ||
| 790 | |||
| 774 | (defun doc-view-fit-width-to-window () | 791 | (defun doc-view-fit-width-to-window () |
| 775 | "Fit the image width to the window width." | 792 | "Fit the image width to the window width." |
| 776 | (interactive) | 793 | (interactive) |