emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114463: * doc-view.el (doc-view-reset-zoom-level):


From: Tassilo Horn
Subject: [Emacs-diffs] trunk r114463: * doc-view.el (doc-view-reset-zoom-level): New command.
Date: Thu, 26 Sep 2013 19:06:07 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114463
revision-id: address@hidden
parent: address@hidden
committer: Tassilo Horn <address@hidden>
branch nick: trunk
timestamp: Thu 2013-09-26 21:05:50 +0200
message:
  * doc-view.el (doc-view-reset-zoom-level): New command.
  (doc-view-mode-map): Remap text-scale-adjust bindings to doc-view
  zoom commands (bug#15466).
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/doc-view.el               docview.el-20091113204419-o5vbwnq5f7feedwu-6334
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-09-26 13:46:50 +0000
+++ b/lisp/ChangeLog    2013-09-26 19:05:50 +0000
@@ -1,3 +1,9 @@
+2013-09-26  Tassilo Horn  <address@hidden>
+
+       * doc-view.el (doc-view-reset-zoom-level): New command.
+       (doc-view-mode-map): Remap text-scale-adjust bindings to doc-view
+       zoom commands (bug#15466).
+
 2013-09-26  Kenichi Handa  <address@hidden>
 
        * international/quail.el (quail-help): Make it not a command.

=== modified file 'lisp/doc-view.el'
--- a/lisp/doc-view.el  2013-09-18 04:38:49 +0000
+++ b/lisp/doc-view.el  2013-09-26 19:05:50 +0000
@@ -405,7 +405,11 @@
     (define-key map (kbd "RET")       'image-next-line)
     ;; Zoom in/out.
     (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)
     ;; 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)
@@ -753,6 +757,20 @@
   (interactive (list doc-view-shrink-factor))
   (doc-view-enlarge (/ 1.0 factor)))
 
+(defun doc-view-reset-zoom-level ()
+  "Reset the document size/zoom level to the initial one."
+  (interactive)
+  (if (and doc-view-scale-internally
+           (eq (plist-get (cdr (doc-view-current-image)) :type)
+               'imagemagick))
+      (progn
+       (kill-local-variable 'doc-view-image-width)
+       (doc-view-insert-image
+        (plist-get (cdr (doc-view-current-image)) :file)
+        :width doc-view-image-width))
+    (kill-local-variable 'doc-view-resolution)
+    (doc-view-reconvert-doc)))
+
 (defun doc-view-fit-width-to-window ()
   "Fit the image width to the window width."
   (interactive)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]