Did you either succeed with debugpy.listen()? Is that suitable to call interactively then quit (like iPDB)?
M-x find-library python
, followed by C-s outline-
shows what's happening: python-base-mode
sets the local outline variables locally, in its mode body. Since mode hooks always run after the body of their mode definitions, you could add a bit of code to the python-base-mode-hook
(or a parent of it, like prog-mode-hook
) setting your desired outline config there (i.e. overwriting what python mode did).
I do that using outli simply (in a use-package stanza):
:hook ((prog-mode text-mode) . outli-mode))
BTW, here's a handy guide (from this epic answer) to what runs in which order upon invoking a derived major mode like python-ts-mode
:
So when we call (child-mode), the full sequence is:
(run-hooks 'change-major-mode-hook) ;; actually the first thing done by
(kill-all-local-variables) ;; <-- this function
,@grandparent-body
,@parent-body
,@child-body
(run-hooks 'change-major-mode-after-body-hook)
(run-hooks 'grandparent-mode-hook)
(run-hooks 'parent-mode-hook)
(run-hooks 'child-mode-hook)
(run-hooks 'after-change-major-mode-hook)
Not sure your definition of easy, but this kind of setup (and much more) is certainly possible: https://www.masteringemacs.org/article/demystifying-emacs-window-manager
Start with the Elisp intro; it’s great. M-x shortdoc buffer gives a nice overview of buffer commands. I love consult-info for general searching of the Elisp (and other) info files. But M-x apropos-function is builtin and useful too.
No need for a package, this is a great chance to learn some elisp. To get you started:
(let ((cur (current-indentation)))
(push-mark nil t t)
(while (and (not (eobp)) (= (current-indentation) cur))
(forward-line 1)))
Seems like in-process debuggers like iPDB are far more practical for interactive debugging of long running shells.
How would you attach a DAP python debugger to a running instance of (i)Python? Is there some import debugpy; debugpy.start() command or similar?
Set a window-configuration-change-hook
temporarily, see if the (selected-frame)
matches. If so do the split, and remove the hook.
When I hear of a package that may be interesting, I immediately check its repo page to see how many issues and PRs are still open. I look to see whether they have garnered any responses, especially if the submissions are of high quality. Years of issues building up isn't a good sign. This isn't 100% reliable, as different skilled developers approach issues and PRs quite differently, but it gives you some information. And there are outliers, like multiple-cursors, whose developer is very skilled and motivated, but whose popularity overwhelmed his resources.
For simple package, "no updates" for 5 years is usually fine. But before investing energy in a larger new package, I want to know whether it will still be working well in the next 5 years.
There are a variety of "self-quoting" constructs in elisp (including all :keywords
!).
(eq (quote nil) nil) ; ==> t
(eq (quote t) t) ; ==> t
(eq (quote :some-keyword) :some-keyword) ; ==> t
Outline mode works well for this. I use my own small outli package to set this up automatically with nice formatting and “speed key” access at the beginning of headlines. Tab to fold.
Note that
debug-on-error
is disabled for process filter functions and post-command hooks:You can turn error debugging back for culprit functions; see this gist.