all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Andreas Röhler" <andreas.roehler@online.de>
To: emacs-devel@gnu.org
Subject: Re: save-excursion and the mark
Date: Wed, 25 Feb 2015 14:05:30 +0100	[thread overview]
Message-ID: <54EDC89A.8000001@online.de> (raw)
In-Reply-To: <87ioeq2mpl.fsf@violet.siamics.net>

On 25.02.2015 13:35, Ivan Shmakov wrote:
>>>>>> Andreas Röhler <andreas.roehler@online.de> writes:
>>>>>> On 25.02.2015 03:59, Stefan Monnier wrote:
>
>   >>> See for example indent-code-ridigly.
>
>   >> Can you give more details about how this requires save&restore of
>   >> the mark (or its "active" status)?
>
>   > Think a shifting code by TAB in python-mode.
>
> 	FWIW, python.el doesn’t seem to use the mark.
>
>   > Mark might exist somewhere in line. Shifting will use its own region
>   > – but original region should be restored – if any.  Shifting by
>   > itself should not create a region nor clutter the mark-ring.
>
> 	There seem to be a misunderstanding; the notion of /Emacs Lisp/
> 	region is different to that of /Emacs/ region, the former being
> 	(more or less) a way of saying “from here to there”, and
> 	does /not/ (generally) involve either mark or point.
>
> 	For instance, indent-code-ridigly can be used from Lisp like:
>
>     (indent-code-ridigly 13 37)
>
> 	Or perhaps:
>
>     (when-let ((here  (re-search-backward "START" nil t))
>                (there (re-search-forward  "END"   nil t)))
>       (indent-code-ridigly here there))
>
> 	With the common idiom being:
>
>     (let ((save (point)))
>       ; Move point forward, by some amount.
>       (indent-code-ridigly save (point)))
>
> 	As should be obvious, the mark is /not/ involved in either case.
> 	And, arguably, it /should not/ be.
>
> […]
>
>   > commit b1d6ddd44614c84746f5ee494e1f29cd9be8a2d8
>
>   > Notable changes to goto-line, i. e. calling push-mark.
>
> 	That makes a point, indeed: there’s a class of Emacs commands
> 	intended first and foremost for interactive use.  Naturally,
> 	goto-line is one of them; to quote its docstring:
>
> This function is for interactive use only;
> in Lisp code use `forward-line' instead.
>
> 	The proposed change to save-excursion would expose the bugs in
> 	the code which uses such commands inside of save-excursion,
> 	which now masks the unfortunate side-effects of such (mis)use.
>

Okay, thanks.

Andreas



  reply	other threads:[~2015-02-25 13:05 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-23  4:44 save-excursion and the mark Stefan Monnier
2015-02-23 11:34 ` Oleh Krehel
2015-02-23 22:33   ` Stefan Monnier
2015-02-23 23:14     ` Oleh Krehel
2015-02-24  0:12       ` Artur Malabarba
2015-02-24  8:47         ` Oleh Krehel
2015-02-24  2:31   ` Alexis
2015-02-24  3:52     ` Stefan Monnier
2015-02-25  1:58       ` Yuri Khan
2015-02-24 15:37 ` Barry Warsaw
2015-02-24 19:27   ` Stefan Monnier
2015-02-24 20:11     ` Barry Warsaw
2015-02-24 20:49       ` Artur Malabarba
2015-02-25  3:01         ` Stefan Monnier
2015-02-25  3:25           ` Artur Malabarba
2015-02-25 16:31           ` Barry Warsaw
2015-02-25 16:42             ` Stefan Monnier
2015-02-25 17:17             ` Drew Adams
2015-02-25 18:30     ` Richard Stallman
2015-02-26 13:50       ` Stefan Monnier
2015-02-27  0:13         ` Richard Stallman
2015-02-27 13:49           ` Stefan Monnier
2015-02-27 23:46             ` Richard Stallman
2015-02-28 18:50               ` martin rudalics
2015-03-02  5:36                 ` Stefan Monnier
2015-03-02  5:35               ` Stefan Monnier
2015-03-02 21:05                 ` Richard Stallman
2015-03-03 16:34                   ` Stefan Monnier
2015-03-04 12:01                     ` Richard Stallman
2015-02-24 16:05 ` Andreas Röhler
2015-02-25  2:59   ` Stefan Monnier
2015-02-25 11:49     ` Andreas Röhler
2015-02-25 12:35       ` Ivan Shmakov
2015-02-25 13:05         ` Andreas Röhler [this message]
2015-02-25 14:00       ` Stefan Monnier
2015-02-25 17:13         ` Andreas Röhler
2015-02-25  9:18 ` Ivan Shmakov
2015-02-25 15:56   ` Eli Zaretskii
2015-04-06 18:45 ` Magnar Sveen
2015-04-07 21:37   ` Stefan Monnier
2015-04-08  1:57   ` Stefan Monnier
2015-04-14 16:08     ` Magnar Sveen
2015-04-14 20:16       ` Stefan Monnier
2015-04-15  4:14         ` Magnar Sveen
2015-04-15 12:53           ` Stefan Monnier
2015-04-15 13:49             ` Magnar Sveen
2015-04-15 14:59               ` Stefan Monnier
2015-04-18  1:02                 ` Daniel Colascione
2015-04-15 14:24           ` Richard Stallman
2015-04-15 15:16           ` Phillip Lord
2015-04-19 15:28         ` Oleh Krehel
2015-04-20  2:03           ` Stefan Monnier
2015-04-20  6:31         ` Andreas Röhler
2015-04-23 10:03 ` Frank Fischer
2015-05-28 17:42 ` Nicolas Richard
  -- strict thread matches above, loose matches on Subject: below --
2015-04-17 18:53 Lars Magne Ingebrigtsen
2015-04-18  4:26 ` Stefan Monnier
2015-04-18 12:30   ` Wolfgang Jenkner
2015-04-25 12:45   ` Lars Magne Ingebrigtsen
2015-04-25 13:23     ` Lars Magne Ingebrigtsen
2015-04-25 14:19       ` Artur Malabarba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54EDC89A.8000001@online.de \
    --to=andreas.roehler@online.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.