How to let yasnippet support PyQt in emacs
I used emacs as Python IDE. I have install yasnippet, but how can I get it to support PyQt? This is my .emacs:
(require 'auto-complete) (add-to-list 'ac-dictionary-directories "~/.emacs.d/dict") (require 'auto-complete-config) (if (load "auto-complete-scite-api" t) (setq-default ac-sources (cons 'ac-source-scite-api ac-sources))) (ac-config-default) (require 'auto-complete-yasnippet) (require 'pymacs) (autoload 'pymacs-apply "pymacs") (autoload 'pymacs-call "pymacs") (autoload 'pymacs-eval "pymacs" nil t) (autoload 'pymacs-exec "pymacs" nil t) (autoload 'pymacs-load "pymacs" nil t) (require 'python) (require 'yasnippet) (yas/initialize) (yas/load-directory "~/.emacs.d/plugins/yasnippet/snippets") (yas/global-mode 1) (require 'python-mode) (require 'django-html-mode) (require 'django-mode) (yas/load-directory "/home/jactry/.emacs.d/snippets") (add-to-list 'auto-mode-alist '("\\.djhtml$" . django-html-mode)) (autoload 'python-mode "python-mode" "Python Mode." t) (add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode)) (add-to-list 'interpreter-mode-alist '("python" . python-mode))
I use Ubuntu and have install auto-complete and yasnippt,I want to let my emacs have a code autp complete of PyQt. Thanks.
I'm not sure how you installed yasnippets however, i used el-get and i don't think it should matter with what I'm about to write.
- Create a directory called ~/.emacs.d/snippets/pyqt
- open up a pyqt file in emacs.
- Under the YaSnippet top menu, choose New Snippet (or C+c & C+n)
- Save the file with just the snippet letters you want to hit. My sample file i saved as just l
- When done saving, reload your snippets using Reload Everything well that's what i do, the other one was too finicky for me.
You will get a file that kind of looks like this, only I filled it out:
# -*- mode: snippet -*- # name: label (l) # key: l # -- <label> $0 </label>
That should be it. you may have to adjust PyQt in the directory name, but it should be all lowercase. Cheers.