diff options
| author | Vedang Manerikar <ved.manerikar@gmail.com> | 2021-12-31 12:17:42 +0530 |
|---|---|---|
| committer | Vedang Manerikar <ved.manerikar@gmail.com> | 2021-12-31 12:17:42 +0530 |
| commit | b0f01a9031cca6d3425ebd43f4e3fc4f5aa266c5 (patch) | |
| tree | a5fbd6e95cb6c7fa104bd7c3c4240466cc80152e | |
| parent | 5b1c367f366c7daa22f1a8f82e51b760c279c1ec (diff) | |
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
| -rw-r--r-- | lisp/pdf-view.el | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lisp/pdf-view.el b/lisp/pdf-view.el index 6b50fbd..87a03a9 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))))) ;; * ================================================================== * |
