emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r111416: * lisp/doc-view.el (doc-view


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111416: * lisp/doc-view.el (doc-view-scale-internally): New var.
Date: Thu, 03 Jan 2013 21:45:59 -0500
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111416
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Thu 2013-01-03 21:45:59 -0500
message:
  * lisp/doc-view.el (doc-view-scale-internally): New var.
  (doc-view-enlarge, doc-view-insert-image): Obey it.
modified:
  lisp/ChangeLog
  lisp/doc-view.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-01-03 23:56:51 +0000
+++ b/lisp/ChangeLog    2013-01-04 02:45:59 +0000
@@ -1,3 +1,8 @@
+2013-01-04  Stefan Monnier  <address@hidden>
+
+       * doc-view.el (doc-view-scale-internally): New var.
+       (doc-view-enlarge, doc-view-insert-image): Obey it.
+
 2013-01-03  Daiki Ueno  <address@hidden>
 
        * epg.el (epg--start): Ignore errors when /dev/fd/0 does not

=== modified file 'lisp/doc-view.el'
--- a/lisp/doc-view.el  2013-01-01 09:11:05 +0000
+++ b/lisp/doc-view.el  2013-01-04 02:45:59 +0000
@@ -173,9 +173,17 @@
   :type 'number
   :group 'doc-view)
 
+(defcustom doc-view-scale-internally t
+  "Whether we should try to rescale images ourselves.
+If nil, the document is re-rendered every time the scaling factor is modified.
+This only has an effect if the image libraries linked with Emacs support
+scaling."
+  :type 'boolean)
+
 (defcustom doc-view-image-width 850
   "Default image width.
-Has only an effect if imagemagick support is compiled into emacs."
+Has only an effect if `doc-view-scale-internally' is non-nil and support for
+scaling is compiled into emacs."
   :version "24.1"
   :type 'number
   :group 'doc-view)
@@ -669,8 +677,9 @@
 (defun doc-view-enlarge (factor)
   "Enlarge the document by FACTOR."
   (interactive (list doc-view-shrink-factor))
-  (if (eq (plist-get (cdr (doc-view-current-image)) :type)
-         'imagemagick)
+  (if (and doc-view-scale-internally
+           (eq (plist-get (cdr (doc-view-current-image)) :type)
+               'imagemagick))
       ;; ImageMagick supports on-the-fly-rescaling.
       (let ((new (ceiling (* factor doc-view-image-width))))
         (unless (equal new doc-view-image-width)
@@ -1133,10 +1142,11 @@
     (setq doc-view-pending-cache-flush nil))
   (let ((ol (doc-view-current-overlay))
         (image (if (and file (file-readable-p file))
-                  (if (not (fboundp 'imagemagick-types))
+                  (if (not (and doc-view-scale-internally
+                                 (fboundp 'imagemagick-types)))
                       (apply 'create-image file 'png nil args)
                     (unless (member :width args)
-                      (setq args (append args (list :width 
doc-view-image-width))))
+                      (setq args `(,@args :width ,doc-view-image-width)))
                     (apply 'create-image file 'imagemagick nil args))))
         (slice (doc-view-current-slice)))
     (setf (doc-view-current-image) image)


reply via email to

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