Closed waymondo closed 11 months ago
Thank you for the pull request!
However, to keep the number of arguments passed to mistty-create manageable, I'd prefer it if you first created the buffer, then renamed it, since it is possible. The temporary name shouldn't be user visible:
(defun project-mistty ()
(interactive)
(let* ((default-directory (project-root (project-current t)))
(default-project-mistty-name (project-prefixed-buffer-name "mistty"))
(mistty-buffer (get-buffer default-project-mistty-name)))
(if (and mistty-buffer (not current-prefix-arg))
(pop-to-buffer mistty-buffer display-comint-buffer-action)
(with-current-buffer (mistty-create)
(rename-buffer (generate-new-buffer-name default-project-mistty-name))))))
The hook mistty-mode-hook
would normally be a good time to rename a buffer or change its default-directory
, if you wanted to do it all the time instead of when a specific command is called.
It looks like a pretty useful function, by the way! Maybe there should be a mistty-project.el to make it generally available.
One unrelated inconsistency I see is that mistty-create will switch to the buffer without using display-comint-buffer-action. It probably should. You should also probably have access to a function that doesn't display the buffer so you can do it yourself the way you want.
your solution definitely works for me! it didn't feel elegant to just tack on an additional argument to get passed around anyways.
It looks like a pretty useful function, by the way! Maybe there should be a mistty-project.el to make it generally available.
if you wanted to include a mistty-project.el
file in this repo with this, feel free to add it, or i could draft up a PR. if not, i'm fine with keeping it in my .emacs.d
.
One unrelated inconsistency I see is that mistty-create will switch to the buffer without using display-comint-buffer-action. It probably should. You should also probably have access to a function that doesn't display the buffer so you can do it yourself the way you want.
both points makes sense to me, good thinking!
Very nice. I've been toying with misTTY for the last couple days and I've just remapped project-shell
to project-mistty
to give it a go for day-to-day work.
Thanks for the new package @szermatt! It's always cool to see new ideas in Emacs.
if you wanted to include a mistty-project.el file in this repo with this, feel free to add it, or i could draft up a PR.
Thanks! I ended up creating mistty-project.el at commit 505f664 which introduces the command mistty-in-project
.
really cool package! i'm trying it out as a replacement for how i use
vterm
and it's going well so far.i like to have one main term-ish buffer per project (git repo). i do this with a custom defun in my
.emacs.d
that allows me to find or create a buffer based on the default directory of the current project root. currently i can't easily do this asmistty-create
always generates a buffer named*mistty*
. after this change, i'm able to rewrite my custom defun usingproject.el
as:this PR was just the easiest way to accommodate for this. if you have a different implementation idea, please feel free to override this change, but i think it might be good to allow customizing the buffer name so one can more easily pop to specific mistty buffers.