comint-mime
comint-mime copied to clipboard
Q: should ipython configurations from within emacs be encouraged?
If comint-mime-prefer-svg is non-nil, the ipython config might be overwritten (e.g. ~/.ipython/profile_default/ipython_config.py). Is it desirable for emacs to configure ipython? I guess it maybe is, since most other ipython consoles are "smarter" than emacs these days (e.g. the qtconsole) so maybe you want to reserve ipython_config.py for those? On the other hand, I would find it confusing if my ipython settings are "overwritten" via comint-mime.
Maybe it's fine to just have such config nil by default?
Or maybe it's better to point out how to configure ipython in reasonable ways in docstrings and the README?
That's a tricky question. In principle I'd say the config file should be respected. That said, this file probably includes some "console-dependent" (such as supported image formats) and some "console-independent" settings (such as preferred color schemes), and it's also probably hard to tell the two classes of settings apart from each other.
I don't use an ipython config file, if you could give me some insight on what kind of settings people typically do there it might help with those design questions.
I mostly use it to improve the output of matplotlib_inline tbh. I am not sure what they are generally used for but there's an introduction.
c = get_config()
c.TerminalInteractiveShell.confirm_exit = False
c.InteractiveShellApp.extensions = ["autoreload"]
c.InteractiveShellApp.exec_lines = ["%autoreload 2"]
c.InlineBackend.figure_formats = {"svg"}
c.InlineBackend.print_figure_kwargs = {'bbox_inches': None}
c.InteractiveShellApp.exec_lines = ["%matplotlib inline"]
Maybe it's fine to just have such config nil by default? Or maybe it's better to point out how to configure ipython in reasonable ways in docstrings and the README?
For my use case, I think asking the user to configure IPython would make things harder:
- I regularly use IPython inside Emacs, iTerm2 (with itermplot), and VSCode (via "Jupyter: Create interactive window"). Currently, all of these solutions inject the settings they need, so that I only have to put their common customizationa in my IPython config. If this feature is removed from
comint-mime, I'd have to make a complex config file that detects whether IPython is running in Emacs. - Currently,
comint-mime+trampworks excellent together – even to servers where I haven't pulled down my dotfiles. If this setting injection is removed fromcomint-mime, I'll have to start syncing my dotfiles to all servers to retain the SVG plot feature remotely. Part of the reason I liketrampis that it works well even for remotes that I haven't configured.
My opinion would therefore be that it's perhaps better to keep the current default, where the setting is nil by default but injects some IPython config if the user turns it on?
Okay, I agree with your rationale, @jabirali. In fact, in dREPL I've taken the "settings injection" approach you described to set the shell prompt, and now I'm planning to expand this approach to allow submitting arbitrary configuration options. Of course if a configuration file exists, it will be presumably be read as well, and since the Emacs-injected configuration happens later, it will take precedence.
Since from my perspective everything is clear now (although not necessarily implemented), I will close the issue.
(By the way, if you guys like comint-mime you might like that other package as well ;-)).