bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#13122: sort-regexp-fields also seems to not save point


From: Alexander Kjeldaas
Subject: bug#13122: sort-regexp-fields also seems to not save point
Date: Mon, 7 Jan 2013 13:32:18 +0100


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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]