diff --git a/.gitignore b/.gitignore index c433a57..3ce1c40 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ authors.txt doc/gh-pages doc/*.html +doc/html-revision pkg/ extras/imported/** !extras/imported/*/.yas-setup.el diff --git a/.gitmodules b/.gitmodules index 80584ea..e9a0388 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,7 @@ [submodule "snippets"] - path = snippets - url = git@github.com:AndreaCrotti/yasnippet-snippets.git + path = snippets + url = https://github.com/AndreaCrotti/yasnippet-snippets.git + branch = master [submodule "yasmate"] - path = yasmate - url = git@github.com:capitaomorte/yasmate.git + path = yasmate + url = https://github.com/capitaomorte/yasmate.git diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..4bd7940 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,24 @@ +language: emacs + +env: + - "EMACS=emacs23" + - "EMACS=emacs24" + +install: + - if [ "$EMACS" = "emacs23" ]; then + sudo apt-get -qq update && + sudo apt-get -qq -f install && + sudo apt-get -qq install emacs23-nox && + curl -LO https://raw.githubusercontent.com/ohler/ert/c619b56c5bc6a866e33787489545b87d79973205/lisp/emacs-lisp/ert.el && + curl -LO https://raw.githubusercontent.com/ohler/ert/c619b56c5bc6a866e33787489545b87d79973205/lisp/emacs-lisp/ert-x.el && + curl -Lo cl-lib.el http://elpa.gnu.org/packages/cl-lib-0.5.el; + fi + - if [ "$EMACS" = "emacs24" ]; then + sudo add-apt-repository -y ppa:cassou/emacs && + sudo apt-get -qq update && + sudo apt-get -qq -f install && + sudo apt-get -qq install emacs24-nox; + fi + +script: + - rake compile; rake tests diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..83310bc --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,27 @@ +# Submitting Bug Reports + +Please read [Important note regarding bug reporting][bugnote]. + +# Contributing to Yasnippet + +## Copyright Assignment + +Yasnippet is part of GNU ELPA, so it falls under the same copyright +assignment policy as the rest of Emacs (see "Copyright Assignment" in +https://www.gnu.org/software/emacs/CONTRIBUTE). A copyright assignment +for Emacs also covers Yasnippet. + +## Commit message format + +The commit message format roughly follows Emacs conventions, although +there is no separate Changelog file. + + The commit message's first sentence should be capitalized, no period + + It may be followed by a paragraph with a longer explanation. The + changelog style entry goes at the end of the message. + + * foo.el (a-function): Terse summary of per-function changes. + + +[bugnote]: https://github.com/capitaomorte/yasnippet#important-note-regarding-bug-reporting diff --git a/README.mdown b/README.mdown index da61284..75ca37a 100644 --- a/README.mdown +++ b/README.mdown @@ -1,3 +1,5 @@ +[![Build Status](https://travis-ci.org/capitaomorte/yasnippet.png)](https://travis-ci.org/capitaomorte/yasnippet) + # Intro **YASnippet** is a template system for Emacs. It allows you to @@ -107,44 +109,63 @@ should be added like this to `yas-snippet-dirs`: (yas-global-mode 1) ;; or M-x yas-reload-all if you've started YASnippet already. -# Documentation, issues, etc +# Manual, issues etc -Please refer to the comprehensive (albeit slightly outdated) -[documentation][docs] for full customization -and support. If you find a bug, please report it on -[the GitHub issue tracker][issues]. (please **do not** submit new issues to the old -[googlecode tracker][googlecode tracker]) +Please refer to the comprehensive [documentation][docs] for full +customisation and support. If you find a bug in the code or in the +documentation, please report it on [the GitHub issue tracker][issues]. ## Important note regarding bug reporting -If you think have found a bug, please report it clearly. Yasnippet -does have (lots of) bugs and your reports are very valuable. Here's -a [great example](https://github.com/capitaomorte/yasnippet/issues/318) -of a bug report. It has everything needed for a sucessfull analysis and -speedy resolution: -*Before* reporting try to reproduce the bug **without** your usual -`.emacs` (or whatever startup file you use). Do so either by starting -emacs from the command line with the `-Q` switch, or by temporarily -moving away your `.emacs` and creating a new smaller one just for -reproducing the bug. Paste that file in your bug report. Paste any sequence -of relevant shell commands before you launch Emacs. +Your bug reports are very valuable. -*Then*, describe steps taken to reproduce from an -end-user perspective. Try to be as unambiguous as possible. +The most important thing when reporting bugs is making sure that we have +a way to reproduce the problem exactly like it happened to you. + +To do this, we need to rule out interference from external factors +like other Emacs extensions or your own customisations. + +Here's an example report that "sandboxes" an Emacs session just for +reproducing a bug. + +``` +$ emacs --version +Emacs 24.3 +$ cd /tmp/ +$ git clone https://github.com/capitaomorte/yasnippet.git yasnippet-bug +$ cd yasnippet-bug +$ git log -1 --oneline +6053db0 Closes #527: Unbreak case where yas-fallback-behaviour is a list +$ HOME=$PWD emacs -L # This "sandboxes" your emacs, melpa configuration, etc + +(require 'yasnippet) +(yas-global-mode 1) + +When I open a foo-mode file I can't expand foo-mode snippets! +OR +I can't get yasnippet to load because frankinbogen! +``` + +Using `emacs -Q` or temporarily moving your `.emacs` init file to the side +is another way to achieve good reproducibility. + +Here's a +[another example](https://github.com/capitaomorte/yasnippet/issues/318) +of a bug report. It has everything needed for a successful analysis +and speedy resolution. Also, don't forget to state the Emacs version (use `M-x emacs-version`) and the yasnippet version you are using (if using the latest from github, do `git log -1` in the dir). Any more info is welcome, but don't just paste a backtrace or an error -message string you got. I'm not saying your analysis might not be -useful but following the instructions above immediately gives me a -clear picture of what is happening. +message string you got, unless we ask for it. There is also a [YASnippet google group][forum]. I will keep the group -open for reference and for discussion among users, unfortunately I -can't guarantee a timely response, so maybe creating a github issue -clearly marking your intent (user support/bug/feature request). +open for reference and for discussion among users. Unfortunately I +can't guarantee a timely response, so maybe it's better to create a +github issue clearly marking your intent (user support/bug/feature +request). Finally, thank you very much for using YASnippet! diff --git a/Rakefile b/Rakefile index 278120d..2965eb9 100644 --- a/Rakefile +++ b/Rakefile @@ -2,7 +2,10 @@ require 'fileutils' -$EMACS=ENV["EMACS"] || "emacs" +$EMACS = ENV["EMACS"] +if not $EMACS or $EMACS == 't' + $EMACS = "emacs" +end def find_version File.read("yasnippet.el", :encoding => "UTF-8") =~ /;; Package-version: *([0-9.]+?) *$/ @@ -13,9 +16,8 @@ FileUtils.mkdir_p('pkg') desc "run tests in batch mode" task :tests do - batch_run_line = "(yas-batch-run-tests t)" - sh "#{$EMACS} -Q -L . -l yasnippet-tests.el -nw" + - " --batch --eval '#{batch_run_line}'" + sh "#{$EMACS} -Q -L . -l yasnippet-tests.el" + + " --batch -f ert-run-tests-batch-and-exit" end desc "create a release package" @@ -67,10 +69,22 @@ namespace :doc do Dir.glob("doc/images/*").each do |file| FileUtils.cp file, 'doc/gh-pages/images' end - rev = `git rev-parse --verify HEAD` + Dir.glob("doc/stylesheets/*.css").each do |file| + FileUtils.cp file, 'doc/gh-pages/stylesheets' + end + curRev = `git rev-parse --verify HEAD`.chomp() + expRev = IO.read('doc/html-revision').chomp() + if curRev != expRev + raise ("The HTML rev: #{expRev},\n" + + "current rev: #{curRev}!\n") + end + if !system "git diff-index --quiet HEAD" + system "git status --untracked-files=no" + raise "You have uncommitted changes!" + end Dir.chdir 'doc/gh-pages' do sh "git commit -a -m 'Automatic documentation update.\n\n" + - "From #{rev.chomp()}'" + "From #{curRev.chomp()}'" sh "git push" end end diff --git a/doc/.nosearch b/doc/.nosearch new file mode 100644 index 0000000..e69de29 diff --git a/doc/faq.org b/doc/faq.org index cc889e1..79249e8 100644 --- a/doc/faq.org +++ b/doc/faq.org @@ -134,8 +134,7 @@ This is also the default value starting for that version. It skips the minor mode in buffers where it is not applicable (no snippet tables), but only once you have setup your yas-root-directory. -* How do I define an abbrev key containing characters not supported by -the filesystem? +* How do I define an abbrev key containing characters not supported by the filesystem? - *Note*: This question applies if you're still defining snippets whose key /is/ the filename. This is behavior still provided by diff --git a/doc/nav-menu.html.inc b/doc/nav-menu.html.inc new file mode 100644 index 0000000..b31ec94 --- /dev/null +++ b/doc/nav-menu.html.inc @@ -0,0 +1,16 @@ + diff --git a/doc/org-setup.inc b/doc/org-setup.inc index 96b7028..6ad09c9 100644 --- a/doc/org-setup.inc +++ b/doc/org-setup.inc @@ -4,6 +4,8 @@ #+LINK: sym file:snippet-reference.org::#%s -#+LINK_HOME: ./index.html #+OPTIONS: author:nil num:nil #+AUTHOR: +# org < 8.0 use +STYLE, after use +HTML_HEAD +#+STYLE: +#+HTML_HEAD: diff --git a/doc/snippet-development.org b/doc/snippet-development.org index a7d653a..9e8f901 100644 --- a/doc/snippet-development.org +++ b/doc/snippet-development.org @@ -6,14 +6,18 @@ ** Quickly finding snippets -There are some ways you can quickly find a snippet file: +There are some ways you can quickly find a snippet file or create a new one: - =M-x yas-new-snippet= - Prompts you for a snippet name, then tries to guess a suitable - directory to store it, prompting you for creation if it does not - exist. Finally, places you in a new buffer set to =snippet-mode= so - you can write your snippet. + Creates a new buffer with a template for making a new snippet. + The buffer is in =snippet-mode= (see below). When you are done + editing the new snippet, use =C-c C-c= to save it. This will + prompt for a directory two steps: first, the snippet table + (with a default based on the major mode you started in), and then + then snippet collection directory (defaults to the first directory + in =yas-snippet-dirs=. (See [[file:snippet-organization.org][Organizing Snippets]] + for more detail on how snippets are organized.) - =M-x yas-find-snippets= @@ -169,12 +173,28 @@ This binding will be recorded in the keymap =html-mode-map=. To expand a paragraph tag newlines, just press =C-u C-c C-c C-m=. Omitting the =C-u= will expand the paragraph tag without newlines. +** =# type:= =snippet= or =command= + +If the =type= directive is set to =command=, the body of the snippet +is interpreted as lisp code to be evaluated when the snippet is +triggered. + +If it's =snippet= (the default when there is no =type= directive), the +snippet body will be parsed according to the [[Template Syntax]], +described below. + +** =# uuid:= unique identifier + +This provides to a way to identify a snippet, independent of its name. +Loading a second snippet file with the same uuid would replace the +previous snippet. + ** =# contributor:= snippet author This is optional and has no effect whatsoever on snippet functionality, but it looks nice. -* Template syntax +* <