unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Does one need save-excursion with delete-region
@ 2021-05-20 14:02 pauline-galea
  2021-05-21 19:57 ` Filipp Gunbin
  0 siblings, 1 reply; 3+ messages in thread
From: pauline-galea @ 2021-05-20 14:02 UTC (permalink / raw)
  To: Help Gnu Emacs

Does one need save-excursion with delete-region so that the cursor
remains at the same position.

(save-excursion (delete-region (point) c))




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

* Re: Does one need save-excursion with delete-region
  2021-05-20 14:02 Does one need save-excursion with delete-region pauline-galea
@ 2021-05-21 19:57 ` Filipp Gunbin
  2021-05-21 20:04   ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 3+ messages in thread
From: Filipp Gunbin @ 2021-05-21 19:57 UTC (permalink / raw)
  To: pauline-galea; +Cc: Help Gnu Emacs

On 20/05/2021 16:02 +0200, pauline-galea@gmx.com wrote:

> Does one need save-excursion with delete-region so that the cursor
> remains at the same position.
>
> (save-excursion (delete-region (point) c))

No:

--8<---------------cut here---------------start------------->8---
 -- Command: delete-region start end
     This command deletes the text between positions START and END in
     the current buffer, and returns ‘nil’.  If point was inside the
     deleted region, its value afterward is START.  Otherwise, point
     relocates with the surrounding text, as markers do.
--8<---------------cut here---------------end--------------->8---



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

* Re: Does one need save-excursion with delete-region
  2021-05-21 19:57 ` Filipp Gunbin
@ 2021-05-21 20:04   ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 3+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-05-21 20:04 UTC (permalink / raw)
  To: help-gnu-emacs

Filipp Gunbin wrote:

>> Does one need save-excursion with delete-region so that the
>> cursor remains at the same position.
>>
>> (save-excursion (delete-region (point) c))
>
> No

Can't we try that? :)

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




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

end of thread, other threads:[~2021-05-21 20:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-20 14:02 Does one need save-excursion with delete-region pauline-galea
2021-05-21 19:57 ` Filipp Gunbin
2021-05-21 20:04   ` 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).