Doom-emacs: isearch in pdf-view-mode of pdf-tools scales pdf file incorrectly.

Created on 28 Feb 2020  路  10Comments  路  Source: hlissner/doom-emacs

What did you expect to happen?
isearch-forward in pdf files only highlight the match area, the display size of the pdf file remains unchanged.

What actually happened?

Open a pdf file with pdf-tools, then use isearch-forward to search some words, if match, the contents in pdf files will be highlight, that is ok, but the pdf file will scale by the keypress. i.e. when search the word "hello", and it is actually in the pdf file. Then, when press "h", the "h" in pdf file will be highlighted, but at the same time, the display area in emacs will be double sized. After press "o", the display size of pdf file is even double as press "h".

Additional details:
only add :tools pdf in init file.

:tools pdf investigating

Most helpful comment

I've attached an gif file, to reference.

Untitled1

All 10 comments

I cannot reproduce this, the search works fine for me. Any special setting for viewing the pdf?

@smallzhan Please include your M-x doom/info

I've created a fresh doom.d, only default doom settings, isearch on pdf still have the pdf file scaled.

emacs   version    27.0.90
        features   RSVG IMAGEMAGICK GLIB NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS XWIDGETS JSON PDUMPER LCMS2 GMP
        build      Feb 29, 2020
        buildopts  (--disable-dependency-tracking --disable-silent-rules --enable-locallisppath=/usr/local/share/emacs/site-lisp --infodir=/usr/local/Cellar/emacs-plus/HEAD-6dc2ebe/share/info/emacs --prefix=/usr/local/Cellar/emacs-plus/HEAD-6dc2ebe --with-xml2 --without-dbus --with-gnutls --with-imagemagick --with-json --with-modules --with-rsvg --with-xwidgets --with-ns --disable-ns-self-contained)
        windowsys  ns
        daemonp    server-running
doom    version    2.0.9
        build      HEAD -> develop, origin/develop 698001900 2020-02-29 19:09:50 -0500
        dir        ~/.doom.d.nothing/
system  type       darwin
        config     x86_64-apple-darwin19.3.0
        shell      /bin/zsh
        uname      Darwin 19.3.0 Darwin Kernel Version 19.3.0: Thu Jan  9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64
        path       (/usr/local/opt/qt/bin /usr/local/Cellar/zplug/2.4.2/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /Library/TeX/texbin /Applications/Wireshark.app/Contents/MacOS ~/.golang/bin /usr/local/opt/go/libexec/bin ~/Library/Android/sdk/tools ~/Library/Android/sdk/platform-tools /usr/local/opt/llvm/bin ~/bin /usr/local/opt/fzf/bin /usr/local/Cellar/emacs-plus/HEAD-6dc2ebe/libexec/emacs/27.0.90/x86_64-apple-darwin19.3.0/)
config  envfile    envvar-file
        elc-files  1
        modules    (:completion company ivy :ui doom doom-dashboard doom-quit hl-todo modeline nav-flash (popup +all +defaults) vc-gutter window-select :editor fold multiple-cursors snippets :emacs dired electric ibuffer vc :checkers syntax :tools (eval +overlay) (lookup +docsets) magit pdf :lang data emacs-lisp markdown org sh :config (default +bindings +smartparens))
        packages   (n/a)
        unpin      (n/a)
        elpa       (n/a)

I've attached an gif file, to reference.

Untitled1

i have encountered this problem in emacs28.

I have also encountered this problem.

System information:


((emacs
(version . "27.0.90")
(features . "RSVG IMAGEMAGICK GLIB NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS JSON PDUMPER LCMS2 GMP")
(build . "Apr 08, 2020")
(buildopts "--disable-dependency-tracking --disable-silent-rules --enable-locallisppath=/usr/local/share/emacs/site-lisp --infodir=/usr/local/Cellar/emacs-plus/HEAD-f451ef9/share/info/emacs --prefix=/usr/local/Cellar/emacs-plus/HEAD-f451ef9 --with-xml2 --without-dbus --with-gnutls --with-imagemagick --with-json --with-modules --with-rsvg --with-ns --disable-ns-self-contained")
(windowsys . batch)
(daemonp . server-running))
(doom
(version . "2.0.9")
(build . "HEAD -> develop, origin/develop, origin/HEAD 3a5ef316f 2020-04-19 22:04:12 -0400")
(dir . "~/.config/doom/"))
(system
(type . darwin)
(config . "x86_64-apple-darwin19.4.0")
(shell . "/usr/local/bin/zsh")
(uname . "Darwin 19.4.0 Darwin Kernel Version 19.4.0: Wed Mar 4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64")
(path "/usr/local/bin" "/usr/bin" "/bin" "/usr/sbin" "/sbin" "/Library/TeX/texbin" "/opt/X11/bin" "/Applications/Wireshark.app/Contents/MacOS" "~/bin" "~/sbin" "~/.local/bin" "/usr/local/sbin" "/usr/local/Cellar/emacs-plus/HEAD-f451ef9/libexec/emacs/27.0.90/x86_64-apple-darwin19.4.0"))
(config
(envfile . envvar-file)
(elc-files . 0)
(modules :completion company ivy :ui doom-dashboard hl-todo hydra modeline (popup +all +defaults) vc-gutter vi-tilde-fringe window-select workspaces :editor (evil +everywhere) file-templates fold format multiple-cursors rotate-text snippets word-wrap :emacs dired electric ibuffer (undo +tree) vc :term shell :checkers syntax spell grammar :tools (eval +overlay) lookup lsp macos magit make pdf :lang (agda +local) (cc +lsp) coq data emacs-lisp (haskell +dante) javascript (latex +latexmk) lua markdown ocaml (org +pandoc) (python +conda +cython +lsp) (rust +lsp) sh web :config (default +bindings +smartparens))
(packages (solarized-theme) (pdf-view-restore) (graphviz-dot-mode) (rmsbolt) (web-beautify))
(unpin "n/a")
(elpa "n/a")))

