emacs won't repaint buffer (windows 7) - emacs

I am using GNU Emacs 24.2.1 on 64-bit Windows 7. Sometimes emacs window goes blank. This usually happens when switching focus back to emacs from another window. The only way to get the content back is to switch to another buffer and then back. No other programs behave like this. I do not have this problem on my home PC with similar hardware and OS.

I added the following code to my init.el so that when it happens to me (in 24.4), I just need to press F5:
(global-set-key (kbd "<f5>") #'redraw-display)

Related

How to open files and sub-folders in the same window in emacs?

I would like to open files/sub-folders in the same window which is already established in my emacs(I understand the difference between Emacs frames and windows).
Currently when I jump into Emacs I typically use C-x f in order to navigate to the folder I will be working inside of; once there I can look at the folder and its contents in Dired nicely.
However, when I then try and open a file or a sub-folder within this, by clicking or selecting it through navigating with my keyboard, it then spawns a new window beside my current one, making my screen extremely cluttered when I only wanted one window open.
How canI tell Emacs that when I am navigating in Dired I want new files and folders I move into to be opened in the window I am already working in so that I do not have to keep closing and re-opening random windows?
Apologies if this is a newbie question I am a fairly new emacs user and couldn't find this question posed elsewhere.
Try this:
(with-eval-after-load "dired"
(define-key dired-mode-map (kbd "<mouse-2>") #'dired-mouse-find-file)
(define-key dired-mode-map (kbd "<RET>") #'dired-find-file))
It behaved normally for me when I pressed <RET>, but the mouse click indeed opened another window. I used C-h k to see what the commands were named.

Emacs gdb speedbar in same window

I am using emacs gdb with gdb-many-windows mode,
I am noticing that the gdb watch expressions speedbar opens in a different window.
I want to have it in the same window. I looked into http://www.emacswiki.org/emacs/SrSpeedbar which claimed to allow speedbar to open in the same window, i installed it and it works fine for the normal speedbar.
But how do i get it to work with the gdb watch expressions speedbar,
is there any way i can get gdb watch expressions sppedbar to open in the same window by default (say as the 7th window in the GDB gui interface)?
C-x 2 (split any existing buffer into two)
C-x b SPEEDBAR ( Switch to speed bar buffer)
Note: This worked for me in Emacs version 25.1

Emacs auto-complete-mode cycles focus through every window?

When I have autocomplete mode enabled:
(global-auto-complete-mode 1)
Once I get a few windows open, hitting any key in one window will quickly cycle focus through all the windows in the frame.
For example, to recreate:
Load auto-complete-mode
Open up 5 or 6 windows in one frame
Open up a frame editing a Python file (although this appears to happen with other file types too, like .c)
Mash the keyboard. Observe that focus is quickly cycled between the windows.
Here is a video showing the problem: http://gfycat.com/LeafyCleverCommongonolek — notice that I'm typing at a constant rate, but every few characters focus cycles between all the open windows.
If I set:
(global-auto-complete-mode nil)
Then the problem goes away.
What can I do to fix this?
This is happening with Carbon emacs 24.3.1 installed from Homebrew.

Prevent mouse-selected text from being put into Emacs paste buffer?

In emacs, there is a feature where if I select text with a mouse, then without pressing
ctrl-c I can paste into emacs with ctrl-v if I have cua mode turned on.
I want to turn off this feature while keeping the cua mode on. I mean I want to
explicitly press ctrl-c so that the text will get copied to the clipboard.
I suspect that you are using a version of Emacs older than version 24? If so, see the last paragraph of this page of the current Emacs manual. You can probably get rid of the behaviour you dislike by setting x-select-enable-primary to nil.
From my quick tests, setting it to T (which isn't the default on Emacs 24) reproduces the problem behaviour, and this happens both in and not in cua-mode.

Getting YASnippet and viper-mode to work together in emacs

I use viper-mode in emacs, but I want to use YASnippet as well. However, when I enable viper-mode and try using tab-completion through YASnippet, nothing happens. How do I get the two of them to work together?
Using an Emacs without any customizations (emacs -q), I got the following to work:
(load-file "c:/cygwin/home/Trey/scratch/yasnippet-bundle.el")
M-x viper-mode
(define-key viper-insert-global-user-map (kbd "<tab>") 'yas/expand)
C-x C-f a.cpp
i
main<TAB>
Try that, see if it works (as in, if there's something in your .emacs that's messing things up). Also, check to see what Emacs thinks your TAB key is. On my windows system, the tab key was bound to <tab> and not TAB - try doing M-x describe-key TAB and see what the *Help* buffer translates it to. yasnippet appears to bind to TAB, so I needed the extra binding for <tab> to get things to work.
For more information about how Emacs handles the TAB, read the documentation for function keys.