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


Message #20 received at 13122 <at> debbugs.gnu.org (full text, mbox):

From: Alexander Kjeldaas <alexander.kjeldaas <at> gmail.com>
To: 13122 <at> debbugs.gnu.org
Subject: sort-regexp-fields also seems to not save point
Date: Mon, 7 Jan 2013 13:32:18 +0100
[Message part 1 (text/plain, inline)]
I think this might be related.  In the following function, point is also
not restored:

(defun my-java-organize-imports2 ()
  "Sorts import statements"
  (interactive)
  (message "Point %d" (point))
  (sit-for 3)
  (save-excursion
    (let (deactivate-mark)
      ;; Remove empty lines between imports
      (replace-regexp "^import \\(.*\\)\n\\(\n\\)*import \\(.*\\)$"
                      "import \\1\nimport \\3"
                      nil (point-min) (point-max))
      ;; Sort imports in file
      (sort-regexp-fields nil "^.*$" "^import .*$" (point-min)
(point-max))))
  (message "Point %d" (point))
  (sit-for 3))

Thanks,
Alexander
[Message part 2 (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.