Can I scroll the windows in emacs synchronously? - emacs

I mean if I type in c-x 2, then for comparasion I want it to scroll the other window synchronously when I scroll the temporary window.

Try Follow Mode:
M-x follow-mode
Follow mode is a minor mode that makes two windows, both showing the same buffer, scroll as a single tall “virtual window”.
Note that follow mode can only synchronize scrolling windows which content a same file. For scrolling windows with diffrent files synchronously, here's an answer for it.
Follow mode can only synchronize scrolling windows which content a
same file. Does it possible to scrolling windows with diffrent files
synchronously? – 9307420654
There is a minor mode to apply all scrolling commands to all visible
windows in the current frame. Check scroll-all-mode for that. Or else,
if you want to scroll together only 2 windows and only when you use a
specific keystroke, you can do something like a function that scrolls
the current window (scroll-up or scroll-down) and then the “other
window” (i.e., the next one in the list of windows), with
scroll-other-window (with argument '-, i.e., the symbol “minus”, for
scrolling down). Then you can assign this to a keystroke, e.g., C-M-up
/ down.
scroll-all-mode:
Use M-x scroll-all-mode to scroll multiple buffers together.
Very useful for visually comparing two files which are hard to diff
because of lots of trivial changes amongst the changes you are looking
for.

Another solution might be the scroll-all-mode:
M-x scroll-all-mode

Of course, if the windows you want to compare are somehow similar (like different versions of the same file), you probably would like to use a "diff" tool, like M-x ediff-buffers which compares the buffers with colors and keeps them scrolling in sync.

Related

Windows Emacs 25.3 Cursor Type

I have issue changing cursor-type in Emacs 25.3 and 25.2 on Windows. Picture is worth thousand words, so here it is
No customization whatsoever.
I try to change cursor-type to a box directly or via frame parameters and it is always a bar. Even when cursor-type is set to t it is a bar
Is there a way to change it ?
It looks like w32-use-visible-system-caret is non-nil. This can happen by default if Emacs detects some application is using the Accessibility API to track the position of the cursor - most commonly screen readers, and screen magnifiers. Such software often relies on the default Windows cursor being used and visible, rather than the customizable internal Emacs implementation of a cursor.
You can manually force this variable to nil in your startup files if you wish to continue using whatever software is triggering this, but have Emacs use its own cursor drawing. The other software may not work well with Emacs in that case however.

How to have an emacs function called when display size changes?

I'm trying to define an emacs function that will be called when the display size changes, currently I'm not finding any hooks that I can use for this.
I an NOT trying to notice when the emacs window changes size.
My use case is that I have emacs open on my laptop, then I close it and bring it to work and plug it into a bigger monitor and turn it on via the keyboard. After logging in my windows are all in the top left corner.
I want emacs to notice the screen size change and call my function allow me to reposition the window and change the font size.
yes, I know about stay but I also want to change the font size.
I'm running emacs 24.3.1 from emacsformacosx.com under OSX Mavericks
AFAIK, Emacs currently does not catch such screen-size-change events, and even if it does internally, it doesn't expose this in any way to ELisp. So your two best bets might be:
Use a timer that checks the screen size to detect change.
Ask for the feature via M-x report-emacs-bug.

How to make emacs only make new window instead of sometimes new frame?

When calling ediff, run-python and some other commands, emacs will open a new frame, but I want emacs to open new window instead, is that possible?
Dunno why someone voted you down. Perhaps s?he thought you should have looked first in the Ediff manual (which I too recommend).
a. Command ediff-toggle-multiframe toggles between using multiple frames and a single frame (multiple windows).
b. The Ediff manual says also: "See ediff-window-setup-function for details on how to make
either of these modes the default one."
You will need to check whether Python mode similarly provides options or commands to control the window/frame behavior.
If Emacs is always opening a new frame for everything, then make sure you do not have a non-nil value for option pop-up-frames.

Is it possible to restore previously open frames in emacs after full screening (ESC) one of them?

I am using emacs and usually have multiple buffers open using horizontal and vertical splits. Sometimes I need to view one of the buffers in full screen and press ESC for that. However is it possible to restore the previous screen placement ? ie if I had 4 frames open, then can I restore them back ?
http://www.emacswiki.org/emacs/WinnerMode
^ is the best
C-c left to restore previous window placement
You can use window-configuration-to-register or frame-configuration-to-register to save the window and frame configurations to a register and restore them. You can use this along with a little elisp to give you the functionality you need.
I have some more details about how to use registers posted in this screencast.

Better control over Emacs windows

I spend a lot of my time in emacs, and for the most part it's wonderful. But one thing really drives me nuts when I'm deep in it, and that's control over which window various new buffers are opened in. When I do find-file, it always opens in the current window, and this is what I like. But tons of other modes like to split my windows for me, change the layout, and do various other things that annoy me. For example running M-x manual-entry seems to have no rhyme or reason about where it opens the manpage, and various org-mode commands do the same thing, closing windows I want to keep open, etc. I don't like having to redo my layout everytime I want to look at my org agenda or open a manpage.
In short, is there anyway to globally control which windows are used for modes that want to open in a window other than the current one? Can I direct them more easily? Or will I have to hack each mode to act the way I want it to?
Try Winner mode:
http://www.emacswiki.org/emacs/WinnerMode
It provides an undo/redo for changes to the window configuration.
This question has always bugged me too. I found this:
http://www.gnu.org/software/emacs/elisp/html_node/Choosing-Window.html
It looks like you can use (setf pop-up-frames t) to make stuff show up in a new frame.
Also, it looks like you can use display-buffer-function to override the display function (how buffers are chosen.) Of course, you'd have to be good at elisp.