Add option to control automatic recentering #36

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
@mgalgs

mgalgs commented Feb 24, 2013

I personally don't like iedit to recenter my screen for me. Add an option to control that.

@victorhge

This comment has been minimized.

Show comment Hide comment
@victorhge

victorhge Feb 25, 2013

Owner

I added "go to the end and recenter" for better performance.

I discovered an odd thing when I was benchmarking iedit-make-occurrences-overlays:
re-search-forward is 10 times slower when the point is at the beginning of buffer, comparing to when the point is at the end of the buffer.

I don' kow why yet.

"recenter" is in "save-excursion". I thought there is no visible impact to the buffer. Would you describle what you see when there is a "recenter"?

Owner

victorhge commented Feb 25, 2013

I added "go to the end and recenter" for better performance.

I discovered an odd thing when I was benchmarking iedit-make-occurrences-overlays:
re-search-forward is 10 times slower when the point is at the beginning of buffer, comparing to when the point is at the end of the buffer.

I don' kow why yet.

"recenter" is in "save-excursion". I thought there is no visible impact to the buffer. Would you describle what you see when there is a "recenter"?

@mgalgs

This comment has been minimized.

Show comment Hide comment
@mgalgs

mgalgs Feb 25, 2013

What I see is the same thing as if I run recenter.

It seems like save-excursion doesn't provide any guarantees related to window positioning, etc. Try some of these:

(defun recenter-during-excursion ()
  (interactive)
  (save-excursion (recenter)))
(defun make-frame-during-excursion ()
  (interactive)
  (save-excursion (make-frame)))

I've verified that they do indeed affect my window with emacs -Q and emacs -nw -Q using Emacs 24.1.1 on Ubuntu Linux.

Actually, even if my results are somehow anomalous and save-excursion actually does preserve window-related stuff then there really isn't a point of doing a recenter inside a save-excursion since recenter doesn't move point at all, it just re-centers it in your window (at least according to the docs)...

Your benchmarking results are intriguing though... Seems pretty bizarre... Can you re-profile it with the recenter omitted?

mgalgs commented Feb 25, 2013

What I see is the same thing as if I run recenter.

It seems like save-excursion doesn't provide any guarantees related to window positioning, etc. Try some of these:

(defun recenter-during-excursion ()
  (interactive)
  (save-excursion (recenter)))
(defun make-frame-during-excursion ()
  (interactive)
  (save-excursion (make-frame)))

I've verified that they do indeed affect my window with emacs -Q and emacs -nw -Q using Emacs 24.1.1 on Ubuntu Linux.

Actually, even if my results are somehow anomalous and save-excursion actually does preserve window-related stuff then there really isn't a point of doing a recenter inside a save-excursion since recenter doesn't move point at all, it just re-centers it in your window (at least according to the docs)...

Your benchmarking results are intriguing though... Seems pretty bizarre... Can you re-profile it with the recenter omitted?

@victorhge

This comment has been minimized.

Show comment Hide comment
@victorhge

victorhge Mar 2, 2013

Owner

I add a save-window-excursion around to prevent the side effect of recenter. Then the option is not necessary.

Owner

victorhge commented Mar 2, 2013

I add a save-window-excursion around to prevent the side effect of recenter. Then the option is not necessary.

@victorhge victorhge closed this Mar 2, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment