Emacs scrolling behaviour after changing font size - emacs

Emacs23 GUI in Ubuntu 10.04 LTS. I've previously not changed any settings relating to Emacs scrolling behaviour. However, today I noticed a peculiar jumping behaviour when scrolling down in a buffer -- the cursor down key would scroll down as normal to a point and then the next keypress down would sometimes scroll the buffer down instead or sometimes appear to scroll the buffer up and then move the selected line down. It appeared to be more buggy behaviour rather than the normal or predictable jumping of the buffer. If I held down the down cursor the screen would jump and scroll and stutter and then lurch forward and then stutter.
I searched for some answers and tried a few mentioned here, but nothing solved the problem. Only then did I realize that this behaviour is new -- it only appeared after I changed the font in the buffer with C-x C--. When I returned the font to the "default" with C-x C-+, the scrolling behaviour returned to normal (the point moves to the last line, then the next press scrolls a few lines and moves the point up and displays the lines below; this is the default I think and I'm happy with it). Ideas?
Edit: Scrolling up works fine (as expected/default) regardless of font-size changes. Changing the font smaller a second time only makes the scrolling more bizarre.
Edit: Temporary workaround: return to using emacs -nw
Update: Tested on another Ubuntu 10.04 machine (desktop). Launched Emacs 23 and loaded a log file. Maximized Emacs. Help down cursor and scrolling worked as normal -- the cursor gets to the bottom, the buffer scrolls and the cursor moves to the middle of the screen. C-x C-- to reduce font size. Scroll down again. Same strange jerky behaviour, where some jumps don't seem to even move the buffer properly. Enlarge font once, and scrolling returns to normal. Scrolling up is fine regardless of font size. I searched the Emacs bug tracker briefly but did not find a bug which matched.

I've had this problem (or something very similar) for a long time. I finally found something (on EmacsWiki) that's working:
(setq auto-window-vscroll nil)
Without this, the buffer will not scroll down correctly when I've altered the font size, regardless of my scroll settings, which are, for what it's worth,
(setq scroll-conservatively 10)
(setq scroll-margin 7)

Consider filing an Emacs bug: M-x report-emacs-bug.

Related

Can I scroll the windows in emacs synchronously?

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.

Emacs auto-complete popup menu broken

I'm have reinstalled my emacs and now I'm using emacs v24.3.50 with auto-complete v1.4 and popup.el v0.5. Unfortunately the popup "menu" of auto-complete is kinda broken (see attached screenshot).
The different items are not aligned along a commong vertical line [ignore the black overlay, that stems from CEDET and is probably meant to be placed on the right side next to the popup menu; the problem remains when disabling CEDET, so it is not related).
From what I can tell it looks like the extent of this "shift" between lines depends on how much the length of the strings differs. Also, when selecting a different suggestion using the arrow keys the horizontal shift of the lines changes a little (~few pixels) each time the mark is moved one line up/down.
I have uploaded the part of my .emacs.d/init.el that is used for configuring auto-complete here.
Any suggestions on how to fix this?
It appears you are using a proportional font, which breaks the calculation of the left edge of the overlay.
You can try changing the way auto-complete computes the column:
(setq popup-use-optimized-column-computation nil)
You can also change to a fixed width font.
Note that some other completion systems for Emacs can use tooltips instead of overlays, which would avoid this problem.

set the window size of emacs on Window 7

I want to set the window size (maybe it is the frame in emacs speaking). I use this for the config. It works, but something happened that confused me. for example, if I set the width 80 and the height 30. When I start the emacs. It initialize to wider than 80 and higher than 30 which I set previously, then in a flash, it shrinked to the width 80 and height 30.
What I want to ask is why it appeared like this? can I set the window size as soon as the emacs initialized? How?
a similar thing happened with the toolbar. I disable the toolbar like this
(tool-bar-mode 0)
when I initialize the emacs, the toolbar appears, but in a flash it disappeared. FYI, I put the (tool-bar-mode 0) in the very first line of the .emacs file.
For the strangely resizing window:
Basically, Emacs brings up its window (frame) before it reads your .emacs. Obviously it has to be some size. Of course, this is customizable. On Unix systems, you do this by setting an X resource, which works a bit like an environment variable: Emacs can check for the setting when it first runs before loading up all the elisp-parsing machinery and getting to work on your .emacs. On Windows, I think you can set these variables through the registry. See this EmacsWiki page for a description of how to set variables in the registry. You want the Emacs.Geometry key.
I don't know if it's possible to change tool-bar-mode as an X resource. I didn't bother, since the appearing and disappearing tool bar was much less irritating than a moving window!

How to scroll down on pages in doc-view mode in Emacs?

I have recently started using doc-view in Emacs, but I am having quite a few problems with it. The main one is that I can't scroll down on pages. I can see the next or previous page using "n" or "p", but the commands to scroll up and down a page, which are supposedly SPACE and DEL, do not work. Well, to be fair, DEL works, but it goes to the previous page rather than scroll up to the bottom of the previous page. The result is that I can only see the top of the pdf pages, but not the bottom parts.
I tried changing the view to continuous, but that doesn't work either. This is what I tried changing:
I did check the customisations for doc-view, but the variables (or options, or whatever they are called) did not appear to me to be the ones which would solve my problem.
More information: I did manage to make SPACE and DEL work at some point, but I don't remember what I did, and I can't get it to work again. I am using Aquamacs.
Any ideas?
By the way, another problem I have is that doc-view causes Aquamacs to sort of crash, meaning it freezes everything, keeps "thinking", and I have to force quit Aquamacs to get it to work again. While this is not my main question, if anyone can tell me anything about this I would also appreciate.
Thanks!
EDIT: I tried what the answer below suggested, it didn't work, kept trying other things/commands, and then C-n and SPACE started working! I quit Aquamacs, started it again, opened a pdf document, and it is back to not working. Can someone please explain what is happening? How can I make this reliable?
(setq doc-view-continuous t)
This lets you scroll the whole document with mouse wheel(not just the current page).
To commands to scroll down are bind to:
C-n, down
not SPC
UPDATE:
SPC is rebound in docview mode. Can't reproduce you issue using GNU Emacs/Linux, can you invoke:
M-x doc-view-scroll-down-or-previous-page

Emacs mouse focus stuck in one frame

Twice in the past two days, I've had a problem with my emacs sessions. Somehow emacs is keeping the focus within one frame. So, if I mouse over another frame and click in it, the cursor in the new frame stays put and the cursor in frame 1 moves as if I clicked in the corresponding position in it. Same happens with mouse-wheel scrolling. But not keyboard input.
Killing the hogging frame just causes another frame to become the hoarder.
My solution yesterday was to quit and restart emacs.
Some googling pointed me towards the variable focus-follows-mouse, but that appears to be set correctly (i.e. "t").
Any ideas what caused it and how to reset it?
(I'm using Ubuntu intrepid's package of emacs 22.2-0ubuntu2.)
I have
(setq focus-follows-mouse t)
(setq mouse-autoselect-window t)
in my .emacs file, and find that this makes focus follow mouse work correctly. Maybe there's something else in your config that's changing emacs' behaviour, do you have your elisp in version control? Can you identify when this started happening, and look at changes to your elisp around then ?
Try starting emacs with --no-init-file and seeing if the undesired behaviour persists.
I have discovered that switching to another tty (eg crtl-alt-1) then back to whatever tty you were on before will reset your focus.
Not a general solution, but at least you don't have to kill X (which is what I've been doing until now).