]> git.eshelyaron.com Git - emacs.git/commitdiff
* doc-view.el (doc-view-scale-reset): Rename from
authorTassilo Horn <tsdh@gnu.org>
Fri, 27 Sep 2013 06:46:49 +0000 (08:46 +0200)
committerTassilo Horn <tsdh@gnu.org>
Fri, 27 Sep 2013 06:46:49 +0000 (08:46 +0200)
`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'.

lisp/ChangeLog
lisp/doc-view.el

index 512fff9988ee01735bbde666c62f39e3fb9d8558..21bcfc0d9fb03ae19e92443d53efd3e6810fe6f3 100644 (file)
@@ -1,3 +1,11 @@
+2013-09-27  Tassilo Horn  <tsdh@gnu.org>
+
+       * 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  <tsdh@gnu.org>
 
        * doc-view.el (doc-view-reset-zoom-level): New command.
index 9f3ac3293bcc2f1bef0c892aa6a68a039082eff1..e59aecc877386d37f2561d7b2d0b9a0efe902f33 100644 (file)
@@ -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)