From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#54296: Add buffer-matching functionality Date: Fri, 17 Jun 2022 16:39:27 +0300 Message-ID: <5f9c69a7-cf8c-0893-14a0-29f47954ed24@yandex.ru> References: <87ee3d4cli.fsf@posteo.net> <87k0d35c82.fsf@gnus.org> <877d92unqn.fsf@posteo.net> <83bkyednvx.fsf@gnu.org> <87cziudmyg.fsf@posteo.net> <838rtheogd.fsf@gnu.org> <87ilskbgul.fsf@posteo.net> <83ilskcp9i.fsf@gnu.org> <87v8whio1a.fsf@posteo.net> <83czipkylw.fsf@gnu.org> <87pmmp9c63.fsf@posteo.net> <83v8wgk7tn.fsf@gnu.org> <87sfrk3b86.fsf@posteo.net> <834k0ovket.fsf@gnu.org> <5eb376b4-5f7e-6b00-286a-8bd0950dae22@yandex.ru> <83pmjbrsiu.fsf@gnu.org> <6dd7e47d-4115-7e2c-4ee0-d4e00f684a90@yandex.ru> <83ilp2sljp.fsf@gnu.org> <835yl2rrl1.fsf@gnu.org> <9ea1c445-a21e-8ac7-faae-49e01c7d4d12@yandex.ru> <83zgidrjdr.fsf@gnu.org> <18bc3bbe-4051-cf93-6c27-291240353c9f@yandex.ru> <83tu8lrg1c.fsf@gnu.org> <22f2446f-295c-09bd-6229-6b3de3509d0a@yandex.ru> <83k09hqhp4.fsf@gnu.org> <83o7yrq1q7.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39465"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Cc: 54296@debbugs.gnu.org, philipk@posteo.net, larsi@gnus.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 17 15:40:36 2022 Return-path: Envelope-to: geb-bug-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 1o2CDE-000A2U-5d for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 17 Jun 2022 15:40:36 +0200 Original-Received: from localhost ([::1]:35672 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o2CDC-0003oF-TX for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 17 Jun 2022 09:40:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46068) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o2CCo-0003mb-Bo for bug-gnu-emacs@gnu.org; Fri, 17 Jun 2022 09:40:10 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50560) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o2CCg-0001yk-Kk for bug-gnu-emacs@gnu.org; Fri, 17 Jun 2022 09:40:09 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o2CCg-0005Po-FL for bug-gnu-emacs@gnu.org; Fri, 17 Jun 2022 09:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 Jun 2022 13:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54296 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 54296-submit@debbugs.gnu.org id=B54296.165547317920773 (code B ref 54296); Fri, 17 Jun 2022 13:40:02 +0000 Original-Received: (at 54296) by debbugs.gnu.org; 17 Jun 2022 13:39:39 +0000 Original-Received: from localhost ([127.0.0.1]:44455 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o2CCI-0005Oy-CZ for submit@debbugs.gnu.org; Fri, 17 Jun 2022 09:39:39 -0400 Original-Received: from mail-ed1-f44.google.com ([209.85.208.44]:45990) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o2CCF-0005Oa-AR for 54296@debbugs.gnu.org; Fri, 17 Jun 2022 09:39:36 -0400 Original-Received: by mail-ed1-f44.google.com with SMTP id d14so6210263eda.12 for <54296@debbugs.gnu.org>; Fri, 17 Jun 2022 06:39:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=r7in7iHfSGlyg6JqmMmVH2muNGYI0Fe/4UggZv+EsJo=; b=m6j20jTT05p+yRNGa0TIN5qbtG9WePchqaNUjWu6frPTJFg+7A3tm7IZ7lloK9/L68 /J0hk00WWRgRooqFS0H6PBfu7Ug3mO3VlGbBT7TNhr4VdDJ/z6mcC5/B14LPMX5G+ZSe eTZrwADviB9jXtG2hYbFMgsyHdnlsKvP/wmKArhHfXHojQ4WR6uwx5Ry52fpmntiOfs+ YbvA5dOYFoDvOPpClde3S3Uhc8u/GwGNE0ZoRxF95eIFzhx9l1XTU0iDxcOOlp6P/49p cEvsyCgS9D0IdkijzRpJM4ESuykQFDp4weq8+U5KvtH5WKtAlLYy8o5Q2MdpcPhHCxqQ l8yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :subject:content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=r7in7iHfSGlyg6JqmMmVH2muNGYI0Fe/4UggZv+EsJo=; b=U16X0ytb7/lRPnxHd+k0bRtsH1VwjOlqiIxBgywEVqWOPlB99moXgzg2W8nmArtqJW i4T3m7wB8ZFgzsZZ4hj1zbaK5TsbbZNFmAKglwdlTgCM42sPtXZk0DwpwCfWGuW0l6GE fF0G21y09yWutV+TGtWha7+r3LB5/5sZ81VgyJlcitb8dM5iwplyuzd7jMQTiBmjgF2m W3Lw9gQFa7zsuwg1tvJe207eoOgzyKg08Ko2Kxucetk/3Oo3SSZ4ZlD6e6EIhs53lHFh jY9y67EY84I/s6nLalsoiEgvgHrGD/h0egCbvQIMV5ex5tBVi8ebhg9hJmu79jPqdWz+ E6zw== X-Gm-Message-State: AJIora+IzXIwqznysVTnYqxiMfpPwkv0oL/iD/a2VJhxLbOhulubHhps eVO3ZzDEHb9mZmLUhVgn2fU= X-Google-Smtp-Source: AGRyM1uxCadE7fCTw0FlaPfGj0Gu9V92fts6eS5Ze0IHTQDiVufXamiufOHO38ze36RT/7sfpLEBIA== X-Received: by 2002:a05:6402:4490:b0:435:640c:2abb with SMTP id er16-20020a056402449000b00435640c2abbmr2955791edb.301.1655473169493; Fri, 17 Jun 2022 06:39:29 -0700 (PDT) Original-Received: from [192.168.236.48] ([173.237.64.48]) by smtp.googlemail.com with ESMTPSA id z19-20020a056402275300b004319b12371asm3982175edd.47.2022.06.17.06.39.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jun 2022 06:39:28 -0700 (PDT) Content-Language: en-US In-Reply-To: <83o7yrq1q7.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:234692 Archived-At: On 17.06.2022 08:48, Eli Zaretskii wrote: >> Date: Fri, 17 Jun 2022 04:21:04 +0300 >> Cc: 54296@debbugs.gnu.org, philipk@posteo.net, larsi@gnus.org >> From: Dmitry Gutov >> >>> In any case, if we will keep both major-mode and derived-mode >>> conditions in subr.el, let's at least document that derived-mode >>> should be preferred where it can do the job, and major-mode used only >>> where derived-mode will not DTRT. >> >> Sure. Here you go. > > Fine with me, with one nit: > >> +Satisfied if the buffer's major mode is eq to @var{expr}. Prefer > > Using "eq" as a word in the manual is not a good idea. We use "is > equal" elsewhere in the manual. Thanks, done. Backward compatibility and capability are restored. Now, if we wanted to downplay the option of doing equality comparison for major-mode, we could perhaps introduce a more general condition like 'value-equal'. That would change the definition of project-kill-buffer-conditions very slightly, still keeping it readable. And a gradual deprecation of the 'major-mode' matcher could be done. diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 30f51704dc..dea11d4231 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1223,10 +1223,10 @@ project-display-buffer-other-frame (defcustom project-kill-buffer-conditions '(buffer-file-name ; All file-visiting buffers are included. ;; Most of the temp buffers in the background: - (major-mode . fundamental-mode) + (value-equal major-mode . fundamental-mode) ;; non-text buffer such as xref, occur, vc, log, ... (and (derived-mode . special-mode) - (not (major-mode . help-mode))) + (not (value-equal major-mode . help-mode))) (derived-mode . compilation-mode) (derived-mode . dired-mode) (derived-mode . diff-mode)