I'm so far unable to reproduce this, but I've noticed that @howsiwei is running on a 5-day old commit of Doom (3a5ef316f), and @smallzhan is on a 2 month old commit (698001900). There have been a few big improvements made to the :tools pdf module made in the past few days that may address this issue. Please update Doom and see if that is the case.

Upgrading doesn't fix the issue for me. Anyway, the issue is most likely caused by retina support for MacOS as commenting https://github.com/hlissner/doom-emacs/blob/30dea4bf0c3854f991d02efa73c3d38c5d9a7640/modules/tools/pdf/config.el#L28-L42 fixes the issue but also results in blurrier view.

System information:


((emacs
(version . "27.0.90")
(features . "RSVG IMAGEMAGICK GLIB NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS JSON PDUMPER LCMS2 GMP")
(build . "Apr 08, 2020")
(buildopts "--disable-dependency-tracking --disable-silent-rules --enable-locallisppath=/usr/local/share/emacs/site-lisp --infodir=/usr/local/Cellar/emacs-plus/HEAD-f451ef9/share/info/emacs --prefix=/usr/local/Cellar/emacs-plus/HEAD-f451ef9 --with-xml2 --without-dbus --with-gnutls --with-imagemagick --with-json --with-modules --with-rsvg --with-ns --disable-ns-self-contained")
(windowsys . batch)
(daemonp . server-running))
(doom
(version . "2.0.9")
(build . "HEAD -> develop, origin/develop, origin/HEAD 30dea4bf0 2020-04-25 02:55:06 -0400")
(dir . "~/.config/doom/"))
(system
(type . darwin)
(config . "x86_64-apple-darwin19.4.0")
(shell . "/usr/local/bin/zsh")
(uname . "Darwin 19.4.0 Darwin Kernel Version 19.4.0: Wed Mar 4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64")
(path "/usr/local/miniconda3/bin" "/usr/local/miniconda3/condabin" "~/.opam/default/bin" "~/.cargo/bin" "~/perl5/bin" "/usr/local/bin" "/usr/bin" "/bin" "/usr/sbin" "/sbin" "/Library/TeX/texbin" "/opt/X11/bin" "/Applications/Wireshark.app/Contents/MacOS" "~/bin" "~/sbin" "~/.local/bin" "/usr/local/sbin" "/usr/local/Cellar/emacs-plus/HEAD-f451ef9/libexec/emacs/27.0.90/x86_64-apple-darwin19.4.0"))
(config
(envfile . envvar-file)
(elc-files . 0)
(modules :completion company ivy :ui doom-dashboard hl-todo hydra modeline (popup +all +defaults) vc-gutter vi-tilde-fringe window-select workspaces :editor (evil +everywhere) file-templates fold format multiple-cursors rotate-text snippets word-wrap :emacs dired electric ibuffer (undo +tree) vc :term shell :checkers syntax spell grammar :tools (eval +overlay) lookup lsp macos magit make pdf :lang (agda +local) (cc +lsp) coq data emacs-lisp (haskell +dante) javascript (latex +latexmk) lua markdown ocaml (org +pandoc) (python +conda +cython +lsp) (rust +lsp) sh web :config (default +bindings +smartparens))
(packages (solarized-theme) (pdf-view-restore) (graphviz-dot-mode) (rmsbolt) (web-beautify))
(unpin "n/a")
(elpa "n/a")))

I've manually patched the pdf-tools repository and found that the issue gone.
you can try it with the advice lines you mentioned in doom's config uncommented. @howsiwei
please refer to https://github.com/smallzhan/pdf-tools/tree/retina-view

Thanks @smallzhan! Your patch solve the issue.

Was this page helpful?
0 / 5 - 0 ratings