* Python docstring folding
@ 2018-11-20 17:45 Rock Storm
2018-11-20 18:12 ` Drew Adams
0 siblings, 1 reply; 4+ messages in thread
From: Rock Storm @ 2018-11-20 17:45 UTC (permalink / raw)
To: help-gnu-emacs
Dear all,
I'm new to Emacs and I'm trying to use it (among other things) as an
IDE for Python development. However I'm struggling with code
folding. I installed 'outline-magic' [1]. Which works great but it
doesn't fold docstrings. This is something that should be addressed in
'python-mode' right? I can't be the first one to stumble across
this. What am I missing? Is there an easy way to achieve docstring
folding? Or should I be using other folding package?
[1]: https://github.com/tj64/outline-magic
Thanks a lot,
--
Rock Storm
GPG KeyID: 4096R/C96832FD
GPG Fingerprint:
C304 34B3 632C 464C 2FAF C741 0439 CF52 C968 32FD
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: Python docstring folding
2018-11-20 17:45 Python docstring folding Rock Storm
@ 2018-11-20 18:12 ` Drew Adams
2018-11-20 19:16 ` Rock Storm
0 siblings, 1 reply; 4+ messages in thread
From: Drew Adams @ 2018-11-20 18:12 UTC (permalink / raw)
To: Rock Storm, help-gnu-emacs
> I'm struggling with code folding. I installed
> 'outline-magic'. Which works great but it doesn't
> fold docstrings... Is there an easy way to achieve
> docstring folding?
What do you mean by folding doc strings? What do you
want that it doesn't do?
If you just want to toggle whether doc strings (only)
are hidden, see this:
http://lists.gnu.org/archive/html/help-gnu-emacs/2018-11/msg00115.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Python docstring folding
2018-11-20 18:12 ` Drew Adams
@ 2018-11-20 19:16 ` Rock Storm
2018-11-26 17:04 ` Tomas Nordin
0 siblings, 1 reply; 4+ messages in thread
From: Rock Storm @ 2018-11-20 19:16 UTC (permalink / raw)
To: Drew Adams; +Cc: help-gnu-emacs
On Tue, Nov 20, 2018 at 10:12:03AM -0800, Drew Adams wrote:
> > I'm struggling with code folding. I installed
> > 'outline-magic'. Which works great but it doesn't
> > fold docstrings... Is there an easy way to achieve
> > docstring folding?
>
> What do you mean by folding doc strings? What do you
> want that it doesn't do?
The behaviour I was expecting would be something similar to what this
plugin does [1].
[1]: https://github.com/alecthomas/SublimeFoldPythonDocstrings
> If you just want to toggle whether doc strings (only)
> are hidden, see this:
>
> http://lists.gnu.org/archive/html/help-gnu-emacs/2018-11/msg00115.html
Thanks a lot for the hint. I'll try that. However, isn't there a less
complicated way of doing it? Is it so uncommon? How did Python
developers live before you provided them with this? :P
Thanks again,
--
Rock Storm
GPG KeyID: 4096R/C96832FD
GPG Fingerprint:
C304 34B3 632C 464C 2FAF C741 0439 CF52 C968 32FD
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Python docstring folding
2018-11-20 19:16 ` Rock Storm
@ 2018-11-26 17:04 ` Tomas Nordin
0 siblings, 0 replies; 4+ messages in thread
From: Tomas Nordin @ 2018-11-26 17:04 UTC (permalink / raw)
To: Rock Storm; +Cc: help-gnu-emacs
Rock Storm <rockstorm@gmx.com> writes:
> On Tue, Nov 20, 2018 at 10:12:03AM -0800, Drew Adams wrote:
>> > I'm struggling with code folding. I installed
>> > 'outline-magic'. Which works great but it doesn't
>> > fold docstrings... Is there an easy way to achieve
>> > docstring folding?
>>
>> What do you mean by folding doc strings? What do you
>> want that it doesn't do?
>
> The behaviour I was expecting would be something similar to what this
> plugin does [1].
>
> [1]: https://github.com/alecthomas/SublimeFoldPythonDocstrings
>
>> If you just want to toggle whether doc strings (only)
>> are hidden, see this:
>>
>> http://lists.gnu.org/archive/html/help-gnu-emacs/2018-11/msg00115.html
>
> Thanks a lot for the hint. I'll try that. However, isn't there a less
> complicated way of doing it? Is it so uncommon? How did Python
> developers live before you provided them with this? :P
If it is OK to "simply" split windows maybe this is less complicated to
install:
(defun tn-split-window-signature-on-top (&optional numlines)
"Split window at point leaving minimum 2 lines of defun beginning on top"
(interactive "p")
(let ((start-pos (point))
(start-line (line-number-at-pos))
(toplines (if (> numlines 1) numlines 2)))
(beginning-of-defun)
(split-window-below (1+ toplines))
(window-resize nil (- toplines (window-body-height)))
(recenter 0)
(other-window 1)
(goto-char start-pos)
(recenter 0)))
Should work with any function understood as a defun. You can control how
much of the beginning of the defun to show with a numeric prefix
argument (like C-u). I find it comfortable that point will remain on its
current position in the lower window (at the moment you forgot about
arguments).
Best regards
--
Tomas
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-11-26 17:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-20 17:45 Python docstring folding Rock Storm
2018-11-20 18:12 ` Drew Adams
2018-11-20 19:16 ` Rock Storm
2018-11-26 17:04 ` Tomas Nordin
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.