unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Python doc string with three double quotes
@ 2013-09-11 16:48 Scott Reynolds
  2013-09-11 18:43 ` Andreas Röhler
  0 siblings, 1 reply; 5+ messages in thread
From: Scott Reynolds @ 2013-09-11 16:48 UTC (permalink / raw)
  To: help-gnu-emacs

Having an issue adding a doc string to my modules, functions, classes and
methods in python. I am using Emacs Prelude(
https://github.com/bbatsov/prelude). When started with --no-init-file the
behavior is not experienced.

A python doc string is surrounded by three double quotes. Like so:
"""
This is a doc string for a function.
"""

When I add the fifth ", emacs auto escapes the last two double  quotes. It
is like this:
"""
This is a doc string for the method
"\"\"

How do I prevent this from happening in python-mode ?

Turning off electric-auto-pair, changes the behavior to escaping the third
double quote instead of the 5th and 6th.

Anybody have any ideas to help me?

Thanks ahead of time!


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Python doc string with three double quotes
  2013-09-11 16:48 Scott Reynolds
@ 2013-09-11 18:43 ` Andreas Röhler
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Röhler @ 2013-09-11 18:43 UTC (permalink / raw)
  To: help-gnu-emacs

Am 11.09.2013 18:48, schrieb Scott Reynolds:
> Having an issue adding a doc string to my modules, functions, classes and
> methods in python. I am using Emacs Prelude(
> https://github.com/bbatsov/prelude). When started with --no-init-file the
> behavior is not experienced.
>
> A python doc string is surrounded by three double quotes. Like so:
> """
> This is a doc string for a function.
> """
>
> When I add the fifth ", emacs auto escapes the last two double  quotes. It
> is like this:
> """
> This is a doc string for the method
> "\"\"
>
> How do I prevent this from happening in python-mode ?
>
> Turning off electric-auto-pair, changes the behavior to escaping the third
> double quote instead of the 5th and 6th.
>
> Anybody have any ideas to help me?
>
> Thanks ahead of time!
>


Can't reproduce with shipped python-mode. Maybe use this?

Andreas




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Python doc string with three double quotes
       [not found] <mailman.1832.1378919078.10748.help-gnu-emacs@gnu.org>
@ 2013-09-12  3:46 ` Stefan Monnier
  2013-09-12  8:43 ` Damien Wyart
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2013-09-12  3:46 UTC (permalink / raw)
  To: help-gnu-emacs

> When I add the fifth ", emacs auto escapes the last two double  quotes. It
> is like this:
> """
> This is a doc string for the method
> "\"\"

This sounds like a bug in some kind of "automatic pairing" mode
you're using.  I can't reproduce it with "emacs -Q" using
electric-pair-mode, tho, so it's apparently some other automatic
pairing mode.


        Stefan


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Python doc string with three double quotes
       [not found] <mailman.1832.1378919078.10748.help-gnu-emacs@gnu.org>
  2013-09-12  3:46 ` Python doc string with three double quotes Stefan Monnier
@ 2013-09-12  8:43 ` Damien Wyart
  2013-09-12 18:43   ` Scott Reynolds
  1 sibling, 1 reply; 5+ messages in thread
From: Damien Wyart @ 2013-09-12  8:43 UTC (permalink / raw)
  To: help-gnu-emacs

* Scott Reynolds <sdrreynolds@gmail.com> in gnu.emacs.help:
> Having an issue adding a doc string to my modules, functions, classes and
> methods in python. I am using Emacs Prelude(
> https://github.com/bbatsov/prelude). When started with --no-init-file the
> behavior is not experienced.

> Anybody have any ideas to help me?

This comes from smartparens:
https://github.com/Fuco1/smartparens/issues/8

So you should add python-mode to the variable sp-autoescape-string-quote-if-empty
(with M-x customize-variable sp-autoescape-string-quote-if-empty).

-- 
DW


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Python doc string with three double quotes
  2013-09-12  8:43 ` Damien Wyart
@ 2013-09-12 18:43   ` Scott Reynolds
  0 siblings, 0 replies; 5+ messages in thread
From: Scott Reynolds @ 2013-09-12 18:43 UTC (permalink / raw)
  To: Damien Wyart; +Cc: help-gnu-emacs

Didn't totally work for me (that is already setup for python-mode) but!
pointed me in the right direction so I am able so I should be able to fix
it up!

Thanks Damien

On Thu, Sep 12, 2013 at 1:43 AM, Damien Wyart <damien.wyart@free.fr> wrote:

> sp-autoescape-string-quote-if-empty
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-09-12 18:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1832.1378919078.10748.help-gnu-emacs@gnu.org>
2013-09-12  3:46 ` Python doc string with three double quotes Stefan Monnier
2013-09-12  8:43 ` Damien Wyart
2013-09-12 18:43   ` Scott Reynolds
2013-09-11 16:48 Scott Reynolds
2013-09-11 18:43 ` Andreas Röhler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).