GNU bug report logs - #13122
transpose-subr defeats save-excursion

Previous Next

Package: emacs;

Reported by: Jyothis V <jyothisv <at> gmail.com>

Date: Sat, 8 Dec 2012 07:16:01 UTC

Severity: minor

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Jyothis V <jyothisv <at> gmail.com>
Subject: bug#13122: closed (Re: bug#13122: save-excursion not saving point)
Date: Fri, 21 Dec 2012 05:45:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#13122: transpose-subr defeats save-excursion

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 13122 <at> debbugs.gnu.org.

-- 
13122: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13122
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Chong Yidong <cyd <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Jyothis V <jyothisv <at> gmail.com>, 13122-done <at> debbugs.gnu.org
Subject: Re: bug#13122: save-excursion not saving point
Date: Fri, 21 Dec 2012 13:43:55 +0800
martin rudalics <rudalics <at> gmx.at> writes:

> This is a limitation (or bug) in the code of `transpose-subr' and
> `transpose-subr-1' due to the use of `delete-and-extract-region' (IIRC
> transposing mangles `undo' as well.)

I've committed a fix to trunk.

[Message part 3 (message/rfc822, inline)]
From: Jyothis V <jyothisv <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: save-excursion not saving point
Date: Sat, 8 Dec 2012 11:50:13 +0530
[Message part 4 (text/plain, inline)]
Hi,

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
Configured using:
 `configure '--prefix=/usr' '--sysconfdir=/etc' '--libexecdir=/usr/lib'
 '--localstatedir=/var' '--with-x-toolkit=gtk3' '--with-xft'
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector
 --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2'
 'LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  diff-auto-refine-mode: t
  global-auto-complete-mode: t
  auto-complete-mode: t
  icomplete-mode: t
  ido-everywhere: t
  shell-dirtrack-mode: t
  which-function-mode: t
  cua-mode: t
  display-time-mode: t
  electric-pair-mode: t
  show-paren-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
[Message part 5 (text/html, inline)]

This bug report was last modified 6 years and 23 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.