unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#41361: Fwd: Re: python.el: improve sexp-based navigation or make it optional?
       [not found] <f2aea052-8802-e77d-aae9-7a6445850604@online.de>
@ 2020-05-17 14:12 ` Andreas Röhler
  2020-05-20  1:06   ` Stefan Kangas
  2021-07-31 16:44   ` Lars Ingebrigtsen
  0 siblings, 2 replies; 5+ messages in thread
From: Andreas Röhler @ 2020-05-17 14:12 UTC (permalink / raw)
  To: 41361

[-- Attachment #1: Type: text/plain, Size: 1510 bytes --]

Hi,

maybe make forward-sexp-function customizable. Currently that var is set 
inside the derived mode:

   (set (make-local-variable 'forward-sexp-function)
        'python-nav-forward-sexp)

and comment section in python.el head contains:


If you prefer `cc-mode'-like
;; `forward-sexp' movement, setting `forward-sexp-function' to nil is
;; enough, You can do that using the `python-mode-hook':

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

Thread is here:

https://lists.gnu.org/archive/html/emacs-devel/2020-05/msg02196.html

Thanks,
Andreas

-------- Forwarded Message --------
Subject: 	Re: python.el: improve sexp-based navigation or make it optional?
Date: 	Sat, 16 May 2020 21:11:51 +0200
From: 	Andreas Röhler <andreas.roehler@online.de>
To: 	emacs-devel@gnu.org
CC: 	immerrr again <immerrr@gmail.com>, Stefan Kangas 
<stefankangas@gmail.com>




On 16.05.20 15:16, immerrr again wrote:
> In absence of such mode, I wonder if it would be a welcome addition to
> introduce a configuration parameter that at least disables the smart
> navigation, making sexp skip one symbol or explicitly
> parenthesized/bracketed expression at a time.

Maybe that does it?: (from python.el)

If you prefer `cc-mode'-like
;; `forward-sexp' movement, setting `forward-sexp-function' to nil is
;; enough, You can do that using the `python-mode-hook':

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



[-- Attachment #2: Type: text/html, Size: 3798 bytes --]

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

* bug#41361: Fwd: Re: python.el: improve sexp-based navigation or make it optional?
  2020-05-17 14:12 ` bug#41361: Fwd: Re: python.el: improve sexp-based navigation or make it optional? Andreas Röhler
@ 2020-05-20  1:06   ` Stefan Kangas
  2020-05-21 13:42     ` João Távora
  2021-07-31 16:44   ` Lars Ingebrigtsen
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Kangas @ 2020-05-20  1:06 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: 41361

Andreas Röhler <andreas.roehler@online.de> writes:

> maybe make forward-sexp-function customizable. Currently that var is
> set inside the derived mode:

I agree that this should be customizable.

Best regards,
Stefan Kangas





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

* bug#41361: Fwd: Re: python.el: improve sexp-based navigation or make it optional?
  2020-05-20  1:06   ` Stefan Kangas
@ 2020-05-21 13:42     ` João Távora
  2021-03-20  2:51       ` Stefan Kangas
  0 siblings, 1 reply; 5+ messages in thread
From: João Távora @ 2020-05-21 13:42 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 41361, Andreas Röhler, immerrr

Stefan Kangas <stefan@marxist.se> writes:

> Andreas Röhler <andreas.roehler@online.de> writes:
>
>> maybe make forward-sexp-function customizable. Currently that var is
>> set inside the derived mode:
>
> I agree that this should be customizable.

I too am a fan of sexp navigation (C-M-f, C-M-b, etc.)  If this
navigation in indeed superior, we could consider making it the default
for python-mode?  Something similar thing was done recently for
nxml-mode, by changing nxml-sexp-element-flag from nil to t.  I liked
this change very much.

João









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

* bug#41361: Fwd: Re: python.el: improve sexp-based navigation or make it optional?
  2020-05-21 13:42     ` João Távora
@ 2021-03-20  2:51       ` Stefan Kangas
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Kangas @ 2021-03-20  2:51 UTC (permalink / raw)
  To: João Távora; +Cc: 41361, immerrr, Andreas Röhler

João Távora <joaotavora@gmail.com> writes:

> Stefan Kangas <stefan@marxist.se> writes:
>
>> Andreas Röhler <andreas.roehler@online.de> writes:
>>
>>> maybe make forward-sexp-function customizable. Currently that var is
>>> set inside the derived mode:
>>
>> I agree that this should be customizable.
>
> I too am a fan of sexp navigation (C-M-f, C-M-b, etc.)  If this
> navigation in indeed superior, we could consider making it the default
> for python-mode?  Something similar thing was done recently for
> nxml-mode, by changing nxml-sexp-element-flag from nil to t.  I liked
> this change very much.

I have been back to coding a bunch of Python lately, and having
experimented with this I think making it the default behavior is indeed
a good idea.

In the linked emacs-devel thread, I said that the old behavior was fine,
which I guess is true.  I have now come to the conclusion that it is
also worse than the alternative.  :-)





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

* bug#41361: Fwd: Re: python.el: improve sexp-based navigation or make it optional?
  2020-05-17 14:12 ` bug#41361: Fwd: Re: python.el: improve sexp-based navigation or make it optional? Andreas Röhler
  2020-05-20  1:06   ` Stefan Kangas
@ 2021-07-31 16:44   ` Lars Ingebrigtsen
  1 sibling, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-31 16:44 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: 41361

Andreas Röhler <andreas.roehler@online.de> writes:

> maybe make forward-sexp-function customizable.

Makes sense to me, so I've now added that to Emacs 28.  It was also
suggested to change the default to nil, but that seems too annoying, so
I didn't do that.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2021-07-31 16:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <f2aea052-8802-e77d-aae9-7a6445850604@online.de>
2020-05-17 14:12 ` bug#41361: Fwd: Re: python.el: improve sexp-based navigation or make it optional? Andreas Röhler
2020-05-20  1:06   ` Stefan Kangas
2020-05-21 13:42     ` João Távora
2021-03-20  2:51       ` Stefan Kangas
2021-07-31 16:44   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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