From: Tassilo Horn Date: Fri, 27 Sep 2013 06:46:49 +0000 (+0200) Subject: * doc-view.el (doc-view-scale-reset): Rename from X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1445 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=529fb53f7ef1f8f6dbc97b8c41efbc542a9bef3b;p=emacs.git * 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'. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 512fff9988e..21bcfc0d9fb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2013-09-27 Tassilo Horn + + * 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'. + 2013-09-26 Tassilo Horn * 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\".") (define-key map "+" 'doc-view-enlarge) (define-key map "=" 'doc-view-enlarge) (define-key map "-" 'doc-view-shrink) - (define-key map [remap text-scale-adjust] 'doc-view-enlarge) - (define-key map (kbd "C-x C--") 'doc-view-shrink) - (define-key map (kbd "C-x C-0") 'doc-view-reset-zoom-level) + (define-key map "0" 'doc-view-scale-reset) + (define-key map [remap text-scale-adjust] 'doc-view-scale-adjust) ;; Fit the image to the window (define-key map "W" 'doc-view-fit-width-to-window) (define-key map "H" 'doc-view-fit-height-to-window) @@ -757,7 +756,7 @@ OpenDocument format)." (interactive (list doc-view-shrink-factor)) (doc-view-enlarge (/ 1.0 factor))) -(defun doc-view-reset-zoom-level () +(defun doc-view-scale-reset () "Reset the document size/zoom level to the initial one." (interactive) (if (and doc-view-scale-internally @@ -771,6 +770,24 @@ OpenDocument format)." (kill-local-variable 'doc-view-resolution) (doc-view-reconvert-doc))) +(defun doc-view-scale-adjust (factor) + "Adjust the scale of the DocView page images by FACTOR. +FACTOR defaults to `doc-view-shrink-factor'. + +The actual adjustment made depends on the final component of the +key-binding used to invoke the command, with all modifiers removed: + + +, = Increase the image scale by FACTOR + - Decrease the image scale by FACTOR + 0 Reset the image scale to the initial scale" + (interactive (list doc-view-shrink-factor)) + (let ((ev last-command-event) + (echo-keystrokes nil)) + (pcase (event-basic-type ev) + ((or ?+ ?=) (doc-view-enlarge factor)) + (?- (doc-view-shrink factor)) + (?0 (doc-view-scale-reset))))) + (defun doc-view-fit-width-to-window () "Fit the image width to the window width." (interactive)