Closed shipmints closed 3 months ago
Sorry for the delay to reply. What does the entire (format ...)
for evaluates to? (You can try with C-x C-e
.) Whatever the result is, it should be a command your shell (I suppose that's zsh) understands. I'm suspecting it might be related to relative versus absolute file names.
Should there be a progn else clause?
No, see C-h f if RET
for more info on the if
syntax.
Using bash
over here across all platforms. Old fashioned, perhaps, but reliably ubiquitous. The expansions are nearly identical and the "." should work.
" . /Users/shipmints/.emacs.d/elpa/comint-mime-0.4/comint-mime.sh "
"source /Users/shipmints/.emacs.d/elpa/comint-mime-0.4/comint-mime.sh "
While I was typing this and thinking it through, I realized what the issue is, and it is one that will bite other people. I have a bash
alias alias .='cd ..'
and this is what gets executed by the command. Adding a single backslash avoids invoking the alias. I would happily delete the alias BUT I'd prefer to keep it as an edge case, should this come up again with other programs.
(format "\\. %s\n" (shell-quote-argument
I tested this just now and it works. I believe the backslash approach is portable and innocuous.
Ah, makes sense! But what does the backslash mean? The trick I know to avoid these problems would be to use
(format " command . %s\n" (shell-quote-argument
(If you wonder what the space at the beginning means, check out the HISTCONTROL=ignorespace
option.)
Or maybe, now that I found this explanation, I think I'm going to pick this one as a less weird alternative:
(format " '.' %s\n" (shell-quote-argument
If you could do a quick test it would be great. Thanks for figuring it out!
That works. The backslash syntax is well documented for avoiding alias expansion, too.
For future readers, it might pay to put in a comment about both the leading space and the quotes.
Let me know when comint-mime is updated in elpa and I'll remove my workaround. Cheers.
Quick ping on publishing to [m]elpa when you get a chance. Thank you.
Done, thanks for the ping.
Greetings and thank you for this package and your other work.
code-cells
is on deck for me also. Tryingcomint-mime
out to see if I can get python-based plots into shell buffers and avoid web-based outputs. (Perhaps some day, a decent web component might live natively in Emacs and we could have a more natural symbiotic Emacs/web ecosystem. I've looked at https://github.com/emacs-eaf but it requires X11 and I'm on a Mac nearly 100% of the time.)While testing
comint-mime
on Emacs 29, which now defaults to OSC 7 ANSI escape code directory tracking enabled incomint-mode
and using bash with PROMPT_COMMAND appropriately set, I've found thatcomint-mime-setup-shell
is broken in two ways:It interferes with the initial
shell-mode
OSC 7 sequence and the child shell winds up in the wrongdefault-directory
.mimecat fails to load.
While attempting to narrow down what's going on, and failing to completely understand what is actually happening, I was able to force it to work by overriding
comint-mime-setup-shell
with my own that has only this change which addresses both issues:This change will screw up shells that support only
.
. I don't understand why this works. I tried several attempts to see if there was a race condition or something else that would cause this, to no avail.Also, there might be a secondary bug. Should there be a
progn
else clause?