From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hongyi Zhao 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, 1 May 2023 15:21:48 +0800 Message-ID: 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> <878re8h87w.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38499"; mail-complaints-to="usenet@ciao.gmane.io" Cc: stefan-husmann@t-online.de, help-gnu-emacs@gnu.org To: Tassilo Horn Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 01 09:22:50 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 1ptNs1-0009qU-FC for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 01 May 2023 09:22:49 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ptNrJ-0001TP-Gk; Mon, 01 May 2023 03:22:05 -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 1ptNrI-0001Sq-8u for help-gnu-emacs@gnu.org; Mon, 01 May 2023 03:22:04 -0400 Original-Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ptNrG-00018Z-G3; Mon, 01 May 2023 03:22:04 -0400 Original-Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-94f3df30043so356762466b.2; Mon, 01 May 2023 00:22:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682925720; x=1685517720; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=cUfhHdmcov/F8QR0mEitvsXfoEn1vhB38xL2S+hssMQ=; b=RLPkCHp8ih1jRj/3Bns+vjTnv/MQJDLfV/z69nuKNj0Jv76f8fRcMH1CbygKgBaXQ2 9yuJh42hCHK9uMbEkFQvXCQ+7A1fdLJxOHg1hh6Ae7lCdhfdys71eYmYRi8hgw5KkzbD nNYGwK5rC6AOILeT/xYkvsRLcw8+Q7oFrpgjvGHw1DiaPjnu53dr4kUDvg7c0lzemIA6 YgGxFbAt8mYpUNXx9kK076uCNHEb65e2o5cFgYrruunV6FaI6Ebg4+3RGCcSF7QCYkdb YZxv5xsYf3QdQAGTcolQ+OVn5Up+QaSzdDLiuvCP/d7756BMFICSUpCr8yV+Bj5BWnOz N0FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682925720; x=1685517720; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cUfhHdmcov/F8QR0mEitvsXfoEn1vhB38xL2S+hssMQ=; b=Sr/o+c526xoIa9OPYjE5a+lyNqYYV3iIUa7xY5lJ3mbDSM3mXTquJKS3V6D1lmYaYy GS5u317tg+CqB9P0l+dILizUrBfy478OQgz74yGL3NL6m1nmUX2DuGzQE3LtvZ4RCCWG I4pS9OF1vwsdUIxIGbQ02r0TDibI2Cm2ie5UWpvoGRTkoowM7z1MjlcZ1Yo4uPqW+mgz ARSLVqoSVTsHOiZ8ZuIwSwmcXYjP3z8YF1Hxqpa9YTzVEbj4njwYeUgr+0eVnrlAS1fF 04AoBzg65tpCUkP1kN4RAi0riCz6gD6Ub+uQp9KeYrWuTaC9zFwDTrtn93BeZl1iVg9R u+xg== X-Gm-Message-State: AC+VfDzZHNHsNrCLmgWooGR+9Bnsz/DpWoV5BuPsEBcdCPsu/ITGT/Ff poQGckGUV/mg70yxBcr6mMTSrECfLIpuhW/60/XNx8SjNgAuxQ== X-Google-Smtp-Source: ACHHUZ5E750VeJSaN4Ws3JLu4yuT0PR7xaj/yJ5QT65VqKLDzwdZVN1cuyVbWDz1oJYDQutWTAmhDi8SPHvQpkE7uEw= X-Received: by 2002:a17:907:1625:b0:94f:450e:6a76 with SMTP id hb37-20020a170907162500b0094f450e6a76mr12045168ejc.61.1682925719701; Mon, 01 May 2023 00:21:59 -0700 (PDT) In-Reply-To: <878re8h87w.fsf@gnu.org> Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=hongyi.zhao@gmail.com; helo=mail-ej1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:143478 Archived-At: On Mon, May 1, 2023 at 2:33=E2=80=AFPM Tassilo Horn wrote: > > 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. Please go ahead with the latter and let me test it. > Bye, > Tassilo Best, Zhao