Skip to content

Commit

Permalink
Don't require pdf-sync when setting up latex
Browse files Browse the repository at this point in the history
Avoid manually requiring `'pdf-sync` during latex setup, since it can
have some unfortunate side effects that seem to break pdf-tools. In brief, it
loads something that we otherwise wanted to autoload.

In more detail: when we manually require pdf-sync, that in turn requires
pdf-view, which causes pdf-view.el to be loaded and pdf-view-mode to be defined.
However, use-package had configured pdf-view-mode to be autoloaded (by its
specification of :mode in use-package). Loading it manually doesn't trigger the
autoload, so all of the configuration that is waiting to happen in pdf-tools's
use-package :config block doesn't get triggered. Most critically,
`(pdf-tools-install)` doesn't get triggered, which prevents pdf-view-mode from
functioning properly.

If we don't require pdf-sync, then we end up setting a
variable (`pdf-sync-forward-display-action`) which isn't yet bound. Fortunately,
pdf-tools appropriately defines this variable using `defcustom`, so it won't
override whatever we set it to here :)
  • Loading branch information
dankessler authored and smile13241324 committed Mar 22, 2024
1 parent afe1291 commit 17e03e6
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion layers/+lang/latex/funcs.el
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
(progn
(setf (alist-get 'output-pdf TeX-view-program-selection) '("PDF Tools"))
(when latex-view-pdf-in-split-window
(require 'pdf-sync)
(setq pdf-sync-forward-display-action t)))
(spacemacs-buffer/warning "Latex Layer: latex-view-with-pdf-tools is non-nil but pdf layer is not installed, this setting will have no effect."))))

Expand Down

0 comments on commit 17e03e6

Please sign in to comment.