From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: How to have a frame dedicated to buffers of a certain kind? (was: use pdf-tools in Emacs.) Date: Sat, 29 Apr 2023 21:37:43 +0200 Message-ID: <87y1mafo4i.fsf@gnu.org> References: <87r0s5efab.fsf@frege.mail-host-address-is-not-set> <87edo5bc61.fsf@gnu.org> <87edo52mtg.fsf@gnu.org> <87o7n8jwzw.fsf@gnu.org> <87jzxwjghd.fsf@gnu.org> <87fs8kjedb.fsf@gnu.org> <87ildfdqwu.fsf@gnu.org> <87fs8jauv0.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18396"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.11.3; emacs 30.0.50 Cc: stefan-husmann@t-online.de, help-gnu-emacs@gnu.org To: Hongyi Zhao Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 29 22:08:41 2023 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1psqs5-0004eS-Kx for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 29 Apr 2023 22:08:41 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1psqrW-0001qm-JS; Sat, 29 Apr 2023 16:08:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psqrU-0001qb-SZ for help-gnu-emacs@gnu.org; Sat, 29 Apr 2023 16:08:04 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psqrS-0001v8-IM; Sat, 29 Apr 2023 16:08:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-reply-to:Date:Subject:To:From: References; bh=Zm2E/a8OPGt6AbfgKc9Y+oopZlQ/s98QQT/z8Xm/YaI=; b=W3t2o8T5LvtXvw 1xBkSY+d8xxhV+IwdU0RAc/XtH5LycfG+YFgtRyfN6W4zDNwv3BY6sFHYncdXA6w3iP7tuDYJvtmt wH/LO3AtIT7qfgVhZT8Wz9S7+WEszW1KiuMGzLlUpP3bJtJrZavvwVYI8v67tUIQRRSlcbRNObGTE 2QCC6fb+NpniMsTO2pXfAFCem1HY1N2fOe9XyinhVKJgswSKxd7EwXZm91bjNxTIR9xgydfBj5N0G 4J9+xb0StVINbFHyZb22DttgrFE6FpC3ojn1dR8B6yS5oLF4KycTUuXu3NXNSWqx2SAWVT5YIC+Q7 nBcFBmnqOmB5WIhLwRuQ==; Original-Received: from auth2-smtp.messagingengine.com ([66.111.4.228]) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1psqrS-00071f-BL; Sat, 29 Apr 2023 16:08:02 -0400 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id AE9E327C0054; Sat, 29 Apr 2023 16:08:01 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sat, 29 Apr 2023 16:08:01 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfedvtddguddvudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpehffgfhvfevufffjgfkgggtsehttdertddtredtnecuhfhrohhmpefvrghs shhilhhoucfjohhrnhcuoehtshguhhesghhnuhdrohhrgheqnecuggftrfgrthhtvghrnh epudejtdehuddvleffjeekteegvdehleehvdeufefhueekkeekhedvgfeggeffvefgnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhrnh domhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqkeeijeefkeejkeegqdeifeeh vdelkedqthhsughhpeepghhnuhdrohhrghesfhgrshhtmhgrihhlrdhfmh X-ME-Proxy: Feedback-ID: ib2b94485:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 29 Apr 2023 16:08:00 -0400 (EDT) In-reply-to: X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:143457 Archived-At: Hongyi Zhao writes: > And this time the 3rd circle numbered window will be used to display > the LaTeX code and PDF alternately when I do the forward and backward > searching. This is not the result we hope to see. Here's a slightly improved version: (defun th/display-buffer-in-my-pdf-frame (buffer alist) (if-let ((frame (car (seq-filter (lambda (f) (frame-parameter f 'th/pdf-frame)) (frame-list))))) (display-buffer-use-some-frame buffer `((frame-predicate . ,(lambda (f) (frame-parameter f 'th/pdf-frame))))) (display-buffer-pop-up-frame buffer (cons '(pop-up-frame-parameters (th/pdf-frame . t)) alist)))) ;; PDFs in a dedicated pdf frame. (add-to-list 'display-buffer-alist `((derived-mode . pdf-view-mode) th/display-buffer-in-my-pdf-frame)) The problem remains that when double-clicking in the pdf-view-mode buffer to jump to the corresponding position in the tex file, the tex file buffer appears in a new window of the pdf frame. The issue is that pdf-tools uses pop-to-buffer here: (defun pdf-sync-backward-search (x y) "Go to the source corresponding to image coordinates X, Y. Try to find the exact position, if `pdf-sync-backward-use-heuristic' is non-nil." (cl-destructuring-bind (source finder) (pdf-sync-backward-correlate x y) (pop-to-buffer (or (find-buffer-visiting source) (find-file-noselect source)) pdf-sync-backward-display-action) (push-mark) (funcall finder) (run-hooks 'pdf-sync-backward-hook))) But there you go! You can define a pdf-sync-backward-display-action to make it work. (setq pdf-sync-backward-display-action '(display-buffer-reuse-window (reusable-frames . t))) You can read up how that all works in (info "(elisp) Displaying Buffers"). Bye, Tassilo