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 08:28:55 +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> 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="7334"; 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 02:29:51 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 1ptHQN-0001jj-NO for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 01 May 2023 02:29:51 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ptHPn-0002DU-4T; Sun, 30 Apr 2023 20:29:15 -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 1ptHPl-0002DH-1D for help-gnu-emacs@gnu.org; Sun, 30 Apr 2023 20:29:13 -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 1ptHPj-0003MB-9I; Sun, 30 Apr 2023 20:29:12 -0400 Original-Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-94f6c285d22so410535166b.2; Sun, 30 Apr 2023 17:29:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682900948; x=1685492948; 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=jK0p9TpkBDprCRPayzKgpw1QtHGPoHrCfbmDEr/2uGU=; b=TS6HVeGeMG94nZ3ExFQl/BgP3YC2WIEGcKhnELGmS7LM4r3sMgNpUX4Ruc+5ydWuqJ LRCxtXvD4aGZiLhJmYKnBTAdzqThuMbcO2qNQ/gHn1dEiLLBD88gBBvp/Whc7KWyyfBy zYOb14BHxfLote07ZWulmfgFlbODUsu/GzllwKAJ50Zmzzu8ZChokP3VclSNfGrX1rAg zGOf0Yt3p9o0/9/hhNAnTibnJ8qT9XAowLjZ0XmT5UKQMVtahriZlbCmrUMiOM9TR3VD TnEhQPiQejnDQR51DbTAQtppP6dPzIu4cOr7sT/A1AaRH/o2eHKrWBgsKldPxpYHrDee 7d+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682900948; x=1685492948; 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=jK0p9TpkBDprCRPayzKgpw1QtHGPoHrCfbmDEr/2uGU=; b=B0ELkS9ff9iFT3B7LL/BFb/CTyx4Vj6tLZascKWlWWh4glRTBuTmTMJGH2myqGqCzE fK99+cJX0m+SdbpgUbyc008M5RyRhryliNk6HMJIVgvknkbWLF87reD4Tys4ayRdB5LJ TVnSSMoe0oF1ZEesGPxRAu7j4S1MIbH9SXLpl1DN+i8Ma6PdpeCwi8gBlpzzJPbSoGo+ sCpSTGPYII2rsbTDzqGNnpBERXquxXgDlcYPY46C4VzfGibTuOvwRpN5tKxejTWlLWHr OhEVy7TTE4+ri8T/s40XifI849lvLby037PqwFaaWSnyM6a3cvbjKBn3NN95xw4xhC9/ ZMaA== X-Gm-Message-State: AC+VfDxS0HxFkA+3ewpLxKzlFMZKJPihEw2cpQcoSbthUnzqA1BA5Rg+ rPgGGuoCb9oQpbNpbn7fDXE9Do/xADRUdMpoip7kuIDWROBrm/Bm X-Google-Smtp-Source: ACHHUZ6n/p37MnF6ZYWcyIg1VYh2o918DwHi/bOKHR8klUta9Q4EcqKga02/xCdEcDelz971kMnFy+KExHjc9Ky5Nzk= X-Received: by 2002:a17:907:8a16:b0:94e:6504:d134 with SMTP id sc22-20020a1709078a1600b0094e6504d134mr12119911ejc.42.1682900947703; Sun, 30 Apr 2023 17:29:07 -0700 (PDT) In-Reply-To: <87354h9osf.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:143470 Archived-At: On Mon, May 1, 2023 at 3:02=E2=80=AFAM 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: (use-package pdf-tools :ensure t :init (pdf-tools-install) (setq pdf-sync-backward-display-action '(display-buffer-reuse-window (reusable-frames . t))) (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)))) (defun th/display-buffer-in-my-tex-frame (buffer alist) (if-let ((frame (car (seq-filter (lambda (f) (frame-parameter f 'th/tex-frame)) (frame-list))))) (display-buffer-use-some-frame buffer `((frame-predicate . ,(lambda (f) (frame-parameter f 'th/tex-frame))))) (display-buffer-pop-up-frame buffer (cons '(pop-up-frame-parameters (th/tex-frame . t)) alist)))) (add-to-list 'display-buffer-alist `((derived-mode . pdf-view-mode) th/display-buffer-in-my-pdf-frame)) (add-to-list 'display-buffer-alist `((derived-mode . LaTeX-mode) th/display-buffer-in-my-tex-frame)) ) > Bye, > Tassilo Best, Zhao