all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Philip Kaludercic <philipk@posteo.net>
Cc: "Eli Zaretskii" <eliz@gnu.org>,
	58839@debbugs.gnu.org, manuel.uberti@inventati.org,
	"João Távora" <joaotavora@gmail.com>
Subject: bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running
Date: Tue, 1 Nov 2022 21:50:17 +0200	[thread overview]
Message-ID: <39e79ad3-66df-3aa9-cc3f-c5868bfbc6a2@yandex.ru> (raw)
In-Reply-To: <87bkpqecpv.fsf@posteo.net>

On 01.11.2022 20:44, Philip Kaludercic wrote:

>> Sure, but only after we're ready to drop project.el support for Emacs
>> older than 29.
> 
> The functionality can be provided using Compat[0], as is already done for a
> few core package that are distributed on GNU ELPA (ERC, python-mode).
> 
> [0] https://elpa.gnu.org/packages/compat.html

I suppose if the performance improvement is shown to be significant, we 
could. I'm a little hesitant to add a new dependency: I haven't been 
following this package, not sure how stable it is.

>>> diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
>>> index ac278edd40..b55c245368 100644
>>> --- a/lisp/progmodes/project.el
>>> +++ b/lisp/progmodes/project.el
>>> @@ -352,15 +352,28 @@ project--remote-file-names
>>>                    (concat remote-id file))
>>>                  local-files))))
>>>    +(defun project-includes-buffer-p (buffer dir)
>>> +  "Return non-nil if the `default-directory' of BUFFER is below DIR."
>>> +  (file-in-directory-p
>>> +   (buffer-local-value 'default-directory buffer)
>>> +   dir))
>>
>> Not an optimal name, given that we have made project-buffers a generic
>> function, so that a custom project backend can define their own
>> buffer-listing strategy. And this one implies that matching by
>> default-directory is universal.
> 
> Right, as I said this is just a sketch.
> 
> But as the diff showed, I think any more specific implementation ought
> to extend the generic implementation, by using `cl-call-next-method'
> instead of `buffer-list'.

Or apply the same filters some other way, I guess. But yes, the 
cl-call-next-method call makes sense in your patch.

>>> +(defcustom project-buffer-conditions
>>
>> Why not keep considering unknown buffers as part of project by default?
> 
> What are "unknown buffers"?

Take whatever special buffer belonging to jsonrpc that was the cause of 
this bug report. It can still be useful to be able switch to it using 
project-switch-to-buffer (if, say, one was looking for the specific 
buffer to try to debug a problem with some Eglot feature in their 
project). We don't want to kill it with the rest of the buffers, 
however. Apparently.

>> We'll just stop killing them on cleanup.
>>
>> Otherwise, we'll really need an extensible mechanism for major modes
>> all around the ecosystem to tag themselves as project-visible.
> 
> Wouldn't a simple buffer local variable suffice?

I guess it will. Only with a more meaningful name than 'project-owned' 
and some proper documentation.

>>> +  '(and (or buffer-file-name
>>> +            (derived-mode . compilation-mode)
>>> +            (derived-mode . dired-mode)
>>> +            (derived-mode . diff-mode)
>>> +            (derived-mode . comint-mode)
>>> +            (derived-mode . eshell-mode)
>>> +            (derived-mode . change-log-mode))
>>> +        project-includes-buffer-p)
>>> +  "A buffer predicate for matching what buffers belong to a project."
>>> +  :type 'buffer-predicate)
>>
>> Let's not forget Xref, Occur, VC-Dir, Log-View. Maybe some others.
> 
> This is my point, I think João is right that this ought to be an
> enumeration of major modes that are related to projects.  As this is a
> user option, users can add or remove whatever modes they disagree on and
> that behaviour would ideally be propagated to all projects.

Being to customize it is a good thing.

But either we provide a reasonably complete list which we regularly 
update, or we say its completeness is up to the user.

And in the latter case, as soon as the user customizes the var, they 
stop getting any updates we might make to it later (to the default value).

