How to make light cursor in auto-complete in emacsClient - emacs

mode is here : http://emacswiki.org/emacs/AutoComplete
and in the bottom:
I have a black background and when I use auto-complete, as soon as I
type something my cursor turns black, so now I can’t see it. Help! How
am I going to fix this problem?
Ok nevermind, fixed it. Just added (set-cursor-color “white”) to my
.emacs file after loading the auto-complete package.
So I just made it too. even (set-cursor-color “#ffffff”) but it doesn't help me. How can I solve this problem?
Correction: it works for emacs but doesn't work for emacsclient
Maybe I must to add some hook? But I need to make a proper hook then, not to add all my mess where I'm trying to solve the trouble setting everything foreground light background dark...
also here is off-topic question: why most of professional emacs users use light themes?
config:
(require 'auto-complete-config)
(ac-config-default)
(set-face-background 'ac-completion-face "darkgray")
(set-face-underline 'ac-completion-face "lightgray")
(set-face-background 'ac-yasnippet-candidate-face "black")
(set-face-underline 'ac-yasnippet-candidate-face "sandybrown")
(set-face-background 'ac-candidate-face "darkgray")
(set-face-underline 'ac-candidate-face "lightgray")
(set-face-background 'ac-selection-face "steelblue")
(set-cursor-color "#ffffff")
(provide 'auto-complete-settings)
Answers for comments:
(frame-parameter (selected-frame) 'cursor-color)
"black"
-- before autocomplete (when cursor light) and after when cursor goes dark.

The three faces which autocomplete uses are ac-candidate-face, ac-completion-face and ac-selection-face. Customising them should take care of your problem.

I'm not using autocomplete, but I can't reproduce this behaviour for the default face.
In 23.1.1 I can set the background colour of the default face using the same function you've specified, and it applies the change and sets it as the default value for all subsequent frames, including those from emacsclients.
Can you confirm that you're definitely talking to a server to which your changes have been made?

Here is what works for me:
(defun frame-bg (frame)
"Custom behaviours for new frames."
(with-selected-frame frame
(set-cursor-color "#ffffff")
))
(frame-bg (selected-frame))
(add-hook 'after-make-frame-functions 'frame-bg)

I agree that Heather's answer will work, but I found that all I needed to solve this problem was to put the following into my .emacs file (after enabling auto-complete-mode):
(set-cursor-color “white”)

Related

Setting Emacs 24 color theme from .emacs

I have the following code in my .emacs:
(if (null window-system)
(progn
(require 'color-theme)
(color-theme-initialize)
(color-theme-simple-1)))
When I open Emacs on the console, I can verify that the progn block runs (by a (message "Got here.")), and I see a flash that suggests that the color theme was loaded, but if it was loaded, it is overridden by something else. If, after loading, I open my .emacs file and submit the block above using C-x C-e, it works. I've tried doing:
(add-hook 'after-init-hook
(lambda ()
(progn
(require 'color-theme)
(color-theme-initialize)
(color-theme-simple-1))))
but that acts the same.
It may be relevant that I'm using Emacs 24, and that this code is not in my .emacs, but in ~/Dropbox/.emacs, which is loaded from my .emacs.
An additional note: I've tried M-x customize-themes, but none of those work acceptably on the console. They either produce a nearly unreadable light theme, or most of the text is invisible.
Emacs 24 has built-in theming, which doesn't use statements like (require 'color-theme). As Drew points out in the comments, there are differences between color themes and custom themes, and the new direction is towards the latter. Try M-x customize-themes to take a look. From .emacs, you can do things like (load-theme 'wombat t).
But...
It may still be going wrong for you. One thing that can mess it up like this is changing the face -- maybe in the custom-set-faces part of your .emacs file. Emacs's interactive customization automatically includes the color information (both background and foreground) of whatever theme you happen to be using at the time you set it, so this can definitely make trouble with color themes. If that is what's causing it, you can just set the particular attribute you care about with something like
(set-face-attribute 'default nil :height 120)
That will change the font size without changing the colors.
Emacs 24 have own theming system.
M-x customize-themes
or
(custom-set-variables
....
'(custom-enabled-themes (quote (selected-theme)))
)

Emacs auto-complete

since I can't get CEDET to work for automatic code-completion (aka intelli-sense in the MS-world), after trying several times (no, it's just not working!), I've decided to use auto-complete, which works "quite fine" for me.
Unfortunately, auto-complete has an annoying behaviour when it comes to quit the imenu with its suggestions.
auto-complete starts imenu, no matter how many suggestions it has. So, if there's only one suggestion, the menu appears.
1.
To exit the imenu, I have to use the LEFT or RIGHT keys in order to make the menu disappear. ESC-ESC-ESC does not have any effect.
Is there any way, to modify these two behaviors?
Here's an excerpt of my .emacs file showing the auto-complete relevant stuff:
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(ac-config-default)
(setq ac-delay 0.5) ;; eclipse uses 500ms
Kind regards,
mefiX
'Stop autocompleting' can be set by adding the following to your .emacs:
(define-key ac-completing-map "\ESC/" 'ac-stop)
...or alternatively you can use C-g as the default Emacs StopSomething command :)
As for showing the completion in a menu when there's only one candidate, I'm not really sure what other behaviour you'd want?

Emacs - how do I automatically enter minor modes when I enter a major mode?

I'm kind of a newb when it comes to emacs. I know about the .emacs file but have very little idea as to do anything more advanced than elementary stuff.
Whenever I enter latex-mode, I'd also like to automatically turn on flyspell-mode, reftex-mode, auto-fill-mode, and also set fill-column to 120. How do I edit my .emacs file to do this?
Thanks!
(add-hook 'latex-mode-hook
(function (lambda ()
(flymake-mode)
(reftex-mode)
(auto-fill-mode)
(setq fill-column 120))))
for example should work.
You can set a so-called hook to a major mode. Have a look at this page of the manual for some examples.

Disable auto fill mode in noweb-mode

Please for the love of god how can I make Emacs stop auto-filling? I use visual-line-mode, I do not want auto fill. I can turn it off with M-x auto-fill-mode RET but in Noweb mode it gets turned back on when I move into a code chunk and back out again. Please, I just want to globally turn of auto fill mode, it's driving me crazy.
I've tried
(auto-fill-mode 0)
and a bunch of crazy things like
(add-hook 'Rnw-mode-hook '(lambda () (auto-fill-mode 0)))
(add-hook 'latex-mode-hook '(lambda () (auto-fill-mode 0)))
But nothing seems to work. Please help me.
Instead of adding further hooks to your system, you should check if you could remove some to disable auto-fill.
If you see noweb-mode's source code, around line 211 you find this chunk:
(add-hook 'noweb-select-doc-mode-hook 'noweb-auto-fill-doc-mode)
(add-hook 'noweb-select-code-mode-hook 'noweb-auto-fill-code-mode)
To disable auto filling, put the following one or two lines in your dotemacs (depending on whether you want to disable auto-fill in both code and documentation).
(remove-hook 'noweb-select-doc-mode-hook 'noweb-auto-fill-doc-mode)
(remove-hook 'noweb-select-code-mode-hook 'noweb-auto-fill-code-mode)
OK, I worked out a hack that does the trick:
(setq auto-fill-mode -1)
(setq-default fill-column 99999)
(setq fill-column 99999)
If I can't turn off auto-fill mode, at least I can make it harmless by setting it to fill only in column 99999. I'll be annoyed if I type a paragraph with more than 99999 characters, but if that happens I'll have bigger things to worry about...
If you look at simple.el, at the very top text-mode-hook is defined, which is ultimately responsible for turning on this abomination (or at least, it was for me).
To get to simple.el and look for yourself: (C-h f, auto-fill-mode, click / follow simple.el link)
To disable, M-x customize-variable text-mode-hook
Screen shot
Uncheck turn-on-auto-fill. Be sure to click "Save for future sessions" at the top.

Disable Carbon Emacs scroll beep

I've been looking into adopting Carbon Emacs for use on my Mac, and the only stumbling block I've run into is the annoying scroll beep when you try to scroll past the end of the document. I've looked online but I can't seem to find what I should add to my .emacs that will stop it from beeping when scrolling. I don't want to silence it completely, just when scrolling. Any ideas?
(setq visible-bell t)
This makes emacs flash instead of beep.
Using the hints from the Emacs wiki AlarmBell page, this does it for me:
(defun my-bell-function ()
(unless (memq this-command
'(isearch-abort abort-recursive-edit exit-minibuffer
keyboard-quit mwheel-scroll down up next-line previous-line
backward-char forward-char))
(ding)))
(setq ring-bell-function 'my-bell-function)
If you don't know the name of a command, press C-h k then the key/action you would like to get the name of.
You will have to customize the ring-bell-function.
This page may provide hints:
http://www.emacswiki.org/emacs/AlarmBell
Between Stephen Hassard's answer and Kipton Barros' comment:
(setq ring-bell-function 'ignore)
seems to be the most concise, works on emacs 24.x, and answers the original question.
This seems to do the trick:
(setq ring-bell-function nil)