From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Kiso Katsuyuki Newsgroups: gmane.emacs.devel Subject: Re: Selecting *Compile-log* buffer automatically Date: Sun, 24 Dec 2023 06:51:23 -0600 Message-ID: References: <86wmtlrqpc.fsf@mail.linkov.net> <86wmt4hl5e.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000cd7004060d40e89d" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36461"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Dec 24 13:52:13 2023 Return-path: Envelope-to: ged-emacs-devel@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 1rHNxk-0009Ns-Qu for ged-emacs-devel@m.gmane-mx.org; Sun, 24 Dec 2023 13:52:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rHNxE-0001BE-E4; Sun, 24 Dec 2023 07:51:40 -0500 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 1rHNxC-0001AW-Mo for emacs-devel@gnu.org; Sun, 24 Dec 2023 07:51:38 -0500 Original-Received: from mail-qk1-x72b.google.com ([2607:f8b0:4864:20::72b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rHNxA-0001Us-EP for emacs-devel@gnu.org; Sun, 24 Dec 2023 07:51:38 -0500 Original-Received: by mail-qk1-x72b.google.com with SMTP id af79cd13be357-7811b05d23bso247003785a.0 for ; Sun, 24 Dec 2023 04:51:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703422295; x=1704027095; darn=gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=rtBmSjd9veonPPdYPH0WGJ8Fh9qxZNA5hALIdG6dalc=; b=kNqwnkeLSwafZBBJfjE7WzQdmPyZtHCPmJmMTaDBskkDX6epntGCDGur4kas0i8Aqs riyY4fMzR3D1QGWo7w0P4ZjKW1+NJEdd83O5NjU1GrXYQdeHKDyvJV2bVHm7IKhgPFdt UctMejJ/Tz7hYJU6XyL0HNjGZPxenWHfrzNLgZ755iR+pV0fROxcW9RUw+VJFAFWGLNG xgOR/L93oN5BM7fsOhWYbrijLUybKl6RaZ39o2QaojTklUQVn+2Ib6Act+YXuXMq1OAb ql/E7/k8onyhWkAbNx2X9iJQFNGhS4WsxZS47KPP9/MqZ112ucyRCkbrXgIKX/C5ml5S VFNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703422295; x=1704027095; h=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=rtBmSjd9veonPPdYPH0WGJ8Fh9qxZNA5hALIdG6dalc=; b=KZPwaQH8P3bk3NR10lJUwYp48bd23kXnzWYDsdVuOe8ghBMfp6VsZHgdxn/Id5BmSI DYdh+AWk+qhtzb4r51Rj1H3bdrsOx5EKuk+LUWZP7MLuAGtzgblnRmQ3Fq8yD9YFsFeH 3o9Zwv4PKBaBwrxshy4ncUZKVO8OoOm8u9guuMn67bjrzpQM4PCka6XlJ/p2LfN3zcgG Y3g09tCrpYQNl+0wATQPAXPk/gn4YxcDjy8HLV3NcLFnJN/Q7faRWWgv1m/KDCZeZOuB D63d8CwTnkF2Rm2+PFuNa35Eh2kPrZFoWZtECUivTBHPlEmErpYhN7j8rT0kphQwcrm/ 6qxQ== X-Gm-Message-State: AOJu0Yx4K/CD98N9cwzrW1+N/udCrp4miAwR8pthE7VeD1Syi4K/qWjq TzKUhL6gm51JoyywZxitvQIZffyCUmwmlEDvbiGo+40cSpOvWg== X-Google-Smtp-Source: AGHT+IEFZiPvTlcgzRPBdsWKHu4K9wj/ixjByYjVt8lEdMI5UgAq9TlhanjAFo0CheZQAYpiilcvMr6TfQrGPmwmEus= X-Received: by 2002:a05:620a:1a8d:b0:77f:948:8a09 with SMTP id bl13-20020a05620a1a8d00b0077f09488a09mr6128756qkb.114.1703422295074; Sun, 24 Dec 2023 04:51:35 -0800 (PST) In-Reply-To: <86wmt4hl5e.fsf@mail.linkov.net> Received-SPF: pass client-ip=2607:f8b0:4864:20::72b; envelope-from=katsuyuki2388@gmail.com; helo=mail-qk1-x72b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=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: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:314121 Archived-At: --000000000000cd7004060d40e89d Content-Type: multipart/alternative; boundary="000000000000cd7001060d40e89b" --000000000000cd7001060d40e89b Content-Type: text/plain; charset="UTF-8" >>>I believe this should be customizable with something like >>> >>> (setopt display-buffer-alist >>> '(("\\*Compile-log\\*" nil (select-window . t)))) >> >> Thank you for the advice, but I tried this and it didn't work. >> *Compile-log* buffer isn't selected. >> I used emacs 29.1 with no init files loaded. > >This feature was discussed in bug#33258 and bug#46034, >but not yet implemented. It should be easy to implement >exactly the same way as 'windmove-display-in-direction' >selects the old or new window in 'post-command-hook'. >Ok, I will post a patch to bug-gnu-emacs. There seems to be another problem with using display-buffer-alist. byte-compile-file repeats byte-compile, display-warning (this uses display-buffer) for each S-expression. Selecting *Compile-log* buffer before finishing byte-compiling the last S-expression causes an error. I checked the error using (defun select-visible-warning-buffer (_type _message &optional _level buffer-name) "Select the visible warning buffer" (unless buffer-name (setq buffer-name "*Warnings*")) (let ((window (get-buffer-window (get-buffer buffer-name)))) (if window (select-window window)))) (advice-add 'display-warning :after #'select-visible-warning-buffer) , and byte-compile causes "Error: End of file during parsing". display-buffer-alist should affect every display-buffer, so I think it leads to the same error. I think selecting the *Compile-Log* buffer separately from display-buffer is easier. I made the attached patch to select *Compile-Log* buffer for emacs 29.1 bytecomp.el. >> I'll consider a different way. > >Until this is pushed, you could use such a simple advice >that does the same: > >(define-advice dired-do-byte-compile (:after (&rest _args) select-window) > (when-let ((window (get-buffer-window "*Compile-Log*" 0))) > (select-window window))) Thanks. I referred to this when I made the above patch. --000000000000cd7001060d40e89b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
>>>I believe this should be cust= omizable with something like
>>>
>>> =C2=A0(setopt= display-buffer-alist
>>> =C2=A0 '(("\\*Compile-log\\*= " nil (select-window . t))))
>>
>> Thank you for the= advice, but I tried this and it didn't work.
>> *Compile-log*= buffer isn't selected.
>> I used emacs 29.1 with no init file= s loaded.
>
>This feature was discussed in bug#33258 and bug#4= 6034,
>but not yet implemented.=C2=A0 It should be easy to implement<= br>>exactly the same way as 'windmove-display-in-direction'
&= gt;selects the old or new window in 'post-command-hook'.
>Ok,= I will post a patch to bug-gnu-emacs.

There seems to be another pro= blem with using display-buffer-alist.
byte-compile-file repeats byte-com= pile, display-warning (this uses display-buffer)
for each S-expression. = Selecting *Compile-log* buffer before finishing byte-compiling the last
= S-expression causes an error. I checked the error using

(defun sele= ct-visible-warning-buffer (_type _message &optional _level buffer-name)=
=C2=A0 "Select the visible warning buffer"
=C2=A0 (unless = buffer-name
=C2=A0 =C2=A0 (setq buffer-name "*Warnings*"))
= =C2=A0 (let ((window (get-buffer-window (get-buffer buffer-name))))
=C2= =A0 =C2=A0 (if window (select-window window))))

(advice-add 'dis= play-warning :after #'select-visible-warning-buffer)

, and byte-= compile causes "Error: End of file during parsing".

displa= y-buffer-alist should affect every display-buffer, so I think
it leads t= o the same error.

I think selecting the *Compile-Log* buffer separat= ely from display-buffer
is easier. I made the attached patch to select *= Compile-Log* buffer
for emacs 29.1 bytecomp.el.


>> I= 9;ll consider a different way.
>
>Until this is pushed, you co= uld use such a simple advice
>that does the same:
>
>(de= fine-advice dired-do-byte-compile (:after (&rest _args) select-window)<= br>> =C2=A0(when-let ((window (get-buffer-window "*Compile-Log*&quo= t; 0)))
> =C2=A0 =C2=A0(select-window window)))

Thanks. I refe= rred to this when I made the above patch.

--000000000000cd7001060d40e89b-- --000000000000cd7004060d40e89d Content-Type: text/x-patch; charset="US-ASCII"; name="bytecomp.patch" Content-Disposition: attachment; filename="bytecomp.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lqjhik5y0 ZGlmZiAtLWdpdCBhL2xpc3AvZW1hY3MtbGlzcC9ieXRlY29tcC5lbCBiL2xpc3AvZW1hY3MtbGlz cC9ieXRlY29tcC5lbAppbmRleCA1ZGYxMjA1ODY5Yy4uYjliNWI5M2QxYTIgMTAwNjQ0Ci0tLSBh L2xpc3AvZW1hY3MtbGlzcC9ieXRlY29tcC5lbAorKysgYi9saXNwL2VtYWNzLWxpc3AvYnl0ZWNv bXAuZWwKQEAgL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