emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/pdf-tools b0f01a9031 1/3: Reset slice when auto-slice is t


From: ELPA Syncer
Subject: [nongnu] elpa/pdf-tools b0f01a9031 1/3: Reset slice when auto-slice is turned off
Date: Fri, 31 Dec 2021 03:58:40 -0500 (EST)

branch: elpa/pdf-tools
commit b0f01a9031cca6d3425ebd43f4e3fc4f5aa266c5
Author: Vedang Manerikar <ved.manerikar@gmail.com>
Commit: Vedang Manerikar <ved.manerikar@gmail.com>

    Reset slice when auto-slice is turned off
    
    When `pdf-view-auto-slice-minor-mode` is turned off, remove slicing
    and re-display the window.
    
    Fixes: #44
---
 lisp/pdf-view.el | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/lisp/pdf-view.el b/lisp/pdf-view.el
index 6b50fbd4d6..87a03a951c 100644
--- a/lisp/pdf-view.el
+++ b/lisp/pdf-view.el
@@ -786,9 +786,9 @@ displayed page number."
 ;; * ================================================================== *
 
 (defun pdf-view-set-slice (x y width height &optional window)
-  ;; TODO: add WINDOW to docstring.
-  "Set the slice of the pages that should be displayed.
+  "Set the slice of the pages that should be displayed in WINDOW.
 
+WINDOW defaults to `selected-window' if not provided.
 X, Y, WIDTH and HEIGHT should be relative coordinates, i.e. in
 \[0;1\].  To reset the slice use `pdf-view-reset-slice'."
   (unless (equal (pdf-view-current-slice window)
@@ -825,9 +825,10 @@ dragging it to its bottom-right corner.  See also
                   (/ 1.0 (float (cdr size))))))))
 
 (defun pdf-view-set-slice-from-bounding-box (&optional window)
-  ;; TODO: add WINDOW to docstring.
   "Set the slice from the page's bounding-box.
 
+WINDOW defaults to `selected-window' if not provided.
+
 The result is that the margins are almost completely cropped,
 much more accurate than could be done manually using
 `pdf-view-set-slice-using-mouse'.
@@ -848,8 +849,9 @@ See also `pdf-view-bounding-box-margin'."
            (append slice (and window (list window))))))
 
 (defun pdf-view-reset-slice (&optional window)
-  ;; TODO: add WINDOW to doctring.
-  "Reset the current slice.
+  "Reset the current slice and redisplay WINDOW.
+
+WINDOW defaults to `selected-window' if not provided.
 
 After calling this function the whole page will be visible
 again."
@@ -873,8 +875,9 @@ See also `pdf-view-set-slice-from-bounding-box'."
     (add-hook 'pdf-view-change-page-hook
               'pdf-view-set-slice-from-bounding-box nil t))
    (t
-    (remove-hook 'pdf-view-change-page-hook
-                 'pdf-view-set-slice-from-bounding-box t))))
+    (progn (remove-hook 'pdf-view-change-page-hook
+                        'pdf-view-set-slice-from-bounding-box t)
+           (pdf-view-reset-slice)))))
 
 
 ;; * ================================================================== *



reply via email to

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