Getting YASnippet and viper-mode to work together in emacs - plugins

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.

Related

Ergoemacs C-x and C-c Shortcuts, and Apple Cmd shortcuts

For ergoemacs, what are the C-x and C-c shortcuts re-mapped to?
There doesn't seem to be a page to help people transition from regular emacs to ergoemacs mode. They just have a keyboard picture with everything in it, without any information on C-x and C-c.
Also for Apple keyboards, when it says Ctrl/Cmd, does that mean either can be used? It doesn't look like it. It seems that OS X Cmd shortcuts are taking precedence over the ergoemacs ones. Until Ctrl/Cmd means something else?
Ctrl-c is copy and Ctrl-x is cut.
According to ErgoEmacs Documentation, the keybindings C-c and C-y are respectively associated with native <copy> and <paste> functionality using emacs kill-ring-save and yank commands.
The traditional C-k and C-y methods of line pulling / yanking used in GNU Emacs and XEmacs are left behind in an attempt to "[make it] so you don't have to change your mindset when you switch in and out of emacs". We can expect many features of ergoemacs to be intuitive to the sort of end-users who have never been religiously bound to a text editor.
In current version of ergoemacs-mode, by default C-x and C-c are same as GNU Emacs's.
in older version of ergoemacs-mode, the gnu emacs's C-x and C-c are simply left intact. ergoemacs-mode just turn on cua-mode.

emacs won't repaint buffer (windows 7)

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)

Cedet completion menu

I am using emacs24. I would like to get the auto-completion experience that I get in e.g. eclipse. That is:
- on pressing e.g. C-RETURN, to get a menu, which updates on-the-fly as I type the name of the method; I would also like to navigate with the arrows through the choices
- On clicking a completion from the menu, I would like to have something like a tooltip with the documentation of the specific method, if found
semantic-ia-complete-symbol opens a new buffer. semantic-ia-complete-symbol-menu does not come by default with emacs (built-in). Even if it did, it does not update itself on the fly, and I don't have the documentation.
This doesn't answer all your questions, but it is a start:
;; shows a menu by clicking CTRL-RETURN
(global-set-key (kbd "C-<return>") 'auto-complete)
;; allow to navigate the autocompletion menu with <up> and <down>
(setq ac-use-menu-map t)
(define-key ac-menu-map "<down>" 'ac-next)
(define-key ac-menu-map "<up>" 'ac-previous)

how to define a key to toggle viper-mode in Emacs

In Emacs, I want to define the key to enable/disable the viper-mode. When I press the F6, if viper-mode not enabled, then enable it; if viper-mode enabled, then disable it.
Thanks.
(global-set-key [f6] 'toggle-viper-mode)
May pose problems in modes which locally rebind F6. If that happens, see this related question

Emacs Starter Kit on the Mac

I just installed Emacs on my mac from here:
http://emacsformacosx.com/
and that got rid of all the menus. How do I get those menus back?
Look for menu-bar-mode in your ~/.emacs or ~/.emacs.d/init.el file.
You should find...
(menu-bar-mode -1)
If so, remove it. If you don't find it... add the following line.
(menu-bar-mode 1)
and save the file.
If you want to enable or disable the menu in emacs, you can use
M-x menu-bar-mode
and if you want the same with the toolbar you can use
M-x tool-bar-mode
The menu should be enabled "by default" unless stated otherwise in your .emacs file which you can find in emacs using C-x C-f ~/.emacs.