Add New Notes
91
Zim/Utils/emacs/new-setup/Emacs-w3m.txt
Normal file
@@ -0,0 +1,91 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T15:41:01+08:00
|
||||
|
||||
====== Emacs-w3m ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: cvs -d :pserver:anonymous@cvs.namazu.org:/storage/cvsroot co emacs-w3m
|
||||
Homepage: http://emacs-w3m.namazu.org/
|
||||
|
||||
===== Installation =====
|
||||
|
||||
Before installing emacs-w3m, you have to check whether your environment meets the requirements.
|
||||
|
||||
Installing emacs-w3m on UNIX-like systems
|
||||
|
||||
At the first, run the configure script.
|
||||
|
||||
% ./configure
|
||||
|
||||
If you've installed APEL, FLIM or something in non-standard directories other than the default load-path, you must specify them using the --with-addpath option as follows:
|
||||
|
||||
% ./configure --with-addpath=/opt/share/apel:/opt/share/flim
|
||||
|
||||
Next, execute the following commands to install emacs-w3m to an appropriate directory.
|
||||
|
||||
% make
|
||||
# make install
|
||||
|
||||
If you are using Emacs 21.1 and newer or XEmacs, you had better install icon image files. To do this:
|
||||
|
||||
# make install-icons
|
||||
|
||||
You can also install emacs-w3m as an XEmacs package using make install-package instead of make install.
|
||||
|
||||
% make
|
||||
# make install-package
|
||||
|
||||
In this case, you don't have to execute make install-icons.
|
||||
|
||||
===== Installing on non-UNIX-like systems =====
|
||||
|
||||
If you cannot execute the configure script on your system, or if no make command is available, execute the following command:
|
||||
|
||||
# emacs -batch -q -no-site-file -l w3mhack.el NONE -f w3mhack-nonunix-install
|
||||
|
||||
If APEL, FLIM (or any other library) aren't installed in the ordinary places, the installer will leave them out. In such a case, it is necessary to tell those places to the installer as shown below:
|
||||
|
||||
# emacs -batch -q -no-site-file -l w3mhack.el //c/share/apel://c/share/flim -f w3mhack-nonunix-install
|
||||
|
||||
===== Configuration =====
|
||||
|
||||
Put this line into your ~/.emacs file:
|
||||
|
||||
(require 'w3m-load)
|
||||
|
||||
Just type M-x w3m, and you can use emacs-w3m.
|
||||
|
||||
In order to handle text/html part with emacs-w3m under SEMI MUAs such as Wanderlust, you have to put the following line in your ~/.emacs file:
|
||||
|
||||
(require 'mime-w3m)
|
||||
|
||||
For more detail, see Info manual.
|
||||
|
||||
===== Mailing List =====
|
||||
|
||||
We have the mailing list, emacs-w3m@namazu.org, to discuss about emacs-w3m. Because almost all of its members are Japanese, Japanese is mainly used for discussion but we also welcome mails written in English. This list is opened to the public, and its archive is accessible via WEB. You can also subscribe to the gmane.emacs.w3m newsgroup which is gateway'd to this list bidirectionally.
|
||||
|
||||
If you want to subscribe to this list, check the disclaimer and send a mail containing
|
||||
|
||||
subscribe Your Name
|
||||
|
||||
(not your email address) in the body to emacs-w3m-ctl@namazu.org. To unsubscribe to it, send a mail containing just
|
||||
|
||||
# bye
|
||||
|
||||
in the body to emacs-w3m-ctl@namazu.org.
|
||||
|
||||
===== Related Links =====
|
||||
http://www.emacswiki.org/emacs/emacs-w3m
|
||||
|
||||
|
||||
|
||||
w3m
|
||||
w3m-m17n
|
||||
w3mmee
|
||||
APEL
|
||||
FLIM
|
||||
BITMAP-MULE
|
||||
gifsicle
|
||||
New custom
|
||||
95
Zim/Utils/emacs/new-setup/ac-math.txt
Normal file
@@ -0,0 +1,95 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T15:37:35+08:00
|
||||
|
||||
====== ac-math ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: svn checkout http://ac-math.googlecode.com/svn/trunk/ ac-math-read-only
|
||||
Homepage: http://code.google.com/p/ac-math/
|
||||
|
||||
This is an add-on which defines three ac-sources for the__ auto-complete__ package:
|
||||
|
||||
* ac-source-latex-commands - input latex commands
|
||||
* ac-source-math-latex - input math latex tags (active only in math environments)
|
||||
* ac-source-math-unicode - input of unicode symbols (active everywhere except math environments)
|
||||
|
||||
To start the math completion by typing the prefix "\" key. To select the completion type RET.
|
||||
|
||||
Depending on the context the unicode symbol or latex \tag will be inserted.
|
||||
|
||||
===== Activation =====
|
||||
|
||||
You must have auto-complete package installed.
|
||||
|
||||
Download ac-math.el and put it into your load-path directory.
|
||||
|
||||
This is an example of how to activate the 'ac-math' in latex-mode:
|
||||
|
||||
(require 'ac-math)
|
||||
|
||||
(add-to-list 'ac-modes 'latex-mode) ; make auto-complete aware of {{{latex-mode}}}
|
||||
|
||||
(defun ac-latex-mode-setup () ; add ac-sources to default ac-sources
|
||||
(setq ac-sources
|
||||
(append '(ac-source-math-unicode ac-source-math-latex ac-source-latex-commands)
|
||||
ac-sources))
|
||||
)
|
||||
|
||||
(add-hook 'LaTeX-mode-hook 'ac-latex-mode-setup)
|
||||
|
||||
If you are using 'flyspell' you would also like to activate the workaround:
|
||||
|
||||
(ac-flyspell-workaround)
|
||||
|
||||
===== Unicode Input =====
|
||||
|
||||
To use unicode in full force with LaTeX you will need XeTeX bundle.
|
||||
|
||||
By default unicode input (ac-source-math-unicode) is not activated in latex math environments. To activate it do
|
||||
|
||||
(setq ac-math-unicode-in-math-p t)
|
||||
|
||||
You can always call UNDO to insert LaTeX command instead of Unicode character. For instance \alp RET inserts the character, next undo reinserts \alpha. Thus, you might consider removing ac-source-math-latex altogether from the list of ac-sources to increase the completion speed:
|
||||
|
||||
(defun ac-latex-mode-setup ()
|
||||
(setq ac-sources
|
||||
(append '(ac-source-math-unicode ac-source-latex-commands)
|
||||
ac-sources))
|
||||
)
|
||||
|
||||
Unicode input is not restricted to LaTeX modes and is particularly useful in org-mode with it's powerful exporting facilities, or web development tools where unicode is crucial.
|
||||
|
||||
Suppose you want it for mode XXX:
|
||||
|
||||
(require 'ac-math)
|
||||
|
||||
(add-to-list 'ac-modes 'XXX-mode)
|
||||
|
||||
(defun ac-XXX-mode-setup ()
|
||||
(add-to-list 'ac-sources 'ac-source-math-unicode)
|
||||
)
|
||||
|
||||
(add-hook 'XXX-mode-hook 'ac-XXX-mode-setup)
|
||||
|
||||
===== Other Sources =====
|
||||
|
||||
Here is how to make the TaTeX completion work everywhere (default is only in math mode):
|
||||
|
||||
(defvar ac-source-math-latex-everywere
|
||||
'((candidates . ac-math-symbols-latex)
|
||||
(prefix . "\\\\\\(.*\\)")
|
||||
(action . ac-math-action-latex)
|
||||
(symbol . "l")
|
||||
))
|
||||
|
||||
Here is how to make unicode completion work with prefix "%" (prefix is deleted automatically on completion):
|
||||
|
||||
(defvar ac-source-math-unicode-on-%
|
||||
'((candidates . ac-math-symbols-unicode)
|
||||
(prefix . "%\\(.*\\)")
|
||||
(action . ac-math-action-unicode)
|
||||
(symbol . "u")
|
||||
))
|
||||
|
||||
Please let me know if you want anything different from above.
|
||||
9
Zim/Utils/emacs/new-setup/auctex.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T15:43:28+08:00
|
||||
|
||||
====== auctex ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/auctex co auctex
|
||||
Homepage: http://www.gnu.org/software/auctex/
|
||||
9
Zim/Utils/emacs/new-setup/auctex/reftex.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T15:45:18+08:00
|
||||
|
||||
====== reftex ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/auctex co reftex
|
||||
Homepage: http://cvs.savannah.gnu.org/viewvc/?root=auctex
|
||||
9
Zim/Utils/emacs/new-setup/auto-complete.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T15:46:37+08:00
|
||||
|
||||
====== auto-complete ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: git clone git://github.com/m2ym/auto-complete.git
|
||||
Homepage: http://cx4a.org/software/auto-complete/
|
||||
8
Zim/Utils/emacs/new-setup/autopair.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T15:47:51+08:00
|
||||
|
||||
====== autopair ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: svn checkout http://autopair.googlecode.com/svn/trunk autopair
|
||||
8
Zim/Utils/emacs/new-setup/buffer-move.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T15:48:19+08:00
|
||||
|
||||
====== buffer-move ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: git clone git://github.com/emacsmirror/buffer-move.git
|
||||
8
Zim/Utils/emacs/new-setup/cedet.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T15:48:43+08:00
|
||||
|
||||
====== cedet ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: bzr checkout bzr://cedet.bzr.sourceforge.net/bzrroot/cedet/code/trunk cedet
|
||||
9
Zim/Utils/emacs/new-setup/color-theme.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T16:23:53+08:00
|
||||
|
||||
====== color-theme ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Homepage: http://savannah.nongnu.org/bzr/?group=color-theme
|
||||
Repo: bzr branch bzr://bzr.savannah.nongnu.org/color-theme/trunk color-theme
|
||||
8
Zim/Utils/emacs/new-setup/django-mode.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T15:49:04+08:00
|
||||
|
||||
====== django-mode ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: git clone git://github.com/myfreeweb/django-mode.git
|
||||
248
Zim/Utils/emacs/new-setup/el-get.txt
Normal file
@@ -0,0 +1,248 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T15:38:05+08:00
|
||||
|
||||
====== el-get ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: https://github.com/dimitri/el-get
|
||||
Homepage: http://tapoueh.org/tags/el-get.html
|
||||
|
||||
===== README.asciidoc =====
|
||||
|
||||
Short Story: el-get allows you to install and manage elisp code for Emacs. It supports lots of differents types of sources and is able to install them, update them and remove them, but more importantly it will init them for you.
|
||||
|
||||
That means it will require the features you need, load the necessary files, set the Info paths so that C-h i shows the new documentation you now depend on, and finally call your own :post-init function for you to setup the extension. Or call it a package.
|
||||
Status and Version Numbers
|
||||
|
||||
Current el-get status is stable, ready for daily use and packed with extra features that make life easier. There are some more things we could do, as always, but they will be about smoothing things further.
|
||||
Latest released version
|
||||
|
||||
el-get version 3.1 is available, with a boatload of features, including autoloads support, byte-compiling in an external "clean room" Emacs instance, custom support, lazy initialisation support (defering all init functions to eval-after-load), and multi repositories ELPA support.
|
||||
Version numbering
|
||||
|
||||
Version String are now inspired by how Emacs itself numbers its versions. First is the major version number, then a dot, then the minor version number. The minor version number is 0 when still developping the next major version. So 3.0 is a developer release while 3.1 will be the next stable release.
|
||||
|
||||
Please note that this versioning policy has been picked while backing 1.2~dev, so 1.0 was a "stable" release in fact. Ah, history.
|
||||
How to Install it?
|
||||
|
||||
Here’s the lazy installer:
|
||||
|
||||
;; So the idea is that you copy/paste this code into your *scratch* buffer,
|
||||
;; hit C-j, and you have a working el-get.
|
||||
(url-retrieve
|
||||
"https://raw.github.com/dimitri/el-get/master/el-get-install.el"
|
||||
(lambda (s)
|
||||
(end-of-buffer)
|
||||
(eval-print-last-sexp)))
|
||||
|
||||
You have to type C-j with the cursor at the end of the last line, but still on the line. C-j runs the command eval-print-last-sexp, so it will evaluate the code you’re looking at, and that will git clone el-get at the right place.
|
||||
|
||||
Note that you can add this elisp code into your emacs init file directly, as the installer code will detect if el-get is already installed. Notice that doing so directly will require internet access to start emacs. You can avoid this with the following snippet instead:
|
||||
|
||||
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
|
||||
|
||||
(unless (require 'el-get nil t)
|
||||
(url-retrieve
|
||||
"https://raw.github.com/dimitri/el-get/master/el-get-install.el"
|
||||
(lambda (s)
|
||||
(end-of-buffer)
|
||||
(eval-print-last-sexp))))
|
||||
|
||||
See next section for details about how to setup you emacs so that it’s able to benefit from el-get automatically.
|
||||
How to install the developer version (master branch)?
|
||||
|
||||
The lazy installer uses the default el-get-install.el file which targets the 2.stable branch. To install el-get directly on the master branch, summon the el-get-master-branch variable into existence:
|
||||
|
||||
;; So the idea is that you copy/paste this code into your *scratch* buffer,
|
||||
;; hit C-j, and you have a working developper edition of el-get.
|
||||
(url-retrieve
|
||||
"https://raw.github.com/dimitri/el-get/master/el-get-install.el"
|
||||
(lambda (s)
|
||||
(let (el-get-master-branch)
|
||||
(end-of-buffer)
|
||||
(eval-print-last-sexp))))
|
||||
|
||||
Basic usage
|
||||
|
||||
Now that el-get is installed, simply use M-x el-get-install and pick whatever package you need. Arrange to have el-get part of your setup, so that at next emacs startup the installed packages are initialized. Here’s how to:
|
||||
|
||||
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
|
||||
|
||||
(unless (require 'el-get nil t)
|
||||
(with-current-buffer
|
||||
(url-retrieve-synchronously
|
||||
"https://raw.github.com/dimitri/el-get/master/el-get-install.el")
|
||||
(end-of-buffer)
|
||||
(eval-print-last-sexp)))
|
||||
|
||||
(el-get 'sync)
|
||||
|
||||
That’s the basic setup.
|
||||
Advanced setup with local recipes
|
||||
|
||||
Of course, my emacs setup is managed in a private git repository. Some people on #emacs are using git submodules (or was it straight import) for managing external repositories in there, but all I can say is that I frown on this idea. I want an easy canonical list of packages I depend on to run emacs, and I want this documentation to be usable as-is. Enters el-get!
|
||||
|
||||
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
|
||||
(require 'el-get)
|
||||
|
||||
;; local sources
|
||||
(setq el-get-sources
|
||||
'((:name magit
|
||||
:after (lambda () (global-set-key (kbd "C-x C-z") 'magit-status)))
|
||||
|
||||
(:name asciidoc
|
||||
:type elpa
|
||||
:after (lambda ()
|
||||
(autoload 'doc-mode "doc-mode" nil t)
|
||||
(add-to-list 'auto-mode-alist '("\\.adoc$" . doc-mode))
|
||||
(add-hook 'doc-mode-hook '(lambda ()
|
||||
(turn-on-auto-fill)
|
||||
(require 'asciidoc)))))
|
||||
|
||||
(:name lisppaste :type elpa)
|
||||
(:name emacs-goodies-el :type apt-get)))
|
||||
|
||||
(setq my-packages
|
||||
(append
|
||||
'(cssh el-get switch-window vkill google-maps nxhtml xcscope yasnippet)
|
||||
(mapcar 'el-get-source-name el-get-sources)))
|
||||
|
||||
(el-get 'sync my-packages)
|
||||
|
||||
So now you have a pretty good documentation of the packages you want installed, where to get them, and how to install them. For the advanced methods (such as elpa or apt-get), you basically just need the package name. When relying on a bare git repository, you need to give some more information, such as the URL to clone and the build steps if any. Then also what features to require and maybe where to find the texinfo documentation of the package, for automatic inclusion into your local Info menu.
|
||||
|
||||
The good news is that not only you now have a solid readable description of all that in a central place, but this very description is all (el-get) needs to do its magic. This command will check that each and every package is installed on your system (in el-get-dir) and if that’s not the case, it will actually install it. Then, it will init the packages: that means caring about the load-path, the Info-directory-list (and dir texinfo menu building) the loading of the emacs-lisp files, and finally it will require the features.
|
||||
How to use it?
|
||||
|
||||
You see that el-get-sources example up there? It finishes with a single (el-get) call. That’s it. It will install new sources on the list and only init already installed ones.
|
||||
|
||||
The status of each package is tracked into ~/.emacs.d/el-get/.status.el (by default) and can get the values required, installed or removed.
|
||||
Sync or async?
|
||||
|
||||
Most often you want el-get-install and el-get-build to stay out of the way and be asynchronous, so that you can continue using Emacs while your new package is getting ready. But imagine you’re starting up Emacs after a git pull on the other computer (after a commute, say), and there’s some newer packages for this instance to consider installing.
|
||||
|
||||
Now you want a synchronous install, right?
|
||||
|
||||
So, by default (el-get) is asynchronous, but you can ask for it to be sync, or to still be asynchronous but to wait until it finished before to give control back:
|
||||
|
||||
(el-get 'sync)
|
||||
(el-get 'wait)
|
||||
|
||||
You even get a progress report!
|
||||
Sources
|
||||
|
||||
See the documentation of the el-get-sources variable for details. Please note that el-get-sources is another source location for recipes, adding to your el-get-recipe-path.
|
||||
|
||||
Note that you can also give a mix of packages symbols, inline recipes and source lists to el-get as arguments, and completely bypass the el-get-sources variable.
|
||||
|
||||
(el-get 'sync 'package 'name 'list-of-packages-names-or-symbol)
|
||||
|
||||
It is still recommended to (setq el-get-sources '(list of packages)) then use (el-get 'sync), so that commands such as el-get-update know which packages to update.
|
||||
Recipes
|
||||
|
||||
Some sources are contributed to el-get directly, so that you only have to put in the el-get-sources the name of the package you want to install.
|
||||
|
||||
Should you need some local specific setup, you can do that by providing a partial sources missing the :type property: your local properties will get merged into the recipes one.
|
||||
|
||||
Also, the variable el-get-recipe-path allows you to maintain local recipes in case you either dislike the default one or are crafting some new one not commited to the main repository yet. But please do consider sending them over!
|
||||
|
||||
We do not intend to provide recipes for advanced types such as apt-get and elpa because there’s so little to win here, and maintaining a package list would take too much time.
|
||||
Package setup
|
||||
|
||||
The package setup can either go into the :after function, or in a file named init-package.el in el-get-user-package-directory. Any such named file will get automatically loaded by el-get at init time, if it exists.
|
||||
Build Commands
|
||||
|
||||
Avoid using make install, which will usually move files into a "system location." In our case, you probably just want your package foo to be all installed into ~/.emacs.d/el-get/foo, right? So, no make install.
|
||||
Byte Compiling
|
||||
|
||||
el-get will byte compile the elisp for the package when its source definition includes a :compile property set to the list of files to byte compile (or to a single file), or all the .el files found in the package when there’s no :build command.
|
||||
Hooks
|
||||
|
||||
el-get offers a variety of specific hooks (read the source), and two general purposes hooks facilities: el-get-post-install-hooks and el-get-post-update-hooks, called with the package name as argument.
|
||||
Some more commands?
|
||||
|
||||
Yes, ok.
|
||||
|
||||
M-x el-get-list-packages
|
||||
|
||||
Opens a buffer listing all known packages (those for which you have a recipe). The listing includes the package name, its status (one of "available", "installed", "removed" or "required") and the package description. The description is a free form text and has not been provided for all recipes. Please also note that el-get-emacswiki-refresh will create recipes omitting the description as of now.
|
||||
M-x el-get-describe
|
||||
|
||||
Prompt for a package name, with completion, then open an Help window with details about the selected package. Those include current status, website, description, installation method, full recipe, and buttons to easily install, update or remove the package.
|
||||
M-x el-get-install
|
||||
|
||||
Will prompt for a package name, with completion, then install it. It will only propose packages that are not already installed. Any package that you have a recipe for is a candidate.
|
||||
|
||||
Please note that when installing a package that is not in your el-get-sources or your el-get call means that it will not be initialized for you automatically at emacs startup. You get a WARNING message when that’s the case.
|
||||
M-x el-get-cd
|
||||
|
||||
Will prompt for an installed package name, with completion, then open its directory with dired.
|
||||
M-x el-get-update
|
||||
|
||||
Will prompt for an installed package name, with completion, then update it. This will run the build commands and init the package again.
|
||||
M-x el-get-self-update
|
||||
|
||||
Update only one package, el-get itself.
|
||||
M-x el-get-update-all
|
||||
|
||||
Will update all packages used in el-get-sources. Beware that using this function can lead to hours of settings review: more often than not updating a package requires some adjustments to your setup. Updating all of them at once will require reviewing almost all your setup.
|
||||
M-x el-get-reload
|
||||
|
||||
Reload the given package files. Happens automatically at update time too.
|
||||
M-x el-get-remove
|
||||
|
||||
Will prompt for an installed package name, with completion, then remove it. Depending on the type of the package, this often means simply deleting the directory where the source package lies. Sometime we have to use external tools instead (apt-get, e.g.). No effort is made to unload the features.
|
||||
M-x el-get-find-recipe-file
|
||||
|
||||
Will prompt for the name of a package, with completion, then find-file its recipe file.
|
||||
M-x el-get-make-recipes
|
||||
|
||||
Will prompt for an existing directory where to output all your new recipe files: one file for each entry in el-get-sources that is not just a symbol and that is not found anywhere in el-get-recipe-path.
|
||||
M-x el-get-checksum
|
||||
|
||||
Will prompt for the name of an installed package, with complement, then compute its checksum if the package type supports that feature. The checksum is added to the kill-ring so that you’re ready to yank it into your el-get-sources :checksum property if you want to.
|
||||
M-x el-get-emacswiki-refresh
|
||||
|
||||
Will launch a subprocess that connects to EmacsWiki and fetch from there the list of elisp scripts hosted. Then produce a recipe file per script, and store that in the given directory, which default to ~/.emacs.d/el-get/el-get/recipes/emacswiki/ if you didn’t change el-get-dir.
|
||||
|
||||
Useful functions
|
||||
|
||||
el-get-package-types-alist (statuses &rest types)
|
||||
|
||||
Return an alist of package names that are of given types. Only consider packages whose status is ‘member’ of STATUSES, which defaults to installed, required and removed.
|
||||
|
||||
ELISP> (el-get-package-types-alist "installed" 'cvs 'emacswiki)
|
||||
((emacs-w3m . cvs)
|
||||
(rect-mark . emacswiki)
|
||||
(icomplete+ . emacswiki)
|
||||
(php-mode-improved . emacswiki)
|
||||
(rainbow-delimiters . emacswiki)
|
||||
(goto-last-change . emacswiki)
|
||||
(emacs-goodies-el . cvs))
|
||||
|
||||
el-get-extra-packages (&rest packages)
|
||||
|
||||
Return installed or required packages that are not in given package list.
|
||||
|
||||
ELISP> (el-get-extra-packages dim-packages)
|
||||
((verbiste "installed")
|
||||
(package "installed"))
|
||||
|
||||
Extending it
|
||||
|
||||
Please see the documentation for the el-get-methods and provide a patch!
|
||||
|
||||
Adding bzr support for example was only about writing 2 functions, mostly using copy paste. Here’s the patch: https://github.com/dimitri/el-get/commit/63e9018102bdeb7b6d9136db231adcd983087217#L0R437
|
||||
Upgrade Notes
|
||||
Upgrading to 3.1
|
||||
|
||||
A change has been included so that el-get-sources is now only another source for recipes, and (el-get '…) will now only install and initialize known "required" and "installed" packages.
|
||||
|
||||
The documentation has been updated to detail the new setup.
|
||||
|
||||
If you have packages that have been installed in the past but you no longer want in your setup, here’s how to get them out of the way:
|
||||
|
||||
M-: (el-get-save-package-status "package-name-here" "removed")
|
||||
|
||||
Please review documentation section Advanced setup with local recipes.
|
||||
10
Zim/Utils/emacs/new-setup/global.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T16:43:18+08:00
|
||||
|
||||
====== global ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/global co global
|
||||
Homepage: http://www.gnu.org/software/global/global.html
|
||||
http://savannah.gnu.org/cvs/?group=global
|
||||
8
Zim/Utils/emacs/new-setup/htmlize.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T15:51:01+08:00
|
||||
|
||||
====== htmlize ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: git clone http://fly.srk.fer.hr/~hniksic/emacs/htmlize.git
|
||||
8
Zim/Utils/emacs/new-setup/icicles.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T15:52:20+08:00
|
||||
|
||||
====== icicles ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: git clone git://github.com/emacsmirror/icicles.git
|
||||
8
Zim/Utils/emacs/new-setup/ido.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T15:53:15+08:00
|
||||
|
||||
====== ido ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: wget http://repo.or.cz/w/emacs.git/blob_plain/HEAD:/lisp/ido.el
|
||||
8
Zim/Utils/emacs/new-setup/insert-time-string.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T15:54:07+08:00
|
||||
|
||||
====== insert-time-string ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: git clone git://github.com/emacsmirror/insert-time-string.git
|
||||
8
Zim/Utils/emacs/new-setup/magit.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T15:54:53+08:00
|
||||
|
||||
====== magit ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: git clone git://github.com/magit/magit.git
|
||||
8
Zim/Utils/emacs/new-setup/org-mode.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T15:55:45+08:00
|
||||
|
||||
====== org-mode ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: git clone git://orgmode.org/org-mode.git
|
||||
10
Zim/Utils/emacs/new-setup/package.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T15:56:33+08:00
|
||||
|
||||
====== package ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo:
|
||||
package: wget http://tromey.com/elpa/package.el
|
||||
package-install: wget http://tromey.com/elpa/package-install.el
|
||||
7
Zim/Utils/emacs/new-setup/python.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T15:57:37+08:00
|
||||
|
||||
====== python ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
8
Zim/Utils/emacs/new-setup/python/Pymacs.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T16:02:52+08:00
|
||||
|
||||
====== Pymacs ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: git clone git://github.com/pinard/Pymacs.git
|
||||
8
Zim/Utils/emacs/new-setup/python/ipython.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T15:57:44+08:00
|
||||
|
||||
====== ipython ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: git clone git://github.com/ipython/ipython.git
|
||||
9
Zim/Utils/emacs/new-setup/python/pylint.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T16:00:57+08:00
|
||||
|
||||
====== pylint ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: hg clone http://hg.logilab.org/pylint
|
||||
|
||||
8
Zim/Utils/emacs/new-setup/python/pylookup.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T16:02:01+08:00
|
||||
|
||||
====== pylookup ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: git clone git://github.com/tsgates/pylookup.git
|
||||
31
Zim/Utils/emacs/new-setup/python/python-mode.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T16:08:06+08:00
|
||||
|
||||
====== python-mode ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: bzr branch [[lp:python-mode]]
|
||||
|
||||
Homepage: https://code.launchpad.net/~python-mode-devs/python-mode/python-mode
|
||||
branch: https://code.launchpad.net/python-mode
|
||||
|
||||
===== Related blueprints =====
|
||||
|
||||
pymacs integration
|
||||
|
||||
IPython, ipython.el issues
|
||||
|
||||
edit or navigate code by feature
|
||||
|
||||
shift keep relative position
|
||||
|
||||
EmacsWiki
|
||||
|
||||
Ropemacs integration
|
||||
|
||||
deliver cython-mode.el
|
||||
|
||||
features delivered by paredit.el
|
||||
|
||||
Link to another blueprint
|
||||
9
Zim/Utils/emacs/new-setup/python/rope.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T16:12:16+08:00
|
||||
|
||||
====== rope ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: hg clone https://bitbucket.org/agr/rope
|
||||
Homepage: http://rope.sourceforge.net/
|
||||
14
Zim/Utils/emacs/new-setup/python/ropemacs.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T16:13:53+08:00
|
||||
|
||||
====== ropemacs ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: hg clone https://bitbucket.org/agr/ropemacs
|
||||
Homepage: http://rope.sourceforge.net/ropemacs.html
|
||||
|
||||
|
||||
**Ropemacs** is a plugin for performing python refactorings in emacs. It uses__ rope__ library and __pymacs__.
|
||||
|
||||
You should install** rope** library, **ropemode** and **pymacs** before using** ropemacs**. You can download ropemacs from here.
|
||||
9
Zim/Utils/emacs/new-setup/python/ropemode.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T16:14:57+08:00
|
||||
|
||||
====== ropemode ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: hg clone https://bitbucket.org/agr/ropemode
|
||||
Homepage: http://rope.sourceforge.net/ropemacs.html
|
||||
8
Zim/Utils/emacs/new-setup/smex.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T16:26:47+08:00
|
||||
|
||||
====== smex ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: git clone git://github.com/nonsequitur/smex.git
|
||||
8
Zim/Utils/emacs/new-setup/switch-window.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T16:27:15+08:00
|
||||
|
||||
====== switch-window ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: git clone git://github.com/dimitri/switch-window.git
|
||||
8
Zim/Utils/emacs/new-setup/yanippet.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T16:27:44+08:00
|
||||
|
||||
====== yanippet ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: git clone git://github.com/capitaomorte/yasnippet.git
|
||||
8
Zim/Utils/emacs/new-setup/zencoding.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-10T16:28:03+08:00
|
||||
|
||||
====== zencoding ======
|
||||
Created Tuesday 10 January 2012
|
||||
|
||||
Repo: git clone git://github.com/rooney/zencoding.git
|
||||
7
Zim/Utils/emacs/new-setup/插件.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-08-14T09:16:07+08:00
|
||||
|
||||
====== 插件 ======
|
||||
Created Sunday 14 August 2011
|
||||
|
||||
200
Zim/Utils/emacs/new-setup/插件/AucTeX.txt
Normal file
@@ -0,0 +1,200 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-08T14:38:59+08:00
|
||||
|
||||
====== AucTeX ======
|
||||
Created Sunday 08 January 2012
|
||||
http://emacser.com/auctex.htm/comment-page-1#comments
|
||||
|
||||
===== AucTeX 简介 =====
|
||||
关于 TeX
|
||||
|
||||
关于 TeX 或是 LaTeX 的介绍和使用由于篇幅就不在本文的范围之内,如果需要了解详情可以访问 ctex 论坛。
|
||||
|
||||
===== 为何选用 AucTeX? =====
|
||||
TeX 的编辑器很丰富,有跨平台的 TeXworks,Kile 以及 vim 的 LaTeX-suite 插件。选用 emacs+AucTeX 作为 tex 的编辑器与之相比还是有太多的优点。
|
||||
* 跨平台 。 AucTeX 作为 emacs 的插件,自然可以实现跨平台,只是由于外部工具的限制在 windows 实在有诸般限制。
|
||||
* 半 ‘WYSIWYG’ TeX 的工作方式为 WYTIWYG,但是其搭配 emacs,AucTeX 可以对 tex文件进行分析,并且提供__一部分的可视化特性__,例如可以以粗体显示章节目录,以斜体表示 \textit{} 中的文本。另外配合 preview 组件,还可以显示 tex 文件中的公式和图片。
|
||||
* 拓展性 AucTeX 是完全是 elisp 实现的,如果你觉得 AucTeX 不能很好的按照你预想的方式工作或是觉得 AucTeX 功能还是不够强大,你可以用 elisp 轻松的拓展其功能,当然这需要一定的 elisp 功力。
|
||||
|
||||
===== 安装 =====
|
||||
|
||||
=== 安装条件 ===
|
||||
在 unix-like 上的手动安装比较方便,只需要 “./configure && make && make install” 即可,但是当前系统需要满足这些条件:
|
||||
|
||||
* 可以工作的 TeX 目录树 在 unix 上 TeXLive 更加流行,当然各个 linux 发行版本也可以使用各自包管理系统安装 TeX,windows 上 MikTeX 更加流行。无论是如何安装,TeX 目录树都是很庞大的,你必须确保 TeX 可以编译。
|
||||
* ghostscript AucTeX 的 preview 组件在 DVI 和 PDF 模式需要 ghostscript 的协作。
|
||||
|
||||
=== windows 下的安装 ===
|
||||
需要单独说明下 AucTeX 在 windows 下的配置,windows 下建议使用官方提供的预编译版本,如现在的版本为 “AucTeX-11.86-e23.1-msw.zip”。如果喜欢折腾自己的话,也可以选择在 windows 编译安装 AucTeX,但是除了满足之前叙述的安装前提外,你还需要一个可以工作的 shell,现在只有 MSYS 和 Cygwin 可供选择。最后还是再建议使用预编译的版本,更加建议你在 unix 下使用 emacs 和 TeX,可以免去太多的被折腾。
|
||||
|
||||
===== 加载 AucTeX =====
|
||||
首先你需要把 AucTeX 加入到 load-path 中,然后加载 AucTeX 即可。如把 AucTeX 的预编译安装包解压至 “~/.emacs.d/AucTeX” 路径,相应的配置如下,其他的目录也可以相应修改。
|
||||
|
||||
(add-to-list 'load-path
|
||||
"~/.emacs.d/lisps/AucTeX/site-lisp/site-start.d")
|
||||
(load "AucTeX.el" nil t t)
|
||||
(load "preview-latex.el" nil t t)
|
||||
(if (string-equal system-type "windows-nt")
|
||||
(require 'tex-mik))
|
||||
|
||||
另外,如果 emacs 是运行在多需折腾的 windows 平台上,系统会加载 “tex-mik”文件,这可以提供很多在 windows 上方便的设置。
|
||||
|
||||
===== 快速开始 =====
|
||||
|
||||
=== LaTeX 设置 ===
|
||||
通常情况下,编译 tex 文件选用的多是 LaTeX,plainTeX 和 conTeXt 相对使用要少一些。因此本文默认只涉及对 LaTeX 模式相关的设置。
|
||||
为了使用 AucTeX 方便,为 LaTeX 模式 hook 自动换行,数学公式,reftex 和显示行号的功能。
|
||||
|
||||
(mapc (lambda (mode)
|
||||
(add-hook 'LaTeX-mode-hook mode))
|
||||
(list 'auto-fill-mode
|
||||
'LaTeX-math-mode
|
||||
'turn-on-reftex
|
||||
'linum-mode))
|
||||
|
||||
现在 TeX 对于中文的处理基本有两种方案,CJK 宏包和 xetex。如果使用 CJK 宏包需要对字体进行配置,这也是大部分面对 TeX 最折腾的地方。相比 CJK 宏包,xetex 要方便的多。本文也建议你设置 ‘TeX-engine’ 变量为 xetex 替代 latex 作为 tex 文件的默认排版引擎。
|
||||
|
||||
在 LaTeX mode 中,默认开启 PDF mode,即默认使用 xelatex 直接生成 pdf 文件,而不用每次用 ‘C-c C-t C-p’ 进行切换。设置 ‘Tex-show-compilation’ 为 t,在另一个窗口显示编译信息,对于错误的排除很方便。另外,编译时默认直接保存文件,绑定补全符号到 TAB 键。
|
||||
|
||||
(add-hook 'LaTeX-mode-hook
|
||||
(lambda ()
|
||||
(setq TeX-auto-untabify t ; remove all tabs before saving
|
||||
TeX-engine '__xetex__ ; use xelatex default
|
||||
TeX-show-compilation t) ; display compilation windows
|
||||
(TeX-global-PDF-mode t) ; PDF mode enable, not plain
|
||||
(setq TeX-save-query nil)
|
||||
(imenu-add-menubar-index)
|
||||
(define-key LaTeX-mode-map (kbd "TAB") 'TeX-complete-symbol)))
|
||||
|
||||
===== 快速插入 =====
|
||||
|
||||
在 tex 文档中,为了结构化的需要,经常会需要插入 ‘\chapter’, ‘\section’,'\subsection’ 命令。在 AucTeX 中,这些命令都可以通过 ‘__C-c C-s’__ 一站式完成,你只需要告诉 AucTeX 你所需要插入**章节层次**(section level),然后告诉 AucTeX 相应章节的标题,如果需要,你也可以添加相应的标签(可选)。
|
||||
|
||||
类似的,在 tex 文档中,必不可少的 ‘\begin{document}’ 与 ‘\end{document},以及众多的类似的各种各样的**环境**,自己在编辑 tex 文档时,经常会遗忘去匹配相应的环境,然后在编译时候要花费时间去修改。于 AucTeX 里你只需要键入__’C-c C-e’ __然后告诉 AucTeX 你所希望插入文档的环境,例如你键入了 ‘math’,AucTeX 会悉心的插入数学环境 ‘\begin{math}’ 与 ‘\end{math}’。
|
||||
|
||||
AucTeX 还提供了__ ‘C-c C-m’ __快捷键供方便地插入**宏命令**,在大多数情况下 auxtex 都可以理解相应宏命令的参数个数并提示你一一输入。
|
||||
|
||||
在使用这些快捷键时,你可以使用 __TAB 自动补全__,或是使用 ‘M-p’ 与 ‘M-n’浏览命令历史记录,也可以使用上下快捷键,但是相信众 emacs 党应该还是键盘流多,会更习惯前者。
|
||||
|
||||
此处涉及的相关快捷键如下:
|
||||
C-c C-s 插入章节
|
||||
C-c C-e 插入 LaTex 环境
|
||||
C-c C-j 插入列表 item
|
||||
C-c ] 闭合 LaTeX 环境
|
||||
C-c C-m 插入 Tex 宏
|
||||
|
||||
===== 快速更改字体 =====
|
||||
AucTeX 也提供了一系列方便的快捷键用以方便的插入指定应该文本如何格式化的命令,这系列命令一致__以 ‘C-c C-f’ 为前缀__,以 ‘C- ‘ 结尾告诉 AucTeX 你具体需要如何排版文本。
|
||||
C-c C-f C-b 插入粗体文本
|
||||
C-c C-f C-i 插入斜体文本
|
||||
C-c C-f C-e 插入强调文本
|
||||
C-c C-f C-s 插入微斜体文本
|
||||
C-c C-f C-r 插入罗马体文本
|
||||
C-c C-f C-f 插入无衬线体文本
|
||||
C-c C-f C-t 插入打印机体字体
|
||||
C-c C-f C-c 插入小型大写文本
|
||||
C-c C-f C-d 删除字体信息
|
||||
|
||||
默认情况下,输入以上的快捷键时,会假定插入新的相应格式化文本,如果你希望更改已存在文本的话,需要先__设定区域__,然后再使用这些快捷键。
|
||||
|
||||
===== 一站式的编译、查看、打印服务 =====
|
||||
如果你已经完成了 tex 文档的编写想查看排版后输出的 pdf,试着输入__ ‘C-c C-c’__,AucTeX 会询问你想调用那项命令,在大多数情形中,AucTeX __所建议__给出的命令往往可以符合你的需要。例如,你刚刚完成对文档的修改,此时 AucTeX 所给出的建议命令为 ‘latex’,即建议你重新编译文档,而如果你已经完成对最新文档的编译,AucTeX 会建议你查看最新的 pdf,而不是再次对文档进行编译(如果需要更新文档的交叉索引信息,可能需要多次的编译)。
|
||||
|
||||
如果 AucTeX 给出的建议命令不合适,你可以键入 __TAB __查看当前可用的命令,然后再指定 AucTeX 运行相应的合适命令。
|
||||
|
||||
在对于__自定义查看文档命令__的设置中,不推荐使用原来的’TeX-output-view-style’,而更推荐灵活性更强的 ‘TeX-view-program-list’与”TeX-view-program-selection”。’TeX-output-view-style’ 是直接绑定指定类型与相应的 viewer,而对于后者,在不同系统平台之间你需要定义阅读器,并且对于不同的类型灵活绑定。
|
||||
|
||||
‘TeX-view-program-list’ 控制 AucTeX 预定义的 viewer,包括符号名与具体定义所调用的命令或函数,预定义为 ‘TeX-view-program-list-builtin’ 的内容,有兴趣可以查看一下该变量的内容。如果需要自定义,如在 windows 平台上,可能会定义 SumatraPDF 查看 pdf 文档,而把相应的符号名记为 SumatraPDF,那就可以使用如下的命令去定义。
|
||||
|
||||
(setq TeX-view-program-list
|
||||
'(("SumatraPDF "SumatraPDF.exe %o")))
|
||||
|
||||
当然仅仅只是定义了符号名,而对于该符号名所对应的具体 viewer 在该平台是否可用,是需要使用者自己去选择控制的。更通用而言,你可能需要同时使用Linux 与 Windows 系统,那你需要分别定义其上平台的 viewer,如下的设置中就分别定义了 SumatraPDF, Gsview 用于 Windows 平台,Okular, Evince, Firefox用于Linux 平台。
|
||||
|
||||
(setq TeX-view-program-list
|
||||
'(("SumatraPDF" "SumatraPDF.exe %o")
|
||||
("Gsview" "gsview32.exe %o")
|
||||
("Okular" "okular --unique %o")
|
||||
("Evince" "evince %o")
|
||||
("Firefox" "firefox %o")))
|
||||
|
||||
对于如上的示例而言,在 Windows 平台上绑定 SumatraPDF 为 pdf viewer,Miktex 的组件 Yap 为 dvi viewer,而在 Linux 平台上,或许需要 Okular 作为pdf 与 dvi 的 viewer。当然对于 Gnomer 而言,Evince 应该是比 Okular 更好的选择。
|
||||
|
||||
PS:
|
||||
|
||||
* 对于 windows 平台而言,需要确保命令在 PATH 路径下,如果没有在 PATH 路径下,请使用路径全名进行调用。
|
||||
* 由于自己没有 MacOsX 平台使用经验,所以没有对此作相关的 viewer 设置如果有需要,也可以自己设置。
|
||||
|
||||
在设置好了 viewer 之后,就需要在不同类型的文件类型与相应的 viewer 之间进行绑定。’TeX-view-program-selection’ 变量用于指定如何用 viewer 查看指定类型的文件。
|
||||
|
||||
(cond
|
||||
((eq system-type 'windows-nt)
|
||||
(add-hook 'LaTeX-mode-hook
|
||||
(lambda ()
|
||||
(setq TeX-view-program-selection '((output-pdf "SumatraPDF")
|
||||
(output-dvi "Yap"))))))
|
||||
|
||||
((eq system-type 'gnu/linux)
|
||||
(add-hook 'LaTeX-mode-hook
|
||||
(lambda ()
|
||||
(setq TeX-view-program-selection '((output-pdf "Okular")
|
||||
(output-dvi "Okular")))))))
|
||||
|
||||
可以看出,使用后者绑定 viewer 与指定类型相对要更灵活的多,而 AucTeX 手册也推荐此种方式,而且感觉可读性也更好。而在以后的版本中,可能会移除’TeX-output-view-style’ 变量。
|
||||
|
||||
===== 进阶使用 =====
|
||||
|
||||
==== 编译片段文件 ====
|
||||
编译片段文件是个很实用的功能,如果你的文档很庞大,但是你只是需要看一下最近编辑修改过的__片段__,这时就很有用。
|
||||
用快捷键设置好一个**片段(region)**,然后按下__ ‘C-c C-r’__ 编译文件,然后再按 ‘C-c C-r’ 就可以查看片段编译后的文件了。
|
||||
|
||||
编译片段文件的过程中,AucTeX 先首先生成 _region_.tex 文件,然后再依次进行编译和查看的操作,当然你也可以设置 ‘TeX-region’ 控制生成的文件名。而为了生成 _region_.tex 文件,AucTeX 需要知道那些是文档开始需要的内容(例如文档类,载入的宏包和自定义信息),那些是文档结束的内容。在 AucTeX 中,这两者是由变量’TeX-header-end’ 与 ‘TeX-trailer-start’ 控制的。前者在 LaTeX mode 中默认为 ‘\begin{document},而后者默认为\end{document},因此AucTeX 会截取文件开始到 ‘TeX-header-end’ 的内容和片段内容以及’TeX-trailer-start’ 的内容组成 _region_.tex 文件。也可以简单的理解成 AucTeX 把原来文件的文档内容替换成了片段内容的过程。
|
||||
|
||||
此外,设置好 region,按 ‘C-c C-t C-r’ 可以固定一个 “region”,即使光标位置改变,设定的将要部分编译的”region”也不会改变,可以随时修改”region”中的内容,再按 ‘C-c C-t C-r’ 取消该”region”。
|
||||
|
||||
==== 多文件管理 ====
|
||||
在协作文档时,为了便于对文档进行管理,一般都会把文档根据内容拆分成几个部分,搭配使用 LaTeX 的 \include(\input in plainTeX) 命令对文件进行组织。
|
||||
举个例子,假设当前目录下有三个 tex 文件,master.tex, sectone.tex, secttwo.tex,其内容分别如下。
|
||||
|
||||
master.tex:
|
||||
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
\include{sectone}
|
||||
\include{secttwo}
|
||||
\end{document}
|
||||
|
||||
sectone.tex:
|
||||
|
||||
\section{one}
|
||||
hello, world!
|
||||
|
||||
secttwo.tex:
|
||||
|
||||
\section{two}
|
||||
Don't be evil!
|
||||
|
||||
用 AucTeX 编辑 secttwo.tex 文件时,编译文件时就会出错,因为 AucTeX **无法知道当前文件所属的 master 文件**,因此需要通知 AucTeX master 文件的信息。
|
||||
|
||||
为了便于对文件进行组织和管理,AucTeX 允许你为文件设置__文件变量__(file variables)。因此你可以把 sectwo.tex 修改成如下内容。
|
||||
|
||||
\section{two}
|
||||
Don't be evil!
|
||||
%%% Local Variables:
|
||||
%%% **TeX-master: "master"**
|
||||
%%% End:
|
||||
|
||||
现在再编译 secttwo.tex 文件,AucTeX 就可以知道 master.tex 文件为 master文件,__AucTeX 会转去编译 master.tex 文件__。因此,你需要在每个 tex 文件末尾添加相应的信息,文件一多,就会变得很繁琐。因此,AucTeX 提供了’TeX-master’ 变量,可以设置其为 “master”,这样就可以通知所有的文件 master 文件总为 master.tex 文件。
|
||||
(setq-default** TeX-master **"master")
|
||||
|
||||
当然,如果你不需要对多文件进行组织和管理,设置 ‘TeX-master’ 为 t 即可,即假设当前的文件总为 master 文件。
|
||||
|
||||
===== reftex 与 preview 的使用 =====
|
||||
reftex 和 preview 是使用 tex 的两个很方便的插件,reftex 为是 emacs 内置的插件,preview 也是 AucTeX 的组成部件。这两个组件使用的不是很多,但还是很有用。此处仅仅是对它们多简要的介绍,如果需要,可以查看相应的文档。
|
||||
|
||||
reftex 可以按文档目录结构浏览。在 LaTeX 缓冲中,按 __C-c =__,Emacs 会打开一个类似文档的目录的缓冲。
|
||||
|
||||
当然 reftex 的功能远远比此强大,更方便之处是配合 bibtex 可以很方便的插入参考文献。
|
||||
|
||||
preview 的好处是可以是 tex 文件中的数学公式和图片可视化,于相应的命令处用图片替代,当然这需要你的 emacs 开启图片支持和 ghostscript。
|
||||
131
Zim/Utils/emacs/new-setup/插件/auto-complete.txt
Normal file
@@ -0,0 +1,131 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-04-05T21:42:17+08:00
|
||||
|
||||
====== Emacs补全利器:auto-complete+gccsense ======
|
||||
|
||||
1 前言
|
||||
2 简介
|
||||
3 安装
|
||||
3.1 配置auto-complete
|
||||
3.2 配置gcc-code-assist
|
||||
3.3 安装配置gccsense
|
||||
4 主要模块介绍
|
||||
5 实例
|
||||
6 附录
|
||||
7 参考
|
||||
|
||||
===== 1 前言 =====
|
||||
|
||||
搜索引擎上关于emacs代码补全的文章一大堆,大多讲的是cedet、semantic、ctags之类的。我自己也尝试过一些“主流”的组合,奈何都不来感啊。用得最长的也就auto-complete了,但是用的也仅仅是它__自带的buffer内内容的补全__,基本不涉及__语义的补__全。偶然发现了gccsense这个东西,简单配置了下,比较满意。有图有真相
|
||||
{{./emacs-gccsense.jpg}}
|
||||
Emacs gccsense
|
||||
|
||||
我绑定的补全键到M+/,这样,遇到要补全的地方,按下M+/就出现了补全菜单,旁边是提示。
|
||||
|
||||
===== 2 简介 =====
|
||||
|
||||
auto-complete提供一个**补全的前端**,通过不同的后端,支持ctags等。
|
||||
gccsense是**补全的后端**,能提供**符合语义的补全**。因为它是直接利用gcc的代码,使用了编译器内在的分析器。它是一个独立的程序,目前通过插件可以被用到emacs和vim的补全上。因为是用的gcc的代码,**理论上可以补全所有gcc支持的语言**。auto-complete和gccsense是一家出的。
|
||||
|
||||
==== 3 安装 ====
|
||||
|
||||
==== 3.1 配置auto-complete ====
|
||||
|
||||
下载:http://cx4a.org/software/auto-complete/
|
||||
配置.emacs,我的auto-complete在/mydoc/lib/emacs-plugins/下
|
||||
|
||||
; auto complete
|
||||
(add-to-list 'load-path "/mydoc/lib/emacs-plugins/auto-complete")
|
||||
(require 'auto-complete-config)
|
||||
(add-to-list 'ac-dictionary-directories "/mydoc/lib/emacs-plugins/auto-complete/ac-dict")
|
||||
(ac-config-default)
|
||||
|
||||
==== 3.2 配置gcc-code-assist ====
|
||||
|
||||
gcc-code-assist就是在gcc代码基础上改的,主要用来**从代码中提取补全信息**
|
||||
|
||||
下载:http://cx4a.org/software/gccsense/#Downloads
|
||||
编译安装之前,准备好环境,debian系统如下:
|
||||
|
||||
sudo apt-get install build-essential libgmp3-dev libmpfr-dev flex ruby rubygems libsqlite3-ruby
|
||||
|
||||
其它系统,如freebsd、macos请自行参考用户手册。
|
||||
配置安装:
|
||||
|
||||
$ tar xvjf gcc-code-assist-*.tar.bz2
|
||||
$ cd gcc-code-assist-*
|
||||
$ ./configure --program-suffix=-code-assist --enable-languages=c,c++ --disable-bootstrap --disable-multilib
|
||||
$ make # -j2
|
||||
$ sudo make install
|
||||
|
||||
安装成功之后执行下,如果有正常输出,就说明安装成功:
|
||||
$ gcc-code-assist --version
|
||||
$ g++-code-assist --version
|
||||
|
||||
==== 3.3 安装配置gccsense ====
|
||||
|
||||
gccsense这个包包含一些辅助函数,以及编辑器的插件
|
||||
|
||||
解压缩之后,执行:
|
||||
|
||||
$ cd gccsense-*
|
||||
$ sudo cp bin/* /usr/local/bin/
|
||||
|
||||
执行一下命令,确保安装成功:
|
||||
|
||||
$ gccrec --version
|
||||
$ autopch --version
|
||||
|
||||
emacs的插件文件为etc/gccsense.el,放到插件目录然后,在.emacs里面加入
|
||||
|
||||
(require 'gccsense)
|
||||
|
||||
即可。
|
||||
由于我的gccsense.el放到了。/mydoc/lib/emacs-plugins/c下,并且把auto-complete的补全命令绑定到了M+/上,所以这部分配置如下:
|
||||
|
||||
(add-to-list 'load-path "/mydoc/lib/emacs-plugins/c")
|
||||
(require 'gccsense)
|
||||
(global-set-key "\257" (quote ac-complete-gccsense))
|
||||
|
||||
ok,搞定。
|
||||
|
||||
===== 4 主要模块介绍 =====
|
||||
|
||||
在介绍使用前,简单介绍下几个主要模块的作用
|
||||
__gcc-code-assist__
|
||||
gcc4.4代码基础上改的那位,**用来从被补全代码中分析出补全信息**
|
||||
__gccrec__
|
||||
编译一个文件,往往要加上编译参数的,比如自定义的include地址。但是编辑器在补全的时候,是不知道这些的,硬生生地调用gcc-code-assist来“模拟编译”,参数补全造成的错误会扰乱补全信息的获取。gccrec就是为了解决这个问题,在使用编辑器补全之前,需要执行一次gccrec,它会将编译参数信息存到~/.gccrec这个sqlite3的数据库中。具体用法参见下一节的示例。
|
||||
__autopch__
|
||||
用来启用预编译头,来提高速度。autopch的相关部分请各位看官自行参考用户手册吧,后面的示例代码简单,不需要这个东西。
|
||||
|
||||
5 实例
|
||||
|
||||
准备一个测试cpp文件,test.cpp:
|
||||
|
||||
#include <string>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
string s;
|
||||
}
|
||||
|
||||
使用gccrec记录编译命令
|
||||
这里可以认为g++-code-assist就是g++,参数一样的,比如-I -l之类的。
|
||||
用emacs打开test.cpp,享受补全吧
|
||||
在string s;后面接着输入s.,然后按M-x ac-complete-gccsense,就可以利用auto-complete和它的gccsense后端来补全了。
|
||||
|
||||
6 附录
|
||||
|
||||
这里贴上我的emacs相关部分的配置文件。
|
||||
我把补全的命令绑定到了M-/上面,
|
||||
gccsense.el放到了/mydoc/lib/emacs-plugins/c/下面,所以这样写:
|
||||
|
||||
(add-to-list 'load-path "/mydoc/lib/emacs-plugins/c")
|
||||
(require 'gccsense)
|
||||
(global-set-key "\257" (quote ac-complete-gccsense))
|
||||
|
||||
7 参考
|
||||
|
||||
gccsense用户手册,http://cx4a.org/software/gccsense/manual.html
|
||||
1056
Zim/Utils/emacs/new-setup/插件/auto-complete/auto_complete_manual.txt
Normal file
BIN
Zim/Utils/emacs/new-setup/插件/auto-complete/emacs-gccsense.jpg
Normal file
|
After Width: | Height: | Size: 34 KiB |
346
Zim/Utils/emacs/new-setup/插件/flymake.txt
Normal file
@@ -0,0 +1,346 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-04-05T22:34:00+08:00
|
||||
|
||||
====== 用flymake检测C/C++语法 ======
|
||||
2010年12月5日 Meteor Liu 发表评论 阅读评论
|
||||
|
||||
1 前言
|
||||
2 flymake基本用法
|
||||
3 ahei的改进
|
||||
4 我的修改
|
||||
5 检测python语法
|
||||
6 遗留问题
|
||||
|
||||
===== 1 前言 =====
|
||||
|
||||
前段时间ahei使劲推荐flymake,而且在dea中还给出一段flymake配置,勾起了我学习flymake的兴趣。在此之前只是听说过flymake,偶尔浅尝一下还没学会怎么用就放弃了,这几天折腾flymae后觉得实在很给力。生活不是缺少美,而是缺少发现美的眼睛这话说得还真有点道理。
|
||||
|
||||
===== 2 flymake基本用法 =====
|
||||
|
||||
flymake是一个**实时的语法检查工具**,好像是从emacs22开始已经自带flymake,自带的flymake提供了对C,C++,XML,HTML,C#,perl,php,java,tex,idl的支持。查看flymake-allowed-file-name-masks这个变量可以得到支持语言的详细信息。想要了解其它语言的支持,可以看看http://www.emacswiki.org/FlyMake。
|
||||
|
||||
在以下四种情况下,flymake会执行语法检测:
|
||||
|
||||
打开文件时
|
||||
换行(可通过flymake-start-syntax-check-on-newline配置)
|
||||
代码改变0.5秒后(可通过flymake-no-changes-timeout配置)
|
||||
手工执行 flymake-start-syntax-check
|
||||
|
||||
下面是flymake基本配置:
|
||||
|
||||
**(requirt 'flymake-mode)**
|
||||
**(autoload 'flymake-find-file-hook "flymake" "" t)**
|
||||
**(add-hook 'find-file-hook 'flymake-find-file-hook)**
|
||||
**(setq flymake-gui-warnings-enabled nil)**
|
||||
**(setq flymake-log-level 0)**
|
||||
|
||||
加上以上配置后,打开文件时会检测是否是flymake支持的语言,是的话就会自动打开flymake-mode。flymake-gui-warnings-enabled设置为nil表示出错时不弹个对话框显示错误;flymake-log-level设置为0表示记录错误日志。
|
||||
|
||||
本文主要讨论C/C++(因为别的我不会),__自带的flymake对C/C++的支持是通过Makefile实现的__,Makefile中__必须有一个check-syntax目标__,比如我在Linux下用automake,那我在Makefile.am中加了这么一段(其实就是调用gcc):
|
||||
|
||||
check-syntax:
|
||||
$(CXXCOMPILE) -Wall -Wextra -pedantic -fsyntax-only $(CHK_SOURCES)
|
||||
|
||||
如果不用automake,手写Makefile的话,相应地修改一下就行了。
|
||||
|
||||
有了这些设置后,打开项目中的cpp文件,应该会自动检测语法了,语法有错误的话会用颜色标识出错的行,M-x flymake-goto-next-error和M-xflymake-goto-prev-error可以在错误行间移动;鼠标在错误行上停留会用tooltip显示错误信息;M-x flymake-display-err-menu-for-current-line能弹出一个菜单显示错误。
|
||||
|
||||
另外,ahei写了几个函数可以在错误行间移动时在minibuffer显示出错误信息:
|
||||
|
||||
(defun flymake-display-current-error ()
|
||||
"Display errors/warnings under cursor."
|
||||
(interactive)
|
||||
(let ((ovs (overlays-in (point) (1+ (point)))))
|
||||
(catch 'found
|
||||
(dolist (ov ovs)
|
||||
(when (flymake-overlay-p ov)
|
||||
(message (overlay-get ov 'help-echo))
|
||||
(throw 'found t))))))
|
||||
(defun flymake-goto-next-error-disp ()
|
||||
"Go to next error in err ring, then display error/warning."
|
||||
(interactive)
|
||||
(flymake-goto-next-error)
|
||||
(flymake-display-current-error))
|
||||
(defun flymake-goto-prev-error-disp ()
|
||||
"Go to previous error in err ring, then display error/warning."
|
||||
(interactive)
|
||||
(flymake-goto-prev-error)
|
||||
(flymake-display-current-error))
|
||||
|
||||
我把它绑定到了这几个按键:
|
||||
|
||||
(defvar flymake-mode-map (make-sparse-keymap))
|
||||
(define-key flymake-mode-map (kbd "C-c <f4>") 'flymake-goto-next-error-disp)
|
||||
(define-key flymake-mode-map (kbd "C-c <S-f4>") 'flymake-goto-prev-error-disp)
|
||||
(define-key flymake-mode-map (kbd "C-c <C-f4>")
|
||||
'flymake-display-err-menu-for-current-line)
|
||||
(or (assoc 'flymake-mode minor-mode-map-alist)
|
||||
(setq minor-mode-map-alist
|
||||
(cons (cons 'flymake-mode flymake-mode-map)
|
||||
minor-mode-map-alist)))
|
||||
|
||||
编辑过程中,每次修改过代码0.5秒后,flymake都会检测错误,这就可以随时发现代码编写的错误了。
|
||||
|
||||
在这补充一下flymake检测的方法:
|
||||
|
||||
对于cpp文件,每次检测时,flymake是把buffer内的内容另存一份,再检测另存出来的文件。
|
||||
|
||||
而对于h文件,gcc没办法单独检查头文件,flymake会在flymake-master-file-dirs设定的目录中查找include过这个头文件的实现文件,把buffer另存为xxx_flymake.h,把查找到的第一个满足条件的实现文件另存yyy_flymake_master.cpp,并把里面的include语句改为include另存的文件,然后通过yyy_flymake_master.cpp来间接检测头文件。
|
||||
3 ahei的改进
|
||||
|
||||
自带的flymake对C++只能通过Makefile来支持,还必须在Makefile中加入check-syntax目标,实在很麻烦。要是代码不是通过Makefile来管理的,flymake就无能为力了。
|
||||
|
||||
其实Makefile也是通过gcc来检测代码了,那要是跳过Makefile直接调用gcc来检测代码该多好啊,所以ahei在DEA中配置了flymake直接调用gcc检测C++代码,具体代码在flymake-setting.el中,主要是以下几个函数:
|
||||
|
||||
|
||||
(defvar flymake-makefile-filenames '("Makefile" "makefile" "GNUmakefile") "File names for make.")
|
||||
|
||||
(defun flymake-get-make-gcc-cmdline (source base-dir)
|
||||
(let (found)
|
||||
(dolist (makefile flymake-makefile-filenames)
|
||||
(if (file-readable-p (concat base-dir "/" makefile))
|
||||
(setq found t)))
|
||||
(if found
|
||||
(list "make"
|
||||
(list "-s"
|
||||
"-C"
|
||||
base-dir
|
||||
(concat "CHK_SOURCES=" source)
|
||||
"SYNTAX_CHECK_MODE=1"
|
||||
"check-syntax"))
|
||||
(list (if (string= (file-name-extension source) "c") "gcc" "g++")
|
||||
(list "-o"
|
||||
"/dev/null"
|
||||
"-S"
|
||||
source)))))
|
||||
|
||||
(defun flymake-simple-make-gcc-init-impl (create-temp-f use-relative-base-dir use-relative-source build-file-name get-cmdline-f)
|
||||
"Create syntax check command line for a directly checked source file.
|
||||
Use CREATE-TEMP-F for creating temp copy."
|
||||
(let* ((args nil)
|
||||
(source-file-name buffer-file-name)
|
||||
(buildfile-dir (file-name-directory source-file-name)))
|
||||
(if buildfile-dir
|
||||
(let* ((temp-source-file-name (flymake-init-create-temp-buffer-copy create-temp-f)))
|
||||
(setq args
|
||||
(flymake-get-syntax-check-program-args
|
||||
temp-source-file-name
|
||||
buildfile-dir
|
||||
use-relative-base-dir
|
||||
use-relative-source
|
||||
get-cmdline-f))))
|
||||
args))
|
||||
|
||||
(defun flymake-simple-make-gcc-init ()
|
||||
(flymake-simple-make-gcc-init-impl 'flymake-create-temp-inplace t t "Makefile" 'flymake-get-make-gcc-cmdline))
|
||||
|
||||
主要思路就是先检测Makefile文件,如果存在就调用make,否则就直接调用gcc检测。
|
||||
4 我的修改
|
||||
|
||||
ahei配置的gcc非常实用,我就是因为它喜欢上flymake的,不过用过几天后,发现ahei的配置里有几个问题没解决:
|
||||
|
||||
没有对make或gcc进行检测
|
||||
|
||||
flymake进行语法检测都是通过调用外部程序来实现的,比如make或gcc,如果没有安装这两个程序,flymake还是会死心眼地启动一个process去调用。
|
||||
不支持用gcc直接检测头文件
|
||||
|
||||
ahei好像是把头文件忘掉了。
|
||||
目标没有权限写入时会出错
|
||||
|
||||
因为flymake检测文件时会把buffer内容另存到一个临时文件中再检测,如果我以普通用户身份打开/usr/include/下的头文件,或者/usr/src/下的实现文件时,flymake会报靠说权限有问题,并且你会发现这个文件没在emacs中被打开。
|
||||
不支持父目录中的Makefile
|
||||
|
||||
原始的flymake调用flymake-init-find-buildfile-dir来查找Makefile,它会从当前目录一直往上找,直到根目录为止,只要找到Makefile都可以。这有一个好处就是对一个有很多子目录的大工程,不需要对每个子目录下的Makefile文件都加上check-syntax目标,只需要在最顶层的Makefile中加就可以了。但ahei修改的时候可能是因为flymake-init-find-buildfile-dir找不到Makefile就会报错退出而无法转而使用gcc而放弃了这个函数,改为只在当前目录下找Makefile文件而不支持查找父目录了。
|
||||
|
||||
我的配置主要是在ahei的基础上进行修改,解决了这几个我发现的问题:
|
||||
|
||||
1.没有检测make或gcc存在的问题,我在配置文件中先检测有没有对应的外部程序,没有的话就不配置到flymake-allowed-file-name-masks中了。
|
||||
|
||||
2.我加了两个函数:flymake-master-make-gcc-header-init和flymake-master-make-gcc-init来支持直接用gcc检测头文件。
|
||||
|
||||
3.用ignore-error忽略掉权限错误,用flymake-report-fatal-status把错误通过minibuffer报告出来。
|
||||
|
||||
4.用flymake-find-buildfile来查找Makefile文件,能支持父目录Makefile查找。
|
||||
|
||||
修改后的代码如下(完整的配置见http://github.com/meteor1113/dotemacs/blob/master/init-basic.el):
|
||||
?[Copy to clipboard]View Code LISP
|
||||
|
||||
(setq flymake-allowed-file-name-masks '())
|
||||
(when (executable-find "texify")
|
||||
(add-to-list 'flymake-allowed-file-name-masks
|
||||
'("\\.tex\\'" flymake-simple-tex-init))
|
||||
(add-to-list 'flymake-allowed-file-name-masks
|
||||
'("[0-9]+\\.tex\\'"
|
||||
flymake-master-tex-init flymake-master-cleanup)))
|
||||
(when (executable-find "xml")
|
||||
(add-to-list 'flymake-allowed-file-name-masks
|
||||
'("\\.xml\\'" flymake-xml-init))
|
||||
(add-to-list 'flymake-allowed-file-name-masks
|
||||
'("\\.html?\\'" flymake-xml-init)))
|
||||
(when (executable-find "perl")
|
||||
(add-to-list 'flymake-allowed-file-name-masks
|
||||
'("\\.p[ml]\\'" flymake-perl-init)))
|
||||
(when (executable-find "php")
|
||||
(add-to-list 'flymake-allowed-file-name-masks
|
||||
'("\\.php[1]?\\'" flymake-php-init)))
|
||||
(when (executable-find "make")
|
||||
(add-to-list 'flymake-allowed-file-name-masks
|
||||
'("\\.idl\\'" flymake-simple-make-init))
|
||||
(add-to-list 'flymake-allowed-file-name-masks
|
||||
'("\\.java\\'"
|
||||
flymake-simple-make-java-init flymake-simple-java-cleanup))
|
||||
(add-to-list 'flymake-allowed-file-name-masks
|
||||
'("\\.cs\\'" flymake-simple-make-init)))
|
||||
(when (or (executable-find "make")
|
||||
(executable-find "gcc")
|
||||
(executable-find "g++"))
|
||||
(defvar flymake-makefile-filenames '("Makefile" "makefile" "GNUmakefile")
|
||||
"File names for make.")
|
||||
(defun flymake-get-gcc-cmdline (source base-dir)
|
||||
(let ((cc (if (string= (file-name-extension source) "c") "gcc" "g++")))
|
||||
(list cc
|
||||
(list "-Wall"
|
||||
"-Wextra"
|
||||
"-pedantic"
|
||||
"-fsyntax-only"
|
||||
"-I.."
|
||||
"-I../include"
|
||||
"-I../inc"
|
||||
"-I../common"
|
||||
"-I../public"
|
||||
"-I../.."
|
||||
"-I../../include"
|
||||
"-I../../inc"
|
||||
"-I../../common"
|
||||
"-I../../public"
|
||||
source))))
|
||||
(defun flymake-init-find-makfile-dir (source-file-name)
|
||||
"Find Makefile, store its dir in buffer data and return its dir, if found."
|
||||
(let* ((source-dir (file-name-directory source-file-name))
|
||||
(buildfile-dir nil))
|
||||
(catch 'found
|
||||
(dolist (makefile flymake-makefile-filenames)
|
||||
(let ((found-dir (flymake-find-buildfile makefile source-dir)))
|
||||
(when found-dir
|
||||
(setq buildfile-dir found-dir)
|
||||
(setq flymake-base-dir buildfile-dir)
|
||||
(throw 'found t)))))
|
||||
buildfile-dir))
|
||||
(defun flymake-simple-make-gcc-init-impl (create-temp-f
|
||||
use-relative-base-dir
|
||||
use-relative-source)
|
||||
"Create syntax check command line for a directly checked source file.
|
||||
Use CREATE-TEMP-F for creating temp copy."
|
||||
(let* ((args nil)
|
||||
(source-file-name buffer-file-name)
|
||||
(source-dir (file-name-directory source-file-name))
|
||||
(buildfile-dir
|
||||
(and (executable-find "make")
|
||||
(flymake-init-find-makfile-dir source-file-name)))
|
||||
(cc (if (string= (file-name-extension source-file-name) "c")
|
||||
"gcc"
|
||||
"g++")))
|
||||
(if (or buildfile-dir (executable-find cc))
|
||||
(let* ((temp-source-file-name
|
||||
(ignore-errors
|
||||
(flymake-init-create-temp-buffer-copy create-temp-f))))
|
||||
(if temp-source-file-name
|
||||
(setq args
|
||||
(flymake-get-syntax-check-program-args
|
||||
temp-source-file-name
|
||||
(if buildfile-dir buildfile-dir source-dir)
|
||||
use-relative-base-dir
|
||||
use-relative-source
|
||||
(if buildfile-dir
|
||||
'flymake-get-make-cmdline
|
||||
'flymake-get-gcc-cmdline)))
|
||||
(flymake-report-fatal-status
|
||||
"TMPERR"
|
||||
(format "Can't create temp file for %s" source-file-name))))
|
||||
(flymake-report-fatal-status
|
||||
"NOMK" (format "No buildfile (%s) found for %s, or can't found %s"
|
||||
"Makefile" source-file-name cc)))
|
||||
args))
|
||||
(defun flymake-simple-make-gcc-init ()
|
||||
(flymake-simple-make-gcc-init-impl 'flymake-create-temp-inplace t t))
|
||||
(defun flymake-master-make-gcc-init (get-incl-dirs-f
|
||||
master-file-masks
|
||||
include-regexp)
|
||||
"Create make command line for a source file
|
||||
checked via master file compilation."
|
||||
(let* ((args nil)
|
||||
(temp-master-file-name
|
||||
(ignore-errors
|
||||
(flymake-init-create-temp-source-and-master-buffer-copy
|
||||
get-incl-dirs-f
|
||||
'flymake-create-temp-inplace
|
||||
master-file-masks
|
||||
include-regexp)))
|
||||
(cc (if (string= (file-name-extension buffer-file-name) "c")
|
||||
"gcc"
|
||||
"g++")))
|
||||
(if temp-master-file-name
|
||||
(let* ((source-file-name buffer-file-name)
|
||||
(source-dir (file-name-directory source-file-name))
|
||||
(buildfile-dir
|
||||
(and (executable-find "make")
|
||||
(flymake-init-find-makfile-dir source-file-name))))
|
||||
(if (or buildfile-dir (executable-find cc))
|
||||
(setq args (flymake-get-syntax-check-program-args
|
||||
temp-master-file-name
|
||||
(if buildfile-dir buildfile-dir source-dir)
|
||||
nil
|
||||
nil
|
||||
(if buildfile-dir
|
||||
'flymake-get-make-cmdline
|
||||
'flymake-get-gcc-cmdline)))
|
||||
(flymake-report-fatal-status
|
||||
"NOMK"
|
||||
(format "No buildfile (%s) found for %s, or can't found %s"
|
||||
"Makefile" source-file-name cc))))
|
||||
(flymake-report-fatal-status
|
||||
"TMPERR" (format "Can't create temp file for %s" source-file-name)))
|
||||
args))
|
||||
(defun flymake-master-make-gcc-header-init ()
|
||||
(flymake-master-make-gcc-init
|
||||
'flymake-get-include-dirs
|
||||
'("\\.cpp\\'" "\\.c\\'")
|
||||
"[ \t]*#[ \t]*include[ \t]*\"\\([[:word:]0-9/\\_.]*%s\\)\""))
|
||||
(add-to-list 'flymake-allowed-file-name-masks
|
||||
'("\\.\\(?:h\\(?:pp\\)?\\)\\'"
|
||||
flymake-master-make-gcc-header-init flymake-master-cleanup))
|
||||
(add-to-list 'flymake-allowed-file-name-masks
|
||||
'("\\.\\(?:c\\(?:pp\\|xx\\|\\+\\+\\)?\\|CC\\)\\'"
|
||||
flymake-simple-make-gcc-init)))
|
||||
|
||||
5 检测python语法
|
||||
|
||||
因为偶尔我也用下python,所以我也希望flymake能把python也支持了。python有三个语法检测工具,我比较之后选择了pyflakes。
|
||||
|
||||
装好pyflakes后,加入以下配置就可以像检测cpp那样检测py文件了:
|
||||
?[Copy to clipboard]View Code LISP
|
||||
|
||||
(when (executable-find "pyflakes")
|
||||
(defun flymake-pyflakes-init ()
|
||||
(let* ((temp-file (flymake-init-create-temp-buffer-copy
|
||||
'flymake-create-temp-inplace))
|
||||
(local-file (file-relative-name
|
||||
temp-file
|
||||
(file-name-directory buffer-file-name))))
|
||||
(list "pyflakes" (list local-file))))
|
||||
(add-to-list 'flymake-allowed-file-name-masks
|
||||
'("\\.py\\'" flymake-pyflakes-init)))
|
||||
|
||||
如果是在windows下的话,可能会找不到pyflakes这个外部程序,因为C:\Python25\Scripts\pyflakes没被windows识别为可执行文件,我是在C:\Python25\Scripts\下加了个pyflakes.bat的文件,文件里写入以下内容就能正常检测了:
|
||||
|
||||
C:\Python25\python.exe C:\Python25\Scripts\pyflakes %*
|
||||
|
||||
6 遗留问题
|
||||
|
||||
有两个问题我还没解决:
|
||||
|
||||
一、对C++来说,找不到Makefile的时候自动改用gcc语法检测,但有时候看别人工程时会碰到有Makefile,但里面没有写check-syntax目标的问题(从网上下载的开源代码很少有在Makefile中写check-syntax目标的)。要是能配置成在Makefile中找不到check-syntax目标后也能自动改用gcc检测就好了。
|
||||
|
||||
二、flymake通过定时器,改变代码超过0.5秒后进行语法检测,其实我不太喜欢这种立即检测的方式,相比之下我更喜欢保存文件后进行检测。要是下个版本的flymake可以把这两种方式做成可配置就好了。
|
||||
|
||||
54
Zim/Utils/emacs/new-setup/插件/ido-mode.txt
Normal file
@@ -0,0 +1,54 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-04-15T14:36:56+08:00
|
||||
|
||||
|
||||
|
||||
===== Using IDO =====
|
||||
|
||||
;;in the .emacs
|
||||
(require ‘ido)
|
||||
(ido-mode t)
|
||||
|
||||
===== 1. =====
|
||||
To switch between buffers, press “__C-x b__”, then:
|
||||
type some characters appearing in the buffer name(只要name中包含输入的字符即可), RET to visit the buffer in the front the list.
|
||||
use __C-s __(next) or__ C-r __(previous) to move through the list.
|
||||
__[Tab]__ display possible completion in a buffer (or visit the buffer if there is only one possible completion).
|
||||
use __C-f __to fall back to find file (without ido-mode) or __C-b__ to fall back to switch to buffer (without ido-mode).
|
||||
|
||||
===== 2. =====
|
||||
To find a file, press “__C-x C-f__”.
|
||||
|
||||
type some characters appearing in the file name, RET to choose the file or directory in the front of the list.
|
||||
C-s (next) or C-r (previous) to move through the list.
|
||||
[Tab] - display possible completion in a buffer (or open the file or go down the directory if there is only one possible completion).
|
||||
**RET - type to go down inside the directory in front of the list.**
|
||||
** [backspace] - go up to the parent directory.**
|
||||
// - go to the root directory.** 可以用在文件路径的任何地方**
|
||||
~/ - go to the home directory.
|
||||
C-f - to go back temporarily to the normal find-file.
|
||||
C-d - enter Dired for this directory (used to be C-x C-d in older versions)
|
||||
__ C-j __- create a new file named with the text you entered (note: this is needed if the text you entered matches an existing file, because RET would open the existing one)
|
||||
|
||||
===== 3. =====
|
||||
To restrict the list after a first filtering:(缩小检索范围)
|
||||
|
||||
type some characters appearing in the buffer/file name(say .cpp)
|
||||
type **C-SPC (C-@)**
|
||||
continue as normal with a list containing only the filtered names
|
||||
|
||||
===== 4. =====
|
||||
Recently visited directories:
|
||||
|
||||
type__ M-p__ and __M-n__ to change to previous/next directories from the history
|
||||
__M-s __to search for a file matching your input
|
||||
__ M-k__ to remove the current directory from the history
|
||||
directories are added to the history by navigating inside them via RET
|
||||
|
||||
===== 5. =====
|
||||
The documentation for these keys is available via
|
||||
|
||||
M-x describe-function RET ido-find-file RET
|
||||
C-h f ido-find-file RET
|
||||
|
||||
119
Zim/Utils/emacs/new-setup/插件/ido-mode/tutor.txt
Normal file
@@ -0,0 +1,119 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-04-15T14:45:13+08:00
|
||||
|
||||
====== tutor ======
|
||||
Created Friday 15 April 2011
|
||||
http://www.masteringemacs.org/articles/2010/10/10/introduction-to-ido-mode/
|
||||
|
||||
===== Introduction to Ido Mode =====
|
||||
by mickey on October 10th, 2010
|
||||
|
||||
There are many ways of improving your productivity when you use Emacs, and Ido (or “**Interactively DO things**”) is one of those packages that you enable and then never, ever turn off again. It’s simply that useful. By super-charging Emacs’s completion engine and improving the speed at which you open files and buffers, you will significantly cut down on the time spent doing these menial tasks. Think about how often you switch buffers, open files or navigate directories in Emacs.
|
||||
|
||||
When Ido is enabled __it replaces the existing key-, and command bindings with its own, “Ido-powered”, versions__. Most ido commands are named “ido-xxxxx”; so find-file becomes ido-find-file, and so on.
|
||||
|
||||
The “Ido-powered” completion engine __matches anywhere in a name__, instead of just the beginning. That means if you were to search for the buffer “*Customize Group: Foobar*” without Ido you’d have to contort your fingers and type the *, then TAB (and hope it completes) and if not, type in some more; then rinse and repeat.
|
||||
|
||||
With Ido you’d type a few characters until you find the match, or until you narrow down your list of matches to a manageable subset, and then press RET. Even better, with __fuzzy matching__ you can find things even more efficiently. So the above buffer name could be found by typing “cgf” — c for Customize, g for Group and f for Foobar. Magic.
|
||||
|
||||
There are some who refuse to use Ido because it “gets in the way”; I think a lot of those worries stem from not knowing that it is possible to disable Ido’s completion mode when it makes sense to do so.
|
||||
|
||||
===== Enable Ido Everywhere =====
|
||||
Add this to your .emacs file:
|
||||
|
||||
(setq ido-enable-flex-matching t)
|
||||
(setq ido-everywhere t)
|
||||
(ido-mode 1)
|
||||
|
||||
That’ll enable basic Ido support for files and buffers and the very useful “flex matching” as well.
|
||||
|
||||
===== My Customizations =====
|
||||
|
||||
There’s more to Ido than just enabling it. I’ve compiled a list of interesting settings you can change and I have thrown in some of my preferences for good measure.
|
||||
|
||||
==== Find File At Point ====
|
||||
|
||||
Find File At Point, also known generally as “ffap”, is an intelligent (well, when I say that, I mean it uses simple heuristics to infer the context at point) system for opening files, and URLs.
|
||||
|
||||
Some people hate it, and personally I tolerate it. It gets in the way sometimes and when it does it’s really annoying, but mostly it helps me so it gets to stay. It works in surprisingly many contexts like inferring the filepath of a library in an elisp (require 'foobar) form.
|
||||
|
||||
This will make Ido guess the context, which is what I use.
|
||||
|
||||
** (setq ido-use-filename-at-point 'guess)**
|
||||
|
||||
You can disable URL ffap support by toggling ido-use-url-at-point.
|
||||
|
||||
==== Eliminating Obstacles ====
|
||||
|
||||
If you create a ton of throw-away buffers like I do, this setting will force Ido to always create a new buffer (in C-x b) if the name does not exist. I create throw-away buffers all the time and the last thing I need is Ido asking my permission to create one. Other choices are prompt and never.
|
||||
|
||||
**(setq ido-create-new-buffer 'always)**
|
||||
|
||||
You can customize the order in which files are sorted when Ido displays them in the minibuffer. There are certain file extensions I use more than others, so I tell Ido to emphasize those.
|
||||
|
||||
**(setq ido-file-extensions-order '(".org" ".txt" ".py" ".emacs" ".xml" ".el" ".ini" ".cfg" ".cnf"))**
|
||||
|
||||
==== Ignorance is Bliss ====
|
||||
|
||||
Ido is capable of ignoring (that is, by omission) buffers, directories, files and extensions using regexp.
|
||||
Variable Name Description
|
||||
ido-ignore-buffers Takes a list of buffers to ignore in C-x b
|
||||
ido-ignore-directories Takes a list of directories to ignore in C-x d and C-x C-f
|
||||
ido-ignore-files Takes a list of files to ignore in C-x C-f
|
||||
|
||||
I would recommend using M-x customize-variable RET variable-name-here to customize them unless you are comfortabe editing Emacs lisp directly. I don’t ignore anything in Ido beyond the defaults, as I prefer to use the more general completion-ignored-extensions as it works with and without Ido.
|
||||
|
||||
To make Ido use completion-ignored-extensions you need to enable it:
|
||||
|
||||
** (setq ido-ignore-extensions t)**
|
||||
|
||||
Now you can customize that variable as well: M-x customize-variable RET completion-ignored-extensions. Go ahead and add all the useless object files, backup, autosave and other computing flotsam you don’t want Ido to show.
|
||||
|
||||
NOTE:Ido will still complete the ignored elements if Ido would otherwise not show any other matches. So if you type out the name of an ignored file Ido will still let you open it just fine.
|
||||
|
||||
==== Ido Cheatsheet ====
|
||||
|
||||
Here’s a quick cheatsheet of all the interesting Ido commands.
|
||||
The “Available In” column indicates where the keybinding is available. “All” means that is is a feature inherent to ido-completing-read and as such is available in all the completion engines. “Files”, “Dirs” and “Buffers” means it is only available in one of those.
|
||||
|
||||
==== General-purpose Commands ====
|
||||
Keybinding Description Available In
|
||||
C-b Reverts to the old switch-buffer completion engine Buffers
|
||||
C-f Reverts to the old find-file completion engine Files
|
||||
C-d Opens a dired buffer in the current directory Dirs / Files
|
||||
C-a Toggles showing ignored files (see ido-ignore-files) Files / Buffers
|
||||
C-c Toggles if searching of buffer and file names should ignore case. (see ido-case-fold) Dirs / Files / Buffers
|
||||
TAB Attempt to complete the input like the normal completing read functionality Dirs / Files / Buffers
|
||||
C-p Toggles prefix matching; when it’s on the input will only match the beginning of a filename instead of any part of it. Files
|
||||
C-s / C-r Moves to the next and previous match, respectively All
|
||||
**C-t ** Toggles matching by Emacs regular expression. All
|
||||
Backspace Deletes characters as usual or goes up one directory if it makes sense to do so. All (but functionality varies)
|
||||
C-SPC / C-@ Restricts the completion list to anything that matches your current input. (Thanks to Joakim Hårsman for pointing it out) All
|
||||
// Like most *nix shells two forward slashes in a path means “ignore the preceding path, and go back to the top-most directory”. Works the same in Ido but it’s more interactive: it will go to the root / (or the root of the current drive in Windows) Files
|
||||
~/ Jumps to the home directory. On Windows this would be typically be %USERPROFILE% or %HOME%, if it is defined.
|
||||
|
||||
==== Files / Dirs ====
|
||||
M-d Searches for the input in all sub-directories to the directory you’re in. Files
|
||||
C-k Kills the currently focused buffer or deletes the file depending on the mode. Files / Buffers
|
||||
M-m Creates a new sub-directory to the directory you’re in Files
|
||||
|
||||
OK, so you probably won’t get in the habit of using all the commands; that’s fine, but some are more important to remember than others, like: Backspace; C-s and C-r; // and ~/; and C-d.
|
||||
|
||||
If Ido is getting in your way, remember the fallback commands: C-f for files; C-b for buffers.
|
||||
|
||||
==== Work Directory Commands ====
|
||||
|
||||
Work directories are recently used directories that Ido caches so the files and directories in them can be quickly recalled. Work directory commands only function in find-file routines, but that goes without saying.
|
||||
|
||||
You change the cached directory list by manipulating the variable ido-work-directory-list. If you’re tired of Ido caching slow, transient or generally unwanted directories you can add regular expressions to the list in ido-work-directory-list-ignore-regexps to keep Ido from caching them.
|
||||
|
||||
Similarly, when you go to the next or previous work directory you can force Ido to disregard directories that do not match your current input. To change this behavior, set ido-work-directory-match-only.
|
||||
Keybinding Description
|
||||
M-n / M-p Cycles through the next or previous work directories
|
||||
M-k Kills (removes) the active work directory from the list.
|
||||
M-s M-s forces ido to search the list of work directories for the current input.
|
||||
|
||||
Using M-s is an excellent way to quickly scan recently used directories for files. You do not have to explicitly type M-s as Ido will automagically start searching after a few seconds of idle time.
|
||||
|
||||
You can change the work directory merge delay by modifying the ido-auto-merge-delay-time variable.
|
||||
129
Zim/Utils/emacs/new-setup/插件/yasnippet.txt
Normal file
@@ -0,0 +1,129 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-04-06T20:09:15+08:00
|
||||
|
||||
====== yasnippet ======
|
||||
Created Wednesday 06 April 2011
|
||||
|
||||
Emacs高效的yasnippet 简单使用和定制
|
||||
2010年12月24日 星期五 18:16
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Emacs高效的yasnippet
|
||||
====================
|
||||
|
||||
Author: Lijunpeng <maillijunpeng@gmail.com>
|
||||
Date: 2010-12-24 10:28:08 CST
|
||||
|
||||
|
||||
Table of Contents
|
||||
=================
|
||||
1 介绍yasnippet
|
||||
2 安装yasnippet
|
||||
3 使用yasnippet
|
||||
4 定制自己的模板
|
||||
5 再以一个51外部中断函数举例
|
||||
6 参考资源
|
||||
|
||||
|
||||
1 介绍yasnippet
|
||||
~~~~~~~~~~~~~~~~
|
||||
官方地址:[http://code.google.com/p/yasnippet/]
|
||||
|
||||
想看原汁原味的介绍建议看官方文档,这里中文简要说明一下:
|
||||
|
||||
首先如果你是Emacser,而你又没接触过yasnippet,请查看这里有一个很hacking的视频。
|
||||
地址:[http://v.youku.com/v_show/id_XMjMxNDg5MjQ4.html]
|
||||
|
||||
YASnippet 是emacs高效一个通用的模板系统。它允许定义缩写并通过[TAB]键自动帮你展开。在我们平常编辑一经常复用的模板是非常有帮助的,比如本人平常做Latex
|
||||
ppt就用到yasnippet,就显得非常方便快捷。
|
||||
|
||||
2 安装yasnippet
|
||||
~~~~~~~~~~~~~~~~
|
||||
Yasnippet的安装详细已经有好多文章介绍,并且官方视频里也简洁的演示,这里给出最简单步骤:
|
||||
- 下载:wget http://yasnippet.googlecode.com/files/yasnippet-bundle-0.6.1c.el.tgz
|
||||
- 解压并移动emacs路径:tar -xvf yasnippet-bundle-0.6.1c.el.tgz && mv yasnippet-bundle.el ~/.emacs.d/plugins
|
||||
- 编辑.emacs文件:(add-to-list 'load-path " ~/.emacs.d/plugins")
|
||||
(require 'yasnippet-bundle)
|
||||
- 重启一下emacs,如果emacs设置有启动画面请按下[q]键就可以看到菜单里多一个yasnippet菜单,到些安装完毕。
|
||||
|
||||
3 使用yasnippet
|
||||
~~~~~~~~~~~~~~~~
|
||||
安装好之后,我们就可以试试牛力方便的yasnippet;;;
|
||||
例如编辑一个C文件:emacs /tmp/yas_test.c
|
||||
键入模板关键词inc 然后[TAB]键,就出现有模板选择
|
||||
键入模板关键词main 然后[TAB]键,同样也出现一个我们常用main函数
|
||||
简单的使用方法就是这样,是不是有很hacking的感觉,更多细节可以查看yasnippet菜单
|
||||
|
||||
4 定制自己的模板
|
||||
~~~~~~~~~~~~~~~~~
|
||||
- yasnippet的强大之处于允许用户自定义自己的模板,这里介绍它的定制功能,并通过latex-mode来演示它是如何高效编辑能力。这里演示用的Tex发行版本是texlive的latex-cjk-all扩展
|
||||
- ubuntu 可以直接安装:sudo apt-get install texlive cjk-latex latex-cjk-all
|
||||
- 定制自己的模板必须在.emacs配置文件里指定模板的位置,这一步必不可少,所以在.emacs加上:
|
||||
(add-to-list 'load-path " ~/.emacs.d/plugins")
|
||||
(require 'yasnippet-bundle)
|
||||
(setq yas/root-directory "~/.emacs.d/snippets")
|
||||
(yas/load-directory yas/root-directory)
|
||||
|
||||
这样.emacs的yasnippet就配置完成了,下来就是定制模板缩写词
|
||||
|
||||
随便进入Emacs的一个mode模式,我演示这里是latex-mode,然后输入命令[M-x] yas/new-snippet即可在这个模式下建立模板
|
||||
|
||||
输入yas/new-snippet命令,它会提示文件不存在,是否建立,这里直接键入[Enter]键,然后输入模块的名字。(注:这里模块的名字就是此模式下的缩写词即关键词)然后出现# -*- mode: snippet -*- 等字符,在这里删除它们,照着这里的演示一步一步来就要可以了。
|
||||
|
||||
以新建立一个幻灯片为例子,可以这个来:
|
||||
|
||||
1: #contributor : ljp <ljp.gogo@gmail.com>
|
||||
2: #name : Create a slide frame
|
||||
3: # --
|
||||
4:
|
||||
5: \frame{\frametitle{${1:Slide title}}
|
||||
6: \pause{}
|
||||
7: \begin{itemize}
|
||||
8: \item $0
|
||||
9: \end{itemize} }
|
||||
|
||||
说明:snippet的语法变量是以$美元符开始的,根据变量$1 $2 $... 定义顺序光标移动位置,特殊的$0是最后光标停位置
|
||||
|
||||
第1行是模板贡献者的一些信息
|
||||
|
||||
第2行是模板说明,也就是用鼠标点击yasnippet菜单里相应模式的模板的一些文字提示(这里Create a slide frame 就可以知道它是创建一个幻灯片)
|
||||
|
||||
第3行是语法要求,声明模板内容开始
|
||||
|
||||
第4行以后的,就是模板的内容了。
|
||||
|
||||
5 再以一个51外部中断函数举例
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
1. emacs /tmp/interrupt.c
|
||||
2. [M-x] yas/new-snippet ->[Enter]键 -> 创建缩写关键词 interrupt ->[Enter]键
|
||||
#contributor : ljp <ljp.gogo@gmail.com>
|
||||
#name : Create a 51 interrupt function
|
||||
# --
|
||||
|
||||
void int${1:变量1}() interrupt ${2:变量2} using ${3:变量3}
|
||||
{
|
||||
${0:这里是变量光标最后停留位置}
|
||||
}
|
||||
|
||||
以上在C模式下,就可以键入关键词interrupt 然后[TAB]键,来创建一个51单片机外部中断
|
||||
|
||||
6 参考资源
|
||||
~~~~~~~~~~~
|
||||
- 李杀网:[http://xahlee.org/emacs/yasnippet_templates_howto.html]
|
||||
|
||||
- YASnippet基础入门:[http://blog.waterlin.org/articles/emacs-yasnippet-basic-usage.html]
|
||||
|
||||
- 官方doc:[http://yasnippet.googlecode.com/svn/trunk/doc/index.html]
|
||||
|
||||
- 一个yasnippet模板快速制作PPT演示视频:[http://v.youku.com/v_show/id_XMjMxNTQ1NzA4.html]
|
||||
|
||||
|
||||
- 个人代码仓:[https://github.com/live5156go51]
|
||||
|
||||
|
||||
|
||||
PS: 祝大家对圣诞快乐!
|
||||
@@ -0,0 +1,56 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-04-06T21:16:21+08:00
|
||||
|
||||
====== auto-complete vs yas ======
|
||||
Created Wednesday 06 April 2011
|
||||
|
||||
auto complete和yasnippet的区别
|
||||
2009年11月27日 ahei 发表评论 阅读评论
|
||||
|
||||
auto-complete和yasnippet是Emacs下两款非常强悍的补全插件,那么auto-complete和yasnippet是否就是一对竞争者呢?有你没我,有我没你?
|
||||
|
||||
其实不是这样的,它们两个完全能融洽的相处,并且合作的非常愉快。
|
||||
|
||||
本质上来说,auto complete只是一个补全界面,它用来展示其他补全引擎的结果,它支持好多补全引擎,包括补全全路径文件名的backend,补全单独文件名的backend,补全当前buffer下单词的backend,补全所有buffer下的单词的backend,补全Elisp语法的引擎,补全yasnippet片段的引擎,补全缩写的引擎,等等等等,当然也包括yasnippet,它会把所有的补全引擎的补全结果一起展示出来,当然是根据你定义的补全引擎的顺序。
|
||||
|
||||
那么我们为什么不直接使用yasnippet,而去使用auto complete呢?
|
||||
|
||||
除了auto complete可以同时利用其他补全引擎的结果,还使得使用yasnippet起来更方便。比如在yasnippet中你看不到当前光标出单词是否有它的片段定义,你要补全它的时候,要按tab,而auto complete加了yasnippet的引擎后,可以自动提示出当前光标处单词是否有yasnippet的片段定义,yasnippet引擎的结果会用特殊的颜色标注,这里有代码证明:
|
||||
|
||||
|
||||
(defface ac-yasnippet-candidate-face
|
||||
'((t (:background "sandybrown" :foreground "black")))
|
||||
"Face for yasnippet candidate.")
|
||||
|
||||
(defface ac-yasnippet-selection-face
|
||||
'((t (:background "coral3" :foreground "white")))
|
||||
"Face for the yasnippet selected candidate.")
|
||||
|
||||
(defvar ac-source-yasnippet
|
||||
'((candidates . ac-yasnippet-candidate)
|
||||
(action . yas/expand)
|
||||
(candidate-face . ac-yasnippet-candidate-face)
|
||||
(selection-face . ac-yasnippet-selection-face))
|
||||
"Source for Yasnippet.")
|
||||
|
||||
上述代码中的candidate-face表示补全结果的颜色,而selection-face表示当你把光标移到这个补全结果上的时候的颜色,如下图所示:
|
||||
在auto complete使用yasnippet引擎
|
||||
|
||||
在auto complete使用yasnippet引擎
|
||||
|
||||
上图中,defun和dired都是yasnippet引擎给出来的补全结果,其他的则是其他引擎的补全结果,yasnippet的补全结果用其他颜色标注,而当前所选的yasnippet引擎的补全候选则是用另外一种颜色标注,一目了然。
|
||||
还有,比如你有个for的yasnippet片段定义,你输入fo的时候,在yasnippet中这时候你并不能按tab进行补全,但是在auto complete中,你加了yasnippet引擎后,auto complete会提示出yasnippet的补全结果for,就像下面这样:
|
||||
在auto complete使用yasnippet引擎
|
||||
|
||||
在auto complete使用yasnippet引擎
|
||||
|
||||
这时候,你按回车的话,会自动扩展yasnippet的for片段的定义,变成下面这样:
|
||||
Emacs的超级补全yasnippet
|
||||
|
||||
Emacs的超级补全yasnippet
|
||||
|
||||
那么auto complete是怎么做到不需要完整输入yasnippet的片段, 只需要输入部分就能补全yasnippet的片段呢? 很简单,大家看到上面代码中ac-source-yasnippet的定义就明白了,里面有一个(action . yas/expand),你应该猜到了吧,它的意思就是当你选中yasnippet的candidate并且按下回车的时候,auto complete会去执行那个yas/expand,而它正是yasnippet的补全命令。
|
||||
经上所述,通过auto complete,你用yasnippet更方便了。
|
||||
|
||||
现在你该明白了,auto complete和yasnippet的区别了吧。
|
||||
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 100 KiB |
111
Zim/Utils/emacs/new-setup/插件/yasnippet/example2.txt
Normal file
@@ -0,0 +1,111 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-04-06T20:25:16+08:00
|
||||
|
||||
====== example2 ======
|
||||
Created Wednesday 06 April 2011
|
||||
http://blog.waterlin.org/articles/emacs-yasnippet-basic-usage.html
|
||||
Posted on 30-09-2009
|
||||
|
||||
===== YASnippet 基础入门 =====
|
||||
Filed Under (技术) by waterlin
|
||||
|
||||
YASnippet 是 Emacs 的一个缩略词 (abbreviation) 模板替换系统,可以把一个预先设定好的缩略词扩展成模板。刚开始用 YASnippet 的时候,一般感觉无从下手,现在就简单介绍一下 YASnippet 最基本的使用方法。
|
||||
|
||||
YASnippet 的安装
|
||||
|
||||
YASnippet 有两种安装方法,可以视个人情况选用。
|
||||
|
||||
1). 单个 yasnippet-bundle.el 文件安装方式
|
||||
|
||||
如果想快速地试用、了解一下 YASnippet 这个系统,从官方网站下载 yasnippet-bundle.el 这个文件,放到 Emacs 扩展目录里,然后把下面的代码放到 .emacs 文件里:
|
||||
|
||||
(add-to-list 'load-path
|
||||
"~/.emacs.d/plugins")
|
||||
(require 'yasnippet-bundle)
|
||||
|
||||
本方法适合于快速地试用一下 YASnippet 系统,当然,如果你需要修改模板或是定制自己的扩展模板,你就需要用下面介绍的完全安装方法。
|
||||
|
||||
2). 完全安装方法
|
||||
|
||||
需要完全安装 YASnippet 的话,先从官方网站上下载完整的 yasnippet-x.y.z.tar.bz2 包,把包解压放到 Emacs 的扩展目录,然后添加下面的语句到 .emacs 文件里:
|
||||
|
||||
(add-to-list 'load-path
|
||||
"~/.emacs.d/plugins/yasnippet-x.y.z")
|
||||
(require 'yasnippet) ;; not yasnippet-bundle
|
||||
(yas/initialize)
|
||||
(yas/load-directory "~/.emacs.d/plugins/yasnippet-x.y.z/snippets")
|
||||
|
||||
YASnippet 的基本使用方法
|
||||
|
||||
正确安装好 YASnippet 后,重新启动 Emacs 就可以看到菜单栏里多了一个 YASnippet 的菜单(图1所示),
|
||||
|
||||
YASnippetMultiModeCopyright.png
|
||||
|
||||
mini buffer 上也会显示出类似于 (org yas) 的字样(这里是指 yas 作为子模式存在于主模式 org 里)如图2所示。
|
||||
|
||||
YASnippetMultiModeCopyright.png
|
||||
|
||||
总的来说,正确安装好 YASnippet 后,只要输入缩略词,然后用 __TAB 键或是 C-i __就可以完成扩展了。
|
||||
|
||||
在 Emacs 启动后,YASnippet 模式是作为一个子模式 (minor mode) 存在于各个模式之中。要用 YASnippet 进行缩略词补全有好多种方法,最常用的补全方法有三种:
|
||||
输入一个缩写词 (abbrev),然后用 snippet 的触发键 (trigger key) 来补全。这个键默认是 TAB 或是 C-i,当然,也可以用命令 M-x yas/expand 来进行扩展。
|
||||
用命令 M-x yas/insert-snippet 直接进行输入,输入完这个命令后,会弹出一个补全窗口,提示当前主模式下可以补全的模板。
|
||||
直接从菜单栏里的 YASnippet 里,选择内容进行输入。
|
||||
|
||||
有关 YASnippet 使用的更详细叙述,可以参考官方文档 Expanding snippets。
|
||||
YASnippet 个性化定制的命令
|
||||
|
||||
虽然 YASnippet 已经自带了许多常用的扩展模板,但是很多情况下,我们需要根据自己的实际情况,来进行模板定制。以下是扩展 YASnippet 常用的一些命令:
|
||||
用命令 M-x yas/new-snippet 就可以新建一个扩展模板 (snippet),YASnippet 会自动提示存放该模板的最佳目录。
|
||||
用命令 M-x yas/find-snippets 可以查找 snippet 文件,默认的目录是当前主模式下的模板文件 (snippet file) 的存放目录。
|
||||
用命令 M-x yas/visit-snippet-file 可以通过弹出的对话框来寻找你需要的模板文件 (snippet file),在对话框里选择一个选项,就会打开这个模板文件 (snippet file) 来让你编辑。
|
||||
org 里的 YASnippet 使用实例
|
||||
|
||||
下面就用一个实例,结合 YASnippet 的语法规则,来简单介绍一下 YASnippet 最基本的使用。
|
||||
|
||||
我在 org 模式里写笔记或是发布网页的时候,经常需要添加一个有关版权声明的文字(或为公司,或为自己)。因为公司和私人的内容都混在一起,所以我需要有多个模板。下面就以添加我个人版权声明的模板为例,介绍一下配置 YASnippet 的完整步骤。
|
||||
|
||||
1). 添加一个有关个人版权的 snippet
|
||||
|
||||
首先,在 org 模式里,用命令 M-x yas/new-snippet 来添加一个 snippet,输入你想要的 snippet 名称,我这里输入
|
||||
|
||||
Copyright
|
||||
|
||||
YASnippet 会自动生成一个名叫 Copyright.yasnippet 的文件,生成的内容如下:
|
||||
|
||||
# -*- mode: snippet -*-
|
||||
# name: Copyright
|
||||
# key:
|
||||
# binding: "keybinding"
|
||||
# expand-env: ((some-var some-value))
|
||||
# --
|
||||
|
||||
2). 现在我们只需要根据 YASnippet 的相关语法来修改这个文件就可以了。上面文件关键词的基本语法含义如下:
|
||||
# name: 显示在弹出菜单里的 snippet 名称
|
||||
# key: 缩略词,即你在用 TAB 键进行扩展前输入的关键词,如果不设定,则把这个关键词默认为本文件名
|
||||
# binding: 设置使用哪个组合键来直接插入这个 snippet,对于比较常用的模板内容比较有用
|
||||
# expand-env: 用 elisp 重新设置一些环境变量
|
||||
# – 表示在这一行之上的全是注释
|
||||
|
||||
3). 因为我们这里是配置一个最简单的模板,所以,我们删掉 # key:,# binding:,# expand-env: 这三个高级定制功能。最后,我们写成类似下面的东西:
|
||||
|
||||
# -*- mode: snippet -*-
|
||||
# name: Copyright
|
||||
# --
|
||||
#+BEGIN_HTML
|
||||
<p style="TEXT-ALIGN: center">
|
||||
原创文章,如转载请注明:转载自细节之锤 [ <a href="http://blog.waterlin.org/">http://blog.waterlin.org/</a> ]
|
||||
</p>
|
||||
<p style="TEXT-ALIGN: center">
|
||||
Copyright © WaterLin.org. All rights reserved.
|
||||
</p>
|
||||
#+END_HTML
|
||||
|
||||
4). 重启 Emacs 让修改生效,然后我们再回到 org 文件里,这个时候,可以直接输入一个 Copyright (注意:缩略词大小写敏感),然后用 C-i 进行替换(原本可以用 TAB 键的,但是 Emacs23 里的 org 模式把 TAB 键给霸占了),就可以把 Copyright 这个词替换成上面用 html 写成的版权声明。
|
||||
|
||||
在 org 模式里,我们可以用同样的方法来插入 #+begin_example,#+begin_ditaa,#+begin_dot,#+begin_src 等标记,这样可以节省一大笔时间。
|
||||
|
||||
一般来讲,用 YASnippet 来进行替换与自动插入,比直接用 elisp 写一个函数、命令来进行插入要简单、方便得多,并且容易管理。
|
||||
|
||||
YASnippet 的模板语言 (Template syntax) 还有着更加灵活的用法,参见官方文档 Writing snippets。
|
||||
@@ -0,0 +1,445 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"><head profile="http://gmpg.org/xfn/11">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
|
||||
<title>浏忙大爆炸 » Blog Archive » YASnippet 基础入门</title>
|
||||
|
||||
<meta name="generator" content="WordPress 3.1"> <!-- leave this for stats -->
|
||||
|
||||
<link rel="stylesheet" href="emacs-yasnippet-basic-usage_files/style.css" type="text/css" media="screen">
|
||||
<link rel="alternate" type="application/rss+xml" title="浏忙大爆炸 RSS Feed" href="http://blog.waterlin.org/feed">
|
||||
<link rel="pingback" href="http://blog.waterlin.org/xmlrpc.php">
|
||||
<!--[if IE 6]>
|
||||
<link rel="stylesheet" href="http://waterlin.cookwhy.com/wp-content/themes/waterlinorg/styleie.css" type="text/css" media="screen" />
|
||||
<![endif]-->
|
||||
<link rel="alternate" type="application/rss+xml" title="浏忙大爆炸 » YASnippet 基础入门 Comments Feed" href="http://blog.waterlin.org/articles/emacs-yasnippet-basic-usage.html/feed">
|
||||
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://blog.waterlin.org/xmlrpc.php?rsd">
|
||||
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://blog.waterlin.org/wp-includes/wlwmanifest.xml">
|
||||
<link rel="index" title="浏忙大爆炸" href="http://blog.waterlin.org/">
|
||||
<link rel="start" title="我对11月份广州房价下跌的理解" href="http://blog.waterlin.org/articles/%e6%88%91%e5%af%b911%e6%9c%88%e4%bb%bd%e5%b9%bf%e5%b7%9e%e6%88%bf%e4%bb%b7%e4%b8%8b%e8%b7%8c%e7%9a%84%e7%90%86%e8%a7%a3.html">
|
||||
<link rel="prev" title="用 org 把选定内容发布成 html 页面" href="http://blog.waterlin.org/articles/org-export-region-as-html.html">
|
||||
<link rel="next" title="把 org 文档发布成网页工程的方法" href="http://blog.waterlin.org/articles/publish-org-files-to-html-project.html">
|
||||
<meta name="generator" content="WordPress 3.1">
|
||||
<link rel="canonical" href="http://blog.waterlin.org/articles/emacs-yasnippet-basic-usage.html">
|
||||
<link rel="shortlink" href="http://blog.waterlin.org/?p=79923">
|
||||
<link rel="shortcut icon" href="http://blog.waterlin.org/articles/favicon.ico">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<center>
|
||||
<div id="page">
|
||||
|
||||
<div id="header">
|
||||
<div id="header_top">
|
||||
<div id="menu_search_box">
|
||||
<form method="get" id="searchform" style="display:inline;" action="http://blog.waterlin.org/">
|
||||
Search:
|
||||
<input class="s" name="s" id="s" type="text">
|
||||
<input src="emacs-yasnippet-basic-usage_files/go.gif" value="Submit" class="sub" align="top" type="image">
|
||||
</form>
|
||||
</div>
|
||||
<div id="header_title">
|
||||
浏忙大爆炸 |
|
||||
<span>源于理工科男的烂笔头情结</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="header_end">
|
||||
<div id="menu">
|
||||
<div id="menu_pad">
|
||||
<div id="menu_items">
|
||||
|
||||
|
||||
<div class="no_bg"> | </div><div><a href="http://blog.waterlin.org/">博客</a></div>
|
||||
<div class="no_bg"> | </div><div><a href="http://en.waterlin.org/">English</a></div>
|
||||
<div class="no_bg"> | </div><div><a href="http://cn.waterlin.org/">首页</a></div>
|
||||
<div class="no_bg"> | </div><div><a href="http://blog.waterlin.org/contactme">留言给我</a></div>
|
||||
<div class="no_bg"> | </div><div><a href="http://blog.waterlin.org/about-2">关于</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<!-- Alimama ads -->
|
||||
<!--
|
||||
<script type="text/JavaScript">
|
||||
alimama_pid="mm_12493040_1648461_5980954";
|
||||
alimama_type="f";
|
||||
alimama_sizecode ="tl_3x3_12";
|
||||
alimama_fontsize=12;
|
||||
alimama_bordercolor="FFFFFF";
|
||||
alimama_bgcolor="E5E5E5";
|
||||
alimama_titlecolor="0000FF";
|
||||
alimama_underline=0;
|
||||
alimama_height=62;
|
||||
alimama_width=972;
|
||||
</script>
|
||||
<script src="http://a.alimama.cn/inf.js" type=text/javascript>
|
||||
</script>
|
||||
-->
|
||||
</div>
|
||||
|
||||
<div id="blog">
|
||||
<div id="blog_pad">
|
||||
<div id="blog_left">
|
||||
|
||||
<div class="item_class">
|
||||
<div class="item_class_title">
|
||||
<div class="item_class_title_text">
|
||||
<div class="titles">
|
||||
<div class="top_title_top">Posted on 30-09-2009</div>
|
||||
<div class="top_title"><a href="http://blog.waterlin.org/articles/emacs-yasnippet-basic-usage.html" rel="bookmark" title="Permanent Link to YASnippet 基础入门">YASnippet 基础入门</a></div>
|
||||
<div class="end_title">Filed Under (<a href="http://blog.waterlin.org/category/%e6%8a%80%e6%9c%af" title="View all posts in 技术" rel="category tag">技术</a>) by waterlin</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="item_class_text">
|
||||
<!-- add google ads -->
|
||||
<script type="text/javascript"><!--
|
||||
google_ad_client = "pub-3004770317513210";
|
||||
/* 468x15, black link, 创建于 09-9-6 */
|
||||
google_ad_slot = "9565258986";
|
||||
google_ad_width = 468;
|
||||
google_ad_height = 15;
|
||||
//-->
|
||||
</script>
|
||||
<script type="text/javascript" src="emacs-yasnippet-basic-usage_files/show_ads.js">
|
||||
</script><ins style="display:inline-table;border:none;height:15px;margin:0;padding:0;position:relative;visibility:visible;width:468px"><ins id="aswift_0_anchor" style="display:block;border:none;height:15px;margin:0;padding:0;position:relative;visibility:visible;width:468px"><iframe allowtransparency="true" hspace="0" marginwidth="0" marginheight="0" onload="var i=this.id,s=window.google_iframe_oncopy,H=s&&s.handlers,h=H&&H[i],w=this.contentWindow,d;try{d=w.document}catch(e){}if(h&&d&&(!d.body||!d.body.firstChild)){if(h.call){i+='.call';setTimeout(h,0)}else if(h.match){i+='.nav';w.location.replace(h)}s.log&&s.log.push(i)}" vspace="0" id="aswift_0" name="aswift_0" style="left: 0pt; position: absolute; top: 0pt;" frameborder="0" height="15" scrolling="no" width="468"></iframe></ins></ins>
|
||||
<!-- add google ads -->
|
||||
<p><a href="http://code.google.com/p/yasnippet/">YASnippet</a> 是 Emacs 的一个缩略词 (abbreviation) 模板替换系统,可以把一个预先设定好的缩略词扩展成模板。刚开始用 YASnippet 的时候,一般感觉无从下手,现在就简单介绍一下 YASnippet 最基本的使用方法。</p>
|
||||
<ol>
|
||||
<li>YASnippet 的安装
|
||||
<p>YASnippet 有两种安装方法,可以视个人情况选用。</p>
|
||||
<p>1). 单个 yasnippet-bundle.el 文件安装方式</p>
|
||||
<p>如果想快速地试用、了解一下 YASnippet 这个系统,从官方网站下载 <a href="http://yasnippet.googlecode.com/files/yasnippet-bundle-0.6.1c.el.tgz">yasnippet-bundle.el</a> 这个文件,放到 Emacs 扩展目录里,然后把下面的代码放到 .emacs 文件里:</p>
|
||||
<pre>(add-to-list 'load-path
|
||||
<span>"~/.emacs.d/plugins"</span>)
|
||||
(<span>require</span> '<span>yasnippet-bundle</span>)
|
||||
</pre>
|
||||
<p>本方法适合于快速地试用一下 YASnippet 系统,当然,如果你需要修改模板或是定制自己的扩展模板,你就需要用下面介绍的完全安装方法。</p>
|
||||
<p>2). 完全安装方法</p>
|
||||
<p>需要完全安装 YASnippet 的话,先从官方网站上下载完整的 <a href="http://yasnippet.googlecode.com/files/yasnippet-0.6.1c.tar.bz2">yasnippet-x.y.z.tar.bz2</a> 包,把包解压放到 Emacs 的扩展目录,然后添加下面的语句到 .emacs 文件里:</p>
|
||||
<pre>(add-to-list 'load-path
|
||||
<span>"~/.emacs.d/plugins/yasnippet-x.y.z"</span>)
|
||||
(<span>require</span> '<span>yasnippet</span>) <span>;; </span><span>not yasnippet-bundle
|
||||
</span>(yas/initialize)
|
||||
(yas/load-directory <span>"~/.emacs.d/plugins/yasnippet-x.y.z/snippets"</span>)
|
||||
</pre>
|
||||
</li>
|
||||
<li>YASnippet 的基本使用方法
|
||||
<p>正确安装好 YASnippet 后,重新启动 Emacs 就可以看到菜单栏里多了一个 YASnippet 的菜单(图1所示),</p>
|
||||
<p><img src="emacs-yasnippet-basic-usage_files/yasnippetmultimodecopyright.png" alt="YASnippetMultiModeCopyright.png" height="379"></p>
|
||||
<p>mini buffer 上也会显示出类似于 (org yas) 的字样(这里是指 yas 作为子模式存在于主模式 org 里)如图2所示。</p>
|
||||
<p><img src="emacs-yasnippet-basic-usage_files/yasnippetmultimode.png" alt="YASnippetMultiModeCopyright.png" height="67"></p>
|
||||
<p>总的来说,正确安装好 YASnippet 后,只要输入缩略词,然后用 TAB 键或是 C-i 就可以完成扩展了。</p>
|
||||
<p>在 Emacs 启动后,YASnippet 模式是作为一个子模式 (minor mode) 存在于各个模式之中。要用 YASnippet 进行缩略词补全有好多种方法,最常用的补全方法有三种:</p>
|
||||
<ul>
|
||||
<li>输入一个缩写词 (abbrev),然后用 snippet 的触发键 (trigger key) 来补全。这个键默认是 TAB 或是 C-i,当然,也可以用命令 M-x yas/expand 来进行扩展。</li>
|
||||
<li>用命令 M-x yas/insert-snippet 直接进行输入,输入完这个命令后,会弹出一个补全窗口,提示当前主模式下可以补全的模板。</li>
|
||||
<li>直接从菜单栏里的 YASnippet 里,选择内容进行输入。</li>
|
||||
</ul>
|
||||
<p>有关 YASnippet 使用的更详细叙述,可以参考<a href="http://yasnippet.googlecode.com/svn/trunk/doc/snippet-expansion.html">官方文档 Expanding snippets</a>。</p>
|
||||
</li>
|
||||
<li>YASnippet 个性化定制的命令
|
||||
<p>虽然 YASnippet 已经自带了许多常用的扩展模板,但是很多情况下,我们需要根据自己的实际情况,来进行模板定制。以下是扩展 YASnippet 常用的一些命令:</p>
|
||||
<ul>
|
||||
<li>用命令 M-x yas/new-snippet 就可以新建一个扩展模板 (snippet),YASnippet 会自动提示存放该模板的最佳目录。</li>
|
||||
<li>用命令 M-x yas/find-snippets 可以查找 snippet 文件,默认的目录是当前主模式下的模板文件 (snippet file) 的存放目录。</li>
|
||||
<li>用命令 M-x yas/visit-snippet-file 可以通过弹出的对话框来寻找你需要的模板文件 (snippet file),在对话框里选择一个选项,就会打开这个模板文件 (snippet file) 来让你编辑。</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>org 里的 YASnippet 使用实例
|
||||
<p>下面就用一个实例,结合 YASnippet 的语法规则,来简单介绍一下 YASnippet 最基本的使用。</p>
|
||||
<p>我在 org 模式里写笔记或是发布网页的时候,经常需要添加一个有关版权声明的文字(或为公司,或为自己)。因为公司和私人的内容都混在一起,所以我需要有多个模板。下面就以添加我个人版权声明的模板为例,介绍一下配置 YASnippet 的完整步骤。</p>
|
||||
<p>1). 添加一个有关个人版权的 snippet</p>
|
||||
<p>首先,在 org 模式里,用命令 M-x yas/new-snippet 来添加一个 snippet,输入你想要的 snippet 名称,我这里输入</p>
|
||||
<pre> Copyright
|
||||
</pre>
|
||||
<p>YASnippet 会自动生成一个名叫 Copyright.yasnippet 的文件,生成的内容如下:</p>
|
||||
<pre> # -*- mode: snippet -*-
|
||||
# name: Copyright
|
||||
# key:
|
||||
# binding: "keybinding"
|
||||
# expand-env: ((some-var some-value))
|
||||
# --
|
||||
</pre>
|
||||
<p>2). 现在我们只需要根据 YASnippet 的相关语法来修改这个文件就可以了。上面文件关键词的基本语法含义如下:</p>
|
||||
<ul>
|
||||
<li># name: 显示在弹出菜单里的 snippet 名称</li>
|
||||
<li># key: 缩略词,即你在用 TAB 键进行扩展前输入的关键词,如果不设定,则把这个关键词默认为本文件名</li>
|
||||
<li># binding: 设置使用哪个组合键来直接插入这个 snippet,对于比较常用的模板内容比较有用</li>
|
||||
<li># expand-env: 用 elisp 重新设置一些环境变量</li>
|
||||
<li># – 表示在这一行之上的全是注释</li>
|
||||
</ul>
|
||||
<p>3). 因为我们这里是配置一个最简单的模板,所以,我们删掉 # key:,# binding:,# expand-env: 这三个高级定制功能。最后,我们写成类似下面的东西:</p>
|
||||
<pre> # -*- mode: snippet -*-
|
||||
# name: Copyright
|
||||
# --
|
||||
#+BEGIN_HTML
|
||||
<p style="TEXT-ALIGN: center">
|
||||
原创文章,如转载请注明:转载自细节之锤 [ <a href="http://blog.waterlin.org/">http://blog.waterlin.org/</a> ]
|
||||
</p>
|
||||
<p style="TEXT-ALIGN: center">
|
||||
Copyright © WaterLin.org. All rights reserved.
|
||||
</p>
|
||||
#+END_HTML
|
||||
</pre>
|
||||
<p>4). 重启 Emacs 让修改生效,然后我们再回到 org 文件里,这个时候,可以直接输入一个 Copyright
|
||||
(注意:缩略词大小写敏感),然后用 C-i 进行替换(原本可以用 TAB 键的,但是 Emacs23 里的 org 模式把 TAB
|
||||
键给霸占了),就可以把 Copyright 这个词替换成上面用 html 写成的版权声明。</p>
|
||||
<p>在 org 模式里,我们可以用同样的方法来插入 #+begin_example,#+begin_ditaa,#+begin_dot,#+begin_src 等标记,这样可以节省一大笔时间。</p>
|
||||
</li>
|
||||
</ol>
|
||||
<p>一般来讲,用 YASnippet 来进行替换与自动插入,比直接用 elisp 写一个函数、命令来进行插入要简单、方便得多,并且容易管理。</p>
|
||||
<p>YASnippet 的模板语言 (Template syntax) 还有着更加灵活的用法,参见<a href="http://yasnippet.googlecode.com/svn/trunk/doc/snippet-development.html">官方文档 Writing snippets</a>。</p>
|
||||
<p>原创文章,如转载请注明:转载自细节之锤 [ <a href="http://blog.waterlin.org/">http://blog.waterlin.org/</a> ]</p>
|
||||
<p>Copyright © WaterLin.org. All rights reserved.</p>
|
||||
</div>
|
||||
<div class="item_class_panel">
|
||||
<div>
|
||||
<span class="panel_comm"><a href="http://blog.waterlin.org/articles/emacs-yasnippet-basic-usage.html#comments" title="Comment on YASnippet 基础入门">(2) Comments</a></span>
|
||||
<a href="http://blog.waterlin.org/articles/emacs-yasnippet-basic-usage.html" class="panel_read">Read More</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- You can start editing here. -->
|
||||
<div id="blog_comm">
|
||||
<a id="comments"></a>
|
||||
<h2>Comments</h2>
|
||||
|
||||
<div class="comm_panel">
|
||||
<b><a href="http://blog.waterlin.org/articles/three-ways-to-generate-class-diagram.html" rel="external nofollow" class="url">浏忙大爆炸 » Blog Archive » 生成 C++ 类文档及关系图的方法</a></b> on 15 September, 2010 at 2:28 pm #
|
||||
</div>
|
||||
<div class="comm_text">
|
||||
<p>[...] vim, Emacs 这类文本编辑器里,则可以很自然地使用宏操作来插入 Doxygen 注释;如果是用
|
||||
Visual Studio 的话呢,也是可以用 DoxyComment add-in for Visual Studio 2005 [...]</p>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<div class="comm_panel">
|
||||
<b><a href="http://imljp.info/?p=172" rel="external nofollow" class="url">/home/ljp » Emacs yasnippet hacking</a></b> on 17 January, 2011 at 9:07 am #
|
||||
</div>
|
||||
<div class="comm_text">
|
||||
<p>[...] YASnippet基础入门:<a href="http://blog.waterlin.org/articles/emacs-yasnippet-basic-usage.html" rel="nofollow">http://blog.waterlin.org/articles/emacs-yasnippet-basic-usage.html</a> [...]</p>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="comments_from_bg">
|
||||
<a id="respond"></a>
|
||||
<div id="comm_post_title">
|
||||
Post a Comment
|
||||
</div>
|
||||
|
||||
|
||||
<div id="comm_post_form">
|
||||
<form action="http://blog.waterlin.org/wp-comments-post.php" method="post" id="commentform">
|
||||
|
||||
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
<tbody><tr>
|
||||
<td class="right">
|
||||
Name:
|
||||
</td>
|
||||
<td>
|
||||
<input name="author" id="author" size="22" tabindex="1" type="text">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="right">
|
||||
Email:
|
||||
</td>
|
||||
<td>
|
||||
<input name="email" id="email" size="22" tabindex="2" type="text">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="right">
|
||||
Website:
|
||||
</td>
|
||||
<td>
|
||||
<input name="url" id="url" size="22" tabindex="3" type="text">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<!--<p><small><strong>XHTML:</strong> You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> </small></p>-->
|
||||
<tr>
|
||||
<td class="right">
|
||||
Comments:
|
||||
</td>
|
||||
<td>
|
||||
<textarea name="comment" id="comment" cols="40" rows="5" tabindex="4"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<input class="sub" src="emacs-yasnippet-basic-usage_files/sub.gif" type="image">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
<input name="comment_post_ID" value="79923" type="hidden">
|
||||
|
||||
<p style="display: none;"><input id="akismet_comment_nonce" name="akismet_comment_nonce" value="ab01027976" type="hidden"></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div id="blog_right">
|
||||
<div id="blog_right_body">
|
||||
|
||||
<div id="sidebar">
|
||||
<div id="sidebar_left">
|
||||
<ul>
|
||||
<li>
|
||||
<h2>广而告之</h2>
|
||||
<script type="text/javascript"><!--
|
||||
google_ad_client = "pub-3004770317513210";
|
||||
/* 160x600, 创建于 09-8-10 */
|
||||
google_ad_slot = "5265692676";
|
||||
google_ad_width = 160;
|
||||
google_ad_height = 600;
|
||||
//-->
|
||||
</script>
|
||||
<script type="text/javascript" src="emacs-yasnippet-basic-usage_files/show_ads.js">
|
||||
</script><ins style="display:inline-table;border:none;height:600px;margin:0;padding:0;position:relative;visibility:visible;width:160px"><ins id="aswift_1_anchor" style="display:block;border:none;height:600px;margin:0;padding:0;position:relative;visibility:visible;width:160px"><iframe allowtransparency="true" hspace="0" marginwidth="0" marginheight="0" onload="var i=this.id,s=window.google_iframe_oncopy,H=s&&s.handlers,h=H&&H[i],w=this.contentWindow,d;try{d=w.document}catch(e){}if(h&&d&&(!d.body||!d.body.firstChild)){if(h.call){i+='.call';setTimeout(h,0)}else if(h.match){i+='.nav';w.location.replace(h)}s.log&&s.log.push(i)}" vspace="0" id="aswift_1" name="aswift_1" style="left: 0pt; position: absolute; top: 0pt;" frameborder="0" height="600" scrolling="no" width="160"></iframe></ins></ins>
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li id="archives-3" class="widget widget_archive"><h2 class="widgettitle">文章索引模板</h2>
|
||||
<ul>
|
||||
<li><a href="http://blog.waterlin.org/articles/2011/04" title="April 2011">April 2011</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2011/03" title="March 2011">March 2011</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2011/02" title="February 2011">February 2011</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2011/01" title="January 2011">January 2011</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2010/12" title="December 2010">December 2010</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2010/11" title="November 2010">November 2010</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2010/10" title="October 2010">October 2010</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2010/09" title="September 2010">September 2010</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2010/08" title="August 2010">August 2010</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2010/07" title="July 2010">July 2010</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2010/06" title="June 2010">June 2010</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2010/05" title="May 2010">May 2010</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2010/04" title="April 2010">April 2010</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2010/03" title="March 2010">March 2010</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2010/02" title="February 2010">February 2010</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2010/01" title="January 2010">January 2010</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2009/12" title="December 2009">December 2009</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2009/11" title="November 2009">November 2009</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2009/10" title="October 2009">October 2009</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2009/09" title="September 2009">September 2009</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2009/08" title="August 2009">August 2009</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2009/07" title="July 2009">July 2009</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2009/06" title="June 2009">June 2009</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2009/05" title="May 2009">May 2009</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2009/04" title="April 2009">April 2009</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2009/03" title="March 2009">March 2009</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2009/02" title="February 2009">February 2009</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2009/01" title="January 2009">January 2009</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2008/12" title="December 2008">December 2008</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2008/11" title="November 2008">November 2008</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2008/10" title="October 2008">October 2008</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2008/09" title="September 2008">September 2008</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2008/08" title="August 2008">August 2008</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2008/07" title="July 2008">July 2008</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2008/06" title="June 2008">June 2008</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2008/05" title="May 2008">May 2008</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2008/04" title="April 2008">April 2008</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2008/03" title="March 2008">March 2008</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2008/02" title="February 2008">February 2008</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2008/01" title="January 2008">January 2008</a></li>
|
||||
<li><a href="http://blog.waterlin.org/articles/2007/12" title="December 2007">December 2007</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div id="sidebar_right">
|
||||
|
||||
<ul>
|
||||
<li id="tag_cloud-3" class="widget widget_tag_cloud"><h2 class="widgettitle">标签</h2>
|
||||
<div class="tagcloud"><a href="http://blog.waterlin.org/tag/c" class="tag-link-43" title="23 topics" style="font-size: 16.7399pt;">C++</a>
|
||||
<a href="http://blog.waterlin.org/tag/conkeror" class="tag-link-44" title="3 topics" style="font-size: 10.4277pt;">Conkeror</a>
|
||||
<a href="http://blog.waterlin.org/tag/cygwin" class="tag-link-45" title="5 topics" style="font-size: 11.8844pt;">Cygwin</a>
|
||||
<a href="http://blog.waterlin.org/tag/drupal" class="tag-link-46" title="11 topics" style="font-size: 14.3121pt;">Drupal</a>
|
||||
<a href="http://blog.waterlin.org/tag/emacs" class="tag-link-47" title="71 topics" style="font-size: 20.6243pt;">Emacs</a>
|
||||
<a href="http://blog.waterlin.org/tag/firefox" class="tag-link-49" title="22 topics" style="font-size: 16.578pt;">Firefox</a>
|
||||
<a href="http://blog.waterlin.org/tag/google" class="tag-link-51" title="13 topics" style="font-size: 14.8786pt;">Google</a>
|
||||
<a href="http://blog.waterlin.org/tag/gtd" class="tag-link-52" title="8 topics" style="font-size: 13.2601pt;">GTD</a>
|
||||
<a href="http://blog.waterlin.org/tag/lamp" class="tag-link-53" title="7 topics" style="font-size: 12.8555pt;">LAMP</a>
|
||||
<a href="http://blog.waterlin.org/tag/linux" class="tag-link-54" title="7 topics" style="font-size: 12.8555pt;">Linux</a>
|
||||
<a href="http://blog.waterlin.org/tag/mingw" class="tag-link-55" title="5 topics" style="font-size: 11.8844pt;">MinGW</a>
|
||||
<a href="http://blog.waterlin.org/tag/perl" class="tag-link-56" title="32 topics" style="font-size: 17.8728pt;">Perl</a>
|
||||
<a href="http://blog.waterlin.org/tag/phpbb" class="tag-link-57" title="3 topics" style="font-size: 10.4277pt;">phpBB</a>
|
||||
<a href="http://blog.waterlin.org/tag/tex" class="tag-link-58" title="3 topics" style="font-size: 10.4277pt;">TeX</a>
|
||||
<a href="http://blog.waterlin.org/tag/thunderbird" class="tag-link-59" title="6 topics" style="font-size: 12.4509pt;">Thunderbird</a>
|
||||
<a href="http://blog.waterlin.org/tag/usenet" class="tag-link-61" title="4 topics" style="font-size: 11.237pt;">Usenet</a>
|
||||
<a href="http://blog.waterlin.org/tag/vim" class="tag-link-62" title="2 topics" style="font-size: 9.45665pt;">Vim</a>
|
||||
<a href="http://blog.waterlin.org/tag/windows" class="tag-link-63" title="11 topics" style="font-size: 14.3121pt;">Windows</a>
|
||||
<a href="http://blog.waterlin.org/tag/wordpress" class="tag-link-65" title="18 topics" style="font-size: 15.9306pt;">Wordpress</a>
|
||||
<a href="http://blog.waterlin.org/tag/xulrunner" class="tag-link-66" title="1 topic" style="font-size: 8pt;">XULRunner</a>
|
||||
<a href="http://blog.waterlin.org/tag/zen-cart" class="tag-link-67" title="9 topics" style="font-size: 13.6647pt;">Zen-cart</a>
|
||||
<a href="http://blog.waterlin.org/tag/%e5%95%86%e4%b8%9a" class="tag-link-71" title="9 topics" style="font-size: 13.6647pt;">商业</a>
|
||||
<a href="http://blog.waterlin.org/tag/%e5%b7%b2%e6%8a%a5" class="tag-link-75" title="18 topics" style="font-size: 15.9306pt;">已报</a>
|
||||
<a href="http://blog.waterlin.org/tag/%e6%8a%80%e6%9c%af" class="tag-link-74" title="22 topics" style="font-size: 16.578pt;">技术</a>
|
||||
<a href="http://blog.waterlin.org/tag/%e6%96%87%e5%8c%96" class="tag-link-70" title="15 topics" style="font-size: 15.2832pt;">文化</a>
|
||||
<a href="http://blog.waterlin.org/tag/%e7%90%86%e8%b4%a2" class="tag-link-76" title="1 topic" style="font-size: 8pt;">理财</a>
|
||||
<a href="http://blog.waterlin.org/tag/%e7%94%9f%e6%b4%bb" class="tag-link-68" title="37 topics" style="font-size: 18.3584pt;">生活</a>
|
||||
<a href="http://blog.waterlin.org/tag/%e7%bb%8f%e6%b5%8e" class="tag-link-69" title="4 topics" style="font-size: 11.237pt;">经济</a>
|
||||
<a href="http://blog.waterlin.org/tag/%e8%bd%af%e4%bb%b6" class="tag-link-73" title="106 topics" style="font-size: 22pt;">软件</a></div>
|
||||
</li>
|
||||
<li id="html_javascript_adder-3" class="widget widget_html_javascript_adder">
|
||||
|
||||
<!-- Start - HTML Javascript Adder plugin v3.1.1 -->
|
||||
<h2 class="widgettitle">订阅我吧</h2>
|
||||
|
||||
<div class="hjawidget">
|
||||
<!-- Feedsky FEED发布代码开始 -->
|
||||
<!-- FEED自动发现标记开始 -->
|
||||
<link title="RSS 2.0" type="application/rss+xml" href="http://feed.feedsky.com/WaterDrop" rel="alternate">
|
||||
<!-- FEED自动发现标记结束 -->
|
||||
<script language="javascript"><!--
|
||||
main_sub="";
|
||||
more_subs="zhuaxia_01,pageflakes_01,rojo_01,google_01,netvibes_01,yahoo_01,newsgator_01,bloglines_01,xianguo_01,nazha_01,youdao_01,qq_01,douban_01";
|
||||
is_new="yes";
|
||||
--> </script>
|
||||
<script language="javascript" src="emacs-yasnippet-basic-usage_files/publishlist_v2.html"></script><a href="http://www.zhuaxia.com/add_channel.php?url=http://feed.feedsky.com/WaterDrop" target="_blank"><img src="emacs-yasnippet-basic-usage_files/icon_subshot01_zhuaxia.gif" alt="抓虾" style="margin-bottom: 3px;" border="0" vspace="2"></a><br><a href="http://www.pageflakes.com/subscribe.aspx?url=http://feed.feedsky.com/WaterDrop" target="_blank"><img src="emacs-yasnippet-basic-usage_files/icon_subshot01_pageflakes.gif" alt="pageflakes" style="margin-bottom: 3px;" border="0" vspace="2"></a><br><a href="http://www.rojo.com/add-subscription?resource=http://feed.feedsky.com/WaterDrop" target="_blank"><img src="emacs-yasnippet-basic-usage_files/icon_subshot01_rojo.gif" alt="Rojo" style="margin-bottom: 3px;" border="0" vspace="2"></a><br><a href="http://fusion.google.com/add?feedurl=http://feed.feedsky.com/WaterDrop" target="_blank"><img src="emacs-yasnippet-basic-usage_files/icon_subshot01_google.gif" alt="google reader" style="margin-bottom: 3px;" border="0" vspace="2"></a><br><a href="http://www.netvibes.com/subscribe.php?url=http://feed.feedsky.com/WaterDrop" target="_blank"><img src="emacs-yasnippet-basic-usage_files/icon_subshot01_netvibes.gif" alt="netvibes" style="margin-bottom: 3px;" border="0" vspace="2"></a><br><a href="http://add.my.yahoo.com/rss?url=http://feed.feedsky.com/WaterDrop" target="_blank"><img src="emacs-yasnippet-basic-usage_files/icon_subshot01_yahoo.gif" alt="my yahoo" style="margin-bottom: 3px;" border="0" vspace="2"></a><br><a href="http://www.newsgator.com/ngs/subscriber/subfext.aspx?url=http://feed.feedsky.com/WaterDrop" target="_blank"><img src="emacs-yasnippet-basic-usage_files/icon_subshot01_newsgator.gif" alt="newsgator" style="margin-bottom: 3px;" border="0" vspace="2"></a><br><a href="http://www.bloglines.com/sub/http://feed.feedsky.com/WaterDrop" target="_blank"><img src="emacs-yasnippet-basic-usage_files/icon_subshot01_bloglines.gif" alt="bloglines" style="margin-bottom: 3px;" border="0" vspace="2"></a><br><a href="http://www.xianguo.com/subscribe.php?url=http://feed.feedsky.com/WaterDrop" target="_blank"><img src="emacs-yasnippet-basic-usage_files/icon_subshot01_xianguo.gif" alt="鲜果" style="margin-bottom: 3px;" border="0" vspace="2"></a><br><a href="http://inezha.com/add?url=http://feed.feedsky.com/WaterDrop" target="_blank"><img src="emacs-yasnippet-basic-usage_files/icon_subshot01_nazha.gif" alt="哪吒" style="margin-bottom: 3px;" border="0" vspace="2"></a><br><a href="http://reader.youdao.com/b.do?keyfrom=feedsky&url=http://feed.feedsky.com/WaterDrop" target="_blank"><img src="emacs-yasnippet-basic-usage_files/icon_subshot01_youdao.gif" alt="有道" style="margin-bottom: 3px;" border="0" vspace="2"></a><br><a href="http://mail.qq.com/cgi-bin/feed?u=http://feed.feedsky.com/WaterDrop" target="_blank"><img src="emacs-yasnippet-basic-usage_files/icon_subshot01_qq.gif" alt="QQ邮箱" style="margin-bottom: 3px;" border="0" vspace="2"></a><br><a href="http://9.douban.com/reader/subscribe?url=http://feed.feedsky.com/WaterDrop" target="_blank"><img src="emacs-yasnippet-basic-usage_files/icon_subshot01_douban.gif" alt="九点" style="margin-bottom: 3px;" border="0" vspace="2"></a>
|
||||
<!-- Feedsky FEED发布代码结束 -->
|
||||
<a href="http://www.aakashweb.com/" target="_blank" rel="follow" title="Added with HTML Javascript Adder Wordpress plugin" style="float: right; font-size: 50%;"> ?</a>
|
||||
</div>
|
||||
<!-- End - HTML Javascript Adder plugin v3.1.1 -->
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
<div id="footer_text">
|
||||
Copyright © 浏忙大爆炸. All rights reserved. 由 <a href="http://cookwhy.com/">酷歪基地</a> 提供 <a href="http://www.wordpress.org/">WordPress</a> 博客服务<br>
|
||||
Designed By : <span><a href="http://www.askgraphics.com/" title="Website design">AskGraphics</a></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</center>
|
||||
|
||||
|
||||
</body></html>
|
||||
|
After Width: | Height: | Size: 732 B |
|
After Width: | Height: | Size: 933 B |
|
After Width: | Height: | Size: 705 B |
|
After Width: | Height: | Size: 811 B |
|
After Width: | Height: | Size: 900 B |
|
After Width: | Height: | Size: 843 B |
|
After Width: | Height: | Size: 702 B |
|
After Width: | Height: | Size: 918 B |
|
After Width: | Height: | Size: 818 B |
|
After Width: | Height: | Size: 687 B |
|
After Width: | Height: | Size: 859 B |
|
After Width: | Height: | Size: 673 B |
|
After Width: | Height: | Size: 692 B |
|
After Width: | Height: | Size: 847 B |
@@ -0,0 +1,23 @@
|
||||
|
||||
(function(){var g=null,h=(new Date).getTime();var i=this,aa=function(a,b){var c=a.split("."),d=i;!(c[0]in d)&&d.execScript&&d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)!c.length&&b!==void 0?d[e]=b:d=d[e]?d[e]:d[e]={}},ba=function(a){return a.call.apply(a.bind,arguments)},ca=function(a,b){var c=b||i;if(arguments.length>2){var d=Array.prototype.slice.call(arguments,2);return function(){var b=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(b,d);return a.apply(c,b)}}else return function(){return a.apply(c,arguments)}},
|
||||
j=function(){j=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?ba:ca;return j.apply(g,arguments)};var da=/&/g,ea=/</g,fa=/>/g,ha=/\"/g,k={"\0":"\\0","\u0008":"\\b","\u000c":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\u000b":"\\x0B",'"':'\\"',"\\":"\\\\"},n={"'":"\\'"},r=function(a,b){if(a<b)return-1;else if(a>b)return 1;return 0};var s,t,u,x,z=function(){return i.navigator?i.navigator.userAgent:g},x=u=t=s=!1,A;if(A=z())var ia=i.navigator,s=A.indexOf("Opera")==0,t=!s&&A.indexOf("MSIE")!=-1,u=!s&&A.indexOf("WebKit")!=-1,x=!s&&!u&&ia.product=="Gecko";var B=t,D=x,ja=u,E;
|
||||
a:{var F="",G;if(s&&i.opera)var H=i.opera.version,F=typeof H=="function"?H():H;else if(D?G=/rv\:([^\);]+)(\)|;)/:B?G=/MSIE\s+([^\);]+)(\)|;)/:ja&&(G=/WebKit\/(\S+)/),G)var ka=G.exec(z()),F=ka?ka[1]:"";if(B){var I,la=i.document,I=la?la.documentMode:void 0;if(I>parseFloat(F)){E=String(I);break a}}E=F}
|
||||
var ma=E,na={},J=function(a){var b;if(!(b=na[a])){for(var b=0,c=String(ma).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),d=String(a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),e=Math.max(c.length,d.length),f=0;b==0&&f<e;f++){var ra=c[f]||"",q=d[f]||"",l=RegExp("(\\d*)(\\D*)","g"),y=RegExp("(\\d*)(\\D*)","g");do{var o=l.exec(ra)||["","",""],m=y.exec(q)||["","",""];if(o[0].length==0&&m[0].length==0)break;b=r(o[1].length==0?0:parseInt(o[1],10),m[1].length==0?0:parseInt(m[1],10))||r(o[2].length==
|
||||
0,m[2].length==0)||r(o[2],m[2])}while(b==0)}b=na[a]=b>=0}return b};var K,L,L=K=!1,M=z();M&&(M.indexOf("Firefox")!=-1?K=!0:M.indexOf("Camino")!=-1||M.indexOf("iPhone")!=-1||M.indexOf("iPod")!=-1||M.indexOf("iPad")!=-1||M.indexOf("Android")!=-1||M.indexOf("Chrome")!=-1&&(L=!0));var oa=K,pa=L;var qa=document,N=window;var O=function(a){a=parseFloat(a);return isNaN(a)||a>1||a<0?0:a},P=function(a){if(a=="true")return!0;return!1},sa=/^([\w-]+\.)*([\w-]{2,})(\:[0-9]+)?$/,Q=function(a){if(!a)return"pagead2.googlesyndication.com";return(a=a.match(sa))?a[0]:"pagead2.googlesyndication.com"};var ta=O("0"),ua=O("0"),va=O("1"),wa=O("0.2");var xa=P("false"),ya=P("false"),za=P("false");var Aa=function(){return Q("")};!B||J("9");!D&&!B||B&&J("9")||D&&J("1.9.1");B&&J("9");Q("");var R=function(a){return!!a&&typeof a=="function"&&!!a.call},Ba=function(a){if(!(arguments.length<2))for(var b=1,c=arguments.length;b<c;++b)a.push(arguments[b])};function S(a){return typeof encodeURIComponent=="function"?encodeURIComponent(a):escape(a)}function Ca(a,b){a.attachEvent?a.attachEvent("onload",b):a.addEventListener&&a.addEventListener("load",b,!1)}
|
||||
function Da(a,b){if(!(Math.random()<1.0E-4)){var c=Math.random();if(c<b)return a[Math.floor(c/b*a.length)]}return""};aa("google_protectAndRun",function(a,b,c){a=j(b,i,a);b=window.onerror;window.onerror=a;try{c()}catch(d){var c=d.toString(),e="";d.fileName&&(e=d.fileName);var f=-1;if(d.lineNumber)f=d.lineNumber;if(!a(c,e,f))throw d;}window.onerror=b});
|
||||
aa("google_handleError",function(a,b,c,d){if(Math.random()<0.01)a=["http://",Aa(),"/pagead/gen_204","?id=jserror","&jscb=",xa?1:0,"&jscd=",ya?1:0,"&context=",S(a),"&msg=",S(b),"&file=",S(c),"&line=",S(d.toString()),"&url=",S(qa.URL.substring(0,512)),"&ref=",S(qa.referrer.substring(0,512))],a.push(["&client=",S(N.google_ad_client),"&format=",S(N.google_ad_format),"&slotname=",S(N.google_ad_slot),"&output=",S(N.google_ad_output),"&ad_type=",S(N.google_ad_type)].join("")),a=a.join(""),N.google_image_requests||
|
||||
(N.google_image_requests=[]),b=new Image,b.src=a,N.google_image_requests.push(b);return!za});var Fa=function(a){try{var b=a.google_test;a.google_test=!b;if(a.google_test===!b)return a.google_test=b,!0}catch(c){}return!1},Ga=g,Ha=function(){if(!Ga){for(var a=window;a!=a.parent&&Fa(a.parent);)a=a.parent;Ga=a}return Ga};var T,U=function(a){this.d=[];this.b=a||window;this.a=0;this.c=g},Ia=function(a,b){this.j=a;this.o=b};U.prototype.i=function(a,b){this.a==0&&this.d.length==0&&(!b||b==window)?(this.a=2,this.h(new Ia(a,window))):this.f(a,b)};U.prototype.f=function(a,b){this.d.push(new Ia(a,b||this.b));Ja(this)};U.prototype.k=function(a){this.a=1;if(a)this.c=this.b.setTimeout(j(this.g,this),a)};U.prototype.g=function(){if(this.a==1){if(this.c!=g)this.b.clearTimeout(this.c),this.c=g;this.a=0}Ja(this)};
|
||||
U.prototype.m=function(){return!0};U.prototype.nq=U.prototype.i;U.prototype.nqa=U.prototype.f;U.prototype.al=U.prototype.k;U.prototype.rl=U.prototype.g;U.prototype.sz=U.prototype.m;var Ja=function(a){a.b.setTimeout(j(a.n,a),0)};U.prototype.n=function(){if(this.a==0&&this.d.length){var a=this.d.shift();this.a=2;a.o.setTimeout(j(this.h,this,a),0);Ja(this)}};U.prototype.h=function(a){this.a=0;a.j()};
|
||||
var Ka=function(a){try{return a.sz()}catch(b){return!1}},La=function(a){return!!a&&(typeof a=="object"||typeof a=="function")&&Ka(a)&&R(a.nq)&&R(a.nqa)&&R(a.al)&&R(a.rl)},Ma=function(){if(T&&Ka(T))return T;var a=Ha(),b=a.google_jobrunner;if(La(b))return T=b;return a.google_jobrunner=T=new U(a)},Na=function(a,b){Ma().nq(a,b)},Oa=function(a,b){Ma().nqa(a,b)};var Pa=function(a,b,c){var d=["<iframe"],e;for(e in a)a.hasOwnProperty(e)&&Ba(d,e+"="+a[e]);d.push('style="left:0;position:absolute;top:0;"');d.push("></iframe>");b="border:none;height:"+c+"px;margin:0;padding:0;position:relative;visibility:visible;width:"+b+"px";return['<ins style="display:inline-table;',b,'"><ins id="',a.id+"_anchor",'" style="display:block;',b,'">',d.join(" "),"</ins></ins>"].join("")};var Qa=function(){},Sa=function(a,b,c){switch(typeof b){case "string":Ra(b,c);break;case "number":c.push(isFinite(b)&&!isNaN(b)?b:"null");break;case "boolean":c.push(b);break;case "undefined":c.push("null");break;case "object":if(b==g){c.push("null");break}if(b instanceof Array){var d=b.length;c.push("[");for(var e="",f=0;f<d;f++)c.push(e),Sa(a,b[f],c),e=",";c.push("]");break}c.push("{");d="";for(e in b)b.hasOwnProperty(e)&&(f=b[e],typeof f!="function"&&(c.push(d),Ra(e,c),c.push(":"),Sa(a,f,c),d=
|
||||
","));c.push("}");break;case "function":break;default:throw Error("Unknown type: "+typeof b);}},Ta={'"':'\\"',"\\":"\\\\","/":"\\/","\u0008":"\\b","\u000c":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\u000b":"\\u000b"},Ua=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g,Ra=function(a,b){b.push('"');b.push(a.replace(Ua,function(a){if(a in Ta)return Ta[a];var b=a.charCodeAt(0),e="\\u";b<16?e+="000":b<256?e+="00":b<4096&&(e+="0");return Ta[a]=e+b.toString(16)}));b.push('"')};var V=["google_ad_block","google_ad_channel","google_ad_client","google_ad_format","google_ad_height","google_ad_host","google_ad_host_channel","google_ad_host_tier_id","google_ad_output","google_ad_override","google_ad_region","google_ad_section","google_ad_slot","google_ad_type","google_ad_width","google_adtest","google_allow_expandable_ads","google_alternate_ad_url","google_alternate_color","google_analytics_domain_name","google_analytics_uacct","google_bid","google_city","google_color_bg","google_color_border",
|
||||
"google_color_line","google_color_link","google_color_text","google_color_url","google_container_id","google_contents","google_country","google_cpm","google_ctr_threshold","google_cust_age","google_cust_ch","google_cust_gender","google_cust_id","google_cust_interests","google_cust_job","google_cust_l","google_cust_lh","google_cust_u_url","google_disable_video_autoplay","google_ed","google_eids","google_enable_osd","google_encoding","google_font_face","google_font_size","google_frame_id","google_gl",
|
||||
"google_hints","google_image_size","google_kw","google_kw_type","google_language","google_max_num_ads","google_max_radlink_len","google_num_radlinks","google_num_radlinks_per_unit","google_num_slots_to_rotate","google_only_ads_with_video","google_only_pyv_ads","google_only_userchoice_ads","google_override_format","google_page_url","google_referrer_url","google_region","google_reuse_colors","google_rl_dest_url","google_rl_filtering","google_rl_mode","google_rt","google_safe","google_skip","google_tag_info",
|
||||
"google_targeting","google_ui_features","google_ui_version","google_video_doc_id","google_video_product_type","google_with_pyv_ads"];var Va=function(a){this.b=a;a.google_iframe_oncopy||(a.google_iframe_oncopy={handlers:{},log:[],img:Math.random()<0.01?[]:g});this.e=a.google_iframe_oncopy;a.setTimeout(j(this.l,this),3E4)},Wa;var W="var i=this.id,s=window.google_iframe_oncopy,H=s&&s.handlers,h=H&&H[i],w=this.contentWindow,d;try{d=w.document}catch(e){}if(h&&d&&(!d.body||!d.body.firstChild)){if(h.call){i+='.call';setTimeout(h,0)}else if(h.match){i+='.nav';w.location.replace(h)}s.log&&s.log.push(i)}";
|
||||
/[&<>\"]/.test(W)&&(W.indexOf("&")!=-1&&(W=W.replace(da,"&")),W.indexOf("<")!=-1&&(W=W.replace(ea,"<")),W.indexOf(">")!=-1&&(W=W.replace(fa,">")),W.indexOf('"')!=-1&&(W=W.replace(ha,""")));Wa=W;Va.prototype.set=function(a,b){this.e.handlers[a]=b};
|
||||
Va.prototype.l=function(){if(this.e.img){var a=this.e.log,b=this.b.document;if(a.length)b=["http://",Aa(),"/pagead/gen_204?id=iframecopy&log=",S(a.join("-")),"&url=",S(b.URL.substring(0,512)),"&ref=",S(b.referrer.substring(0,512))].join(""),a.length=0,a=new Image,this.e.img.push(a),a.src=b}};var Xa=function(){var a="script";return["<",a,' src="http://',Q(""),'/pagead/js/r20110330/r20110321-2/show_ads_impl.js"></',a,">"].join("")},Ya=function(a,b,c,d){return function(){var e=!1;d&&Ma().al(3E4);try{var f;try{f=!!a.document.getElementById(b).contentWindow.document}catch(ra){f=!1}if(f){var q=a.document.getElementById(b).contentWindow,
|
||||
l=q.document;if(!l.body||!l.body.firstChild)l.open(),q.google_async_iframe_close=!0,l.write(c)}else{var y=a.document.getElementById(b).contentWindow,o;f=c;f=String(f);if(f.quote)o=f.quote();else{q=['"'];for(l=0;l<f.length;l++){var m=f.charAt(l),Ea=m.charCodeAt(0),mb=q,nb=l+1,ga;if(!(ga=k[m])){var C;if(Ea>31&&Ea<127)C=m;else{var p=m;if(p in n)C=n[p];else if(p in k)C=n[p]=k[p];else{var v=p,w=p.charCodeAt(0);if(w>31&&w<127)v=p;else{if(w<256){if(v="\\x",w<16||w>256)v+="0"}else v="\\u",w<4096&&(v+="0");
|
||||
v+=w.toString(16).toUpperCase()}C=n[p]=v}}ga=C}mb[nb]=ga}q.push('"');o=q.join("")}y.location.replace("javascript:"+o)}e=!0}catch(tb){y=Ha().google_jobrunner,La(y)&&y.rl()}e&&(new Va(a)).set(b,Ya(a,b,c,!1))}},Za=function(){return ta&&ua/ta||typeof window.google_hash_ratio=="number"&&window.google_hash_ratio||g};window.google_loader_used=!0;(function(a){if(!("google_onload_fired"in a))a.google_onload_fired=!1,Ca(a,function(){a.google_onload_fired=!0})})(window);if(!window.google_loader_experiment)window.google_loader_experiment=Da(["async1_all","block1"],wa)||Da(["launch"],va)||"none";var $a,ab=window.google_loader_experiment;
|
||||
if($a=window.google_enable_async===!0||ab=="launch"||ab=="async1_all")$a=window.google_enable_async===!1?!1:(B&&/MSIE 8/.test(navigator.userAgent)||pa||oa&&!!window.document.body)&&!window.google_container_id&&(!window.google_ad_output||window.google_ad_output=="html");
|
||||
if($a){var bb=window;bb.google_unique_id?++bb.google_unique_id:bb.google_unique_id=1;for(var X=window,_script$$inline_198="script",Y,Z={allowtransparency:'"true"',frameborder:'"0"',height:'"'+X.google_ad_height+'"',hspace:'"0"',marginwidth:'"0"',marginheight:'"0"',onload:'"'+Wa+'"',scrolling:'"no"',vspace:'"0"',width:'"'+X.google_ad_width+'"'},cb=X.document,$=Z.id,db=0;!$||X.document.getElementById($);)$="aswift_"+db++;Z.id=$;Z.name=$;cb.write(Pa(Z,X.google_ad_width,X.google_ad_height));var Y=$,eb;
|
||||
X.google_page_url&&(X.google_page_url=String(X.google_page_url));for(var fb=[],gb=0,hb=V.length;gb<hb;gb++){var ib=V[gb];if(X[ib]!=g){var jb;try{var kb=[];Sa(new Qa,X[ib],kb);jb=kb.join("")}catch(lb){}jb&&Ba(fb,ib,"=",jb,";")}}for(var eb=fb.join(""),ob=0,pb=V.length;ob<pb;ob++)X[V[ob]]=g;var qb=(new Date).getTime(),rb=Za(),sb=window.google_loader_experiment,ub=["<!doctype html><html><body><",_script$$inline_198,">",eb,"google_show_ads_impl=true;google_unique_id=",X.google_unique_id,';google_async_iframe_id="',
|
||||
Y,'";google_start_time=',h,";",rb?"google_hash_ratio="+rb+";":"",sb?'google_loader_experiment="'+sb+'";':"","google_bpp=",qb>h?qb-h:1,";</",_script$$inline_198,">",Xa(),"</body></html>"].join("");(X.document.getElementById(Y)?Na:Oa)(Ya(X,Y,ub,!0))}else window.google_start_time=h,window.google_hash_ratio=Za(),document.write(Xa());})();
|
||||
@@ -0,0 +1,631 @@
|
||||
/*
|
||||
Theme Name: RedWave
|
||||
Theme URI: http://www.askgraphics.com/freetemplates/
|
||||
Description: Custom blog design starts from just $250 @ <a href="http://www.askgraphics.com/blog-design.html">AskGraphics.com</a>.
|
||||
Version: 1.0
|
||||
Author: AskGraphics
|
||||
Author URI: http://www.askgraphics.com/
|
||||
Catalog: 三栏、精美、推荐
|
||||
*/
|
||||
|
||||
body{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
font-family:Trebuchet MS, Arial, Helvetica, sans-serif;
|
||||
font-size:12px;
|
||||
background:#000000;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
img{
|
||||
border:0px;
|
||||
}
|
||||
|
||||
a{
|
||||
color:#ff0000;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
form, table, ul, li{
|
||||
padding:0px;
|
||||
margin:0px;;
|
||||
}
|
||||
|
||||
.sub{
|
||||
border:0px;
|
||||
}
|
||||
|
||||
input, textarea{
|
||||
border:1px solid #cecece;
|
||||
font-size:12px
|
||||
}
|
||||
|
||||
div#page{
|
||||
width:973px;
|
||||
text-align:left;
|
||||
}
|
||||
|
||||
/*header*/
|
||||
#header{
|
||||
width:100%;
|
||||
height:232px;
|
||||
text-align:left;
|
||||
}
|
||||
|
||||
#header_top{
|
||||
width:100%;
|
||||
height:183px;
|
||||
background:url(images/header_top_bg.gif) no-repeat bottom;
|
||||
text-align:left;
|
||||
}
|
||||
|
||||
|
||||
#header_end{
|
||||
width:100%;
|
||||
height:49px;
|
||||
background:url(images/header_end_bg.gif) no-repeat top;
|
||||
}
|
||||
|
||||
#menu_items{
|
||||
float:right;
|
||||
}
|
||||
|
||||
#menu_search_box{
|
||||
font-family:Verdana, Arial, Helvetica, sans-serif;
|
||||
color:#7f7f7f;
|
||||
font-size:12px;
|
||||
float:right;
|
||||
padding-top:33px;
|
||||
padding-right:7px;
|
||||
}
|
||||
|
||||
#menu_search_box input.s{
|
||||
width:117px;
|
||||
font-size:13px;
|
||||
color:#666666;
|
||||
border:0px;
|
||||
background:none;
|
||||
}
|
||||
|
||||
#menu_search_box input.sub{
|
||||
position:relative;
|
||||
top:-3px;
|
||||
}
|
||||
|
||||
#header_title{
|
||||
color:#ffffff;
|
||||
font-size:31px;
|
||||
padding-top:45px;
|
||||
padding-left:30px;
|
||||
}
|
||||
#header_title span{
|
||||
color:#db8b85;
|
||||
font-size:12px;
|
||||
font-family:Verdana, Arial, Helvetica, sans-serif;
|
||||
position:relative;
|
||||
top:-5px;
|
||||
}
|
||||
/*menu*/
|
||||
|
||||
#menu{
|
||||
}
|
||||
|
||||
div#menu #menu_pad{
|
||||
font-size:15px;
|
||||
color:#e2efff;
|
||||
padding-top:15px;
|
||||
padding-right:15px;
|
||||
}
|
||||
|
||||
div#menu a{
|
||||
color:#FFFFFF;
|
||||
}
|
||||
|
||||
div#menu a:hover{
|
||||
color:#e2efff;
|
||||
}
|
||||
|
||||
div#menu #menu_items div{
|
||||
float:left;
|
||||
}
|
||||
|
||||
div#menu #menu_items div.no_bg{
|
||||
float:left;
|
||||
padding-right:5px;
|
||||
}
|
||||
|
||||
/* end menu */
|
||||
|
||||
/* end header */
|
||||
|
||||
/* blog*/
|
||||
|
||||
div#page #blog{
|
||||
background:url(images/body_bg.gif) repeat-y right top;
|
||||
float:left;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
div#page #blog_pad{
|
||||
float:left;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
div#blog #blog_left{
|
||||
width:604px;
|
||||
float:left;
|
||||
padding-top:25px;
|
||||
padding-right:20px;
|
||||
}
|
||||
|
||||
div#blog #blog_right{
|
||||
width:325px;
|
||||
float:left;
|
||||
}
|
||||
|
||||
/* sidebar*/
|
||||
#blog_right #blog_right_body{
|
||||
padding-left:0px;
|
||||
}
|
||||
|
||||
#blog_right #blog_right_body #sidebar{
|
||||
padding-left:15px;
|
||||
padding-right:0px;
|
||||
padding-top:10px;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
#blog_right #sidebar #sidebar_left{
|
||||
width:51%;
|
||||
float:left;
|
||||
}
|
||||
|
||||
#blog_right #sidebar #sidebar_right{
|
||||
width:49%;
|
||||
float:left;
|
||||
}
|
||||
|
||||
|
||||
#blog_right #sidebar ul{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
}
|
||||
#blog_right #sidebar li{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
list-style-type:none;
|
||||
}
|
||||
|
||||
#blog_right #sidebar h2{
|
||||
color:#ffffff;
|
||||
font-size:18px;
|
||||
font-family:Arial, Helvetica, sans-serif;
|
||||
font-weight:normal;
|
||||
margin:0px;
|
||||
padding-left:10px;
|
||||
background:url(images/h2_li.gif) no-repeat left center;
|
||||
padding-top:5px;
|
||||
height:28px;
|
||||
}
|
||||
#blog_right #sidebar div#sidebar_right h2{
|
||||
color:#ffffff;
|
||||
}
|
||||
|
||||
#blog_right #sidebar ul li{
|
||||
color:#474747;
|
||||
font-size:12px;
|
||||
font-family:Verdana, Arial, Helvetica, sans-serif;
|
||||
font-weight:bold;
|
||||
padding-bottom:10px;
|
||||
}
|
||||
|
||||
#blog_right #sidebar li a{
|
||||
color:#474747;
|
||||
font-size:12px;
|
||||
font-family:Verdana, Arial, Helvetica, sans-serif;
|
||||
text-decoration:none;
|
||||
font-weight:normal;
|
||||
line-height:19px;
|
||||
}
|
||||
|
||||
#blog_right #sidebar ul li ul li{
|
||||
font-size:12px;
|
||||
font-family:Verdana, Arial, Helvetica, sans-serif;
|
||||
font-weight:bold;
|
||||
padding-right:5px;
|
||||
padding-bottom:5px;
|
||||
background:none;
|
||||
}
|
||||
#blog_right #sidebar ul li ul li ul li{
|
||||
font-size:12px;
|
||||
font-family:Verdana, Arial, Helvetica, sans-serif;
|
||||
font-weight:normal;
|
||||
color:#474747;
|
||||
padding-bottom:0px;
|
||||
}
|
||||
#blog_right #sidebar ul li ul li ul li a{
|
||||
font-size:12px;
|
||||
font-family:Verdana, Arial, Helvetica, sans-serif;
|
||||
font-weight:normal;
|
||||
color:#474747;
|
||||
}
|
||||
|
||||
#blog_right #sidebar ul li ul li{
|
||||
border-bottom:0;
|
||||
background: url(images/solid_li.gif) left bottom no-repeat;
|
||||
}
|
||||
|
||||
#blog_right #sidebar div#sidebar_right ul li ul li{
|
||||
border-bottom:0;
|
||||
background: url(images/solid_li.gif) left bottom no-repeat;
|
||||
}
|
||||
|
||||
#blog_right #sidebar ul li.widget_categories ul li ul li{
|
||||
border-bottom:0;
|
||||
background: none;
|
||||
}
|
||||
|
||||
#blog_right #sidebar ul li ul li ul{
|
||||
padding-left:10px;
|
||||
}
|
||||
|
||||
#blog_right #sidebar ul li ul li a{
|
||||
background: url(images/cat_li.gif) left top no-repeat;
|
||||
padding-left:9px;
|
||||
}
|
||||
|
||||
#blog_right #sidebar #sidebar_right ul li ul li a{
|
||||
background: url(images/bl_li.gif) left top no-repeat;
|
||||
padding-left:9px;
|
||||
}
|
||||
|
||||
#blog_right #sidebar ul li.widget_categories ul li a{
|
||||
background: url(images/cat_li.gif) left top no-repeat;
|
||||
padding-left:9px;
|
||||
}
|
||||
|
||||
#blog_right #sidebar ul li.widget_categories li ul.children li a{
|
||||
background: url(images/line_li.gif) left top no-repeat;
|
||||
padding-left:9px;
|
||||
}
|
||||
|
||||
/*inside*/
|
||||
|
||||
#blog_left #blog_comm{
|
||||
margin-left:20px;
|
||||
float:left;
|
||||
width:530px;
|
||||
}
|
||||
|
||||
#blog_left #blog_comm h2{
|
||||
font-size:23px;
|
||||
font-weight:normal;
|
||||
color:#000000;
|
||||
position:relative;
|
||||
top:-10px;
|
||||
}
|
||||
|
||||
#blog_left #blog_comm .comm_panel{
|
||||
height:16px;
|
||||
background:#e1e1e1;
|
||||
padding-right:10px;
|
||||
padding-left:10px;
|
||||
padding-top:4px;
|
||||
margin-left:30px;
|
||||
font-family:Verdana, Arial, Helvetica, sans-serif;
|
||||
width:100%;
|
||||
color:#003471;
|
||||
}
|
||||
|
||||
#blog_left #blog_comm .comm_panel a{
|
||||
font-weight:bold;
|
||||
color:#003471;
|
||||
}
|
||||
|
||||
#blog_left #blog_comm .comm_text{
|
||||
font-family:Verdana, Arial, Helvetica, sans-serif;
|
||||
line-height:18px;
|
||||
padding-top:10px;
|
||||
padding-bottom:15px;
|
||||
padding-left:5px;
|
||||
padding-right:5px;
|
||||
margin-left:30px;
|
||||
color:#5f5f5f;
|
||||
width:100%;
|
||||
border-bottom:1px solid #9e0b0e;
|
||||
}
|
||||
|
||||
#blog_left #blog_comm .comm_text p{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
}
|
||||
|
||||
#blog_left #comments_from_bg{
|
||||
background:url(images/blog_form_bg.gif) no-repeat top left;
|
||||
width:531px;
|
||||
margin-left:30px;
|
||||
}
|
||||
|
||||
#blog_left #blog_comm #comm_post_title{
|
||||
width:457px;
|
||||
height:45px;
|
||||
font-size:19px;
|
||||
font-style:italic;
|
||||
font-weight:normal;
|
||||
padding-left:25px;
|
||||
padding-top:10px;
|
||||
color:#9e0b0e;
|
||||
}
|
||||
|
||||
#blog_left #blog_comm #comm_post_form{
|
||||
padding-left:25px;
|
||||
}
|
||||
|
||||
#blog_left #blog_comm #comm_post_form input.text{
|
||||
font-size:14px;
|
||||
}
|
||||
|
||||
#blog_left #blog_comm #comm_post_form td{
|
||||
list-style:none;
|
||||
font-family:Verdana, Arial, Helvetica, sans-serif;
|
||||
padding-bottom:10px;
|
||||
padding-right:10px;
|
||||
}
|
||||
|
||||
#blog_left #blog_comm #comm_post_form td.right{
|
||||
text-align:right;
|
||||
vertical-align:top;
|
||||
}
|
||||
|
||||
|
||||
/* end sidebar*/
|
||||
|
||||
/* blod item*/
|
||||
|
||||
#blog_left .item_class{
|
||||
width:570px;
|
||||
padding-left:25px;
|
||||
padding-bottom:30px;
|
||||
float:left;
|
||||
}
|
||||
|
||||
#blog_left .item_class .item_class_title{
|
||||
width:570px;
|
||||
}
|
||||
|
||||
#blog_left .item_class .item_class_title_text{
|
||||
min-height:52px;
|
||||
}
|
||||
|
||||
#blog_left .item_class .item_class_title_text .titles{
|
||||
float:left;
|
||||
width:98%;
|
||||
padding-bottom:5px;
|
||||
}
|
||||
|
||||
#blog_left .item_class .item_class_title_text .top_title_top{
|
||||
font-size:12px;
|
||||
padding-right:10px;
|
||||
padding-left:0px;
|
||||
color:#000000;
|
||||
font-family:Verdana, Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
#blog_left .item_class .item_class_title_text .top_title{
|
||||
padding-right:10px;
|
||||
padding-left:0px;
|
||||
}
|
||||
|
||||
#blog_left .item_class .item_class_title_text .top_title a{
|
||||
font-size:21px;
|
||||
color:#000000;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
#blog_left .item_class .item_class_title_text .end_title{
|
||||
font-size:12px;
|
||||
padding-right:10px;
|
||||
padding-left:0px;
|
||||
color:#000000;
|
||||
font-family:Verdana, Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
#blog_left .item_class .item_class_title_text .end_title a{
|
||||
font-size:12px;
|
||||
font-weight:bold;
|
||||
color:#d14836;
|
||||
}
|
||||
|
||||
#blog_left .item_class .item_class_text{
|
||||
color:#5f5f5f;
|
||||
font-size:14px;
|
||||
line-height:20px;
|
||||
padding-left:5px;
|
||||
padding-right:0px;
|
||||
padding-bottom:5px;
|
||||
padding-top:10px;
|
||||
background:url(images/title_line.gif) no-repeat center top;
|
||||
float:left;
|
||||
width:570px;
|
||||
font-family:Verdana, Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
#blog_left .item_class .item_class_text p{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
margin-top:10px;
|
||||
}
|
||||
|
||||
#blog_left .item_class .item_class_panel{
|
||||
height:22px;
|
||||
background:url(images/item_class_panel.gif) repeat-x top left;
|
||||
margin-left:0px;
|
||||
padding-right:10px;
|
||||
padding-left:10px;
|
||||
padding-top:5px;
|
||||
float:left;
|
||||
width:555px;
|
||||
}
|
||||
|
||||
#blog_left .item_class .item_class_panel a{
|
||||
font-family:Verdana, Arial, Helvetica, sans-serif;
|
||||
font-weight:bold;
|
||||
font-size:12px;
|
||||
color:#ffffff;
|
||||
}
|
||||
|
||||
#blog_left .item_class .item_class_panel a:hover{
|
||||
font-family:Verdana, Arial, Helvetica, sans-serif;
|
||||
font-weight:bold;
|
||||
font-size:12px;
|
||||
text-decoration:underline;
|
||||
color:#ffffff;
|
||||
}
|
||||
|
||||
#blog_left .item_class .item_class_panel a.panel_read{
|
||||
background:url(images/read.gif) no-repeat left center;
|
||||
padding-left:12px;
|
||||
color:#ffffff;
|
||||
}
|
||||
|
||||
#blog_left .item_class .item_class_panel span.panel_comm a{
|
||||
background:url(images/comm.gif) no-repeat left center;
|
||||
padding-left:20px;
|
||||
color:#ffffff;
|
||||
}
|
||||
|
||||
/* end blog */
|
||||
|
||||
/* footer */
|
||||
|
||||
#footer{
|
||||
width:100%;
|
||||
height:118px;
|
||||
text-align:right;
|
||||
float:left;
|
||||
background:url(images/footer_bg.gif) repeat-x top left;
|
||||
}
|
||||
|
||||
div#footer #footer_text{
|
||||
color:#ffffff;
|
||||
line-height:20px;
|
||||
font-family:Verdana, Arial, Helvetica, sans-serif;
|
||||
padding-top:25px;
|
||||
padding-right:10px;
|
||||
}
|
||||
|
||||
div#footer #footer_text img{
|
||||
position:relative;
|
||||
top:3px;
|
||||
}
|
||||
|
||||
/* end footer */
|
||||
|
||||
|
||||
|
||||
#blog_left .navigation{
|
||||
padding-bottom:40px;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
#blog_left .navigation ul{
|
||||
}
|
||||
|
||||
#blog_left .navigation ul li{
|
||||
list-style:none;
|
||||
display:inline;
|
||||
padding-right:20px;
|
||||
}
|
||||
|
||||
#blog_left .navigation .alignright a{
|
||||
font-weight:bold;
|
||||
font-size:12px;
|
||||
padding-right:15px;
|
||||
color:#021f5f;
|
||||
}
|
||||
|
||||
#blog_left .navigation .alignleft a{
|
||||
font-weight:bold;
|
||||
font-size:12px;
|
||||
padding-left:8px;
|
||||
color:#021f5f;
|
||||
}
|
||||
|
||||
div#blog h2{
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
padding-left:40px;
|
||||
padding-top:0px;
|
||||
font-size:19px;
|
||||
color:#000000;
|
||||
}
|
||||
|
||||
div#blog .entry{
|
||||
padding-left:40px;
|
||||
}
|
||||
|
||||
div#blog .entry p{
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
color:#5f5f5f;
|
||||
line-height:16px;
|
||||
margin-top:10px;
|
||||
}
|
||||
|
||||
.item_class blockquote, #blog_comm blockquote{
|
||||
background:url(images/block_bg.gif) no-repeat left top;
|
||||
padding-left:25px;
|
||||
margin:0px;
|
||||
margin-top:5px;
|
||||
margin-bottom:5px;
|
||||
margin-left:20px;
|
||||
padding-top:5px;
|
||||
}
|
||||
|
||||
.item_class blockquote blockquote, #blog_comm blockquote blockquote{
|
||||
background:url(images/block2_bg.gif) no-repeat left top;
|
||||
padding-left:25px;
|
||||
margin:0px;
|
||||
margin-top:5px;
|
||||
margin-bottom:5px;
|
||||
margin-left:20px;
|
||||
}
|
||||
|
||||
#blog_comm blockquote p{
|
||||
line-height:16px;
|
||||
padding-top:15px;
|
||||
text-indent:20px;
|
||||
}
|
||||
|
||||
.item_class ol, #blog_comm ol{
|
||||
background:url(images/ol_bg.png) repeat-y left;
|
||||
color:#5f5f5f;
|
||||
}
|
||||
|
||||
.item_class ol li, #blog_comm ol li{
|
||||
color:#5f5f5f;
|
||||
}
|
||||
|
||||
.item_class ul, #blog_comm ul{
|
||||
padding-left:30px;
|
||||
}
|
||||
|
||||
.item_class img, #blog_comm img{
|
||||
|
||||
margin:5px;
|
||||
}
|
||||
|
||||
.item_class strong, #blog_comm strong{
|
||||
color:#5f5f5f;
|
||||
}
|
||||
|
||||
pre {
|
||||
border: 1pt solid #AEBDCC;
|
||||
background-color: #222A36;
|
||||
padding: 5pt;
|
||||
font-family: courier, monospace;
|
||||
font-size: 90%;
|
||||
color: #FFFFFF;
|
||||
overflow:auto;
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 811 B |
|
After Width: | Height: | Size: 855 B |
|
After Width: | Height: | Size: 9.7 KiB |
74
Zim/Utils/emacs/new-setup/插件/yasnippet/example3.txt
Normal file
@@ -0,0 +1,74 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-04-06T20:39:49+08:00
|
||||
|
||||
====== example3 ======
|
||||
Created Wednesday 06 April 2011
|
||||
|
||||
YAAY–Yet Another Artical about Yasnippet
|
||||
|
||||
|
||||
|
||||
由于最近有很多麻烦的事困扰着我,一直没有把一些心得体会或者是学到的技巧写出来,这是一个很大的遗憾。今天心情尚好,索性就写一下了。因为前面学习了一点HTML(如果你非常理解成那个邪恶的全称我也没有办法)的基本知识,顺便也用这篇文章练手了。哈哈!
|
||||
|
||||
是的,你没有看错,这篇文章的题目有一点点小的幽默在里面,如果你知道Yasnippet全称的话。哈哈。geek就应该有geek的幽默风格。:-)
|
||||
|
||||
之前有一些时间让我去研究一些有意思的东西,这当然是最好的事情了。所以就把研究的一个小的成果和心得写在这些,供大家学习借鉴,恰笑于大方之家了。
|
||||
|
||||
当然,如果你还不知道Yasnippet是什么的话,那你可能要先去做一些功课了。不过这里到是有一篇不错的文章介绍Yasnippet,你可以先去看看。其实本文可以看作是对这这篇文章的一个补充。所以你还是先去看看吧。当然如果你还不知道什么是Emacs的话,那我建议你还是去GNU官方看看消息,当然Google也行,那里有你所需要的东西。其实上面那个链接里面讲得非常不错,只是对于我等新手还是不够细致。所以我就来补充一下。重点放在编写简单的模板,并提供一些技巧心得。
|
||||
|
||||
上面的链接讲了如何创建一个模板,但是没有具体讲一些语法细节。好吧,先让我们慢慢来。Yasnippet会根据Emacs当前处在何种模式来确定把当前的模板放在哪里。以笔者常用到的c-mode为例。如果你执行过M-x yas/new-snippet之后在你的插件加载目录(你可以粗糙的认为就是你放yasnippet-bundle.el那个目录)下面没有对应的c-mode目录,它就
|
||||
会自动创建,并提示你是否在创建该目录。其它的目录也应该可以,反正我没试过,你试完可以告诉我。对应的在其它模式下也会有相应的目录比如text-mode,或者cperl-mode吧。
|
||||
|
||||
讲讲具体的语法了。其实Yasnippet的语法比较简单,而我也没有专门去看相关的内容。我只是找了几段代码看了看,试了试就明白了。由此可知,你也应该可以用同样的时间掌握,不过我写了这个之后,你就可以以更快的时间写出一些简单的模板了。有关Yasnippet的讲法最好的讲解就是直接去看yasnippet-bundle.el文件了,不过那个太复杂了,我们放到后面讲。我们先从最直观的讲。利用gedit的插件来看看最基本的模板应该怎么写。不过你首先应该在Edit-Prenference-plugins里面选中Snippets插件。然后在Tools-Manage Snippets中你可以看到
|
||||
|
||||
for (${1:i} = ${2:0}; ${1:i} < ${3:count}; ${1:i} += ${4:1})
|
||||
{
|
||||
$0
|
||||
}
|
||||
|
||||
如果这个时候你能先在gedit里面用一下这个for的模板你会发现其实这个语句比较简单。${}和脚本语言里面的引用变量方式类似,所以${1:i}的意思就是定义光标第一次出现的位置,并指定该位置的默认值为i.后面都类似。如果要在其它位置引用它的值,直接$1即可那我们就发现了一个重要的原则$后面跟着数字代表光标第几次出现的位置。要特别强调一点的就是$0是光标最后出现的位置。也就是说你用Tab键(也可能是你自己定义的其它按键反正能用Yasnippet就是了)跳转光标的最后一个位置是$0出现的位置。当然你可不要小看它,因为这种光标的控
|
||||
制还要具有一定的逻辑性。
|
||||
|
||||
好的在我们直观的了解了snippet如何运作的时候我们就可以写出Yasnippet的模板了(这两种模板的写法类似,但是有些时候的解释并不相同)。下面是一个Yasnippet的for模板写法,至少是符合笔者风格的写法。
|
||||
|
||||
for (${1:i} = ${2:0}; $1 < ${3:count}; $1++) {
|
||||
$0
|
||||
}
|
||||
|
||||
其实在Yasnippet原生的模板中是有for模板的在yasnippet-bundle.el中可以找到相关定义,本来的定义被我改了。下面是我改过的
|
||||
|
||||
("for" "for (${1:i} = ${2:0}; $1 < ${3:count}; $1++) {\n $0\n}\n" "for (...; ...; ...) { ... }" nil nil nil nil nil)
|
||||
|
||||
可以发现的是这种写法里面必须使用\n这类符号实现控制。
|
||||
|
||||
因此到这里我们介绍了两种添加模板的方式。一种是通过yas/new-snippet命令添加当前模式下的模板,不足之处就是只能在当前模式下使用。比如你要想在text-mode下面使用c-mode下面定义的for模板是不行的(不太明白的话可以去看一下上面那个链接的内容)。另一种是通过直接在yasnippet-bundle.el添加我们需要的模板语句。不过这种方式有些麻烦,而且不太直观。不这看你个人喜好了。如果你愿意以这两种方式添加同一个模板的不同形式也是可以的,就看你使用的yasnippet先解释哪个模板。反正只会有一种结果,不存在二义性问题。
|
||||
|
||||
下面展示笔者自己常用的几个模板(自带的模板请直接看插件源文件相关部分).
|
||||
|
||||
# -*- mode: snippet -*-
|
||||
# name: union
|
||||
# key: union
|
||||
# --
|
||||
union ${1:name} {
|
||||
$0
|
||||
|
||||
};
|
||||
|
||||
# -*- mode: snippet -*-
|
||||
# name: typedef
|
||||
# key: typedef
|
||||
# --
|
||||
typedef ${1:newtype} ${2:type}
|
||||
$0
|
||||
|
||||
# -*- mode: snippet -*-
|
||||
# name: else_if
|
||||
# key: else if
|
||||
# --
|
||||
else if (${1:condition}) {
|
||||
$2
|
||||
}
|
||||
$0
|
||||
|
||||
自己去试试吧,希望能够给大家以启迪。哈哈。
|
||||
331
Zim/Utils/emacs/new-setup/插件/搜集的扩展.txt
Normal file
@@ -0,0 +1,331 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-05-05T22:38:14+08:00
|
||||
|
||||
====== 搜集的扩展 ======
|
||||
Created Thursday 05 May 2011
|
||||
;;; 搜集的扩展加载
|
||||
(require 'tooltip) ;工具提示
|
||||
(require 'eldoc) ;函数参数提示
|
||||
(require 'avoid) ;鼠标行为
|
||||
(require 'shell) ;Shell模式
|
||||
(require 'shell-command) ;增强的shell-command
|
||||
(require 'ansi-color) ;转换shell中的颜色序列为face
|
||||
(require 'flymake) ;实时语法检查
|
||||
(require 'flymake-shell) ;对shell模式的实时语法检查
|
||||
(require 'kill-ring-search) ;Kill ring 搜索
|
||||
(require 'highlight-parentheses) ;智能括号
|
||||
(require 'top-mode) ;top
|
||||
(require 'pick-backup) ;备份浏览
|
||||
(require 'autoload) ;用于'autoload'的处理
|
||||
(require 'ppindent) ;管理C预处理格式
|
||||
(require 'find-dired-lisp) ;文件搜索
|
||||
(require 'rx) ;导入正则表达式生成
|
||||
(require 'sregex) ;导入另一个正则表达式生成
|
||||
(require 'windresize) ;窗口缩放
|
||||
(require 'etags) ;源代码导航
|
||||
(require 'save-abbreviation-mode) ;LISP别名
|
||||
(require 'zone) ;锁屏
|
||||
(require 'maxima) ;代数计算系统
|
||||
(require 'imaxima) ;用Tex显示代数表达式
|
||||
(require 'tempbuf) ;自动关闭临时buffer
|
||||
(require 'doxymacs) ;文档系统
|
||||
(require 'info) ;Info
|
||||
(require 'info+) ;Info 增强
|
||||
(require 'apt-sources) ;Apt源编辑
|
||||
(require 'rect) ;矩形编辑
|
||||
(require 'rect-mark) ;矩形操作
|
||||
(require 'term) ;终端模拟器
|
||||
(require 'uniquify) ;如果有两个重名buffer, 则再前面加上路径区别
|
||||
(require 'org) ;个人信息管理
|
||||
(require 'color-moccur) ;人性化的搜索功能
|
||||
(require 'moccur-edit) ;搜索编辑
|
||||
(require 'apt-utils) ;APT搜索管理工具
|
||||
(require 'g) ;Google Client, 包括Google日历, 博客, 阅读器
|
||||
(require 'cycle-buffer) ;buffer循环切换
|
||||
(require 'tramp) ;很强大远程文件访问工具
|
||||
(require 'rcirc) ;Emacs里面一个轻量IRC客户端
|
||||
(require 'rcirc-color) ;rcirc高亮, 随机颜色妮称
|
||||
(require 'rcirc-sound) ;CTCP声音支持
|
||||
(require 'windows) ;窗口保存
|
||||
(require 'festival) ;语音合成
|
||||
(require 'what-domain) ;域名查询
|
||||
(require 'goto-last-change) ;跳转到最后编辑的地方
|
||||
(require 'iman) ;更好的man手册
|
||||
(require 'yasnippet) ;类似TextMate超酷的模版模式
|
||||
(require 'showtip) ;一种提示信息的弹出小窗口, 基于tooltip
|
||||
(require 'less) ;浏览模式
|
||||
(require 'google-define) ;Google 定义查询
|
||||
(require 'java-mode-indent-annotations) ;Java 缩进
|
||||
(require 'jde-complete) ;Java 补全
|
||||
(require 'beanshell) ;Beanshell
|
||||
(require 'font-lock) ;Font-lock
|
||||
(require 'abbrev) ;用于补全
|
||||
(require 'jde) ;Java Development Environment
|
||||
(require 'crosshairs) ;高亮行和列
|
||||
(require 'mldonkey) ;mldonkey 的管理界面
|
||||
(require 'wget) ;Wget的管理界面
|
||||
(require 'ansi-color) ;shell里面显示颜色
|
||||
(require 'miniedit) ;编辑minibuffer
|
||||
(require 'buffer-move) ;buffer移动功能
|
||||
(require 'scroll-mode-line-mode) ;Mode-line滚动
|
||||
(require 'cc-mode) ;C语言模式
|
||||
(require 'redo) ;重做命令
|
||||
(require 'ascii) ;ASCII编码
|
||||
(require 'ediff) ;文件比较功能
|
||||
(require 'ediff+) ;ediff增强
|
||||
(require 'ctypes) ;C模式的类型定义(typedef)语法加亮
|
||||
(require 'modeline-posn) ;modeline信息标识
|
||||
(require 'show-wspace) ;空格提示
|
||||
(require 'windmove) ;窗口移动功能
|
||||
(require 'compile-dwim) ;智能编译运行程序
|
||||
(require 'eassist) ;h, cpp文件跳转函数, 支持即时按键选择
|
||||
(require 'chart) ;Emacs的内存使用
|
||||
(require 'ibuffer) ;ibuffer模式
|
||||
(require 'ido) ;ido模式
|
||||
(require 'tabbar) ;标签管理
|
||||
(require 'browse-kill-ring) ;超强恢复
|
||||
(require 'recentf) ;打开最近的文件
|
||||
(require 'xcscope) ;cscope
|
||||
(require 'linum) ;显示行号
|
||||
(require 'smiley) ;整加simpley
|
||||
(require 'emms-source-file) ;Emms 文件
|
||||
(require 'emms-source-playlist) ;Emms 列表
|
||||
(require 'emms-player-simple) ;Emms simple
|
||||
(require 'emms-player-mplayer) ;Emms mplayer播放器
|
||||
(require 'emms-playlist-mode) ;Emms 播放列表模式
|
||||
(require 'emms-info) ;Emms信息模式
|
||||
(require 'emms-cache) ;Emms缓存
|
||||
(require 'emms-playing-time) ;Emms 播放时间
|
||||
(require 'emms-volume) ;Emms 声音调节
|
||||
(require 'emms-lyrics) ;Emms 歌词
|
||||
(require 'emms-setup) ;Emms 设置
|
||||
(require 'emms-player-mpg321-remote) ;Emms 远程播放
|
||||
(require 'emms-streams) ;Emms 流媒体
|
||||
(require 'emms-volume-amixer) ;Emms 声音控制
|
||||
(require 'emms-lyrics-download) ;自动下载歌词
|
||||
(require 'emms-i18n) ;自动识别音乐标签的编码
|
||||
(require 'emms-history) ;自动保存和导入上次的播放列表
|
||||
(require 'emms-browser) ;EMMS 浏览器
|
||||
(require 'emms-cache) ;EMMS 缓存
|
||||
(require 'emms-tag-editor) ;EMMS 标签编辑器
|
||||
(require 'executable) ;执行解释脚本
|
||||
(require 'w3m) ;W3M
|
||||
(require 'w3m-search) ;w3m搜索
|
||||
(require 'w3m-bookmark) ;w3m书签
|
||||
(require 'w3m-tabmenu) ;W3m标签菜单
|
||||
(require 'w3m-wget) ;W3m wget 集成
|
||||
(require 'w3m-lnum) ;W3M 数字快速导航
|
||||
(require 'w3m-form) ;W3m 表格
|
||||
(require 'w3m-util) ;w3m 工具
|
||||
(require 'w3m-symbol) ;w3m 符号处理
|
||||
(require 'dired) ;Dired
|
||||
(require 'dired+) ;增强dired
|
||||
(require 'dired-details) ;Dired详细信息
|
||||
(require 'dired-details+) ;Dired详细消息切换
|
||||
(require 'dired-tar) ;在tar文件上按T打包或解包文件
|
||||
(require 'dired-single) ;在Dired模式下用单一的Buffer打开以便于Buffer之间的切换
|
||||
(require 'dired-x) ;Dired增强
|
||||
(require 'dired-view) ;Dired中的文件名跳转
|
||||
(require 'dired-isearch) ;dired增量搜索功能
|
||||
(require 'wdired) ;Dired 编辑模式
|
||||
(require 'smooth-scrolling) ;平滑滚动
|
||||
(require 'fvwm-mode) ;fvwm模式
|
||||
(require 'nnmairix) ;邮件搜索
|
||||
(require 'bbdb) ;数据库
|
||||
(require 'bbdb-autoloads) ;bbdb 自动加载
|
||||
(require 'shell-history) ;Shell历史
|
||||
(require 'paredit) ;括号编辑模式
|
||||
(require 'mwe-log-commands) ;命令日志
|
||||
(require 'predictive) ;英文助手
|
||||
(require 'contentswitch) ;按内容切换缓存或文件
|
||||
(require 'etest) ;测试工具
|
||||
(require 'fringe-helper) ;边缘帮助
|
||||
(require 'newcomment) ;关于注释的函数
|
||||
(require 'icicles) ;智能minibuffer补全
|
||||
(require 'icicles-install) ;icicles自动安装
|
||||
(require 'cus-edit+) ;cus-edit的增强
|
||||
(require 'eyedropper) ;提取当前光标处的前景和背景色
|
||||
(require 'help-mode+) ;help-mode增强
|
||||
(require 'help-fns+) ;help-fns增强
|
||||
(require 'lib-requires) ;列出Emacs Lisp库的依赖
|
||||
(require 'timid) ;增强find-file和iswitch中的历史搜索
|
||||
(require 'gtk-look) ;以HTML的形式查看GTK文档
|
||||
(require 'starttls) ;SSL加密协议
|
||||
(require 'smtpmail) ;SMTP协议
|
||||
(require 'supercite) ;出色的邮件引用
|
||||
(require 'eperiodic) ;化学元素周期表
|
||||
(require 'gnus-srvr) ;gnus虚拟服务器
|
||||
(require 'gnus-demon) ;Gnus固守程序
|
||||
(require 'apropos) ;帮助系统
|
||||
(require 'redo+) ;Extension redo.el
|
||||
(require 'uptimes) ;记录运行时间
|
||||
(require 'ub) ;强大的撤销系统
|
||||
(require 'cal-china-x) ;中文日历
|
||||
(require 'ielm) ;ELISP交互环境
|
||||
(require 'traverselisp) ;在目录中搜索和替换, 支持AVFS!
|
||||
(require 'goto-chg) ;在最近修改中跳转
|
||||
(require 'levents) ;支持xgtags.el
|
||||
(require 'gtags) ;gtags.el
|
||||
(require 'xgtags) ;gtags的界面
|
||||
(require 'macros+) ;macro的扩展
|
||||
(require 'switch-to-new-buffer) ;切换到一个新的buffer
|
||||
(require 'apropos) ;参数查询
|
||||
(require 'apropos-fn+var) ;apropos增强
|
||||
(require 'pp+) ;pp增强
|
||||
(require 'elscreen) ;工作区
|
||||
(require 'breadcrumb) ;快速书签导航
|
||||
(require 'unbound) ;查找一个没有绑定的按键
|
||||
(require 'window-number) ;窗口数字导航
|
||||
(require 're-builder) ;可视化构建正则表达式
|
||||
(require 'scim-bridge-zh-si) ;scim-brige 管理SCIM输入法
|
||||
(require 'highlight-fixmes-mode) ;高亮fixme等关键字
|
||||
(require 'cedet) ;集成开发环境
|
||||
(require 'ecb) ;Emacs代码浏览器
|
||||
(require 'semantic) ;semantic
|
||||
(require 'semantic-ia) ;semantic-ia
|
||||
(require 'hideshow-fringe) ;hideshow 的 fringe 显示
|
||||
(require 'cursor-chg) ;光标随着状态改变形状和颜色
|
||||
(require 'crontab-mode) ;crontab 模式
|
||||
(require 'edit-env) ;编辑环境变量
|
||||
(require 'intel-hex-mode) ;Intel 十六进制模式
|
||||
(require 'wtf) ;查询对话缩写词
|
||||
(require 'slime) ;Common Lisp 的开发环境
|
||||
(require 'slime-autodoc) ;在slime模式中显示参数列表
|
||||
(require 'slime-asdf) ;asdf支持
|
||||
(require 'slime-banner) ;bannber支持
|
||||
(require 'slime-clipboard) ;SLIME的对象剪切板
|
||||
(require 'slime-enclosing-context) ;SLIME分析工具
|
||||
(require 'slime-fuzzy) ;模糊的符号补全
|
||||
(require 'slime-parse) ;分析 Common Lisp 源代码
|
||||
(require 'slime-references) ;引用文档, (SBCL)
|
||||
(require 'slime-scheme) ;支持 scheme 程序运行在 Common Lisp
|
||||
(require 'cldoc) ;显示common lisp的操作符和变量信息
|
||||
(require 'haskell-mode) ;Haskell模式
|
||||
(require 'haskell-ghci) ;Haskell GHCi 交互模式
|
||||
(require 'haskell-indent) ;Haskell 智能缩进
|
||||
(require 'eimp) ;图像操作
|
||||
(require 'look-mode) ;快速文件浏览模式
|
||||
(require 'anything) ;Anything
|
||||
(require 'anything-config) ;Anything config
|
||||
(require 'anything-complete) ;Anything 补全
|
||||
(require 'anything-match-plugin) ;Anything 匹配算法的人性话提升
|
||||
(require 'anything-gtags) ;Anything 结合 Gtags
|
||||
(require 'anything-c-yasnippet) ;Anything yasnippet
|
||||
(require 'anything-c-moccur) ;Anything 和 moccur搜索
|
||||
(require 'anything-etags) ;Anything etags
|
||||
(require 'sys-apropos) ;系统相关查询
|
||||
(require 'ireplace) ;isearch 模式中的替换函数
|
||||
(require 'file-journal) ;文件按日期访问
|
||||
(require 'babel) ;网络翻译接口
|
||||
(require 'auto-complete) ;自动补全
|
||||
(require 'auto-complete-cpp) ;集成 auto-complete 和 C++
|
||||
(require 'auto-complete-emacs-lisp) ;集成 auto-complete 和 emacs-lisp
|
||||
(require 'auto-complete-gtags) ;集成 auto-complete 和 gtags
|
||||
(require 'auto-complete-semantic) ;集成 auto-complete 和 semantic
|
||||
(require 'auto-complete-yasnippet) ;集成 auto-complete 和 yasnippet
|
||||
(require 'auto-complete-css) ;集成 auto-complete 和 css
|
||||
(require 'ac-dabbrev) ;auto-complete 的 `dabbrev' 支持
|
||||
(require 'boxquote) ;文本引用工具
|
||||
(require 'erc) ;IRC聊天
|
||||
(require 'erc-highlight-nicknames) ;不同昵称的颜色
|
||||
(require 'files+) ;file.el 增强
|
||||
(require 'ls-lisp+) ;ls-lisp.el 增强
|
||||
(require 'magit) ;git 函数
|
||||
(require 'egg) ;基于 magit 的界面
|
||||
(require 'egg-grep) ;egg grep 支持
|
||||
(require 'sr-speedbar) ;集成speedbar到当前frame
|
||||
(require 'winpoint) ;记录每一个窗口buffer的特定位置
|
||||
(require 'xray) ;显示Emacs对象的内部结构
|
||||
(require 'ispell) ;拼写检查
|
||||
(require 'color-grep) ;彩色显示 grep buffer
|
||||
(require 'grep-edit) ;grep 编辑的高级模式
|
||||
(require 'hs-lint) ;`hs-lint' 建议
|
||||
(require 'find-lisp) ;查找lisp文件
|
||||
(require 'hl-sexp) ;高亮 sexp
|
||||
(require 'jump-dls) ;查找符号的定义
|
||||
(require 'auto-document) ;自动生成文档
|
||||
(require 'highlight-cl) ;高亮 `cl' 函数
|
||||
(require 'company) ;代码自动补全
|
||||
|
||||
;;; 自己的扩展加载
|
||||
(require 'basic-edit-toolkit) ;基础编辑包
|
||||
(require 'fullscreen) ;全屏
|
||||
(require 'shell-command-extension) ;shell command 扩展
|
||||
(require 'lazycat-toolkit) ;工具包
|
||||
(require 'wget-extension) ;wget 扩展
|
||||
(require 'find-func-extension) ;`find-func' 的扩展
|
||||
(require 'window-extension) ;窗口增强函数
|
||||
(require 'buffer-extension) ;缓存增强函数
|
||||
(require 'lazy-set-key) ;懒惰按键设置
|
||||
(require 'sdcv) ;星际译王的支持
|
||||
(require 'w3m-extension) ;W3m扩展
|
||||
(require 'thing-edit) ;基于thingatpt的编辑扩展
|
||||
(require 'thing-edit-extension) ;thing-edit 增强
|
||||
(require 'rcirc-notify+) ;rcirc提醒
|
||||
(require 'rcirc-extension) ;rcirc的扩展
|
||||
(require 'doc-view-extension) ;doc-view扩展
|
||||
(require 'org-extension) ;Org增强
|
||||
(require 'org-w3m) ;Org w3m 交互转换
|
||||
(require 'alarm) ;闹钟
|
||||
(require 'mail-notify) ;邮件提醒
|
||||
(require 'gnus-notify+) ;Gnus提醒
|
||||
(require 'speedbar-extension) ;speedbar扩展
|
||||
(require 'etags-extension) ;etags扩展
|
||||
(require 'multi-term) ;多标签SHELL
|
||||
(require 'lazycat-c-style) ;C 的编程风格
|
||||
(require 'festival-extension) ;Festival扩展
|
||||
(require 'emms-extension) ;emms扩展
|
||||
(require 'paredit-extension) ;Paredit扩展
|
||||
(require 'xgtags-extension) ;xgtags的扩展
|
||||
(require 'c-mode-extension) ;C 模式的扩展
|
||||
(require 'newsticker-extension) ;newsticker扩展
|
||||
(require 'scim-bridge-extension) ;scim-brige 的一些扩展
|
||||
(require 'dired-extension) ;dired 的一些扩展
|
||||
(require 'wdired-extension) ;wdired 的扩展
|
||||
(require 'dired-sort) ;排序 dired 文件
|
||||
(require 'dired-open) ;在 dired 中打开不同文件
|
||||
(require 'flymake-extension) ;flymake 的一些扩展
|
||||
(require 'haskell-extension) ;Haskell的一些扩展
|
||||
(require 'show-help) ;用 showtip 显示帮助信息
|
||||
(require 'rect-extension) ;矩形编辑扩展
|
||||
(require 'stripe-buffer) ;斑纹buffer
|
||||
(require 'auto-scroll) ;自动滚屏
|
||||
(require 'tabbar-extension) ;Tabbar 的扩展
|
||||
(require 'auto-complete-extension) ;Auto-complete 的扩展
|
||||
(require 'erc-extension) ;ERC的一些扩展
|
||||
(require 'erc-nick-notify) ;ERC 消息提醒
|
||||
(require 'lisppaste-extension) ;lisppaste 的扩展
|
||||
(require 'eldoc-extension) ;Eldoc扩展
|
||||
(require 'gnus-switch) ;智能gnus切换
|
||||
(require 'gnus-summary-stripe) ;Gnus Summary 斑纹化
|
||||
(require 'paste2) ;快速粘贴
|
||||
(require 'multi-shell) ;多shell管理器
|
||||
(require 'auto-install) ;自动下载安装elisp
|
||||
(require 'auto-install-extension) ;auto-install.el 扩展
|
||||
(require 'doi) ;Do Or Insert
|
||||
(require 'doi-extension) ;doi 的扩展
|
||||
(require 'anything-extension) ;Anything 的一些扩展
|
||||
(require 'anything-auto-install) ;auto-install 和 anything 集成
|
||||
(require 'anything-emms) ;emms 和 anything 集成
|
||||
(require 'anything-irfc) ;irfc 和 anything 集成
|
||||
(require 'newsticker-notify) ;newsticker提醒
|
||||
(require 'isearch-extension) ;isearch扩展
|
||||
(require 'one-key) ;one-key
|
||||
(require 'one-key-config) ;one-key 扩展
|
||||
(require 'lazy-search) ;懒惰搜索
|
||||
(require 'lazy-search-extension) ;lazy-seach 扩展
|
||||
(require 'gnus-extension) ;gnus扩展
|
||||
(require 'ispell-extension) ;ispell扩展
|
||||
(require 'yaoddmuse) ;另一种 oddmuse 模式
|
||||
(require 'yaoddmuse-extension) ;yaoddmuse 的扩展
|
||||
(require 'go-to-char) ;跳转到某个字符
|
||||
(require 'elisp-depend) ;查找elisp文件依赖
|
||||
(require 'irfc) ;RFC 文档阅读
|
||||
(require 'oicq) ;QQ
|
||||
(require 'elisp-format) ;elisp 代码格式化
|
||||
(require 'multi-scratch) ;多重草稿
|
||||
(require 'chm-view) ;CHM 文件阅读
|
||||
(require 'org-oddmuse) ;转换 Org-mode 到 Oddmuse 模式
|
||||
(require 'ibus); 支持输入中文输入法
|
||||
|
||||