phillord / lentic

Create views of the same content in two Emacs buffers
183 stars 12 forks source link

auto-switch buffer mode #7

Open phillord opened 9 years ago

phillord commented 9 years ago

Add an "auto-switch" mode which jumps between forms based on markers in the buffer -- so move to the code-centric view in code and document centric view in documentation!

emacswatcher commented 8 years ago

I would not want focus to automatically move from window to window. However, I think I'd like it if the buffer "under" point automatically switched to the most useful view of the text.

Perhaps use each mode's comment fontification as a heuristic: if point is over comment-face in current-buffer, check linked buffers to see if their point is not over comment-face and not already visible. If true, automatically switch buffers.

I include the "not already visible" predicate so that this automatic behavior would stop if the user has set up their frame to see both at once, presumably for a reason.

phillord commented 8 years ago

emacswatcher notifications@github.com writes:

I would not want focus to automatically move from window to window. However, I think I'd like it if the buffer "under" point automatically switched to the most useful view of the text.

Yes that was the kind of thing I was thinking off. Jumping windows, I think, would be poor.

Even changing between buffers might be pretty horrible depending on how fast it happens.

Perhaps use each mode's comment fontification as a heuristic: if point is over comment-face in current-buffer, check linked buffers to see if their point is not over comment-face and not already visible. If true, automatically switch buffers.

I'll probably have to do it on the idle timer also. Otherwise, the buffer will flicker backward and forward when using `next-line'

I include the "not already visible" predicate so that this automatic behavior would stop if the user has purposefully set up their frame to purposefully see both at once.

Yes, this is a good check.

At the moment, I haven't got any immediate plans to implement this (just lack of time!), so feel free to put together a PR!

Phil