unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* how to go back to matching parenthesis in python-mode?
@ 2021-10-25  3:09 edgar
  2021-10-25  6:20 ` Kévin Le Gouguec
  0 siblings, 1 reply; 5+ messages in thread
From: edgar @ 2021-10-25  3:09 UTC (permalink / raw)
  To: help-gnu-emacs

Hi!

I would like to know if you can help me, please. I have this MWE 
(minimally working example):

     a = sum([val for val in range(10)])

If I set the point (cursor) at the end of the line and type `C-M b' 
(`backward-sexp'), I would expect to go back to the matching parenthesis 
next to `sum', but it takes me to the beginning of the line.

How can I go back to the matching parenthesis? Thank you

GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, 
cairo version 1.17.4) of 2021-03-26
python.el:
;; URL: https://github.com/fgallina/python.el
;; Version: 0.28

-------------------------------------------------
This free account was provided by VFEmail.net - report spam to abuse@vfemail.net
 
ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  



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

* Re: how to go back to matching parenthesis in python-mode?
  2021-10-25  3:09 edgar
@ 2021-10-25  6:20 ` Kévin Le Gouguec
  2021-10-25 16:11   ` edgar
  0 siblings, 1 reply; 5+ messages in thread
From: Kévin Le Gouguec @ 2021-10-25  6:20 UTC (permalink / raw)
  To: edgar; +Cc: help-gnu-emacs

edgar@openmail.cc writes:

> How can I go back to the matching parenthesis? Thank you
>
> GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27,

Up to version 27.2, the recommended way (explained in the opening
commentary of python.el[1]) is to set forward-sexp-function to nil in
python-mode-hook:

(add-hook 'python-mode-hook
          (lambda () (setq forward-sexp-function nil)))

In 28.1, the new user option python-forward-sexp-function will let you
do away with the hook[2].


[1] https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/progmodes/python.el?h=emacs-27.2#n59
[2] https://git.savannah.gnu.org/cgit/emacs.git/tree/etc/NEWS?h=emacs-28&id=1e8be48738e1324edb9891ff6f7077bd1306cdd7#n2862



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

* Re: how to go back to matching parenthesis in python-mode?
  2021-10-25  6:20 ` Kévin Le Gouguec
@ 2021-10-25 16:11   ` edgar
  2021-10-25 17:54     ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 5+ messages in thread
From: edgar @ 2021-10-25 16:11 UTC (permalink / raw)
  To: Kévin Le Gouguec; +Cc: help-gnu-emacs

Hi Kévin,

On 2021-10-25 06:20, Kévin Le Gouguec wrote:
> Up to version 27.2, the recommended way (explained in the opening
> commentary of python.el[1]) is to set forward-sexp-function to nil in
> python-mode-hook:
> 
> (add-hook 'python-mode-hook
>           (lambda () (setq forward-sexp-function nil)))
> 
> In 28.1, the new user option python-forward-sexp-function will let you
> do away with the hook[2].


Thank you very much. I did check python.el, but only to see the 
function. I am sorry; I never imagined that this situation would be 
explained there. Much appreciated :) .


> [1]
> https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/progmodes/python.el?h=emacs-27.2#n59
> [2]
> https://git.savannah.gnu.org/cgit/emacs.git/tree/etc/NEWS?h=emacs-28&id=1e8be48738e1324edb9891ff6f7077bd1306cdd7#n2862

-------------------------------------------------
This free account was provided by VFEmail.net - report spam to abuse@vfemail.net
 
ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  



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

* Re: how to go back to matching parenthesis in python-mode?
  2021-10-25 16:11   ` edgar
@ 2021-10-25 17:54     ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 5+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-10-25 17:54 UTC (permalink / raw)
  To: help-gnu-emacs

edgar wrote:

> Thank you very much. I did check python.el, but only to see
> the function. I am sorry; I never imagined that this
> situation would be explained there. Much appreciated :)

Just like girls ... you find them in the place you'd never
ever thought about looking.

> -------------------------------------------------
> This free account was provided by VFEmail.net - report spam to abuse@vfemail.net
>
> ONLY AT VFEmail! - Use our Metadata Mitigator to keep your
> email out of the NSA's hands!
> $24.95 ONETIME Lifetime accounts with Privacy Features!
> 15GB disk! No bandwidth quotas!
> Commercial and Bulk Mail Options!

Report to abuse@vfemail.net please ...

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: how to go back to matching parenthesis in python-mode?
@ 2021-10-26  7:44 Anders Munch
  0 siblings, 0 replies; 5+ messages in thread
From: Anders Munch @ 2021-10-26  7:44 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

edgar@openmail.cc wrote:
> On 2021-10-25 06:20, Kévin Le Gouguec wrote:
>> Up to version 27.2, the recommended way (explained in the opening 
>> commentary of python.el[1]) is to set forward-sexp-function to nil in
>> python-mode-hook:
>> 
>> (add-hook 'python-mode-hook
>>           (lambda () (setq forward-sexp-function nil)))
>> 
>> In 28.1, the new user option python-forward-sexp-function will let you 
>> do away with the hook[2].

It should be noted that this is not actually about python-mode, this is about the python mode python.el.

C-M-b works fine in python-mode.

regards, Anders


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

end of thread, other threads:[~2021-10-26  7:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-26  7:44 how to go back to matching parenthesis in python-mode? Anders Munch
  -- strict thread matches above, loose matches on Subject: below --
2021-10-25  3:09 edgar
2021-10-25  6:20 ` Kévin Le Gouguec
2021-10-25 16:11   ` edgar
2021-10-25 17:54     ` Emanuel Berg via Users list for the GNU Emacs text editor

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).