From andreas.roehler at online.de Sat Nov 10 04:52:20 2018 From: andreas.roehler at online.de (=?UTF-8?Q?Andreas_R=c3=b6hler?=) Date: Sat, 10 Nov 2018 10:52:20 +0100 Subject: [Python-mode] Simplifying python-mode.el Message-ID: <2fa889d6-bae6-b757-ec31-c8d29fb5fc8e@online.de> Hi folks, consider to simplify python-mode.el core a little bit, removing presumely unused forms. For example reduce the number of addressed executables: keeping python3 and python2, but removing python2.7. Respective at IPythons side. Several minor changes already done these days. Please don't hesitate to tell us should something unwanted happen. Cheers, Andreas https://gitlab.com/groups/python-mode-devs From andreas.roehler at online.de Mon Nov 12 06:15:32 2018 From: andreas.roehler at online.de (=?UTF-8?Q?Andreas_R=c3=b6hler?=) Date: Mon, 12 Nov 2018 12:15:32 +0100 Subject: [Python-mode] Simplifying - drop decorator special forms Message-ID: <805091d8-0a76-21d5-381e-4c07ddb7d9b8@online.de> Hi, as decorators are part of function definitions, consider to drop all special handling. Beginning of def-or-class would reach the decorator - same with mark, copying and send. Just FYI, Andreas From barry at python.org Mon Nov 12 16:58:40 2018 From: barry at python.org (Barry Warsaw) Date: Mon, 12 Nov 2018 13:58:40 -0800 Subject: [Python-mode] Simplifying - drop decorator special forms In-Reply-To: <805091d8-0a76-21d5-381e-4c07ddb7d9b8@online.de> References: <805091d8-0a76-21d5-381e-4c07ddb7d9b8@online.de> Message-ID: On Nov 12, 2018, at 03:15, Andreas R?hler wrote: > > as decorators are part of function definitions, consider to drop all special handling. Beginning of def-or-class would reach the decorator - same with mark, copying and send. Is it possible to use C-u to choose whether to go to the first decorator or the function definition? Remember, you can have a bunch of function decorators, not just one. So going to the first decorator could put you way off from where you expect. E.g. if you use click, from Mailman 3: @click.command( cls=I18nCommand, context_settings=dict(help_option_names=['-h', '--help']), help=_("""\ Master subprocess watcher. Start and watch the configured runners, ensuring that they stay alive and kicking. Each runner is forked and exec'd in turn, with the master waiting on their process ids. When it detects a child runner has exited, it may restart it. The runners respond to SIGINT, SIGTERM, SIGUSR1 and SIGHUP. SIGINT, SIGTERM and SIGUSR1 all cause a runner to exit cleanly. The master will restart runners that have exited due to a SIGUSR1 or some kind of other exit condition (say because of an uncaught exception). SIGHUP causes the master and the runners to close their log files, and reopen then upon the next printed message. The master also responds to SIGINT, SIGTERM, SIGUSR1 and SIGHUP, which it simply passes on to the runners. Note that the master will close and reopen its own log files on receipt of a SIGHUP. The master also leaves its own process id in the file specified in the configuration file but you normally don't need to use this PID directly.""")) @click.option( '-C', '--config', 'config_file', envvar='MAILMAN_CONFIG_FILE', type=click.Path(exists=True, dir_okay=False, resolve_path=True), help=_("""\ Configuration file to use. If not given, the environment variable MAILMAN_CONFIG_FILE is consulted and used if set. If neither are given, a default configuration file is loaded.""")) @click.option( '--no-restart', '-n', 'restartable', is_flag=True, default=True, help=_("""\ Don't restart the runners when they exit because of an error or a SIGUSR1. Use this only for debugging.""")) @click.option( '--force', '-f', is_flag=True, default=False, help=_("""\ If the master watcher finds an existing master lock, it will normally exit with an error message. With this option,the master will perform an extra level of checking. If a process matching the host/pid described in the lock file is running, the master will still exit, requiring you to manually clean up the lock. But if no matching process is found, the master will remove the apparently stale lock and make another attempt to claim the master lock.""")) @click.option( '--runners', '-r', metavar='runner[:slice:range]', callback=validate_runner_spec, default=None, multiple=True, help=_("""\ Override the default set of runners that the master will invoke, which is typically defined in the configuration file. Multiple -r options may be given. The values for -r are passed straight through to bin/runner.""")) @click.option( '-v', '--verbose', is_flag=True, default=False, help=_('Display more debugging information to the log file.')) @click.version_option(MAILMAN_VERSION_FULL) @public def main(config_file, restartable, force, runners, verbose): # ?. Cheers, =Barry -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: Message signed with OpenPGP URL: From barry at python.org Mon Nov 12 17:05:47 2018 From: barry at python.org (Barry Warsaw) Date: Mon, 12 Nov 2018 14:05:47 -0800 Subject: [Python-mode] Simplifying python-mode.el In-Reply-To: <2fa889d6-bae6-b757-ec31-c8d29fb5fc8e@online.de> References: <2fa889d6-bae6-b757-ec31-c8d29fb5fc8e@online.de> Message-ID: On Nov 10, 2018, at 01:52, Andreas R?hler wrote: > > For example reduce the number of addressed executables: keeping > python3 and python2, but removing python2.7. Respective at IPythons > side. Several minor changes already done these days. `/usr/bin/python2` doesn?t exist everywhere, unfortunately. Since Python 2.7 will EOL in January 2020, maybe that?s the time to remove python2.7? -Barry -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: Message signed with OpenPGP URL: From andreas.roehler at online.de Tue Nov 13 07:38:45 2018 From: andreas.roehler at online.de (=?UTF-8?Q?Andreas_R=c3=b6hler?=) Date: Tue, 13 Nov 2018 13:38:45 +0100 Subject: [Python-mode] Simplifying - drop decorator special forms In-Reply-To: References: <805091d8-0a76-21d5-381e-4c07ddb7d9b8@online.de> Message-ID: <14106675-7a7e-2318-d683-4b2de8192476@online.de> On 12.11.2018 22:58, Barry Warsaw wrote: > On Nov 12, 2018, at 03:15, Andreas R?hler wrote: >> >> as decorators are part of function definitions, consider to drop all special handling. Beginning of def-or-class would reach the decorator - same with mark, copying and send. > > Is it possible to use C-u to choose whether to go to the first decorator or the function definition? Sure. Probably a defcustom py-include-decorators-p might be useful too. Remember, you can have a bunch of function decorators, not just one. So going to the first decorator could put you way off from where you expect. > > E.g. if you use click, from Mailman 3: > > @click.command( > cls=I18nCommand, > context_settings=dict(help_option_names=['-h', '--help']), > help=_("""\ > Master subprocess watcher. > > Start and watch the configured runners, ensuring that they stay alive and > kicking. Each runner is forked and exec'd in turn, with the master waiting > on their process ids. When it detects a child runner has exited, it may > restart it. > > The runners respond to SIGINT, SIGTERM, SIGUSR1 and SIGHUP. SIGINT, > SIGTERM and SIGUSR1 all cause a runner to exit cleanly. The master will > restart runners that have exited due to a SIGUSR1 or some kind of other > exit condition (say because of an uncaught exception). SIGHUP causes the > master and the runners to close their log files, and reopen then upon the > next printed message. > > The master also responds to SIGINT, SIGTERM, SIGUSR1 and SIGHUP, which it > simply passes on to the runners. Note that the master will close and > reopen its own log files on receipt of a SIGHUP. The master also leaves > its own process id in the file specified in the configuration file but you > normally don't need to use this PID directly.""")) > @click.option( > '-C', '--config', 'config_file', > envvar='MAILMAN_CONFIG_FILE', > type=click.Path(exists=True, dir_okay=False, resolve_path=True), > help=_("""\ > Configuration file to use. If not given, the environment variable > MAILMAN_CONFIG_FILE is consulted and used if set. If neither are given, a > default configuration file is loaded.""")) > @click.option( > '--no-restart', '-n', 'restartable', > is_flag=True, default=True, > help=_("""\ > Don't restart the runners when they exit because of an error or a SIGUSR1. > Use this only for debugging.""")) > @click.option( > '--force', '-f', > is_flag=True, default=False, > help=_("""\ > If the master watcher finds an existing master lock, it will normally exit > with an error message. With this option,the master will perform an extra > level of checking. If a process matching the host/pid described in the > lock file is running, the master will still exit, requiring you to manually > clean up the lock. But if no matching process is found, the master will > remove the apparently stale lock and make another attempt to claim the > master lock.""")) > @click.option( > '--runners', '-r', > metavar='runner[:slice:range]', > callback=validate_runner_spec, default=None, > multiple=True, > help=_("""\ > Override the default set of runners that the master will invoke, which is > typically defined in the configuration file. Multiple -r options may be > given. The values for -r are passed straight through to bin/runner.""")) > @click.option( > '-v', '--verbose', > is_flag=True, default=False, > help=_('Display more debugging information to the log file.')) > @click.version_option(MAILMAN_VERSION_FULL) > @public > def main(config_file, restartable, force, runners, verbose): > # ?. > > Cheers, > =Barry > Thanks for the example, Cheers, Andreas From andreas.roehler at online.de Thu Nov 15 04:51:54 2018 From: andreas.roehler at online.de (=?UTF-8?Q?Andreas_R=c3=b6hler?=) Date: Thu, 15 Nov 2018 10:51:54 +0100 Subject: [Python-mode] py-up-list - behavior and keys Message-ID: <26282e44-ae93-8fd3-335c-4ba2bba1fccf@online.de> Hi all, IMO ?py-up-list? should behave as Elisp's ?backward-up-list? does. When starting from last line "except True:" it should travel current indents and reach beginning of next block above: "if True:" def foo(): if True: def bar(): pass elif False: def baz(): pass else: try: 1 == 1 except True: Maybe also add a mode-specific key-binding , C-M-u, ESC ? Cheers, Andreas From andreas.roehler at easy-emacs.de Wed Nov 21 02:21:34 2018 From: andreas.roehler at easy-emacs.de (=?UTF-8?Q?Andreas_R=c3=b6hler?=) Date: Wed, 21 Nov 2018 08:21:34 +0100 Subject: [Python-mode] Fwd: Re: Python docstring folding In-Reply-To: <20181120191658.GB2480@rockop> References: <20181120191658.GB2480@rockop> Message-ID: <624fec77-f370-e128-811d-e8d51a28267d@easy-emacs.de> Hi all, is this worth a feature request? Cheers, Andreas -------- Forwarded Message -------- Subject: Re: Python docstring folding Date: Tue, 20 Nov 2018 19:16:58 +0000 From: Rock Storm To: Drew Adams CC: help-gnu-emacs at gnu.org 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 From barry at python.org Wed Nov 21 18:30:43 2018 From: barry at python.org (Barry Warsaw) Date: Wed, 21 Nov 2018 18:30:43 -0500 Subject: [Python-mode] Python docstring folding In-Reply-To: <624fec77-f370-e128-811d-e8d51a28267d@easy-emacs.de> References: <20181120191658.GB2480@rockop> <624fec77-f370-e128-811d-e8d51a28267d@easy-emacs.de> Message-ID: <868899FE-5851-4FAB-8E15-BB620ECC7589@python.org> On Nov 21, 2018, at 02:21, Andreas R?hler wrote: > > is this worth a feature request? It?s not something I personally use, but I know other people like it. -Barry -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: Message signed with OpenPGP URL: From andreas.roehler at online.de Thu Nov 22 02:25:29 2018 From: andreas.roehler at online.de (=?UTF-8?Q?Andreas_R=c3=b6hler?=) Date: Thu, 22 Nov 2018 08:25:29 +0100 Subject: [Python-mode] Python docstring folding In-Reply-To: <868899FE-5851-4FAB-8E15-BB620ECC7589@python.org> References: <20181120191658.GB2480@rockop> <624fec77-f370-e128-811d-e8d51a28267d@easy-emacs.de> <868899FE-5851-4FAB-8E15-BB620ECC7589@python.org> Message-ID: On 22.11.18 00:30, Barry Warsaw wrote: > On Nov 21, 2018, at 02:21, Andreas R?hler wrote: >> >> is this worth a feature request? > > It?s not something I personally use, but I know other people like it. > > -Barry > Okay, done. https://gitlab.com/python-mode-devs/python-mode/issues/60