From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tomas Nordin Newsgroups: gmane.emacs.help Subject: Re: Python docstring folding Date: Mon, 26 Nov 2018 18:04:08 +0100 Message-ID: <87zhtvvkhj.fsf@fliptop.i-did-not-set--mail-host-address--so-tickle-me> References: <20181120174557.GA2480@rockop> <5c01f3f8-a9a9-4d73-8cc0-2ec64ad4e88c@default> <20181120191658.GB2480@rockop> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1543252045 20055 195.159.176.226 (26 Nov 2018 17:07:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 26 Nov 2018 17:07:25 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Rock Storm Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Nov 26 18:07:21 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gRKLv-00055w-3R for geh-help-gnu-emacs@m.gmane.org; Mon, 26 Nov 2018 18:07:19 +0100 Original-Received: from localhost ([::1]:37842 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRKO1-0001Kr-7Z for geh-help-gnu-emacs@m.gmane.org; Mon, 26 Nov 2018 12:09:29 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48354) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRKJ0-0006LV-7g for help-gnu-emacs@gnu.org; Mon, 26 Nov 2018 12:04:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRKIu-0001s5-DX for help-gnu-emacs@gnu.org; Mon, 26 Nov 2018 12:04:18 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:59573) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRKIu-0001qx-3i for help-gnu-emacs@gnu.org; Mon, 26 Nov 2018 12:04:12 -0500 Original-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 4F532160061 for ; Mon, 26 Nov 2018 18:04:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1543251849; bh=v7NwCvrFD/oKMz01TMzPxGvSytDQrTuf7GhbMZQL1hQ=; h=From:To:Cc:Subject:Date:From; b=rq2jhpCAV+P5EItMNhvTDXnxfzRrJH8Jy/NSe8DcNpMbgU/GGW44HnrPSCmdvlclb QEbRLDdkyfr6Ly3UcBVqKhLznlwQEl9Bw7MSJbLqtZt1RtE2cFPBV+zJdRuRI11q+Y JGpYA6FycRg+lv1WORwD269vUrVyIPkX6pw5C9dHQGVAgu8yZmx8t0p8VEfX61rgEi 4SksTWQMYJZVkyYMKpH4LyEx9gnW1NSNJzgVy2dNRYFXqLN1PP3OJMC19axQCOFlan rrTYhBX95eegxhzOooZ6iai6sVaZkKklLrTO9Rshl/c8enWyrGcGfm+s7MEpGRRq83 BVhhfF9DRlmZw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 433YD84Xp0z6tm8; Mon, 26 Nov 2018 18:04:08 +0100 (CET) In-Reply-To: <20181120191658.GB2480@rockop> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.67.36.65 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:118765 Archived-At: Rock Storm 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