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.

Answers


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.

  1. Create a directory called ~/.emacs.d/snippets/pyqt
  2. open up a pyqt file in emacs.
  3. Under the YaSnippet top menu, choose New Snippet (or C+c & C+n)
  4. Save the file with just the snippet letters you want to hit. My sample file i saved as just l
  5. 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.


Need Your Help

Error while compile CSS file into SWF through command line

flex flex4.5

I compile my CSS file through command line then i got error like

How can I go to a specific tab after a click event using jquery?

jquery html jquery-ui

How can I go to a specific tab after a click event, I tried $("#tabs").tabs() since every time I refresh it go back to its original but still does not work, what is the right way of doing it?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.