bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#41858: 28.0.50; [PATCH]: Make project-shell use universal argument


From: Theodor Thornhill
Subject: bug#41858: 28.0.50; [PATCH]: Make project-shell use universal argument
Date: Mon, 15 Jun 2020 06:50:53 +0000

Hi, and thanks for looking at the code!

"Juri Linkov" <juri@linkov.net> writes:

[...]
> Thanks, it's a nice idea to prepend the project root dir name
> to the shell buffer name.

Cool!

[...]
> So eventually I arrived to the following line for the init file:
>
>   (add-hook 'shell-mode-hook 'rename-uniquely)
>
> that just appends a number to the buffer name,
> so your patch won't affect my usage at all,
> I'll continue getting new shell buffers every time
> after 'M-x project-shell'.
>
How about we just add this behaviour instead of appending the file-path? so we 
get the "<n>" appended to the shell buffer names. Then you can remove that line 
from init :)

> Regarding the C-u argument, I don't know maybe someone might want
> to use it.  But shouldn't the C-u argument of 'project-shell' be
> more compatible with the C-u argument of 'shell' in its behaviour?

I kind of agree, though it seems like the original "project-shell" was intended 
to be used only interactively. I kind of view it as a specialized case of 
"shell", maybe as a sort of "shell-dwim" but only for a very limited case. We 
are always free of course to add a normal shell buffer in root, and use it 
non-interactively in code.

However, I can add an "&optional buffer" argument to the code and do like it's 
done in "shell". It just seems like it is complicating the behaviour a little 
bit. What do you think?

In addition, how do I then avoid duplication of code between the interactive 
call and the default behaviour? Specifically, I am thinking of the 
'default-directory' which is not set. I guess I have to set that twice then?

> Another possible point for better consistency between them
> is to use 'pop-to-buffer' (like in 'shell') instead of
> 'switch-to-buffer-other-window'.

Agreed. Done.

I've attached another patch for you to look at, with only the easy changes, 
awaiting some feedback on the other parts :)

Thanks again,

Theodor

Attachment: project-shell.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]