And if we take the strict "whitelist" approach, I'm pretty sure the list 
will require updating in the future, it will never be complete.





  reply	other threads:[~2022-11-01 19:50 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-28 12:56 bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running Philip Kaludercic
2022-10-28 17:17 ` bug#58839: [Patch] " João Távora
2022-10-28 17:28   ` Philip Kaludercic
2022-10-28 17:36     ` João Távora
2022-10-28 18:14     ` Dmitry Gutov
2022-10-28 18:20       ` Philip Kaludercic
2022-10-28 18:30         ` João Távora
2022-10-28 18:40         ` Dmitry Gutov
2022-10-29  0:15           ` João Távora
2022-10-29  1:09             ` Dmitry Gutov
2022-10-29  1:39               ` João Távora
2022-10-29 11:27                 ` Dmitry Gutov
2022-10-29 12:16                   ` João Távora
2022-10-29 14:32                     ` Philip Kaludercic
2022-10-29 20:38                       ` João Távora
2022-10-29 22:01                         ` Philip Kaludercic
2022-10-29 22:49                           ` João Távora
2022-10-30  6:28                             ` Eli Zaretskii
2022-10-30 12:40                               ` João Távora
2022-10-30 15:58                               ` Dmitry Gutov
2022-10-30 16:39                                 ` Eli Zaretskii
2022-10-30 19:13                                   ` Dmitry Gutov
2022-10-30 19:54                                     ` Eli Zaretskii
2022-10-30 21:15                                       ` Dmitry Gutov
2022-10-31  9:53                                 ` João Távora
2022-10-31 11:56                                   ` João Távora
2022-10-31 17:11                                     ` Dmitry Gutov
2022-10-31 20:36                                       ` João Távora
2022-10-31 22:26                                         ` Dmitry Gutov
2022-10-31 22:51                                           ` João Távora
2022-10-31 14:35                                   ` Philip Kaludercic
2022-10-31 17:33                                     ` Dmitry Gutov
2022-10-31 23:19                                     ` João Távora
2022-11-01 10:51                                       ` Philip Kaludercic
2022-11-01 13:22                                       ` Dmitry Gutov
2022-11-01 13:39                                         ` João Távora
2022-10-31 17:24                                   ` Dmitry Gutov
2022-10-31 20:58                                     ` João Távora
2022-10-31 22:51                                       ` Dmitry Gutov
2022-11-01 10:48                                         ` Philip Kaludercic
2022-11-01 10:59                                           ` João Távora
2022-11-01 11:23                                             ` Dmitry Gutov
2022-11-01 11:39                                               ` João Távora
2022-11-01 15:27                                                 ` Dmitry Gutov
2022-11-01 16:23                                                   ` João Távora
2022-11-01 22:24                                                     ` Dmitry Gutov
2022-11-02  7:40                                                       ` João Távora
2022-11-01 11:27                                             ` Philip Kaludercic
2022-11-01 11:59                                               ` João Távora
2022-11-01 13:03                                                 ` Philip Kaludercic
2022-11-01 13:37                                                   ` João Távora
2022-11-01 14:00                                                     ` Philip Kaludercic
2022-11-01 14:11                                                       ` João Távora
2022-11-01 14:36                                                         ` Philip Kaludercic
2022-11-02  7:19                                                           ` João Távora
2022-11-02  7:29                                                             ` Philip Kaludercic
2022-11-02  7:48                                                               ` João Távora
2022-11-02  8:21                                                                 ` Philip Kaludercic
2022-11-02  8:41                                                                   ` João Távora
2022-11-02  9:06                                                                     ` Philip Kaludercic
2022-11-02  9:52                                                                       ` João Távora
2022-11-02 11:31                                                                         ` Philip Kaludercic
2022-11-01 15:26                                               ` Dmitry Gutov
2022-11-01 18:44                                                 ` Philip Kaludercic
2022-11-01 19:50                                                   ` Dmitry Gutov [this message]
2022-11-01 20:10                                                     ` Philip Kaludercic
2022-11-01 22:40                                                       ` Dmitry Gutov
2022-11-01 11:36                                         ` João Távora
2022-11-01 22:23                                           ` Dmitry Gutov
2022-11-02  7:34                                             ` João Távora
2022-11-02  8:36                                               ` Philip Kaludercic
2022-11-02  8:50                                                 ` João Távora
2022-11-02  9:13                                                   ` Philip Kaludercic
2022-11-02 14:00                                                     ` João Távora
2022-11-02 14:42                                                       ` Philip Kaludercic
2022-11-02 17:32                                                         ` Juri Linkov
2022-11-03 17:30                                                           ` Juri Linkov
2022-11-03 18:19                                                             ` João Távora
2022-11-02 18:16                                                         ` João Távora
2022-11-04  1:13                                           ` Dmitry Gutov
2022-11-04 11:21                                     ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-05  0:53                                       ` Dmitry Gutov
2022-10-29  6:38               ` Philip Kaludercic
2022-10-29 10:59                 ` Dmitry Gutov
2022-10-29 11:12                   ` João Távora
2022-10-29 11:05                 ` João Távora

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=39e79ad3-66df-3aa9-cc3f-c5868bfbc6a2@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=58839@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=manuel.uberti@inventati.org \
    --cc=philipk@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.