On Fri, Apr 28, 2023 at 10:00 PM Tassilo Horn wrote: > > Hongyi Zhao writes: > > >> If you always want to spawn a new frame when finding a PDF document, I > >> guess you have to add a rule to display-buffer-alist. > > > > I want to use a new frame to show the PDF document with the LaTeX code > > in another frame, and at the same time keeping the forward and reverse > > searching work by skipping between these two frames backward and > > forward accordingly. > > If the pdf is shown in a buffer of another frame makes no difference to > forward/inverse search as long its the same emacs instance. This should > work for you: > > (add-to-list 'display-buffer-alist > '((derived-mode . pdf-view-mode) > display-buffer-pop-up-frame)) > > It tells emacs to open buffers where pdf-view-mode is the major-mode to > be opened in a separate frame. I tried the following configuration: (use-package pdf-tools :ensure t :init (pdf-tools-install) :config (add-to-list 'display-buffer-alist '((derived-mode . pdf-view-mode) display-buffer-pop-up-frame)) ) See the attached screenshot for the effect. In short, frame 1 will open frame 2, and 2 will open 3. But I just want to open frames 1 and 2 and automatically switch between them for forward and backward search. > Bye, > Tassilo Best, Zhao