unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: 13122@debbugs.gnu.org
Subject: bug#13122: save-excursion not saving point
Date: Sat, 27 Apr 2019 04:53:56 +0900	[thread overview]
Message-ID: <87mukciluz.fsf@calancha-pc.dy.bbexcite.jp> (raw)
In-Reply-To: <CAGHGN=X4ruFPs9WvX0SqES6Z=HTbGEMxdBaemB5=2N0EoJaZVA@mail.gmail.com> (Jyothis V.'s message of "Sat, 8 Dec 2012 11:50:13 +0530")



;; Following expression should eval as non-nil
(let ((pos 3))
  (with-temp-buffer
    (insert "abcdef")
    (goto-char pos)
    (save-excursion (transpose-chars 2))
    (= pos (point))))
=> nil

In GNU Emacs 27.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2019-04-23 built on calancha-pc.dy.bbexcite.jp
Repository revision: 981470e3590534a4d2947dfe5626cae832c6502d
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.11902000
System Description: Debian GNU/Linux 9 (stretch)


Jyothis V <jyothisv@gmail.com> writes:


> I wrote the following version of transpose-chars which is supposed to
> always transform the last two chars without moving the point.
> (defun gosmacs-tranpose-chars (n)
>   (interactive "p")
>   (save-excursion
>     (forward-char (- n))
>     (transpose-chars 1)))
>
> The trouble is, even though I have used save-excursion, the point does
> move 2 characters backwards when n=1! For other values of n, this seems to be working fine.
>
> Regards,
> Jyothis V
>
> In GNU Emacs 24.2.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.6.2)
>  of 2012-11-18 on eric
> Windowing system distributor `The X.Org Foundation', version 11.0.11300000





  parent reply	other threads:[~2019-04-26 19:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-08  6:20 bug#13122: save-excursion not saving point Jyothis V
2012-12-08 11:21 ` martin rudalics
2012-12-21  5:43   ` Chong Yidong
2013-01-07 12:32 ` bug#13122: sort-regexp-fields also seems to not save point Alexander Kjeldaas
2019-04-26 19:53 ` Tino Calancha [this message]
2019-04-27  6:57   ` bug#13122: save-excursion not saving point Eli Zaretskii
2019-04-27  7:44     ` Tino Calancha
2019-04-27  9:59       ` Andreas Schwab
2019-05-04  8:39         ` Tino Calancha

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87mukciluz.fsf@calancha-pc.dy.bbexcite.jp \
    --to=tino.calancha@gmail.com \
    --cc=13122@debbugs.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 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).