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: Mon, 01 May 2023 08:15:53 +0200 Message-ID: <878re8h87w.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> <87y1mafo4i.fsf@gnu.org> <87354h9osf.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="5447"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.11.4; 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 Mon May 01 08:33:58 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 1ptN6j-0001GN-U1 for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 01 May 2023 08:33:57 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ptN6B-0003As-FB; Mon, 01 May 2023 02:33:23 -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 1ptN64-00037V-FM for help-gnu-emacs@gnu.org; Mon, 01 May 2023 02:33:21 -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 1ptN61-00082S-HP; Mon, 01 May 2023 02:33:13 -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=Yq+fb6ySAzRLT1gtnBJJOJnT+KLAVIdQTAQUHdS4Au4=; b=PEmqXhrsD/rr3d kPpmVxE6ciElnIqON20ZaSXH07AZfX4IZYwEItObVx00zIrV5Nmwgdbe87v5xGI+1EVthrVK1+ABx Zwk49pgxV2hOLDBWiy5XKL5PQV7rxw9wLrr0Q5Pfq/3ICSDpitbuPd2i3MqMvGek5U11L4cJZr62j ztVYjU+KnhpCbmi5hvCuT01jeEl4BZ3Wdd3KrY2/Kc4M1Jfi+t07la6AoZ/GJGoQ5JC/6Bso10cXX XLiqQMiIjV+wmCzTmkwrDRY0sGx2Hk9ajY5qJsMJdlO9nagQD5yA2gz02MAzq8w2iOsBlAC0fcN0I KATUBKVRRD4Ie7dzrpyw==; Original-Received: from auth1-smtp.messagingengine.com ([66.111.4.227]) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ptN60-0007Fu-Gr; Mon, 01 May 2023 02:33:12 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailauth.nyi.internal (Postfix) with ESMTP id ED1AE27C0054; Mon, 1 May 2023 02:33:11 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 01 May 2023 02:33:11 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfedvfedgudduvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpehffgfhvfevufffjgfkgggtsehttdertddtredtnecuhfhrohhmpefvrghs shhilhhoucfjohhrnhcuoehtshguhhesghhnuhdrohhrgheqnecuggftrfgrthhtvghrnh epudejtdehuddvleffjeekteegvdehleehvdeufefhueekkeekhedvgfeggeffvefgnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhrnh domhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqkeeijeefkeejkeegqdeifeeh vdelkedqthhsughhpeepghhnuhdrohhrghesfhgrshhtmhgrihhlrdhfmh X-ME-Proxy: Feedback-ID: ib2b94485:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 1 May 2023 02:33:10 -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:143475 Archived-At: Hongyi Zhao writes: >> > But I found a further problem: If I first opened the PDF file, then >> > it still won't be able to create a new frame dedicated to buffers >> > of LaTeX code, as shown in the attached screenshot. >> >> True. I didn't know this was a requirement. Basically you could just >> copy&paste&adapt this code to dedicate a special frame to anything you'd >> like. But that's left as an excercise to the reader. ;-) > > I tried as follows, but still can't achieve the goal: Hm, I think a problem might be that when you open the PDF first (and this actually starts emacs itself), the th/pdf-frame frame parameter might not be assigned to that frame. Please verify using M-: (frame-parameter nil 'th/pdf-frame) RET in that frame. If it doesn't return t, then that's the case. Then you'd somehow need to ensure that this initial frame gets the parameter, e.g., by adding a function like this to some reasonable hook: (defun th/pdf-frame-ensure () (when (and (derived-mode-p 'pdf-view-mode) (zerop (length (seq-filter (lambda (f) (frame-parameter f 'th/pdf-frame)) (frame-list))))) (set-frame-parameter nil 'th/pdf-frame t))) Unfortunately, I don't know which hook. pdf-view-mode-hook might run too early, i.e., the buffer might be set up before displaying it which eventually will create the frame. So maybe after-make-frame-functions is better (but then you'd need to use the frame given as parameter). I guess you'll need to do some testing here. BTW, I wonder if you really want to have a dedicated tex frame or just a dedicated pdf frame + one editing/normal frame. If it's actually the latter, I wouldn't introduce another th/tex-frame parameter but simply test for (null (frame-parameter frame 'th/pdf-frame)) everywhere. Bye, Tassilo