summaryrefslogtreecommitdiff
path: root/lisp/pdf-info.el
AgeCommit message (Collapse)Author
2025-12-30fix(pdf-info): add declare-function for native-comp warningsVedang Manerikar
Add declare-function statements for pdf-util-frame-scale-factor, pdf-util-hexcolor, pdf-util-munch-file, pdf-util-highlight-regexp-in-string, and pdf-view-buffer-file-name to silence native compilation warnings. Ref #333
2025-12-29feat(midnight-mode): add gamma correction and fix RGB bugsZiv Scully
Add gamma correction options for better contrast control in midnight mode: - pdf-view-midnight-gamma: nonlinearly scale lightness (default 1.0) - pdf-view-midnight-gamma-before-invert: control gamma application order Bug fixes: - Fix RGB normalization (255 not 256) - was causing incorrect background color - Add missing black→foreground fast path (comment existed but code was missing) Closes: #329 Author: @vizziv
2023-01-17Change the default color inversion to maintain hueVedang Manerikar
This commit enables @smithzvk's work in #69 as the default in `pdf-tools`. It works well for all the PDFs I have tested with. The previous behaviour can be enabled by setting `pdf-view-midnight-invert` to `nil`, if required.
2023-01-17Add support for midnight mode with colorZach Kost-Smith
This inversion method attempts to maintain the color hue and saturation but inverts the lightness using the OKLab color space[^1]. [^1]: https://bottosson.github.io/posts/oklab/ * server/epdfinfo.c (image-recolor): Add feature to support the OKLab inversion method functionality * lisp/pdf-view.el (pdf-view-midnight-invert): Add new variable to invert the image color lightness while maintaining hue. (pdf-view-midnight-minor-mode): Account for above. * lisp/pdf-info.el (pdf-info-query--parse-response): Handle changes to :render/usecolors command Closes: #69 Closes: #169 Closes: politza/pdf-tools#698 Closes: politza/pdf-tools#608
2023-01-16Make selection style configurable by introducing a new variablelennonhill
Make selection-style configurable via `pdf-view-selection-style`. A default value of `word` might be desirable, as selection is usually intended to select entire words is perceptually faster than glyph-based selection. This affects selections and highlights, but not search. Limitation: The selection type is fixed for all currently selected regions. Selecting multiple regions with different selection styles at the same time would require storing the selection style for every region and replacing the protocol for `cmd_addannot` with a more flexible one, e.g. the keyword-based one used by `cmd_renderpage`. Closes: #73
2022-10-11Remove Emacs 24.4 guards for cua-modeVedang Manerikar
Relates to: #26
2022-07-20Fix `revert-buffer` for PDF files opened via TrampIllia Ostapyshyn
There are two issues with `revert-buffer` for remote files: - `revert-buffer` does not update the local temporary copy of the remote file (`pdf-view--buffer-file-name`). Since `revert-buffer--default` does in fact renew contents of the current buffer when visiting a remote file, the fix is the matter of flushing the buffer contents into the temporary file, exactly how it's done in `pdf-view-mode`: https://github.com/vedang/pdf-tools/blob/386dca5b2d078ba691eefe230478a440ee1f7b16/lisp/pdf-view.el#L321-L322 - `revert-buffer` relies on `pdf-info-close` to run `pdf-info-close-document-hook`, which clears the image and data caches, so they can be rebuilt from the new file. `pdf-info-close` first normalizes the file using `pdf-info--normalize-file-or-buffer`, which returns `pdf-view--buffer-file-name`, and then tries to run the hook in the buffer visiting that file. Since there is not going to be a buffer visiting the local temporary file (normally), no hooks are actually ran. Fixed by deriving the buffer directly from the `file-or-buffer` argument: ``` (cond ((not file-or-buffer) (current-buffer)) ((bufferp file-or-buffer) file-or-buffer) ((stringp file-or-buffer) (find-buffer-visiting file-or-buffer))) ``` Closes: #126, #128
2022-06-20fix: disable qt-workaround in Emacs 27>=Pi-Cla
The bug is fixed upstream in Emacs 27 https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19016 Fixes: #118
2021-12-31Fix checkdoc errors in pdf-tools lisp codeVedang Manerikar
- Add / Fix docstrings for functions. - Make punctuation changes as suggested by `checkdoc` This commit makes changes in a subset of files of `pdf-tools`. Some of the major files are still pending changes, and will be addressed in a later commit. Partially Fixes: #64
2021-12-31Indentation and code-quality fixesVedang Manerikar
- Remove :group arguments from `defcustom` declarations - `defcustom` picks up `defgroup` names from the same file, so specifying the group is not necessary - Ensure that all function-names are properly quoted using #' - Add an explicit header-option setting lexical-binding to t - Ensure that cl-check-type uses `satisfies` for filenames - Replace all `defadvice` with `advice-add` - Replace `(list ...)` patterns with `\`(...)` patterns Fixes: #62 Fixes: #32 Partially Fixes: #24
2021-05-30Revert "`pdf-info-renderpage`: Use the width of the page as passed in."Vedang Manerikar
This reverts commit 8b2debaba240d20ac5f30a9ba076eb532a2396c7, which was introduced in an attempt to fix #13. I am now tracking this issue under #19. @iostapyshyn has confirmed that this change breaks scaling and is not the correct fix.
2021-05-30`pdf-info-renderpage`: Use the width of the page as passed in.Vedang Manerikar
`pdf-view-image-size` passes in the width of the current page to `pdf-info-renderpage` during an isearch. Use this as-is, instead of multiplying it with the `pdf-util-frame-scale-factor`. This is a potential fix for the bug raised by PR #13. I'm not sure if this was a bug earlier as well, but was masked since the code-path did not execute for `png` images. I will treat this as a temporary change until I can better understand the original reasons behind putting it in. Since I don't have access to a Mac running `emacs-mac` , I have tested it by hard-coding `pdf-util-frame-scale-factor` to 2 on my local setup, and everything seems to be working correctly.
2019-11-26Fix typosDamien Cassou
Typos found with codespell.
2019-02-19Support high-resolution displaysNathaniel Nicandro
2018-09-25Avoid race-condition when quitting the serverAndreas Politz
2017-09-14Escape the pdffile properlyAndreas Politz
2017-09-14Fix languageAndreas Politz
2017-09-14Don't force pdf-info-epdfinfo-program to exist when customizing itAndreas Politz
2017-09-14Adds some commentsAndreas Politz
2017-09-14Look for epdfinfo in the Emacs's bin directoryAndreas Politz
2017-09-13Improve the epdfinfo checkAndreas Politz
Render a empty page. This should expose problems with linked libraries.
2017-09-13Clean up epdfinfo detectionAndreas Politz
2017-09-12Fix missing defcustom typesAndreas Politz
2017-08-20Fixes whitespaceAndreas Politz
2017-08-09Utilize a system installation of epdfinfoAndreas Politz
2017-07-21Fix directory namethblt
2017-07-20Remove pointless fallback casethblt
2017-07-20Use function in cl namespace instead of adding extra depthblt
2017-07-20Add missing dependencythblt
2017-07-20Support Git clone installationthblt
Let the default value of 'pdf-info-epdfinfo-program' automatically determine if PDF Tools is installed as a Melpa package (where the epdfinfo binary is in ./build) or as a Git clone (where it's found at ../server/)
2017-03-01Delete trailing whitespaceAndreas Politz
2017-01-27Add support for interactive PDF decryptionAndreas Politz
2017-01-19Fix typoAndreas Politz
2017-01-19Add option to log server error messagesAndreas Politz
2016-10-18Fix some spelling errorsBrady Trainor
2016-02-28Set pdf-info-epdfinfo-program for WindowsLars Ljung
2015-11-26correct "it's/its" grammar in docstringsMatt Price
2015-06-12New macro for composing server queries.Andreas Politz
* lisp/pdf-info.el (pdf-info-compose-queries): ...
2015-06-12Allow one more nil argument.Andreas Politz
* lisp/pdf-info.el (pdf-info-charlayout): Let edges-or-pos default to the whole page.
2015-06-12Simplified valid page ranges.Andreas Politz
* lisp/pdf-info.el (pdf-info-normalize-page-range): Remove unused t as allowed page.
2015-06-12Expand filenames for the server.Andreas Politz
* lisp/pdf-info.el (pdf-info--normalize-file-or-buffer): Use expand-file-name on the result.
2015-06-12Removed some duplicate code.Andreas Politz
* lisp/pdf-info.el (pdf-info--normalize-file-or-buffer): Check major-mode once.
2015-06-12Made tq processing iterative.Andreas Politz
* lisp/pdf-info.el (tq-process-buffer): Use a iterative algorithm, which may avoid problems with many requests (max eval depth).
2015-06-12Extended asynchronous callback.Andreas Politz
* lisp/pdf-info.el (pdf-info-asynchronous): Allow for arguments to be passed. (pdf-info-query): Handle them.
2015-06-12Added a noop command to the server.Andreas Politz
* server/epdfinfo.c (cmd_ping): Pong. * lisp/pdf-info.el (pdf-info-ping): Handle it.
2015-06-11Simplify pdf-info interface.Andreas Politz
* lisp/pdf-tools.el: Add let-alist as requirement. * lisp/pdf-occur.el (pdf-occur-add-matches, pdf-occur-start-search): Use new interface. * lisp/pdf-isearch.el (pdf-isearch-search-page): Use new interface. * lisp/pdf-info.el (pdf-info-query--transform-action, pdf-info-query--transform-response): Prefer alists over trees or positional lists, where appropriate. (pdf-info-search-string,pdf-info-search-regexp,pdf-info-pagelinks pdf-info-charlayout,pdf-info-pagelinks, pdf-info-outline, pdf-info-synctex-forward-search, pdf-info-synctex-backward-search): Updated documentation. * test/pdf-info.ert: Require let-alist, use new interface. * Makefile (bytecompile, test): Use cask. * Cask (depends-on): Add let-alist. * lisp/pdf-outline.el: Use new interface. * lisp/pdf-links.el: Use new interface. * lisp/pdf-cache.el: Use new interface. * lisp/pdf-sync.el: Use new interface.
2015-06-07Unified rendering commands in the server.Andreas Politz
* server/epdfinfo.c (cmd_renderpage): Incorporated cmd_renderpage_x commands into cmd_renderpage. * lisp/pdf-view.el (pdf-view-extract-region-image): Use new rendering capabilities. * lisp/pdf-info.el (pdf-info-renderpage): Adhere to and provide new command protocol. (pdf-info-renderpage-text-regions): Use pdf-info-renderpage. (pdf-info-renderpage-highlight): Use pdf-info-renderpage.
2015-06-02Merge pull request #94 from oscarfv/recolorpolitza
Recolor
2015-05-24Start server in an existing directoryAndreas Politz
* lisp/pdf-info.el (pdf-info-check-epdfinfo): Let default-directory be ~. (pdf-info-process-assert-running): Ditto.
2015-05-14Merge branch 'master' into optionsoscar
Conflicts: lisp/pdf-info.el server/epdfinfo.c server/epdfinfo.h