589 changed files with 12 additions and 89775 deletions
-
9.gitmodules
-
1vendor/feature-mode
-
461vendor/feature-mode/feature-mode.el
-
575vendor/feature-mode/i18n.yml
-
4vendor/feature-mode/snippets/feature-mode/and
-
5vendor/feature-mode/snippets/feature-mode/bac
-
7vendor/feature-mode/snippets/feature-mode/fea
-
4vendor/feature-mode/snippets/feature-mode/giv
-
4vendor/feature-mode/snippets/feature-mode/sce
-
4vendor/feature-mode/snippets/feature-mode/the
-
4vendor/feature-mode/snippets/feature-mode/whe
-
79vendor/feature-mode/support/go_to_step.rb
-
1vendor/helm
-
12531vendor/helm/helm-config.el
-
550vendor/helm/helm-match-plugin.el
-
4427vendor/helm/helm.el
-
1vendor/yasnippet
-
251vendor/yasnippet/dropdown-list.el
-
690vendor/yasnippet/extras/imported/html-mode/.yas-setup.el
-
88vendor/yasnippet/extras/imported/objc-mode/.yas-setup.el
-
0vendor/yasnippet/extras/imported/objc-mode/Support/.yas-skip
-
59477vendor/yasnippet/extras/imported/objc-mode/Support/alldefs.txt
-
1257vendor/yasnippet/extras/imported/rails-mode/.yas-setup.el
-
1032vendor/yasnippet/extras/imported/ruby-mode/.yas-setup.el
-
467vendor/yasnippet/extras/textmate_import.rb
-
1vendor/yasnippet/snippets/c++-mode/.yas-parents
-
4vendor/yasnippet/snippets/c++-mode/beginend
-
9vendor/yasnippet/snippets/c++-mode/class
-
4vendor/yasnippet/snippets/c++-mode/ns
-
4vendor/yasnippet/snippets/c++-mode/template
-
5vendor/yasnippet/snippets/c++-mode/using
-
1vendor/yasnippet/snippets/c-mode/.yas-parents
-
4vendor/yasnippet/snippets/c-mode/fopen
-
7vendor/yasnippet/snippets/c-mode/printf
-
1vendor/yasnippet/snippets/cc-mode/.yas-parents
-
7vendor/yasnippet/snippets/cc-mode/do
-
7vendor/yasnippet/snippets/cc-mode/for
-
7vendor/yasnippet/snippets/cc-mode/if
-
4vendor/yasnippet/snippets/cc-mode/inc
-
4vendor/yasnippet/snippets/cc-mode/inc.1
-
8vendor/yasnippet/snippets/cc-mode/main
-
9vendor/yasnippet/snippets/cc-mode/once
-
7vendor/yasnippet/snippets/cc-mode/struct
-
1vendor/yasnippet/snippets/cperl-mode/.yas-parents
-
1vendor/yasnippet/snippets/csharp-mode/.yas-parents
-
8vendor/yasnippet/snippets/csharp-mode/attrib
-
22vendor/yasnippet/snippets/csharp-mode/attrib.1
-
22vendor/yasnippet/snippets/csharp-mode/attrib.2
-
22vendor/yasnippet/snippets/csharp-mode/class
-
7vendor/yasnippet/snippets/csharp-mode/comment
-
5vendor/yasnippet/snippets/csharp-mode/comment.1
-
5vendor/yasnippet/snippets/csharp-mode/comment.2
-
5vendor/yasnippet/snippets/csharp-mode/comment.3
-
11vendor/yasnippet/snippets/csharp-mode/method
-
8vendor/yasnippet/snippets/csharp-mode/namespace
-
17vendor/yasnippet/snippets/csharp-mode/prop
-
7vendor/yasnippet/snippets/csharp-mode/region
-
5vendor/yasnippet/snippets/csharp-mode/using
-
5vendor/yasnippet/snippets/csharp-mode/using.1
-
5vendor/yasnippet/snippets/csharp-mode/using.2
-
1vendor/yasnippet/snippets/css-mode/.yas-parents
-
4vendor/yasnippet/snippets/css-mode/bg
-
4vendor/yasnippet/snippets/css-mode/bg.1
-
4vendor/yasnippet/snippets/css-mode/bor
-
5vendor/yasnippet/snippets/css-mode/cl
-
5vendor/yasnippet/snippets/css-mode/disp.block
-
5vendor/yasnippet/snippets/css-mode/disp.inline
-
5vendor/yasnippet/snippets/css-mode/disp.none
-
5vendor/yasnippet/snippets/css-mode/ff
-
5vendor/yasnippet/snippets/css-mode/fs
-
5vendor/yasnippet/snippets/css-mode/mar.bottom
-
5vendor/yasnippet/snippets/css-mode/mar.left
-
5vendor/yasnippet/snippets/css-mode/mar.mar
-
5vendor/yasnippet/snippets/css-mode/mar.margin
-
5vendor/yasnippet/snippets/css-mode/mar.right
-
5vendor/yasnippet/snippets/css-mode/mar.top
-
5vendor/yasnippet/snippets/css-mode/pad.bottom
-
5vendor/yasnippet/snippets/css-mode/pad.left
-
5vendor/yasnippet/snippets/css-mode/pad.pad
-
5vendor/yasnippet/snippets/css-mode/pad.padding
-
5vendor/yasnippet/snippets/css-mode/pad.right
-
5vendor/yasnippet/snippets/css-mode/pad.top
-
7vendor/yasnippet/snippets/emacs-lisp-mode/.read_me
-
1vendor/yasnippet/snippets/emacs-lisp-mode/.yas-parents
-
6vendor/yasnippet/snippets/emacs-lisp-mode/add-hook.yasnippet
-
6vendor/yasnippet/snippets/emacs-lisp-mode/and.yasnippet
-
5vendor/yasnippet/snippets/emacs-lisp-mode/append.yasnippet
-
5vendor/yasnippet/snippets/emacs-lisp-mode/apply.yasnippet
-
5vendor/yasnippet/snippets/emacs-lisp-mode/aref.yasnippet
-
5vendor/yasnippet/snippets/emacs-lisp-mode/aset.yasnippet
-
5vendor/yasnippet/snippets/emacs-lisp-mode/assq.yasnippet
-
5vendor/yasnippet/snippets/emacs-lisp-mode/autoload.yasnippet
-
6vendor/yasnippet/snippets/emacs-lisp-mode/backward-char.yasnippet
-
6vendor/yasnippet/snippets/emacs-lisp-mode/beginning-of-line.yasnippet
-
6vendor/yasnippet/snippets/emacs-lisp-mode/bounds-of-thing-at-point.yasnippet
-
6vendor/yasnippet/snippets/emacs-lisp-mode/buffer-file-name.yasnippet
-
6vendor/yasnippet/snippets/emacs-lisp-mode/buffer-modified-p.yasnippet
-
6vendor/yasnippet/snippets/emacs-lisp-mode/buffer-substring-no-properties.yasnippet
-
6vendor/yasnippet/snippets/emacs-lisp-mode/buffer-substring.yasnippet
-
5vendor/yasnippet/snippets/emacs-lisp-mode/car.yasnippet
@ -1,3 +1,12 @@ |
|||||
[submodule "personal"] |
[submodule "personal"] |
||||
path = personal |
path = personal |
||||
url = https://github.com/bbatsov/emacs-prelude-personal.git |
url = https://github.com/bbatsov/emacs-prelude-personal.git |
||||
|
[submodule "vendor/helm"] |
||||
|
path = vendor/helm |
||||
|
url = https://github.com/emacs-helm/helm |
||||
|
[submodule "vendor/yasnippet"] |
||||
|
path = vendor/yasnippet |
||||
|
url = https://github.com/capitaomorte/yasnippet |
||||
|
[submodule "vendor/feature-mode"] |
||||
|
path = vendor/feature-mode |
||||
|
url = https://github.com/michaelklishin/cucumber.el |
||||
@ -1,461 +0,0 @@ |
|||||
;; cucumber.el -- Emacs mode for editing plain text user stories |
|
||||
;; |
|
||||
;; Copyright (C) 2008 — 2011 Michael Klishin and other contributors |
|
||||
;; |
|
||||
;; This program is free software; you can redistribute it and/or |
|
||||
;; modify it under the terms of the GNU General Public License |
|
||||
;; as published by the Free Software Foundation; either version 2 |
|
||||
;; of the License, or (at your option) any later version. |
|
||||
;; |
|
||||
;; This program is distributed in the hope that it will be useful, |
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
;; GNU General Public License for more details. |
|
||||
;; |
|
||||
;; You should have received a copy of the GNU General Public License |
|
||||
;; along with this program; if not, write to the Free Software |
|
||||
;; Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110. |
|
||||
;; |
|
||||
;; Copy files to ~/.emacs.d/elisp/feature-mode and add this to your |
|
||||
;; .emacs to load the mode |
|
||||
;; (add-to-list 'load-path "~/.emacs.d/elisp/feature-mode") |
|
||||
;; ;; optional configurations |
|
||||
;; ;; default language if .feature doesn't have "# language: fi" |
|
||||
;; ;(setq feature-default-language "fi") |
|
||||
;; ;; point to cucumber languages.yml or gherkin i18n.yml to use |
|
||||
;; ;; exactly the same localization your cucumber uses |
|
||||
;; ;(setq feature-default-i18n-file "/path/to/gherkin/gem/i18n.yml") |
|
||||
;; ;; and load it |
|
||||
;; (require 'feature-mode) |
|
||||
;; (add-to-list 'auto-mode-alist '("\.feature$" . feature-mode)) |
|
||||
;; |
|
||||
;; Language used in feature file is automatically detected from |
|
||||
;; "language: [2-letter ISO-code]" tag in feature file. You can |
|
||||
;; choose the language feature-mode should use in case autodetection |
|
||||
;; fails. Just add |
|
||||
;; (setq feature-default-language "en") |
|
||||
;; to your .emacs |
|
||||
;; |
|
||||
;; Translations are loaded from ~/.emacs.d/elisp/feature-mode/i18n.yml |
|
||||
;; by default. You can configure feature-mode to load translations |
|
||||
;; directly from cucumber languages.yml or gherkin i18n.yml. Just add |
|
||||
;; (setq feature-default-i18n-file |
|
||||
;; "/usr/lib/ruby/gems/1.8/gems/cucumber-0.4.4/lib/cucumber/languages.yml") |
|
||||
;; to your .emacs before |
|
||||
;; (require 'feature-mode) |
|
||||
;; |
|
||||
;; |
|
||||
;; In order to get goto-step-definition to work, you must install the |
|
||||
;; ruby_parser gem (version 2.0.x). For example: |
|
||||
;; |
|
||||
;; gem install ruby_parser --version=2.0.5 |
|
||||
;; |
|
||||
;; (be sure and use the ruby-interpreter that emacs will use based on |
|
||||
;; `exec-path') |
|
||||
;; |
|
||||
;; |
|
||||
;; Key Bindings |
|
||||
;; ------------ |
|
||||
;; |
|
||||
;; \C-c ,v |
|
||||
;; : Verify all scenarios in the current buffer file. |
|
||||
;; |
|
||||
;; \C-c ,s |
|
||||
;; : Verify the scenario under the point in the current buffer. |
|
||||
;; |
|
||||
;; \C-c ,f |
|
||||
;; : Verify all features in project. (Available in feature and |
|
||||
;; ruby files) |
|
||||
;; |
|
||||
;; \C-c ,r |
|
||||
;; : Repeat the last verification process. |
|
||||
;; |
|
||||
;; \C-c ,g |
|
||||
;; : Go to step-definition under point |
|
||||
|
|
||||
(eval-when-compile (require 'cl)) |
|
||||
(require 'thingatpt) |
|
||||
|
|
||||
;; |
|
||||
;; Keywords and font locking |
|
||||
;; |
|
||||
|
|
||||
(when (featurep 'font-lock) |
|
||||
(or (boundp 'font-lock-variable-name-face) |
|
||||
(setq font-lock-variable-name-face font-lock-type-face))) |
|
||||
|
|
||||
(defun load-gherkin-i10n (filename) |
|
||||
"Read and parse Gherkin l10n from given file." |
|
||||
(interactive "Load l10n file: ") |
|
||||
(with-temp-buffer |
|
||||
(insert-file-contents filename) |
|
||||
(parse-gherkin-l10n))) |
|
||||
|
|
||||
(defun parse-gherkin-l10n () |
|
||||
(let (languages-alist) |
|
||||
(save-excursion |
|
||||
(goto-char (point-min)) |
|
||||
(while (not (eobp)) |
|
||||
(if (try-find-next-language) |
|
||||
(let ((lang-beg (+ (point) 1)) |
|
||||
(lang-end (progn (end-of-line) (- (point) 2))) |
|
||||
(kwds-beg (+ (point) 1)) |
|
||||
(kwds-end (progn (try-find-next-language) (point)))) |
|
||||
(add-to-list |
|
||||
'languages-alist |
|
||||
(cons |
|
||||
(filter-buffer-substring lang-beg lang-end) |
|
||||
(parse-gherkin-l10n-translations kwds-beg kwds-end))))))) |
|
||||
(nreverse languages-alist))) |
|
||||
|
|
||||
(defun try-find-next (regexp) |
|
||||
(let (search-result) |
|
||||
(setq search-result (search-forward-regexp regexp nil t)) |
|
||||
(if search-result |
|
||||
(beginning-of-line) |
|
||||
(goto-char (point-max))) |
|
||||
search-result)) |
|
||||
|
|
||||
(defun try-find-next-language () |
|
||||
(try-find-next "^\"[^\"]+\":")) |
|
||||
|
|
||||
(defun try-find-next-translation () |
|
||||
(try-find-next "^ \\([^ :]+\\): +\"?\\*?|?\\([^\"\n]+\\)\"?")) |
|
||||
|
|
||||
(defun parse-gherkin-l10n-translations (beg end) |
|
||||
(let (translations-alist) |
|
||||
(save-excursion |
|
||||
(save-restriction |
|
||||
(narrow-to-region beg end) |
|
||||
(goto-char (point-min)) |
|
||||
(while (not (eobp)) |
|
||||
(if (try-find-next-translation) |
|
||||
(let ((kwname (match-string-no-properties 1)) |
|
||||
(kw (match-string-no-properties 2))) |
|
||||
(add-to-list |
|
||||
'translations-alist |
|
||||
(cons |
|
||||
(intern kwname) |
|
||||
(if (or (equal kwname "name") |
|
||||
(equal kwname "native")) |
|
||||
kw |
|
||||
(build-keyword-matcher kw)))))) |
|
||||
(end-of-line)))) |
|
||||
(nreverse translations-alist))) |
|
||||
|
|
||||
(defun build-keyword-matcher (keyword) |
|
||||
(concat "^[ \t]*\\(" (replace-regexp-in-string "|" "\\\\|" keyword) "\\):?")) |
|
||||
|
|
||||
(defvar feature-default-language "en") |
|
||||
(defvar feature-default-i18n-file "~/.emacs.d/elisp/feature-mode/i18n.yml") |
|
||||
|
|
||||
(defconst feature-keywords-per-language |
|
||||
(if (file-readable-p feature-default-i18n-file) |
|
||||
(load-gherkin-i10n feature-default-i18n-file) |
|
||||
'(("en" . ((feature . "^ *Feature:") |
|
||||
(background . "^ *Background:") |
|
||||
(scenario . "^ *Scenario:") |
|
||||
(scenario_outline . |
|
||||
"^ *Scenario Outline:") |
|
||||
(given . "^ *Given") |
|
||||
(when . "^ *When") |
|
||||
(then . "^ *Then") |
|
||||
(but . "^ *But") |
|
||||
(and . "^ *And") |
|
||||
(examples . "^ *\\(Examples\\|Scenarios\\):?")))))) |
|
||||
|
|
||||
(defconst feature-font-lock-keywords |
|
||||
'((feature (0 font-lock-keyword-face) |
|
||||
(".*" nil nil (0 font-lock-type-face t))) |
|
||||
(background . (0 font-lock-keyword-face)) |
|
||||
(scenario (0 font-lock-keyword-face) |
|
||||
(".*" nil nil (0 font-lock-function-name-face t))) |
|
||||
(scenario_outline |
|
||||
(0 font-lock-keyword-face) |
|
||||
(".*" nil nil (0 font-lock-function-name-face t))) |
|
||||
(given . font-lock-keyword-face) |
|
||||
(when . font-lock-keyword-face) |
|
||||
(then . font-lock-keyword-face) |
|
||||
(but . font-lock-keyword-face) |
|
||||
(and . font-lock-keyword-face) |
|
||||
(examples . font-lock-keyword-face) |
|
||||
("^ *@.*" . font-lock-preprocessor-face) |
|
||||
("^ *#.*" 0 font-lock-comment-face t))) |
|
||||
|
|
||||
|
|
||||
;; |
|
||||
;; Keymap |
|
||||
;; |
|
||||
|
|
||||
(defvar feature-mode-map nil "Keymap used in feature mode") |
|
||||
|
|
||||
(if feature-mode-map |
|
||||
nil |
|
||||
(setq feature-mode-map (make-sparse-keymap)) |
|
||||
(define-key feature-mode-map "\C-m" 'newline) |
|
||||
(define-key feature-mode-map (kbd "C-c ,s") 'feature-verify-scenario-at-pos) |
|
||||
(define-key feature-mode-map (kbd "C-c ,v") 'feature-verify-all-scenarios-in-buffer) |
|
||||
(define-key feature-mode-map (kbd "C-c ,f") 'feature-verify-all-scenarios-in-project) |
|
||||
(define-key feature-mode-map (kbd "C-c ,g") 'feature-goto-step-definition)) |
|
||||
|
|
||||
;; Add relevant feature keybindings to ruby modes |
|
||||
(add-hook 'ruby-mode-hook |
|
||||
(lambda () |
|
||||
(local-set-key (kbd "C-c ,f") 'feature-verify-all-scenarios-in-project))) |
|
||||
|
|
||||
|
|
||||
;; |
|
||||
;; Syntax table |
|
||||
;; |
|
||||
|
|
||||
(defvar feature-mode-syntax-table nil |
|
||||
"Syntax table in use in ruby-mode buffers.") |
|
||||
|
|
||||
(unless feature-mode-syntax-table |
|
||||
(setq feature-mode-syntax-table (make-syntax-table))) |
|
||||
|
|
||||
;; Constants |
|
||||
|
|
||||
(defconst feature-blank-line-re "^[ \t]*$" |
|
||||
"Regexp matching a line containing only whitespace.") |
|
||||
|
|
||||
(defun feature-feature-re (language) |
|
||||
(cdr (assoc 'feature (cdr (assoc language feature-keywords-per-language))))) |
|
||||
|
|
||||
(defun feature-scenario-re (language) |
|
||||
(cdr (assoc 'scenario (cdr (assoc language feature-keywords-per-language))))) |
|
||||
|
|
||||
(defun feature-background-re (language) |
|
||||
(cdr (assoc 'background (cdr (assoc language feature-keywords-per-language))))) |
|
||||
|
|
||||
;; |
|
||||
;; Variables |
|
||||
;; |
|
||||
|
|
||||
(defvar feature-mode-hook nil |
|
||||
"Hook run when entering `feature-mode'.") |
|
||||
|
|
||||
(defcustom feature-indent-level 2 |
|
||||
"Indentation of feature statements" |
|
||||
:type 'integer :group 'feature) |
|
||||
|
|
||||
(defcustom feature-indent-offset 2 |
|
||||
"*Amount of offset per level of indentation." |
|
||||
:type 'integer :group 'feature) |
|
||||
|
|
||||
(defun feature-compute-indentation () |
|
||||
"Calculate the maximum sensible indentation for the current line." |
|
||||
(save-excursion |
|
||||
(beginning-of-line) |
|
||||
(if (bobp) 10 |
|
||||
(forward-line -1) |
|
||||
(while (and (looking-at feature-blank-line-re) |
|
||||
(> (point) (point-min))) |
|
||||
(forward-line -1)) |
|
||||
(+ (current-indentation) |
|
||||
(if (or (looking-at (feature-feature-re (feature-detect-language))) |
|
||||
(looking-at (feature-scenario-re (feature-detect-language))) |
|
||||
(looking-at (feature-background-re (feature-detect-language)))) |
|
||||
feature-indent-offset 0))))) |
|
||||
|
|
||||
(defun feature-indent-line () |
|
||||
"Indent the current line. |
|
||||
The first time this command is used, the line will be indented to the |
|
||||
maximum sensible indentation. Each immediately subsequent usage will |
|
||||
back-dent the line by `feature-indent-offset' spaces. On reaching column |
|
||||
0, it will cycle back to the maximum sensible indentation." |
|
||||
(interactive "*") |
|
||||
(let ((ci (current-indentation)) |
|
||||
(cc (current-column)) |
|
||||
(need (feature-compute-indentation))) |
|
||||
(save-excursion |
|
||||
(beginning-of-line) |
|
||||
(delete-horizontal-space) |
|
||||
(if (and (equal last-command this-command) (/= ci 0)) |
|
||||
(indent-to (* (/ (- ci 1) feature-indent-offset) feature-indent-offset)) |
|
||||
(indent-to need))) |
|
||||
(if (< (current-column) (current-indentation)) |
|
||||
(forward-to-indentation 0)))) |
|
||||
|
|
||||
(defun feature-font-lock-keywords-for (language) |
|
||||
(let ((result-keywords . ())) |
|
||||
(dolist (pair feature-font-lock-keywords) |
|
||||
(let* ((keyword (car pair)) |
|
||||
(font-locking (cdr pair)) |
|
||||
(language-keyword (cdr (assoc keyword |
|
||||
(cdr (assoc |
|
||||
language |
|
||||
feature-keywords-per-language)))))) |
|
||||
|
|
||||
(push (cons (or language-keyword keyword) font-locking) result-keywords))) |
|
||||
result-keywords)) |
|
||||
|
|
||||
(defun feature-detect-language () |
|
||||
(save-excursion |
|
||||
(goto-char (point-min)) |
|
||||
(if (re-search-forward "language: \\([[:alpha:]-]+\\)" |
|
||||
(line-end-position) |
|
||||
t) |
|
||||
(match-string 1) |
|
||||
feature-default-language))) |
|
||||
|
|
||||
(defun feature-mode-variables () |
|
||||
(set-syntax-table feature-mode-syntax-table) |
|
||||
(setq require-final-newline t) |
|
||||
(setq comment-start "# ") |
|
||||
(setq comment-start-skip "#+ *") |
|
||||
(setq comment-end "") |
|
||||
(setq parse-sexp-ignore-comments t) |
|
||||
(set (make-local-variable 'indent-tabs-mode) 'nil) |
|
||||
(set (make-local-variable 'indent-line-function) 'feature-indent-line) |
|
||||
(set (make-local-variable 'font-lock-defaults) |
|
||||
(list (feature-font-lock-keywords-for (feature-detect-language)) nil nil)) |
|
||||
(set (make-local-variable 'font-lock-keywords) |
|
||||
(feature-font-lock-keywords-for (feature-detect-language)))) |
|
||||
|
|
||||
(defun feature-minor-modes () |
|
||||
"Enable all minor modes for feature mode." |
|
||||
(turn-on-orgtbl)) |
|
||||
|
|
||||
;; |
|
||||
;; Mode function |
|
||||
;; |
|
||||
|
|
||||
;;;###autoload |
|
||||
(defun feature-mode() |
|
||||
"Major mode for editing plain text stories" |
|
||||
(interactive) |
|
||||
(kill-all-local-variables) |
|
||||
(use-local-map feature-mode-map) |
|
||||
(setq mode-name "Feature") |
|
||||
(setq major-mode 'feature-mode) |
|
||||
(feature-mode-variables) |
|
||||
(feature-minor-modes) |
|
||||
(run-mode-hooks 'feature-mode-hook)) |
|
||||
|
|
||||
(add-to-list 'auto-mode-alist '("\\.feature\\'" . feature-mode)) |
|
||||
|
|
||||
;; |
|
||||
;; Snippets |
|
||||
;; |
|
||||
|
|
||||
(defvar feature-snippet-directory (concat (file-name-directory load-file-name) "snippets") |
|
||||
"Path to the feature-mode snippets. |
|
||||
|
|
||||
If the yasnippet library is loaded, snippets in this directory |
|
||||
are loaded on startup. If nil, don't load snippets.") |
|
||||
|
|
||||
(defvar feature-support-directory (concat (file-name-directory load-file-name) "support") |
|
||||
"Path to support folder |
|
||||
|
|
||||
The support folder contains a ruby script that takes a step as an |
|
||||
argument, and outputs a list of all matching step definitions") |
|
||||
|
|
||||
(declare-function yas/load-directory "yasnippet" t) |
|
||||
(when (and (featurep 'yasnippet) |
|
||||
feature-snippet-directory |
|
||||
(file-exists-p feature-snippet-directory)) |
|
||||
(yas/load-directory feature-snippet-directory)) |
|
||||
|
|
||||
|
|
||||
;; |
|
||||
;; Verifying features |
|
||||
;; |
|
||||
|
|
||||
(defun feature-scenario-name-re (language) |
|
||||
(concat (feature-scenario-re (feature-detect-language)) "[[:space:]]+\\(.*\\)$")) |
|
||||
|
|
||||
(defun feature-scenario-name-at-pos (&optional pos) |
|
||||
"Returns the name of the scenario at the specified position. if pos is not specified the current buffer location will be used." |
|
||||
(interactive) |
|
||||
(let ((start (or pos (point)))) |
|
||||
(save-excursion |
|
||||
(end-of-line) |
|
||||
(unless (re-search-backward (feature-scenario-name-re (feature-detect-language)) nil t) |
|
||||
(error "Unable to find an scenario")) |
|
||||
(match-string-no-properties 1)))) |
|
||||
|
|
||||
(defun feature-verify-scenario-at-pos (&optional pos) |
|
||||
"Run the scenario defined at pos. If post is not specified the current buffer location will be used." |
|
||||
(interactive) |
|
||||
(feature-run-cucumber |
|
||||
(list "-n" (concat "'" (feature-escape-scenario-name (feature-scenario-name-at-pos)) "'")) |
|
||||
:feature-file (buffer-file-name))) |
|
||||
|
|
||||
(defun feature-verify-all-scenarios-in-buffer () |
|
||||
"Run all the scenarios defined in current buffer." |
|
||||
(interactive) |
|
||||
(feature-run-cucumber '() :feature-file (buffer-file-name))) |
|
||||
|
|
||||
|
|
||||
(defun feature-verify-all-scenarios-in-project () |
|
||||
"Run all the scenarios defined in current project." |
|
||||
(interactive) |
|
||||
(feature-run-cucumber '())) |
|
||||
|
|
||||
(defun feature-register-verify-redo (redoer) |
|
||||
"Register a bit of code that will repeat a verification process" |
|
||||
(let ((redoer-cmd (eval (list 'lambda () |
|
||||
'(interactive) |
|
||||
(list 'let (list (list `default-directory |
|
||||
default-directory)) |
|
||||
redoer))))) |
|
||||
|
|
||||
(global-set-key (kbd "C-c ,r") redoer-cmd))) |
|
||||
|
|
||||
(defun feature-run-cucumber (cuke-opts &optional &key feature-file) |
|
||||
"Runs cucumber with the specified options" |
|
||||
(feature-register-verify-redo (list 'feature-run-cucumber |
|
||||
(list 'quote cuke-opts) |
|
||||
:feature-file feature-file)) |
|
||||
;; redoer is registered |
|
||||
|
|
||||
(let ((opts-str (mapconcat 'identity cuke-opts " ")) |
|
||||
(feature-arg (if feature-file |
|
||||
(concat " FEATURE='" feature-file "'") |
|
||||
""))) |
|
||||
(ansi-color-for-comint-mode-on) |
|
||||
(let ((default-directory (feature-project-root))) |
|
||||
(compile (concat "rake cucumber CUCUMBER_OPTS=\"" opts-str "\"" feature-arg) t))) |
|
||||
(end-of-buffer-other-window 0)) |
|
||||
|
|
||||
(defun feature-escape-scenario-name (scenario-name) |
|
||||
"Escapes all the characaters in a scenario name that mess up using in the -n options" |
|
||||
(replace-regexp-in-string "\\(\"\\)" "\\\\\\\\\\\\\\1" (replace-regexp-in-string "\\([()\']\\|\\[\\|\\]\\)" "\\\\\\1" scenario-name))) |
|
||||
|
|
||||
(defun feature-root-directory-p (a-directory) |
|
||||
"Tests if a-directory is the root of the directory tree (i.e. is it '/' on unix)." |
|
||||
(equal a-directory (file-name-directory (directory-file-name a-directory)))) |
|
||||
|
|
||||
(defun feature-project-root (&optional directory) |
|
||||
"Finds the root directory of the project by walking the directory tree until it finds Rakefile (presumably, application root)" |
|
||||
(let ((directory (file-name-as-directory (or directory default-directory)))) |
|
||||
(if (feature-root-directory-p directory) (error "No rakefle found")) |
|
||||
(if (file-exists-p (concat directory "Rakefile")) |
|
||||
directory |
|
||||
(feature-project-root (file-name-directory (directory-file-name directory)))))) |
|
||||
|
|
||||
(defun feature-goto-step-definition () |
|
||||
"Goto the step-definition under (point). Requires ruby" |
|
||||
(interactive) |
|
||||
(let* ((root (feature-project-root)) |
|
||||
(input (thing-at-point 'line)) |
|
||||
(_ (set-text-properties 0 (length input) nil input)) |
|
||||
(result (shell-command-to-string (format "cd %S && ruby %S/go_to_step.rb %S" |
|
||||
root |
|
||||
feature-support-directory |
|
||||
input))) |
|
||||
(file-and-line (car (split-string result "\n"))) |
|
||||
(matched? (string-match "^\\(.+\\):\\([0-9]+\\)$" file-and-line))) |
|
||||
(if matched? |
|
||||
(let ((file (format "%s/%s" root (match-string 1 file-and-line))) |
|
||||
(line-no (string-to-number (match-string 2 file-and-line)))) |
|
||||
(find-file file) |
|
||||
(goto-char (point-min)) |
|
||||
(forward-line (1- line-no))) |
|
||||
(if (equal "" result) |
|
||||
(message "No matching steps found for:\n%s" input) |
|
||||
(message "An error occurred:\n%s" result))))) |
|
||||
|
|
||||
(provide 'cucumber-mode) |
|
||||
(provide 'feature-mode) |
|
||||
@ -1,575 +0,0 @@ |
|||||
# encoding: UTF-8 |
|
||||
# |
|
||||
# We use ISO 639-1 (language) and ISO 3166 alpha-2 (region - if appliccable): |
|
||||
# http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes |
|
||||
# http://en.wikipedia.org/wiki/ISO_3166-1 |
|
||||
# |
|
||||
# If you want several aliases for a keyword, just separate them |
|
||||
# with a | character. Make sure there are no ambiguities in the |
|
||||
# keywords. |
|
||||
# |
|
||||
# If you do *not* want a trailing space after a keyword, end it with a < character. |
|
||||
# (See Chinese for examples). |
|
||||
# |
|
||||
"en": |
|
||||
name: English |
|
||||
native: English |
|
||||
feature: Feature |
|
||||
background: Background |
|
||||
scenario: Scenario |
|
||||
scenario_outline: Scenario Outline |
|
||||
examples: Examples|Scenarios |
|
||||
given: "*|Given" |
|
||||
when: "*|When" |
|
||||
then: "*|Then" |
|
||||
and: "*|And" |
|
||||
but: "*|But" |
|
||||
|
|
||||
# Please keep the grammars in alphabetical order by name from here and down. |
|
||||
|
|
||||
"ar": |
|
||||
name: Arabic |
|
||||
native: العربية |
|
||||
feature: خاصية |
|
||||
background: الخلفية |
|
||||
scenario: سيناريو |
|
||||
scenario_outline: سيناريو مخطط |
|
||||
examples: امثلة |
|
||||
given: "*|بفرض" |
|
||||
when: "*|متى|عندما" |
|
||||
then: "*|اذاً|ثم" |
|
||||
and: "*|و" |
|
||||
but: "*|لكن" |
|
||||
"bg": |
|
||||
name: Bulgarian |
|
||||
native: български |
|
||||
feature: Функционалност |
|
||||
background: Предистория |
|
||||
scenario: Сценарий |
|
||||
scenario_outline: Рамка на сценарий |
|
||||
examples: Примери |
|
||||
given: "*|Дадено" |
|
||||
when: "*|Когато" |
|
||||
then: "*|То" |
|
||||
and: "*|И" |
|
||||
but: "*|Но" |
|
||||
"ca": |
|
||||
name: Catalan |
|
||||
native: català |
|
||||
background: Rerefons|Antecedents |
|
||||
feature: Característica|Funcionalitat |
|
||||
scenario: Escenari |
|
||||
scenario_outline: Esquema de l'escenari |
|
||||
examples: Exemples |
|
||||
given: "*|Donat|Donada|Atès|Atesa" |
|
||||
when: "*|Quan" |
|
||||
then: "*|Aleshores|Cal" |
|
||||
and: "*|I" |
|
||||
but: "*|Però" |
|
||||
"cy-GB": |
|
||||
name: Welsh |
|
||||
native: Cymraeg |
|
||||
background: Cefndir |
|
||||
feature: Arwedd |
|
||||
scenario: Scenario |
|
||||
scenario_outline: Scenario Amlinellol |
|
||||
examples: Enghreifftiau |
|
||||
given: "*|Anrhegedig a" |
|
||||
when: "*|Pryd" |
|
||||
then: "*|Yna" |
|
||||
and: "*|A" |
|
||||
but: "*|Ond" |
|
||||
"cs": |
|
||||
name: Czech |
|
||||
native: Česky |
|
||||
feature: Požadavek |
|
||||
background: Pozadí|Kontext |
|
||||
scenario: Scénář |
|
||||
scenario_outline: Náčrt Scénáře|Osnova scénáře |
|
||||
examples: Příklady |
|
||||
given: "*|Pokud" |
|
||||
when: "*|Když" |
|
||||
then: "*|Pak" |
|
||||
and: "*|A|A také" |
|
||||
but: "*|Ale" |
|
||||
"da": |
|
||||
name: Danish |
|
||||
native: dansk |
|
||||
feature: Egenskab |
|
||||
background: Baggrund |
|
||||
scenario: Scenarie |
|
||||
scenario_outline: Abstrakt Scenario |
|
||||
examples: Eksempler |
|
||||
given: "*|Givet" |
|
||||
when: "*|Når" |
|
||||
then: "*|Så" |
|
||||
and: "*|Og" |
|
||||
but: "*|Men" |
|
||||
"de": |
|
||||
name: German |
|
||||
native: Deutsch |
|
||||
feature: Funktionalität |
|
||||
background: Grundlage |
|
||||
scenario: Szenario |
|
||||
scenario_outline: Szenariogrundriss |
|
||||
examples: Beispiele |
|
||||
given: "*|Angenommen|Gegeben sei" |
|
||||
when: "*|Wenn" |
|
||||
then: "*|Dann" |
|
||||
and: "*|Und" |
|
||||
but: "*|Aber" |
|
||||
"en-au": |
|
||||
name: Australian |
|
||||
native: Australian |
|
||||
feature: Crikey |
|
||||
background: Background |
|
||||
scenario: Mate |
|
||||
scenario_outline: Blokes |
|
||||
examples: Cobber |
|
||||
given: "*|Ya know how" |
|
||||
when: "*|When" |
|
||||
then: "*|Ya gotta" |
|
||||
and: "*|N" |
|
||||
but: "*|Cept" |
|
||||
"en-lol": |
|
||||
name: LOLCAT |
|
||||
native: LOLCAT |
|
||||
feature: OH HAI |
|
||||
background: B4 |
|
||||
scenario: MISHUN |
|
||||
scenario_outline: MISHUN SRSLY |
|
||||
examples: EXAMPLZ |
|
||||
given: "*|I CAN HAZ" |
|
||||
when: "*|WEN" |
|
||||
then: "*|DEN" |
|
||||
and: "*|AN" |
|
||||
but: "*|BUT" |
|
||||
"en-Scouse": |
|
||||
name: Scouse |
|
||||
native: Scouse |
|
||||
feature: Feature |
|
||||
background: "Dis is what went down" |
|
||||
scenario: "The thing of it is" |
|
||||
scenario_outline: "Wharrimean is" |
|
||||
examples: Examples |
|
||||
given: "*|Givun|Youse know when youse got" |
|
||||
when: "*|Wun|Youse know like when" |
|
||||
then: "*|Dun|Den youse gotta" |
|
||||
and: "*|An" |
|
||||
but: "*|Buh" |
|
||||
"en-tx": |
|
||||
name: Texan |
|
||||
native: Texan |
|
||||
feature: Feature |
|
||||
background: Background |
|
||||
scenario: Scenario |
|
||||
scenario_outline: All y'all |
|
||||
examples: Examples |
|
||||
given: "*|Given y'all" |
|
||||
when: "*|When y'all" |
|
||||
then: "*|Then y'all" |
|
||||
and: "*|And y'all" |
|
||||
but: "*|But y'all" |
|
||||
"eo": |
|
||||
name: Esperanto |
|
||||
native: Esperanto |
|
||||
feature: Trajto |
|
||||
background: Fono |
|
||||
scenario: Scenaro |
|
||||
scenario_outline: Konturo de la scenaro |
|
||||
examples: Ekzemploj |
|
||||
given: "*|Donitaĵo" |
|
||||
when: "*|Se" |
|
||||
then: "*|Do" |
|
||||
and: "*|Kaj" |
|
||||
but: "*|Sed" |
|
||||
"es": |
|
||||
name: Spanish |
|
||||
native: español |
|
||||
background: Antecedentes |
|
||||
feature: Característica |
|
||||
scenario: Escenario |
|
||||
scenario_outline: Esquema del escenario |
|
||||
examples: Ejemplos |
|
||||
given: "*|Dado" |
|
||||
when: "*|Cuando" |
|
||||
then: "*|Entonces" |
|
||||
and: "*|Y" |
|
||||
but: "*|Pero" |
|
||||
"et": |
|
||||
name: Estonian |
|
||||
native: eesti keel |
|
||||
feature: Omadus |
|
||||
background: Taust |
|
||||
scenario: Stsenaarium |
|
||||
scenario_outline: Raamstsenaarium |
|
||||
examples: Juhtumid |
|
||||
given: "*|Eeldades" |
|
||||
when: "*|Kui" |
|
||||
then: "*|Siis" |
|
||||
and: "*|Ja" |
|
||||
but: "*|Kuid" |
|
||||
"fi": |
|
||||
name: Finnish |
|
||||
native: suomi |
|
||||
feature: Ominaisuus |
|
||||
background: Tausta |
|
||||
scenario: Tapaus |
|
||||
scenario_outline: Tapausaihio |
|
||||
examples: Tapaukset |
|
||||
given: "*|Oletetaan" |
|
||||
when: "*|Kun" |
|
||||
then: "*|Niin" |
|
||||
and: "*|Ja" |
|
||||
but: "*|Mutta" |
|
||||
"fr": |
|
||||
name: French |
|
||||
native: français |
|
||||
feature: Fonctionnalité |
|
||||
background: Contexte |
|
||||
scenario: Scénario |
|
||||
scenario_outline: Plan du scénario|Plan du Scénario |
|
||||
examples: Exemples |
|
||||
given: "*|Soit|Etant donné" |
|
||||
when: "*|Quand|Lorsque|Lorsqu'<" |
|
||||
then: "*|Alors" |
|
||||
and: "*|Et" |
|
||||
but: "*|Mais" |
|
||||
"he": |
|
||||
name: Hebrew |
|
||||
native: עברית |
|
||||
feature: תכונה |
|
||||
background: רקע |
|
||||
scenario: תרחיש |
|
||||
scenario_outline: תבנית תרחיש |
|
||||
examples: דוגמאות |
|
||||
given: "*|בהינתן" |
|
||||
when: "*|כאשר" |
|
||||
then: "*|אז|אזי" |
|
||||
and: "*|וגם" |
|
||||
but: "*|אבל" |
|
||||
"hr": |
|
||||
name: Croatian |
|
||||
native: hrvatski |
|
||||
feature: Osobina|Mogućnost|Mogucnost |
|
||||
background: Pozadina |
|
||||
scenario: Scenarij |
|
||||
scenario_outline: Skica|Koncept |
|
||||
examples: Primjeri|Scenariji |
|
||||
given: "*|Zadan|Zadani|Zadano" |
|
||||
when: "*|Kada|Kad" |
|
||||
then: "*|Onda" |
|
||||
and: "*|I" |
|
||||
but: "*|Ali" |
|
||||
"hu": |
|
||||
name: Hungarian |
|
||||
native: magyar |
|
||||
feature: Jellemző |
|
||||
background: Háttér |
|
||||
scenario: Forgatókönyv |
|
||||
scenario_outline: Forgatókönyv vázlat |
|
||||
examples: Példák |
|
||||
given: "*|Ha" |
|
||||
when: "*|Majd" |
|
||||
then: "*|Akkor" |
|
||||
and: "*|És" |
|
||||
but: "*|De" |
|
||||
"id": |
|
||||
name: Indonesian |
|
||||
native: Bahasa Indonesia |
|
||||
feature: Fitur |
|
||||
background: Dasar |
|
||||
scenario: Skenario |
|
||||
scenario_outline: Skenario konsep |
|
||||
examples: Contoh |
|
||||
given: "*|Dengan" |
|
||||
when: "*|Ketika" |
|
||||
then: "*|Maka" |
|
||||
and: "*|Dan" |
|
||||
but: "*|Tapi" |
|
||||
"it": |
|
||||
name: Italian |
|
||||
native: italiano |
|
||||
feature: Funzionalità |
|
||||
background: Contesto |
|
||||
scenario: Scenario |
|
||||
scenario_outline: Schema dello scenario |
|
||||
examples: Esempi |
|
||||
given: "*|Dato" |
|
||||
when: "*|Quando" |
|
||||
then: "*|Allora" |
|
||||
and: "*|E" |
|
||||
but: "*|Ma" |
|
||||
"ja": |
|
||||
name: Japanese |
|
||||
native: 日本語 |
|
||||
feature: フィーチャ|機能 |
|
||||
background: 背景 |
|
||||
scenario: シナリオ |
|
||||
scenario_outline: シナリオアウトライン|シナリオテンプレート|テンプレ|シナリオテンプレ |
|
||||
examples: 例|サンプル |
|
||||
given: "*|前提<" |
|
||||
when: "*|もし<" |
|
||||
then: "*|ならば<" |
|
||||
and: "*|かつ<" |
|
||||
but: "*|しかし<|但し<|ただし<" |
|
||||
"ko": |
|
||||
name: Korean |
|
||||
native: 한국어 |
|
||||
background: 배경 |
|
||||
feature: 기능 |
|
||||
scenario: 시나리오 |
|
||||
scenario_outline: 시나리오 개요 |
|
||||
examples: 예 |
|
||||
given: "*|조건<|먼저<" |
|
||||
when: "*|만일<|만약<" |
|
||||
then: "*|그러면<" |
|
||||
and: "*|그리고<" |
|
||||
but: "*|하지만<|단<" |
|
||||
"lt": |
|
||||
name: Lithuanian |
|
||||
native: lietuvių kalba |
|
||||
feature: Savybė |
|
||||
background: Kontekstas |
|
||||
scenario: Scenarijus |
|
||||
scenario_outline: Scenarijaus šablonas |
|
||||
examples: Pavyzdžiai|Scenarijai|Variantai |
|
||||
given: "*|Duota" |
|
||||
when: "*|Kai" |
|
||||
then: "*|Tada" |
|
||||
and: "*|Ir" |
|
||||
but: "*|Bet" |
|
||||
"lv": |
|
||||
name: Latvian |
|
||||
native: latviešu |
|
||||
feature: Funkcionalitāte|Fīča |
|
||||
background: Konteksts|Situācija |
|
||||
scenario: Scenārijs |
|
||||
scenario_outline: Scenārijs pēc parauga |
|
||||
examples: Piemēri|Paraugs |
|
||||
given: "*|Kad" |
|
||||
when: "*|Ja" |
|
||||
then: "*|Tad" |
|
||||
and: "*|Un" |
|
||||
but: "*|Bet" |
|
||||
"nl": |
|
||||
name: Dutch |
|
||||
native: Nederlands |
|
||||
feature: Functionaliteit |
|
||||
background: Achtergrond |
|
||||
scenario: Scenario |
|
||||
scenario_outline: Abstract Scenario |
|
||||
examples: Voorbeelden |
|
||||
given: "*|Gegeven|Stel" |
|
||||
when: "*|Als" |
|
||||
then: "*|Dan" |
|
||||
and: "*|En" |
|
||||
but: "*|Maar" |
|
||||
"no": |
|
||||
name: Norwegian |
|
||||
native: norsk |
|
||||
feature: Egenskap |
|
||||
background: Bakgrunn |
|
||||
scenario: Scenario |
|
||||
scenario_outline: Abstrakt Scenario |
|
||||
examples: Eksempler |
|
||||
given: "*|Gitt" |
|
||||
when: "*|Når" |
|
||||
then: "*|Så" |
|
||||
and: "*|Og" |
|
||||
but: "*|Men" |
|
||||
"pl": |
|
||||
name: Polish |
|
||||
native: polski |
|
||||
feature: Właściwość |
|
||||
background: Założenia |
|
||||
scenario: Scenariusz |
|
||||
scenario_outline: Szablon scenariusza |
|
||||
examples: Przykłady |
|
||||
given: "*|Zakładając" |
|
||||
when: "*|Jeżeli" |
|
||||
then: "*|Wtedy" |
|
||||
and: "*|Oraz" |
|
||||
but: "*|Ale" |
|
||||
"pt": |
|
||||
name: Portuguese |
|
||||
native: português |
|
||||
background: Contexto |
|
||||
feature: Funcionalidade |
|
||||
scenario: Cenário|Cenario |
|
||||
scenario_outline: Esquema do Cenário|Esquema do Cenario |
|
||||
examples: Exemplos |
|
||||
given: "*|Dado" |
|
||||
when: "*|Quando" |
|
||||
then: "*|Então|Entao" |
|
||||
and: "*|E" |
|
||||
but: "*|Mas" |
|
||||
"ro": |
|
||||
name: Romanian |
|
||||
native: română |
|
||||
background: Conditii |
|
||||
feature: Functionalitate |
|
||||
scenario: Scenariu |
|
||||
scenario_outline: Scenariul de sablon |
|
||||
examples: Exemplele |
|
||||
given: "*|Daca" |
|
||||
when: "*|Cand" |
|
||||
then: "*|Atunci" |
|
||||
and: "*|Si" |
|
||||
but: "*|Dar" |
|
||||
"ro-RO": |
|
||||
name: Romanian (diacritical) |
|
||||
native: română (diacritical) |
|
||||
background: Condiţii |
|
||||
feature: Funcționalitate |
|
||||
scenario: Scenariu |
|
||||
scenario_outline: Scenariul de şablon |
|
||||
examples: Exemplele |
|
||||
given: "*|Dacă" |
|
||||
when: "*|Când" |
|
||||
then: "*|Atunci" |
|
||||
and: "*|Și" |
|
||||
but: "*|Dar" |
|
||||
"ru": |
|
||||
name: Russian |
|
||||
native: русский |
|
||||
feature: Функционал|Фича |
|
||||
background: Предыстория |
|
||||
scenario: Сценарий |
|
||||
scenario_outline: Структура сценария |
|
||||
examples: Значения |
|
||||
given: "*|Допустим" |
|
||||
when: "*|Если" |
|
||||
then: "*|То" |
|
||||
and: "*|И|К тому же" |
|
||||
but: "*|Но|А" |
|
||||
"sv": |
|
||||
name: Swedish |
|
||||
native: Svenska |
|
||||
feature: Egenskap |
|
||||
background: Bakgrund |
|
||||
scenario: Scenario |
|
||||
scenario_outline: Abstrakt Scenario |
|
||||
examples: Exempel |
|
||||
given: "*|Givet" |
|
||||
when: "*|När" |
|
||||
then: "*|Så" |
|
||||
and: "*|Och" |
|
||||
but: "*|Men" |
|
||||
"sk": |
|
||||
name: Slovak |
|
||||
native: Slovensky |
|
||||
feature: Požiadavka |
|
||||
background: Pozadie |
|
||||
scenario: Scenár |
|
||||
scenario_outline: Náčrt Scenáru |
|
||||
examples: Príklady |
|
||||
given: "*|Pokiaľ" |
|
||||
when: "*|Keď" |
|
||||
then: "*|Tak" |
|
||||
and: "*|A" |
|
||||
but: "*|Ale" |
|
||||
"sr-Latn": |
|
||||
name: Serbian (Latin) |
|
||||
native: Srpski (Latinica) |
|
||||
feature: Funkcionalnost|Mogućnost|Mogucnost|Osobina |
|
||||
background: Kontekst|Osnova|Pozadina |
|
||||
scenario: Scenario|Primer |
|
||||
scenario_outline: Struktura scenarija|Skica|Koncept |
|
||||
examples: Primeri|Scenariji |
|
||||
given: "*|Zadato|Zadate|Zatati" |
|
||||
when: "*|Kada|Kad" |
|
||||
then: "*|Onda" |
|
||||
and: "*|I" |
|
||||
but: "*|Ali" |
|
||||
"sr-Cyrl": |
|
||||
name: Serbian |
|
||||
native: Српски |
|
||||
feature: Функционалност|Могућност|Особина |
|
||||
background: Контекст|Основа|Позадина |
|
||||
scenario: Сценарио|Пример |
|
||||
scenario_outline: Структура сценарија|Скица|Концепт |
|
||||
examples: Примери|Сценарији |
|
||||
given: "*|Задато|Задате|Задати" |
|
||||
when: "*|Када|Кад" |
|
||||
then: "*|Онда" |
|
||||
and: "*|И" |
|
||||
but: "*|Али" |
|
||||
"tr": |
|
||||
name: Turkish |
|
||||
native: Türkçe |
|
||||
feature: Özellik |
|
||||
background: Geçmiş |
|
||||
scenario: Senaryo |
|
||||
scenario_outline: Senaryo taslağı |
|
||||
examples: Örnekler |
|
||||
given: "*|Diyelim ki" |
|
||||
when: "*|Eğer ki" |
|
||||
then: "*|O zaman" |
|
||||
and: "*|Ve" |
|
||||
but: "*|Fakat|Ama" |
|
||||
"uk": |
|
||||
name: Ukrainian |
|
||||
native: Українська |
|
||||
feature: Функціонал |
|
||||
background: Передумова |
|
||||
scenario: Сценарій |
|
||||
scenario_outline: Структура сценарію |
|
||||
examples: Приклади |
|
||||
given: "*|Припустимо|Припустимо, що|Нехай" |
|
||||
when: "*|Якщо" |
|
||||
then: "*|То" |
|
||||
and: "*|І" |
|
||||
but: "*|Але" |
|
||||
"uz": |
|
||||
name: Uzbek |
|
||||
native: Узбекча |
|
||||
feature: Функционал |
|
||||
background: Тарих |
|
||||
scenario: Сценарий |
|
||||
scenario_outline: Сценарий структураси |
|
||||
examples: Мисоллар |
|
||||
given: "*|Агар" |
|
||||
when: "*|Агар" |
|
||||
then: "*|Унда" |
|
||||
and: "*|Ва" |
|
||||
but: "*|Лекин|Бирок|Аммо" |
|
||||
"vi": |
|
||||
name: Vietnamese |
|
||||
native: Tiếng Việt |
|
||||
feature: Tính năng |
|
||||
background: Bối cảnh |
|
||||
scenario: Tình huống|Kịch bản |
|
||||
scenario_outline: Khung tình huống|Khung kịch bản |
|
||||
examples: Dữ liệu |
|
||||
given: "*|Biết|Cho" |
|
||||
when: "*|Khi" |
|
||||
then: "*|Thì" |
|
||||
and: "*|Và" |
|
||||
but: "*|Nhưng" |
|
||||
"zh-CN": |
|
||||
name: Chinese simplified |
|
||||
native: 简体中文 |
|
||||
feature: 功能 |
|
||||
background: 背景 |
|
||||
scenario: 场景 |
|
||||
scenario_outline: 场景大纲 |
|
||||
examples: 例子 |
|
||||
given: "*|假如<" |
|
||||
when: "*|当<" |
|
||||
then: "*|那么<" |
|
||||
and: "*|而且<" |
|
||||
but: "*|但是<" |
|
||||
"zh-TW": |
|
||||
name: Chinese traditional |
|
||||
native: 繁體中文 |
|
||||
feature: 功能 |
|
||||
background: 背景 |
|
||||
scenario: 場景|劇本 |
|
||||
scenario_outline: 場景大綱|劇本大綱 |
|
||||
examples: 例子 |
|
||||
given: "*|假設<" |
|
||||
when: "*|當<" |
|
||||
then: "*|那麼<" |
|
||||
and: "*|而且<|並且<" |
|
||||
but: "*|但是<" |
|
||||
@ -1,4 +0,0 @@ |
|||||
#name: And something else |
|
||||
# -- |
|
||||
And ${1:something else} |
|
||||
$0 |
|
||||
@ -1,5 +0,0 @@ |
|||||
#name: Background |
|
||||
# -- |
|
||||
Background: |
|
||||
Given ${1: a known starting condition} |
|
||||
$0 |
|
||||
@ -1,7 +0,0 @@ |
|||||
#name: Feature: Name |
|
||||
# -- |
|
||||
Feature: ${1:Name} |
|
||||
In order to ${2:get some business value} |
|
||||
${3:Role} will need ${4:this sweet new feature} |
|
||||
|
|
||||
$0 |
|
||||
@ -1,4 +0,0 @@ |
|||||
#name: Given a known starting condition |
|
||||
# -- |
|
||||
Given ${1:a known starting condition} |
|
||||
$0 |
|
||||
@ -1,4 +0,0 @@ |
|||||
#name: Scenario: Name |
|
||||
# -- |
|
||||
Scenario: ${1:Name} |
|
||||
$0 |
|
||||
@ -1,4 +0,0 @@ |
|||||
#name: Then some expected outcome |
|
||||
# -- |
|
||||
Then ${1:some expected outcome} |
|
||||
$0 |
|
||||
@ -1,4 +0,0 @@ |
|||||
#name: When some action |
|
||||
# -- |
|
||||
When ${1:some action} |
|
||||
$0 |
|
||||
@ -1,79 +0,0 @@ |
|||||
require 'rubygems' |
|
||||
gem "ruby_parser", "~> 2.0" |
|
||||
require 'ruby_parser' |
|
||||
|
|
||||
class Step |
|
||||
attr_reader :file, :line, :regexp |
|
||||
def initialize(regexp, file, line) |
|
||||
@file, @line = file, line |
|
||||
self.regexp = regexp |
|
||||
end |
|
||||
|
|
||||
def regexp=(value) |
|
||||
@regexp = |
|
||||
case value |
|
||||
when String |
|
||||
pieces, regexp = [], value.dup |
|
||||
regexp.gsub!(/\$\w+/) { |match| pieces << match; "TOKEN" } |
|
||||
regexp = Regexp.escape(regexp) |
|
||||
regexp.gsub!(/TOKEN/) { |match| "(.*)" } |
|
||||
Regexp.new("^#{regexp}$") |
|
||||
when Regexp |
|
||||
value |
|
||||
else |
|
||||
STDERR.puts "Warning: invalid parameter to Given/When/Then on #{file}:#{line}. Expected Regexp or String, got #{value.class} #{value.inspect}" |
|
||||
Regexp.new(/^INVALID PARAM$/) |
|
||||
end |
|
||||
end |
|
||||
|
|
||||
def match?(text) |
|
||||
@regexp.match(text) |
|
||||
end |
|
||||
end |
|
||||
|
|
||||
class StepParser |
|
||||
def self.parser |
|
||||
@parser ||= RubyParser.new |
|
||||
end |
|
||||
|
|
||||
attr_accessor :steps, :file |
|
||||
|
|
||||
def initialize(file) |
|
||||
@file = file |
|
||||
@steps = [] |
|
||||
extract_steps(self.class.parser.parse(File.read(file))) |
|
||||
end |
|
||||
|
|
||||
def extract_steps(sexp) |
|
||||
return unless sexp.is_a?(Sexp) |
|
||||
case sexp.first |
|
||||
when :block |
|
||||
sexp[1..-1].each do |child_sexp| |
|
||||
extract_steps(child_sexp) |
|
||||
end |
|
||||
when :iter |
|
||||
child_sexp = sexp[1] |
|
||||
return unless child_sexp[0] == :call && [:When, :Then, :Given].include?(child_sexp[2]) |
|
||||
regexp = child_sexp[3][1] && child_sexp[3][1][1] |
|
||||
@steps << Step.new(regexp, file, child_sexp.line) |
|
||||
else |
|
||||
sexp.each do |child_sexp| |
|
||||
extract_steps(child_sexp) |
|
||||
end |
|
||||
end |
|
||||
end |
|
||||
end |
|
||||
|
|
||||
input_text = ARGV[0].strip.gsub(/(When|Then|Given|And) */, "") |
|
||||
|
|
||||
files = Dir["features/step_definitions/**/*_steps.rb"] |
|
||||
steps = [] |
|
||||
files.each do |file| |
|
||||
steps.concat(StepParser.new(file).steps) |
|
||||
end |
|
||||
|
|
||||
steps.each do |step| |
|
||||
if step.match?(input_text) |
|
||||
puts "#{step.file}:#{step.line}" |
|
||||
end |
|
||||
end |
|
||||
12531
vendor/helm/helm-config.el
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,550 +0,0 @@ |
|||||
;;; helm-match-plugin.el --- Multiple regexp matching methods for helm |
|
||||
|
|
||||
;; Original Author: rubikitch <rubikitch@ruby-lang.org> |
|
||||
|
|
||||
;; This is a fork of `anything-match-plugin.el' created by |
|
||||
;; rubikitch <rubikitch@ruby-lang.org> |
|
||||
|
|
||||
;; Maintainers: Thierry Volpiatto <thierry.volpiatto@gmail.com> |
|
||||
;; Le Wang |
|
||||
|
|
||||
;; Copyright (C) 2008~2012, rubikitch, all rights reserved. |
|
||||
;; Copyright (C) 2011~2012, Thierry Volpiatto, all rights reserved. |
|
||||
|
|
||||
;; Keywords: helm, matching |
|
||||
|
|
||||
;; X-URL: <https://github.com/emacs-helm/helm> |
|
||||
|
|
||||
;; Created: 2012-03-15 12:29:23 |
|
||||
|
|
||||
;; This file is free software; you can redistribute it and/or modify |
|
||||
;; it under the terms of the GNU General Public License as published by |
|
||||
;; the Free Software Foundation; either version 2, or (at your option) |
|
||||
;; any later version. |
|
||||
|
|
||||
;; This file is distributed in the hope that it will be useful, |
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
;; GNU General Public License for more details. |
|
||||
|
|
||||
;; You should have received a copy of the GNU General Public License |
|
||||
;; along with GNU Emacs; see the file COPYING. If not, write to |
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
||||
;; Boston, MA 02110-1301, USA. |
|
||||
|
|
||||
;;; Auto documentation |
|
||||
;; ------------------ |
|
||||
;; |
|
||||
;; * User variables |
|
||||
;; [EVAL] (autodoc-document-lisp-buffer :type 'user-variable :prefix "helm-mp" :var-value t) |
|
||||
;; `helm-mp-matching-method' |
|
||||
;; Default Value: multi3 |
|
||||
;; `helm-mp-highlight-delay' |
|
||||
;; Default Value: 0.7 |
|
||||
;; `helm-mp-highlight-threshold' |
|
||||
;; Default Value: 2 |
|
||||
;; |
|
||||
;; * Internal variables |
|
||||
;; [EVAL] (autodoc-document-lisp-buffer :type 'internal-variable :prefix "helm-mp" :var-value t) |
|
||||
;; `helm-mp-default-match-functions' |
|
||||
;; Default Value: (helm-mp-exact-match helm-mp-3-match) |
|
||||
;; `helm-mp-default-search-functions' |
|
||||
;; Default Value: (helm-mp-exact-search helm-mp-3-search) |
|
||||
;; `helm-mp-default-search-backward-functions' |
|
||||
;; Default Value: (helm-mp-exact-search-backward helm-mp-3-search-backward) |
|
||||
;; `helm-mp-space-regexp' |
|
||||
;; Default Value: "[\\ ] " |
|
||||
;; `helm-mp-exact-pattern-str' |
|
||||
;; Default Value: "autod" |
|
||||
;; `helm-mp-exact-pattern-real' |
|
||||
;; Default Value: "\nautod\n" |
|
||||
;; `helm-mp-prefix-pattern-str' |
|
||||
;; Default Value: nil |
|
||||
;; `helm-mp-prefix-pattern-real' |
|
||||
;; Default Value: nil |
|
||||
;; `helm-mp-1-pattern-str' |
|
||||
;; Default Value: nil |
|
||||
;; `helm-mp-1-pattern-real' |
|
||||
;; Default Value: nil |
|
||||
;; `helm-mp-2-pattern-str' |
|
||||
;; Default Value: nil |
|
||||
;; `helm-mp-2-pattern-real' |
|
||||
;; Default Value: nil |
|
||||
;; `helm-mp-3-pattern-str' |
|
||||
;; Default Value: "autod" |
|
||||
;; `helm-mp-3-pattern-list' |
|
||||
;; Default Value: ((identity . "autod")) |
|
||||
;; `helm-mp-initial-highlight-delay' |
|
||||
;; Default Value: nil |
|
||||
;; |
|
||||
;; * Helm match plugin Functions |
|
||||
;; [EVAL] (autodoc-document-lisp-buffer :type 'function :prefix "helm-mp") |
|
||||
;; `helm-mp-set-matching-method' |
|
||||
;; `helm-mp-make-regexps' |
|
||||
;; `helm-mp-1-make-regexp' |
|
||||
;; `helm-mp-exact-get-pattern' |
|
||||
;; `helm-mp-exact-match' |
|
||||
;; `helm-mp-exact-search' |
|
||||
;; `helm-mp-exact-search-backward' |
|
||||
;; `helm-mp-prefix-get-pattern' |
|
||||
;; `helm-mp-prefix-match' |
|
||||
;; `helm-mp-prefix-search' |
|
||||
;; `helm-mp-prefix-search-backward' |
|
||||
;; `helm-mp-1-get-pattern' |
|
||||
;; `helm-mp-1-match' |
|
||||
;; `helm-mp-1-search' |
|
||||
;; `helm-mp-1-search-backward' |
|
||||
;; `helm-mp-2-get-pattern' |
|
||||
;; `helm-mp-2-match' |
|
||||
;; `helm-mp-2-search' |
|
||||
;; `helm-mp-2-search-backward' |
|
||||
;; `helm-mp-3-get-patterns' |
|
||||
;; `helm-mp-3-get-patterns-internal' |
|
||||
;; `helm-mp-3-match' |
|
||||
;; `helm-mp-3-search-base' |
|
||||
;; `helm-mp-3-search' |
|
||||
;; `helm-mp-3-search-backward' |
|
||||
;; `helm-mp-3p-match' |
|
||||
;; `helm-mp-3p-search' |
|
||||
;; `helm-mp-3p-search-backward' |
|
||||
;; `helm-mp-highlight-match' |
|
||||
;; `helm-mp-highlight-region' |
|
||||
;; `helm-mp-highlight-match-internal' |
|
||||
|
|
||||
;; *** END auto-documentation |
|
||||
|
|
||||
;;; Commentary: |
|
||||
|
|
||||
;; Change helm.el matching algorithm humanely. |
|
||||
;; It gives helm.el search refinement functionality. |
|
||||
;; exact match -> prefix match -> multiple regexp match |
|
||||
|
|
||||
;; A query of multiple regexp match is space-delimited string. |
|
||||
;; Helm displays candidates which matches all the regexps. |
|
||||
;; A regexp with "!" prefix means not matching the regexp. |
|
||||
;; To include spaces to a regexp, prefix "\" before space, |
|
||||
;; it is controlled by `helm-mp-space-regexp' variable. |
|
||||
|
|
||||
;; This file highlights patterns like `occur'. Note that patterns |
|
||||
;; longer than `helm-mp-highlight-threshold' are highlighted. And |
|
||||
;; region out of screen is highlighted after |
|
||||
;; `helm-mp-highlight-delay' seconds. |
|
||||
|
|
||||
;; Highlight in Emacs is time-consuming process for slow computers. To |
|
||||
;; disable it is to set nil to `helm-mp-highlight-delay'. |
|
||||
|
|
||||
;; helm-match-plugin is enable by default in helm. |
|
||||
;; To disable/enable it use M-x helm-c-toggle-match-plugin. |
|
||||
|
|
||||
;;; Code: |
|
||||
|
|
||||
(require 'helm) |
|
||||
(require 'cl) |
|
||||
|
|
||||
|
|
||||
;;;; Match-plugin |
|
||||
|
|
||||
;; Internal |
|
||||
(defvar helm-mp-default-match-functions nil) |
|
||||
(defvar helm-mp-default-search-functions nil) |
|
||||
(defvar helm-mp-default-search-backward-functions nil) |
|
||||
|
|
||||
(defun helm-mp-set-matching-method (var key) |
|
||||
"Default function to set matching methods in helm match plugin." |
|
||||
(set-default var key) |
|
||||
(case (symbol-value var) |
|
||||
(multi1 (setq helm-mp-default-match-functions |
|
||||
'(helm-mp-exact-match helm-mp-1-match) |
|
||||
helm-mp-default-search-functions |
|
||||
'(helm-mp-exact-search helm-mp-1-search) |
|
||||
helm-mp-default-search-backward-functions |
|
||||
'(helm-mp-exact-search-backward |
|
||||
helm-mp-1-search-backward))) |
|
||||
(multi2 (setq helm-mp-default-match-functions |
|
||||
'(helm-mp-exact-match helm-mp-2-match) |
|
||||
helm-mp-default-search-functions |
|
||||
'(helm-mp-exact-search helm-mp-2-search) |
|
||||
helm-mp-default-search-backward-functions |
|
||||
'(helm-mp-exact-search-backward |
|
||||
helm-mp-2-search-backward))) |
|
||||
(multi3 (setq helm-mp-default-match-functions |
|
||||
'(helm-mp-exact-match helm-mp-3-match) |
|
||||
helm-mp-default-search-functions |
|
||||
'(helm-mp-exact-search helm-mp-3-search) |
|
||||
helm-mp-default-search-backward-functions |
|
||||
'(helm-mp-exact-search-backward |
|
||||
helm-mp-3-search-backward))) |
|
||||
(multi3p (setq helm-mp-default-match-functions |
|
||||
'(helm-mp-exact-match helm-mp-3p-match) |
|
||||
helm-mp-default-search-functions |
|
||||
'(helm-mp-exact-search helm-mp-3p-search) |
|
||||
helm-mp-default-search-backward-functions |
|
||||
'(helm-mp-exact-search-backward |
|
||||
helm-mp-3p-search-backward))) |
|
||||
(t (error "Unknow value: %s" helm-mp-matching-method)))) |
|
||||
|
|
||||
(defgroup helm-match-plugin nil |
|
||||
"Helm match plugin." |
|
||||
:group 'helm) |
|
||||
|
|
||||
(defcustom helm-mp-matching-method 'multi3 |
|
||||
"Matching method for helm match plugin. |
|
||||
You can set here different methods to match candidates in helm. |
|
||||
Here are the possible value of this symbol and their meaning: |
|
||||
- multi1: Respect order, prefix of pattern must match. |
|
||||
- multi2: Same but with partial match. |
|
||||
- multi3: The best, multiple regexp match, allow negation. |
|
||||
- multi3p: Same but prefix must match. |
|
||||
Default is multi3." |
|
||||
:type '(radio :tag "Matching methods for helm" |
|
||||
(const :tag "Multiple regexp 1 ordered with prefix match" multi1) |
|
||||
(const :tag "Multiple regexp 2 ordered with partial match" multi2) |
|
||||
(const :tag "Multiple regexp 3 matching no order, partial, best." multi3) |
|
||||
(const :tag "Multiple regexp 3p matching with prefix match" multi3p)) |
|
||||
:set 'helm-mp-set-matching-method |
|
||||
:group 'helm-match-plugin) |
|
||||
|
|
||||
(defface helm-match |
|
||||
'((t (:inherit match))) |
|
||||
"Face used to highlight matches." |
|
||||
:group 'helm-match-plugin) |
|
||||
|
|
||||
(defcustom helm-mp-highlight-delay 0.7 |
|
||||
"Highlight matches with `helm-match' face after this many seconds. |
|
||||
If nil, no highlight. " |
|
||||
:type 'integer |
|
||||
:group 'helm-match-plugin) |
|
||||
|
|
||||
(defcustom helm-mp-highlight-threshold 2 |
|
||||
"Minimum length of pattern to highlight. |
|
||||
The smaller this value is, the slower highlight is." |
|
||||
:type 'integer |
|
||||
:group 'helm-match-plugin) |
|
||||
|
|
||||
|
|
||||
|
|
||||
;;; Build regexps |
|
||||
;; |
|
||||
;; |
|
||||
(defvar helm-mp-space-regexp "[\\ ] " |
|
||||
"Regexp to represent space itself in multiple regexp match.") |
|
||||
|
|
||||
(defun helm-mp-make-regexps (pattern) |
|
||||
"Split PATTERN if it contain spaces and return resulting list. |
|
||||
If spaces in PATTERN are escaped, don't split at this place. |
|
||||
i.e \"foo bar\"=> (\"foo\" \"bar\") |
|
||||
but \"foo\ bar\"=> (\"foobar\")." |
|
||||
(if (string= pattern "") |
|
||||
'("") |
|
||||
(loop for s in (split-string |
|
||||
(replace-regexp-in-string helm-mp-space-regexp |
|
||||
"\000\000" pattern) |
|
||||
" " t) |
|
||||
collect (replace-regexp-in-string "\000\000" " " s)))) |
|
||||
|
|
||||
(defun helm-mp-1-make-regexp (pattern) |
|
||||
"Replace spaces in PATTERN with \"\.*\"." |
|
||||
(mapconcat 'identity (helm-mp-make-regexps pattern) ".*")) |
|
||||
|
|
||||
|
|
||||
;;; Exact match. |
|
||||
;; |
|
||||
;; |
|
||||
;; Internal. |
|
||||
(defvar helm-mp-exact-pattern-str nil) |
|
||||
(defvar helm-mp-exact-pattern-real nil) |
|
||||
|
|
||||
(defun helm-mp-exact-get-pattern (pattern) |
|
||||
(unless (equal pattern helm-mp-exact-pattern-str) |
|
||||
(setq helm-mp-exact-pattern-str pattern |
|
||||
helm-mp-exact-pattern-real (concat "\n" pattern "\n"))) |
|
||||
helm-mp-exact-pattern-real) |
|
||||
|
|
||||
|
|
||||
(defun helm-mp-exact-match (str &optional pattern) |
|
||||
(string= str (or pattern helm-pattern))) |
|
||||
|
|
||||
(defun helm-mp-exact-search (pattern &rest ignore) |
|
||||
(and (search-forward (helm-mp-exact-get-pattern pattern) nil t) |
|
||||
(forward-line -1))) |
|
||||
|
|
||||
(defun helm-mp-exact-search-backward (pattern &rest ignore) |
|
||||
(and (search-backward (helm-mp-exact-get-pattern pattern) nil t) |
|
||||
(forward-line 1))) |
|
||||
|
|
||||
|
|
||||
;;; Prefix match |
|
||||
;; |
|
||||
;; |
|
||||
;; Internal |
|
||||
(defvar helm-mp-prefix-pattern-str nil) |
|
||||
(defvar helm-mp-prefix-pattern-real nil) |
|
||||
|
|
||||
(defun helm-mp-prefix-get-pattern (pattern) |
|
||||
(unless (equal pattern helm-mp-prefix-pattern-str) |
|
||||
(setq helm-mp-prefix-pattern-str pattern |
|
||||
helm-mp-prefix-pattern-real (concat "\n" pattern))) |
|
||||
helm-mp-prefix-pattern-real) |
|
||||
|
|
||||
(defun helm-mp-prefix-match (str &optional pattern) |
|
||||
(setq pattern (or pattern helm-pattern)) |
|
||||
(let ((len (length pattern))) |
|
||||
(and (<= len (length str)) |
|
||||
(string= (substring str 0 len) pattern )))) |
|
||||
|
|
||||
(defun helm-mp-prefix-search (pattern &rest ignore) |
|
||||
(search-forward (helm-mp-prefix-get-pattern pattern) nil t)) |
|
||||
|
|
||||
(defun helm-mp-prefix-search-backward (pattern &rest ignore) |
|
||||
(and (search-backward (helm-mp-prefix-get-pattern pattern) nil t) |
|
||||
(forward-line 1))) |
|
||||
|
|
||||
|
|
||||
;;; Multiple regexp patterns 1 (order is preserved / prefix). |
|
||||
;; |
|
||||
;; |
|
||||
;; Internal |
|
||||
(defvar helm-mp-1-pattern-str nil) |
|
||||
(defvar helm-mp-1-pattern-real nil) |
|
||||
|
|
||||
(defun helm-mp-1-get-pattern (pattern) |
|
||||
(unless (equal pattern helm-mp-1-pattern-str) |
|
||||
(setq helm-mp-1-pattern-str pattern |
|
||||
helm-mp-1-pattern-real |
|
||||
(concat "^" (helm-mp-1-make-regexp pattern)))) |
|
||||
helm-mp-1-pattern-real) |
|
||||
|
|
||||
(defun* helm-mp-1-match (str &optional (pattern helm-pattern)) |
|
||||
(string-match (helm-mp-1-get-pattern pattern) str)) |
|
||||
|
|
||||
(defun helm-mp-1-search (pattern &rest ignore) |
|
||||
(re-search-forward (helm-mp-1-get-pattern pattern) nil t)) |
|
||||
|
|
||||
(defun helm-mp-1-search-backward (pattern &rest ignore) |
|
||||
(re-search-backward (helm-mp-1-get-pattern pattern) nil t)) |
|
||||
|
|
||||
|
|
||||
;;; Multiple regexp patterns 2 (order is preserved / partial). |
|
||||
;; |
|
||||
;; |
|
||||
;; Internal |
|
||||
(defvar helm-mp-2-pattern-str nil) |
|
||||
(defvar helm-mp-2-pattern-real nil) |
|
||||
|
|
||||
(defun helm-mp-2-get-pattern (pattern) |
|
||||
(unless (equal pattern helm-mp-2-pattern-str) |
|
||||
(setq helm-mp-2-pattern-str pattern |
|
||||
helm-mp-2-pattern-real |
|
||||
(concat "^.*" (helm-mp-1-make-regexp pattern)))) |
|
||||
helm-mp-2-pattern-real) |
|
||||
|
|
||||
(defun* helm-mp-2-match (str &optional (pattern helm-pattern)) |
|
||||
(string-match (helm-mp-2-get-pattern pattern) str)) |
|
||||
|
|
||||
(defun helm-mp-2-search (pattern &rest ignore) |
|
||||
(re-search-forward (helm-mp-2-get-pattern pattern) nil t)) |
|
||||
|
|
||||
(defun helm-mp-2-search-backward (pattern &rest ignore) |
|
||||
(re-search-backward (helm-mp-2-get-pattern pattern) nil t)) |
|
||||
|
|
||||
|
|
||||
;;; Multiple regexp patterns 3 (permutation). |
|
||||
;; |
|
||||
;; |
|
||||
;; Internal |
|
||||
(defvar helm-mp-3-pattern-str nil) |
|
||||
(defvar helm-mp-3-pattern-list nil) |
|
||||
|
|
||||
(defun helm-mp-3-get-patterns (pattern) |
|
||||
"Return `helm-mp-3-pattern-list', a list of predicate/regexp cons cells. |
|
||||
e.g ((identity . \"foo\") (identity . \"bar\")). |
|
||||
This is done only if `helm-mp-3-pattern-str' is same as PATTERN." |
|
||||
(unless (equal pattern helm-mp-3-pattern-str) |
|
||||
(setq helm-mp-3-pattern-str pattern |
|
||||
helm-mp-3-pattern-list |
|
||||
(helm-mp-3-get-patterns-internal pattern))) |
|
||||
helm-mp-3-pattern-list) |
|
||||
|
|
||||
(defun helm-mp-3-get-patterns-internal (pattern) |
|
||||
"Return a list of predicate/regexp cons cells. |
|
||||
e.g ((identity . \"foo\") (identity . \"bar\"))." |
|
||||
(unless (string= pattern "") |
|
||||
(loop for pat in (helm-mp-make-regexps pattern) |
|
||||
collect (if (string= "!" (substring pat 0 1)) |
|
||||
(cons 'not (substring pat 1)) |
|
||||
(cons 'identity pat))))) |
|
||||
|
|
||||
(defun helm-mp-3-match (str &optional pattern) |
|
||||
"Check if PATTERN match STR. |
|
||||
When PATTERN contain a space, it is splitted and matching is done |
|
||||
with the several resulting regexps against STR. |
|
||||
e.g \"bar foo\" will match \"foobar\" and \"barfoo\". |
|
||||
Argument PATTERN, a string, is transformed in a list of |
|
||||
cons cell with `helm-mp-3-get-patterns' if it contain a space. |
|
||||
e.g \"foo bar\"=>((identity . \"foo\") (identity . \"bar\")). |
|
||||
Then each predicate of cons cell(s) is called with regexp of same |
|
||||
cons cell against STR (a candidate). |
|
||||
i.e (identity (string-match \"foo\" \"foo bar\")) => t." |
|
||||
(let ((pat (helm-mp-3-get-patterns (or pattern helm-pattern)))) |
|
||||
(loop for (predicate . regexp) in pat |
|
||||
always (funcall predicate (string-match regexp str))))) |
|
||||
|
|
||||
(defun helm-mp-3-search-base (pattern searchfn1 searchfn2) |
|
||||
(loop with pat = (if (stringp pattern) |
|
||||
(helm-mp-3-get-patterns pattern) |
|
||||
pattern) |
|
||||
while (funcall searchfn1 (or (cdar pat) "") nil t) |
|
||||
for bol = (point-at-bol) |
|
||||
for eol = (point-at-eol) |
|
||||
if (loop for (pred . str) in (cdr pat) always |
|
||||
(progn (goto-char bol) |
|
||||
(funcall pred (funcall searchfn2 str eol t)))) |
|
||||
do (goto-char eol) and return t |
|
||||
else do (goto-char eol) |
|
||||
finally return nil)) |
|
||||
|
|
||||
(defun helm-mp-3-search (pattern &rest ignore) |
|
||||
(when (stringp pattern) |
|
||||
(setq pattern (helm-mp-3-get-patterns pattern))) |
|
||||
(helm-mp-3-search-base |
|
||||
pattern 're-search-forward 're-search-forward)) |
|
||||
|
|
||||
(defun helm-mp-3-search-backward (pattern &rest ignore) |
|
||||
(when (stringp pattern) |
|
||||
(setq pattern (helm-mp-3-get-patterns pattern))) |
|
||||
(helm-mp-3-search-base |
|
||||
pattern 're-search-backward 're-search-backward)) |
|
||||
|
|
||||
|
|
||||
;;; mp-3p- (multiple regexp pattern 3 with prefix search) |
|
||||
;; |
|
||||
;; |
|
||||
(defun helm-mp-3p-match (str &optional pattern) |
|
||||
"Check if PATTERN match STR. |
|
||||
Same as `helm-mp-3-match' but more strict, matching against prefix also. |
|
||||
e.g \"bar foo\" will match \"barfoo\" but not \"foobar\" contrarily to |
|
||||
`helm-mp-3-match'." |
|
||||
(let* ((pat (helm-mp-3-get-patterns (or pattern helm-pattern))) |
|
||||
(first (car pat))) |
|
||||
(and (funcall (car first) (helm-mp-prefix-match str (cdr first))) |
|
||||
(loop for (predicate . regexp) in (cdr pat) |
|
||||
always (funcall predicate (string-match regexp str)))))) |
|
||||
|
|
||||
(defun helm-mp-3p-search (pattern &rest ignore) |
|
||||
(when (stringp pattern) |
|
||||
(setq pattern (helm-mp-3-get-patterns pattern))) |
|
||||
(helm-mp-3-search-base |
|
||||
pattern 'helm-mp-prefix-search 're-search-forward)) |
|
||||
|
|
||||
(defun helm-mp-3p-search-backward (pattern &rest ignore) |
|
||||
(when (stringp pattern) |
|
||||
(setq pattern (helm-mp-3-get-patterns pattern))) |
|
||||
(helm-mp-3-search-base |
|
||||
pattern 'helm-mp-prefix-search-backward 're-search-backward)) |
|
||||
|
|
||||
|
|
||||
;;; source compiler |
|
||||
;; |
|
||||
;; |
|
||||
(defun helm-compile-source--match-plugin (source) |
|
||||
(let ((searchers (if (assoc 'search-from-end source) |
|
||||
helm-mp-default-search-backward-functions |
|
||||
helm-mp-default-search-functions))) |
|
||||
`(,(if (or (assoc 'candidates-in-buffer source) |
|
||||
(equal '(identity) (assoc-default 'match source))) |
|
||||
'(match identity) |
|
||||
`(match ,@helm-mp-default-match-functions |
|
||||
,@(assoc-default 'match source))) |
|
||||
(search ,@searchers |
|
||||
,@(assoc-default 'search source)) |
|
||||
,@source))) |
|
||||
(add-to-list 'helm-compile-source-functions 'helm-compile-source--match-plugin t) |
|
||||
|
|
||||
|
|
||||
;;; Highlight matches. |
|
||||
;; |
|
||||
;; |
|
||||
(defun helm-mp-highlight-match () |
|
||||
"Highlight matches after `helm-mp-highlight-delay' seconds." |
|
||||
(when (and helm-mp-highlight-delay |
|
||||
(not (string= helm-pattern ""))) |
|
||||
(helm-mp-highlight-match-internal (window-end (helm-window))) |
|
||||
(run-with-idle-timer helm-mp-highlight-delay nil |
|
||||
'helm-mp-highlight-match-internal |
|
||||
(with-current-buffer helm-buffer (point-max))))) |
|
||||
(add-hook 'helm-update-hook 'helm-mp-highlight-match) |
|
||||
|
|
||||
(defun helm-mp-highlight-region (start end regexp face) |
|
||||
(save-excursion |
|
||||
(goto-char start) |
|
||||
(let (me) |
|
||||
(while (and (setq me (re-search-forward regexp nil t)) |
|
||||
(< (point) end) |
|
||||
(< 0 (- (match-end 0) (match-beginning 0)))) |
|
||||
(unless (helm-pos-header-line-p) |
|
||||
(put-text-property (match-beginning 0) me 'face face)))))) |
|
||||
|
|
||||
(defun helm-mp-highlight-match-internal (end) |
|
||||
(when (helm-window) |
|
||||
(set-buffer helm-buffer) |
|
||||
(let ((requote (loop for (pred . re) in |
|
||||
(helm-mp-3-get-patterns helm-pattern) |
|
||||
when (and (eq pred 'identity) |
|
||||
(>= (length re) |
|
||||
helm-mp-highlight-threshold)) |
|
||||
collect re into re-list |
|
||||
finally return |
|
||||
(if (and re-list (>= (length re-list) 1)) |
|
||||
(mapconcat 'identity re-list "\\|") |
|
||||
(regexp-quote helm-pattern))))) |
|
||||
(when (>= (length requote) helm-mp-highlight-threshold) |
|
||||
(helm-mp-highlight-region |
|
||||
(point-min) end requote 'helm-match))))) |
|
||||
|
|
||||
|
|
||||
;;; Toggle helm-match-plugin |
|
||||
;; |
|
||||
;; |
|
||||
(defvar helm-mp-initial-highlight-delay nil) |
|
||||
|
|
||||
;;;###autoload |
|
||||
(defun helm-mp-toggle-match-plugin () |
|
||||
"Turn on/off multiple regexp matching in helm. |
|
||||
i.e helm-match-plugin." |
|
||||
(interactive) |
|
||||
(let ((helm-match-plugin-enabled |
|
||||
(member 'helm-compile-source--match-plugin |
|
||||
helm-compile-source-functions))) |
|
||||
(flet ((disable-match-plugin () |
|
||||
(setq helm-compile-source-functions |
|
||||
(delq 'helm-compile-source--match-plugin |
|
||||
helm-compile-source-functions)) |
|
||||
(setq helm-mp-initial-highlight-delay |
|
||||
helm-mp-highlight-delay) |
|
||||
(setq helm-mp-highlight-delay nil)) |
|
||||
(enable-match-plugin () |
|
||||
(unless helm-mp-initial-highlight-delay |
|
||||
(setq helm-mp-initial-highlight-delay |
|
||||
helm-mp-highlight-delay)) |
|
||||
(setq helm-compile-source-functions |
|
||||
(cons 'helm-compile-source--match-plugin |
|
||||
helm-compile-source-functions)) |
|
||||
(unless helm-mp-highlight-delay |
|
||||
(setq helm-mp-highlight-delay |
|
||||
helm-mp-initial-highlight-delay)))) |
|
||||
(if helm-match-plugin-enabled |
|
||||
(when (y-or-n-p "Really disable match-plugin? ") |
|
||||
(disable-match-plugin) |
|
||||
(message "Helm-match-plugin disabled")) |
|
||||
(when (y-or-n-p "Really enable match-plugin? ") |
|
||||
(enable-match-plugin) |
|
||||
(message "Helm-match-plugin enabled")))))) |
|
||||
|
|
||||
|
|
||||
;;;; Unit test |
|
||||
;; |
|
||||
;; unit test for match plugin are now in developper-tools/unit-test-match-plugin.el |
|
||||
|
|
||||
(provide 'helm-match-plugin) |
|
||||
|
|
||||
;;; helm-match-plugin.el ends here |
|
||||
4427
vendor/helm/helm.el
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,251 +0,0 @@ |
|||||
;;; dropdown-list.el --- Drop-down menu interface |
|
||||
;; |
|
||||
;; Filename: dropdown-list.el |
|
||||
;; Description: Drop-down menu interface |
|
||||
;; Author: Jaeyoun Chung [jay.chung@gmail.com] |
|
||||
;; Maintainer: |
|
||||
;; Copyright (C) 2008 Jaeyoun Chung |
|
||||
;; Created: Sun Mar 16 11:20:45 2008 (Pacific Daylight Time) |
|
||||
;; Version: |
|
||||
;; Last-Updated: Sun Mar 16 12:19:49 2008 (Pacific Daylight Time) |
|
||||
;; By: dradams |
|
||||
;; Update #: 43 |
|
||||
;; URL: http://www.emacswiki.org/cgi-bin/wiki/dropdown-list.el |
|
||||
;; Keywords: convenience menu |
|
||||
;; Compatibility: GNU Emacs 21.x, GNU Emacs 22.x |
|
||||
;; |
|
||||
;; Features that might be required by this library: |
|
||||
;; |
|
||||
;; `cl'. |
|
||||
;; |
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;; |
|
||||
;;; Commentary: |
|
||||
;; |
|
||||
;; According to Jaeyoun Chung, "overlay code stolen from company-mode.el." |
|
||||
;; |
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;; |
|
||||
;;; Change log: |
|
||||
;; |
|
||||
;; 2008/03/16 dadams |
|
||||
;; Clean-up - e.g. use char-to-string for control chars removed by email posting. |
|
||||
;; Moved example usage code (define-key*, command-selector) inside the library. |
|
||||
;; Require cl.el at byte-compile time. |
|
||||
;; Added GPL statement. |
|
||||
;; 2008/01/06 Jaeyoun Chung |
|
||||
;; Posted to gnu-emacs-sources@gnu.org at 9:10 p.m. |
|
||||
;; |
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;; |
|
||||
;; This program is free software; you can redistribute it and/or |
|
||||
;; modify it under the terms of the GNU General Public License as |
|
||||
;; published by the Free Software Foundation; either version 3, or |
|
||||
;; (at your option) any later version. |
|
||||
;; |
|
||||
;; This program is distributed in the hope that it will be useful, |
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||
;; General Public License for more details. |
|
||||
;; |
|
||||
;; You should have received a copy of the GNU General Public License |
|
||||
;; along with this program; see the file COPYING. If not, write to |
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth |
|
||||
;; Floor, Boston, MA 02110-1301, USA. |
|
||||
;; |
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;; |
|
||||
;;; Code: |
|
||||
|
|
||||
(eval-when-compile (require 'cl)) ;; decf, fourth, incf, loop, mapcar* |
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
|
|
||||
(defface dropdown-list-face |
|
||||
'((t :inherit default :background "lightyellow" :foreground "black")) |
|
||||
"*Bla." :group 'dropdown-list) |
|
||||
|
|
||||
(defface dropdown-list-selection-face |
|
||||
'((t :inherit dropdown-list-face :background "purple")) |
|
||||
"*Bla." :group 'dropdown-list) |
|
||||
|
|
||||
(defvar dropdown-list-overlays nil) |
|
||||
|
|
||||
(defun dropdown-list-hide () |
|
||||
(while dropdown-list-overlays |
|
||||
(delete-overlay (pop dropdown-list-overlays)))) |
|
||||
|
|
||||
(defun dropdown-list-put-overlay (beg end &optional prop value prop2 value2) |
|
||||
(let ((ov (make-overlay beg end))) |
|
||||
(overlay-put ov 'window t) |
|
||||
(when prop |
|
||||
(overlay-put ov prop value) |
|
||||
(when prop2 (overlay-put ov prop2 value2))) |
|
||||
ov)) |
|
||||
|
|
||||
(defun dropdown-list-line (start replacement &optional no-insert) |
|
||||
;; start might be in the middle of a tab, which means we need to hide the |
|
||||
;; tab and add spaces |
|
||||
(let ((end (+ start (length replacement))) |
|
||||
beg-point end-point |
|
||||
before-string after-string) |
|
||||
(goto-char (point-at-eol)) |
|
||||
(if (< (current-column) start) |
|
||||
(progn (setq before-string (make-string (- start (current-column)) ? )) |
|
||||
(setq beg-point (point))) |
|
||||
(goto-char (point-at-bol)) ;; Emacs bug, move-to-column is wrong otherwise |
|
||||
(move-to-column start) |
|
||||
(setq beg-point (point)) |
|
||||
(when (> (current-column) start) |
|
||||
(goto-char (1- (point))) |
|
||||
(setq beg-point (point)) |
|
||||
(setq before-string (make-string (- start (current-column)) ? )))) |
|
||||
(move-to-column end) |
|
||||
(setq end-point (point)) |
|
||||
(let ((end-offset (- (current-column) end))) |
|
||||
(when (> end-offset 0) (setq after-string (make-string end-offset ?b)))) |
|
||||
(when no-insert |
|
||||
;; prevent inheriting of faces |
|
||||
(setq before-string (when before-string (propertize before-string 'face 'default))) |
|
||||
(setq after-string (when after-string (propertize after-string 'face 'default)))) |
|
||||
(let ((string (concat before-string replacement after-string))) |
|
||||
(if no-insert |
|
||||
string |
|
||||
(push (dropdown-list-put-overlay beg-point end-point 'invisible t |
|
||||
'after-string string) |
|
||||
dropdown-list-overlays))))) |
|
||||
|
|
||||
(defun dropdown-list-start-column (display-width) |
|
||||
(let ((column (mod (current-column) (window-width))) |
|
||||
(width (window-width))) |
|
||||
(cond ((<= (+ column display-width) width) column) |
|
||||
((> column display-width) (- column display-width)) |
|
||||
((>= width display-width) (- width display-width)) |
|
||||
(t nil)))) |
|
||||
|
|
||||
(defun dropdown-list-move-to-start-line (candidate-count) |
|
||||
(decf candidate-count) |
|
||||
(let ((above-line-count (save-excursion (- (vertical-motion (- candidate-count))))) |
|
||||
(below-line-count (save-excursion (vertical-motion candidate-count)))) |
|
||||
(cond ((= below-line-count candidate-count) |
|
||||
t) |
|
||||
((= above-line-count candidate-count) |
|
||||
(vertical-motion (- candidate-count)) |
|
||||
t) |
|
||||
((>= (+ below-line-count above-line-count) candidate-count) |
|
||||
(vertical-motion (- (- candidate-count below-line-count))) |
|
||||
t) |
|
||||
(t nil)))) |
|
||||
|
|
||||
(defun dropdown-list-at-point (candidates &optional selidx) |
|
||||
(dropdown-list-hide) |
|
||||
(let* ((lengths (mapcar #'length candidates)) |
|
||||
(max-length (apply #'max lengths)) |
|
||||
(start (dropdown-list-start-column (+ max-length 3))) |
|
||||
(i -1) |
|
||||
(candidates (mapcar* (lambda (candidate length) |
|
||||
(let ((diff (- max-length length))) |
|
||||
(propertize |
|
||||
(concat (if (> diff 0) |
|
||||
(concat candidate (make-string diff ? )) |
|
||||
(substring candidate 0 max-length)) |
|
||||
(format "%3d" (+ 2 i))) |
|
||||
'face (if (eql (incf i) selidx) |
|
||||
'dropdown-list-selection-face |
|
||||
'dropdown-list-face)))) |
|
||||
candidates |
|
||||
lengths))) |
|
||||
(save-excursion |
|
||||
(and start |
|
||||
(dropdown-list-move-to-start-line (length candidates)) |
|
||||
(loop initially (vertical-motion 0) |
|
||||
for candidate in candidates |
|
||||
do (dropdown-list-line (+ (current-column) start) candidate) |
|
||||
while (/= (vertical-motion 1) 0) |
|
||||
finally return t))))) |
|
||||
|
|
||||
(defun dropdown-list (candidates) |
|
||||
(let ((selection) |
|
||||
(temp-buffer)) |
|
||||
(save-window-excursion |
|
||||
(unwind-protect |
|
||||
(let ((candidate-count (length candidates)) |
|
||||
done key (selidx 0)) |
|
||||
(while (not done) |
|
||||
(unless (dropdown-list-at-point candidates selidx) |
|
||||
(switch-to-buffer (setq temp-buffer (get-buffer-create "*selection*")) |
|
||||
'norecord) |
|
||||
(delete-other-windows) |
|
||||
(delete-region (point-min) (point-max)) |
|
||||
(insert (make-string (length candidates) ?\n)) |
|
||||
(goto-char (point-min)) |
|
||||
(dropdown-list-at-point candidates selidx)) |
|
||||
(setq key (read-key-sequence "")) |
|
||||
(cond ((and (stringp key) |
|
||||
(>= (aref key 0) ?1) |
|
||||
(<= (aref key 0) (+ ?0 (min 9 candidate-count)))) |
|
||||
(setq selection (- (aref key 0) ?1) |
|
||||
done t)) |
|
||||
((member key `(,(char-to-string ?\C-p) [up] "p")) |
|
||||
(setq selidx (mod (+ candidate-count (1- (or selidx 0))) |
|
||||
candidate-count))) |
|
||||
((member key `(,(char-to-string ?\C-n) [down] "n")) |
|
||||
(setq selidx (mod (1+ (or selidx -1)) candidate-count))) |
|
||||
((member key `(,(char-to-string ?\f)))) |
|
||||
((member key `(,(char-to-string ?\r) [return])) |
|
||||
(setq selection selidx |
|
||||
done t)) |
|
||||
(t (setq done t))))) |
|
||||
(dropdown-list-hide) |
|
||||
(and temp-buffer (kill-buffer temp-buffer))) |
|
||||
;; (when selection |
|
||||
;; (message "your selection => %d: %s" selection (nth selection candidates)) |
|
||||
;; (sit-for 1)) |
|
||||
selection))) |
|
||||
|
|
||||
(defun define-key* (keymap key command) |
|
||||
"Add COMMAND to the multiple-command binding of KEY in KEYMAP. |
|
||||
Use multiple times to bind different COMMANDs to the same KEY." |
|
||||
(define-key keymap key (combine-command command (lookup-key keymap key)))) |
|
||||
|
|
||||
(defun combine-command (command defs) |
|
||||
"$$$$$ FIXME - no doc string" |
|
||||
(cond ((null defs) command) |
|
||||
((and (listp defs) |
|
||||
(eq 'lambda (car defs)) |
|
||||
(= (length defs) 4) |
|
||||
(listp (fourth defs)) |
|
||||
(eq 'command-selector (car (fourth defs)))) |
|
||||
(unless (member `',command (cdr (fourth defs))) |
|
||||
(setcdr (fourth defs) (nconc (cdr (fourth defs)) `(',command)))) |
|
||||
defs) |
|
||||
(t |
|
||||
`(lambda () (interactive) (command-selector ',defs ',command))))) |
|
||||
|
|
||||
(defvar command-selector-last-command nil "$$$$$ FIXME - no doc string") |
|
||||
|
|
||||
(defun command-selector (&rest candidates) |
|
||||
"$$$$$ FIXME - no doc string" |
|
||||
(if (and (eq last-command this-command) command-selector-last-command) |
|
||||
(call-interactively command-selector-last-command) |
|
||||
(let* ((candidate-strings |
|
||||
(mapcar (lambda (candidate) |
|
||||
(format "%s" (if (symbolp candidate) |
|
||||
candidate |
|
||||
(let ((s (format "%s" candidate))) |
|
||||
(if (>= (length s) 7) |
|
||||
(concat (substring s 0 7) "...") |
|
||||
s))))) |
|
||||
candidates)) |
|
||||
(selection (dropdown-list candidate-strings))) |
|
||||
(when selection |
|
||||
(let ((cmd (nth selection candidates))) |
|
||||
(call-interactively cmd) |
|
||||
(setq command-selector-last-command cmd)))))) |
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;; |
|
||||
|
|
||||
(provide 'dropdown-list) |
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;;; dropdown-list.el ends here |
|
||||
@ -1,690 +0,0 @@ |
|||||
;; .yas-setup.el for html-mode |
|
||||
|
|
||||
(defvar yas/html-default-tag "p") |
|
||||
|
|
||||
(defvar yas/html-xhtml-attr "") |
|
||||
|
|
||||
(defvar yas/html-just-like-tm nil |
|
||||
"Html-mode snippets behave as close to TextMate as possible.") |
|
||||
|
|
||||
(defun yas/html-activate () |
|
||||
(add-to-list (make-local-variable 'yas/mode-symbol) 'html-mode)) |
|
||||
|
|
||||
(add-hook 'nxml-mode-hook 'yas/html-activate) |
|
||||
(add-hook 'rhtml-mode-hook 'yas/html-activate) |
|
||||
|
|
||||
(defun yas/html-remove-preceding-word () |
|
||||
(interactive) |
|
||||
(let (word-begin |
|
||||
word-end |
|
||||
(line-beginning-position (line-beginning-position)) |
|
||||
(orig-point (point)) |
|
||||
retval) |
|
||||
(save-excursion |
|
||||
(when (and (forward-word -1) |
|
||||
(setq word-begin (point)) |
|
||||
(forward-word 1) |
|
||||
(setq word-end (point)) |
|
||||
(< word-begin orig-point) |
|
||||
(>= word-end orig-point) |
|
||||
(<= (line-beginning-position) word-begin) |
|
||||
;; (not (string-match "^[\s\t]+$" " ")) |
|
||||
) |
|
||||
(setq retval |
|
||||
(cons |
|
||||
(buffer-substring-no-properties word-begin orig-point) |
|
||||
(buffer-substring-no-properties word-end orig-point))) |
|
||||
(delete-region word-begin word-end) |
|
||||
retval)))) |
|
||||
|
|
||||
|
|
||||
(defun yas/html-first-word (string) |
|
||||
(replace-regexp-in-string "\\\W.*" "" string)) |
|
||||
|
|
||||
(defun yas/html-insert-tag-pair-snippet () |
|
||||
(let* ((tag-and-suffix (or (and yas/selected-text |
|
||||
(cons yas/selected-text nil)) |
|
||||
(yas/html-remove-preceding-word))) |
|
||||
(tag (car tag-and-suffix)) |
|
||||
(suffix (or (cdr tag-and-suffix) "")) |
|
||||
(single-no-arg "\\(br\\|hr\\)") |
|
||||
(single "\\(img\\|meta\\|link\\|input\\|base\\|area\\|col\\|frame\\|param\\)")) |
|
||||
(cond ((null tag) |
|
||||
(yas/expand-snippet (format "<${1:%s}>%s</${1:$(yas/html-first-word yas/text)}>%s" |
|
||||
(or yas/html-default-tag |
|
||||
"p") |
|
||||
(if yas/html-just-like-tm "$2" "$0") |
|
||||
suffix))) |
|
||||
((string-match single-no-arg tag) |
|
||||
(insert (format "<%s%s/>%s" tag yas/html-xhtml-attr suffix))) |
|
||||
((string-match single tag) |
|
||||
(yas/expand-snippet (format "<%s $1%s/>%s" tag yas/html-xhtml-attr suffix))) |
|
||||
(t |
|
||||
(yas/expand-snippet (format "<%s>%s</%s>%s" |
|
||||
tag |
|
||||
(if yas/html-just-like-tm "$1" "$0") |
|
||||
(replace-regexp-in-string "\\\W.*" "" tag) |
|
||||
suffix)))))) |
|
||||
|
|
||||
(defun yas/html-wrap-each-line-in-openclose-tag () |
|
||||
(let* ((mirror "${1:$(yas/html-first-word yas/text)}") |
|
||||
(yas/html-wrap-newline (when (string-match "\n" yas/selected-text) "\n")) |
|
||||
(template (concat (format "<${1:%s}>" (or yas/html-default-tag "p")) |
|
||||
yas/selected-text |
|
||||
"</" mirror ">"))) |
|
||||
(setq template (replace-regexp-in-string "\n" (concat "</" mirror ">\n<$1>") template)) |
|
||||
(yas/expand-snippet template))) |
|
||||
|
|
||||
(defun yas/html-toggle-wrap (string wrap) |
|
||||
(or (and string |
|
||||
(string-match (format "<%s>\\(.*\\)</%s>" wrap wrap) |
|
||||
string) |
|
||||
(match-string 1 string)) |
|
||||
(concat wrap string wrap))) |
|
||||
|
|
||||
(defun yas/html-between-tag-pair-p () |
|
||||
(save-excursion |
|
||||
(backward-word) |
|
||||
(looking-at "\\\w+></\\\w+>"))) |
|
||||
|
|
||||
(defun yas/html-id-from-string (string) |
|
||||
(replace-regexp-in-string " " "_" (downcase string))) |
|
||||
|
|
||||
(defun yas/html-tidy () |
|
||||
(interactive) |
|
||||
(let ((start (or (and mark-active |
|
||||
(region-beginning)) |
|
||||
(point-min))) |
|
||||
(end (or (and mark-active |
|
||||
(region-end)) |
|
||||
(point-max))) |
|
||||
(orig (point)) |
|
||||
(orig-line (count-screen-lines (window-start) (line-beginning-position)))) |
|
||||
(shell-command-on-region start end "tidy" (current-buffer) t (get-buffer-create "*tidy errors*") t) |
|
||||
(goto-char (min (point-max) orig)) |
|
||||
(recenter (1- orig-line)))) |
|
||||
|
|
||||
(defun yas/html-tag-description () |
|
||||
(interactive) |
|
||||
(let* ((tag-at-point (sgml-beginning-of-tag)) |
|
||||
(fragment (and tag-at-point |
|
||||
(aget yas/html-tag-description-urls (upcase tag-at-point))))) |
|
||||
(if fragment |
|
||||
(browse-url (concat "http://www.w3.org/TR/html4/index/" |
|
||||
fragment)) |
|
||||
(if tag-at-point |
|
||||
(message "No documentation for " tag-at-point) |
|
||||
(message "Not on a HTML tag."))))) |
|
||||
|
|
||||
(defvar yas/html-tag-description-urls |
|
||||
'(("A" . "../struct/links.html#edef-A") |
|
||||
("ABBR" . "../struct/text.html#edef-ABBR") |
|
||||
("ACRONYM" . "../struct/text.html#edef-ACRONYM") |
|
||||
("ADDRESS" . "../struct/global.html#edef-ADDRESS") |
|
||||
("APPLET" . "../struct/objects.html#edef-APPLET") |
|
||||
("AREA" . "../struct/objects.html#edef-AREA") |
|
||||
("B" . "../present/graphics.html#edef-B") |
|
||||
("BASE" . "../struct/links.html#edef-BASE") |
|
||||
("BASEFONT" . "../present/graphics.html#edef-BASEFONT") |
|
||||
("BDO" . "../struct/dirlang.html#edef-BDO") |
|
||||
("BIG" . "../present/graphics.html#edef-BIG") |
|
||||
("BLOCKQUOTE" . "../struct/text.html#edef-BLOCKQUOTE") |
|
||||
("BODY" . "../struct/global.html#edef-BODY") |
|
||||
("BR" . "../struct/text.html#edef-BR") |
|
||||
("BUTTON" . "../interact/forms.html#edef-BUTTON") |
|
||||
("CAPTION" . "../struct/tables.html#edef-CAPTION") |
|
||||
("CENTER" . "../present/graphics.html#edef-CENTER") |
|
||||
("CITE" . "../struct/text.html#edef-CITE") |
|
||||
("CODE" . "../struct/text.html#edef-CODE") |
|
||||
("COL" . "../struct/tables.html#edef-COL") |
|
||||
("COLGROUP" . "../struct/tables.html#edef-COLGROUP") |
|
||||
("DD" . "../struct/lists.html#edef-DD") |
|
||||
("DEL" . "../struct/text.html#edef-del") |
|
||||
("DFN" . "../struct/text.html#edef-DFN") |
|
||||
("DIR" . "../struct/lists.html#edef-DIR") |
|
||||
("DIV" . "../struct/global.html#edef-DIV") |
|
||||
("DL" . "../struct/lists.html#edef-DL") |
|
||||
("DT" . "../struct/lists.html#edef-DT") |
|
||||
("EM" . "../struct/text.html#edef-EM") |
|
||||
("FIELDSET" . "../interact/forms.html#edef-FIELDSET") |
|
||||
("FONT" . "../present/graphics.html#edef-FONT") |
|
||||
("FORM" . "../interact/forms.html#edef-FORM") |
|
||||
("FRAME" . "../present/frames.html#edef-FRAME") |
|
||||
("FRAMESET" . "../present/frames.html#edef-FRAMESET") |
|
||||
("H1" . "../struct/global.html#edef-H1") |
|
||||
("H2" . "../struct/global.html#edef-H2") |
|
||||
("H3" . "../struct/global.html#edef-H3") |
|
||||
("H4" . "../struct/global.html#edef-H4") |
|
||||
("H5" . "../struct/global.html#edef-H5") |
|
||||
("H6" . "../struct/global.html#edef-H6") |
|
||||
("HEAD" . "../struct/global.html#edef-HEAD") |
|
||||
("HR" . "../present/graphics.html#edef-HR") |
|
||||
("HTML" . "../struct/global.html#edef-HTML") |
|
||||
("I" . "../present/graphics.html#edef-I") |
|
||||
("IFRAME" . "../present/frames.html#edef-IFRAME") |
|
||||
("IMG" . "../struct/objects.html#edef-IMG") |
|
||||
("INPUT" . "../interact/forms.html#edef-INPUT") |
|
||||
("INS" . "../struct/text.html#edef-ins") |
|
||||
("ISINDEX" . "../interact/forms.html#edef-ISINDEX") |
|
||||
("KBD" . "../struct/text.html#edef-KBD") |
|
||||
("LABEL" . "../interact/forms.html#edef-LABEL") |
|
||||
("LEGEND" . "../interact/forms.html#edef-LEGEND") |
|
||||
("LI" . "../struct/lists.html#edef-LI") |
|
||||
("LINK" . "../struct/links.html#edef-LINK") |
|
||||
("MAP" . "../struct/objects.html#edef-MAP") |
|
||||
("MENU" . "../struct/lists.html#edef-MENU") |
|
||||
("META" . "../struct/global.html#edef-META") |
|
||||
("NOFRAMES" . "../present/frames.html#edef-NOFRAMES") |
|
||||
("NOSCRIPT" . "../interact/scripts.html#edef-NOSCRIPT") |
|
||||
("OBJECT" . "../struct/objects.html#edef-OBJECT") |
|
||||
("OL" . "../struct/lists.html#edef-OL") |
|
||||
("OPTGROUP" . "../interact/forms.html#edef-OPTGROUP") |
|
||||
("OPTION" . "../interact/forms.html#edef-OPTION") |
|
||||
("P" . "../struct/text.html#edef-P") |
|
||||
("PARAM" . "../struct/objects.html#edef-PARAM") |
|
||||
("PRE" . "../struct/text.html#edef-PRE") |
|
||||
("Q" . "../struct/text.html#edef-Q") |
|
||||
("S" . "../present/graphics.html#edef-S") |
|
||||
("SAMP" . "../struct/text.html#edef-SAMP") |
|
||||
("SCRIPT" . "../interact/scripts.html#edef-SCRIPT") |
|
||||
("SELECT" . "../interact/forms.html#edef-SELECT") |
|
||||
("SMALL" . "../present/graphics.html#edef-SMALL") |
|
||||
("SPAN" . "../struct/global.html#edef-SPAN") |
|
||||
("STRIKE" . "../present/graphics.html#edef-STRIKE") |
|
||||
("STRONG" . "../struct/text.html#edef-STRONG") |
|
||||
("STYLE" . "../present/styles.html#edef-STYLE") |
|
||||
("SUB" . "../struct/text.html#edef-SUB") |
|
||||
("SUP" . "../struct/text.html#edef-SUP") |
|
||||
("TABLE" . "../struct/tables.html#edef-TABLE") |
|
||||
("TBODY" . "../struct/tables.html#edef-TBODY") |
|
||||
("TD" . "../struct/tables.html#edef-TD") |
|
||||
("TEXTAREA" . "../interact/forms.html#edef-TEXTAREA") |
|
||||
("TFOOT" . "../struct/tables.html#edef-TFOOT") |
|
||||
("TH" . "../struct/tables.html#edef-TH") |
|
||||
("THEAD" . "../struct/tables.html#edef-THEAD") |
|
||||
("TITLE" . "../struct/global.html#edef-TITLE") |
|
||||
("TR" . "../struct/tables.html#edef-TR") |
|
||||
("TT" . "../present/graphics.html#edef-TT") |
|
||||
("U" . "../present/graphics.html#edef-U") |
|
||||
("UL" . "../struct/lists.html#edef-UL") |
|
||||
("VAR" . "../struct/text.html#edef-VAR"))) |
|
||||
|
|
||||
;; |
|
||||
;; |
|
||||
;; Substitutions for: content |
|
||||
;; # as in Snippets/Emphasize.yasnippet |
|
||||
;; ${TM_SELECTED_TEXT/\A<em>(.*)<\/em>\z|.*/(?1:$1:<em>$0<\/em>)/m} =yyas> `(yas/html-toggle-wrap yas/selected-text "em")` |
|
||||
;; ${TM_SELECTED_TEXT/\A<strong>(.*)<\/strong>\z|.*/(?1:$1:<strong>$0<\/strong>)/m} =yyas> `(yas/html-toggle-wrap yas/selected-text "strong")` |
|
||||
;; ${1/\s.*//} =yyas> ${1:$(replace-regexp-in-string "[\s\t\n].*" "" yas/text)} |
|
||||
;; ${1/[[:alpha:]]+|( )/(?1:_:\L$0)/g} =yyas> ${1:$(replace-regexp-in-string " " "_" (downcase yas/text))} |
|
||||
;; ${TM_XHTML} =yyas> `yas/html-xhtml-attr` |
|
||||
|
|
||||
|
|
||||
;; # as in Commands/Preview in All Active Browsers.yasnippet |
|
||||
;; 970EE6B4-A091-11D9-A5A2-000D93C8BE28 =yyas> (browse-url-of-buffer) |
|
||||
;; 637CEA2B-578C-429C-BB74-30E8D42BFA22 =yyas> (yas/html-tag-description) |
|
||||
;; 2ED44A32-C353-447F-BAE4-E3522DB6944D =yyas> (yas/html-insert-tag-pair-snippet) |
|
||||
;; 991E7EBD-F3F5-469A-BA01-DC30E04AD472 =yyas> (yas/html-wrap-each-line-in-openclose-tag) |
|
||||
|
|
||||
;; Substitutions for: binding |
|
||||
;; |
|
||||
;; # as in Snippets/Strong.yasnippet |
|
||||
;; @b =yyas> s-b |
|
||||
;; |
|
||||
;; # as in Snippets/Emphasize.yasnippet |
|
||||
;; ^@i =yyas> |
|
||||
;; @i =yyas> s-i |
|
||||
;; |
|
||||
;; # as in Snippets/Wrap Selection In Tag.yasnippet |
|
||||
;; ^W =yyas> C-c M-w |
|
||||
;; |
|
||||
;; # as in Commands/Insert Tag Pair.yasnippet |
|
||||
;; ^< =yyas> C-< |
|
||||
;; |
|
||||
;; # as in Commands/Documentation for Tag.yasnippet |
|
||||
;; ^h =yyas> C-c M-h |
|
||||
;; |
|
||||
;; # as in Commands/Wrap Each Selected Line in OpenClose Tag.yasnippet |
|
||||
;; ^@W =yyas> C-c M-W |
|
||||
;; |
|
||||
;; # as in Snippets/XHTML   NonBreakingSpace.yasnippet |
|
||||
;; ~ =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Insert Entity.yasnippet |
|
||||
;; @& =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Refresh All Active Browsers.yasnippet |
|
||||
;; @r =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Persistent Include.yasnippet |
|
||||
;; ^@i =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/CodeCompletion HTML Tags.yasnippet |
|
||||
;; ~ =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Update Includes.yasnippet |
|
||||
;; ^@u =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Macros/Delete whitespace between tags.yasnippet |
|
||||
;; ^~ =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Tidy.yasnippet |
|
||||
;; ^H =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; |
|
||||
;; --**-- |
|
||||
;; Automatically generated code, do not edit this part |
|
||||
;; |
|
||||
;; Translated menu |
|
||||
;; |
|
||||
(yas/define-menu 'html-mode |
|
||||
'(;; Documentation for Tag |
|
||||
(yas/item "637CEA2B-578C-429C-BB74-30E8D42BFA22") |
|
||||
;; Ignoring Validate Syntax (W3C) |
|
||||
(yas/ignore-item "3F26240E-6E4A-11D9-B411-000D93589AF6") |
|
||||
|
|
||||
;; Open Document in Running Browser(s) |
|
||||
(yas/item "970EE6B4-A091-11D9-A5A2-000D93C8BE28") |
|
||||
;; Ignoring Refresh Running Browser(s) |
|
||||
(yas/ignore-item "B8651C6E-A05E-11D9-86AC-000D93C8BE28") |
|
||||
|
|
||||
(yas/submenu "Entities" |
|
||||
(;; Ignoring Convert Character / Selection to Entities |
|
||||
(yas/ignore-item "3DD8406C-A116-11D9-A5A2-000D93C8BE28") |
|
||||
;; Ignoring Convert Character / Selection to Entities Excl. Tags |
|
||||
(yas/ignore-item "43C9E8AE-3E53-4B82-A1AF-56697BB3EF09") |
|
||||
;; Ignoring Decode Entities in Line / Selection |
|
||||
(yas/ignore-item "C183920D-A126-11D9-A5A2-000D93C8BE28") |
|
||||
|
|
||||
;; Non-Breaking Space |
|
||||
(yas/item "73B40BAE-A295-11D9-87F7-000D93C8BE28") |
|
||||
;; → |
|
||||
(yas/item "C70BB693-0954-4440-AEB4-F2ADD6D923F0") |
|
||||
;; ← |
|
||||
(yas/item "C0418A4A-7E42-4D49-8F86-6E339296CB84") |
|
||||
;; ⇤ |
|
||||
(yas/item "7F102705-27D8-4029-BF61-2F042FB61E06") |
|
||||
;; ⌅ |
|
||||
(yas/item "7062316B-4236-4793-AD35-05E4A6577393") |
|
||||
;; ⌃ |
|
||||
(yas/item "B4987DA5-9C2F-4D2D-AC14-678115079205") |
|
||||
;; ⌦ |
|
||||
(yas/item "44E448B6-37CE-4BFE-8611-C5113593B74B") |
|
||||
;; ↩ |
|
||||
(yas/item "9B216475-D73D-4518-851F-CACD0066A909") |
|
||||
;; ⇥ |
|
||||
(yas/item "ADC78A82-40C2-4AAC-8968-93AF0ED98DF0") |
|
||||
;; ⌫ |
|
||||
(yas/item "38E50882-27AF-4246-A039-355C3E1A699E") |
|
||||
;; ⌘ |
|
||||
(yas/item "7214ACD1-93D9-4D3F-A428-8A7302E0A35E") |
|
||||
;; ↓ |
|
||||
(yas/item "35654B4E-2D76-4CD3-8FBB-2DA1F314BA19") |
|
||||
;; → |
|
||||
(yas/item "AC15621A-8A16-40DD-A671-EA4C37637215") |
|
||||
;; ↑ |
|
||||
(yas/item "0E2F4A47-EADE-4A05-931E-FC874FA28FC3") |
|
||||
;; ⇧ |
|
||||
(yas/item "1B8D58B9-D9DB-484C-AACD-5D5DF5385308") |
|
||||
;; ⎋ |
|
||||
(yas/item "D7CC7C7C-CD01-4357-AF91-AEFFD914DF98") |
|
||||
;; ⌥ |
|
||||
(yas/item "980A8D39-CA8B-4EC2-9739-DC36A262F28E") |
|
||||
(yas/separator) |
|
||||
;; Ignoring Insert Entity… |
|
||||
(yas/ignore-item "89E5CC0A-3EFF-4DEF-A299-2E9651DE6529"))) |
|
||||
(yas/submenu "URL Escapes" |
|
||||
(;; Ignoring URL Escape Line / Selection |
|
||||
(yas/ignore-item "6B024865-6095-4CE3-8EDD-DC6F2230C2FF") |
|
||||
;; Ignoring URL Unescape Line / Selection |
|
||||
(yas/ignore-item "2C4C9673-B166-432A-8938-75A5CA622481"))) |
|
||||
;; Ignoring Encrypt Line / Selection (ROT 13) |
|
||||
(yas/ignore-item "9B13543F-8356-443C-B6E7-D9259B604927") |
|
||||
|
|
||||
;; Ignoring CodeCompletion HTML Attributes |
|
||||
(yas/ignore-item "CBD82CF3-74E9-4E7A-B3F6-9348754EB5AA") |
|
||||
;; Insert Open/Close Tag (With Current Word) |
|
||||
(yas/item "2ED44A32-C353-447F-BAE4-E3522DB6944D") |
|
||||
;; Ignoring Insert Close Tag |
|
||||
(yas/ignore-item "0658019F-3635-462E-AAC2-74E4FE508A9B") |
|
||||
(yas/submenu "Insert DocType" |
|
||||
(;; HTML — 4.01 Strict |
|
||||
(yas/item "944F1410-188C-4D70-8340-CECAA56FC7F2") |
|
||||
;; HTML — 4.01 Transitional |
|
||||
(yas/item "B2AAEE56-42D8-42C3-8F67-865473F50E8D") |
|
||||
(yas/separator) |
|
||||
;; XHTML — 1.0 Frameset |
|
||||
(yas/item "9ED6ABBE-A802-11D9-BFC8-000D93C8BE28") |
|
||||
;; XHTML — 1.0 Strict |
|
||||
(yas/item "C8B83564-A802-11D9-BFC8-000D93C8BE28") |
|
||||
;; XHTML — 1.0 Transitional |
|
||||
(yas/item "7D8C2F74-A802-11D9-BFC8-000D93C8BE28") |
|
||||
;; XHTML — 1.1 |
|
||||
(yas/item "5CE8FC6E-A802-11D9-BFC8-000D93C8BE28"))) |
|
||||
(yas/submenu "Insert Tag" |
|
||||
(;; Ignoring CodeCompletion HTML Tags |
|
||||
(yas/ignore-item "3463E85F-F500-49A0-8631-D78ED85F9D60") |
|
||||
|
|
||||
;; Base |
|
||||
(yas/item "4462A6B8-A08A-11D9-A5A2-000D93C8BE28") |
|
||||
;; Body |
|
||||
(yas/item "4905D47B-A08B-11D9-A5A2-000D93C8BE28") |
|
||||
;; Br |
|
||||
(yas/item "3E008E42-A5C9-11D9-9BCD-000D93C8BE28") |
|
||||
;; Div |
|
||||
(yas/item "576036C0-A60E-11D9-ABD6-000D93C8BE28") |
|
||||
;; Embed QT Movie |
|
||||
(yas/item "42F15753-9B6D-4DD8-984C-807B94363277") |
|
||||
;; Fieldset |
|
||||
(yas/item "9BD2BE01-A854-4D55-B584-725D04C075C0") |
|
||||
;; Form |
|
||||
(yas/item "232C2E8B-A08E-11D9-A5A2-000D93C8BE28") |
|
||||
;; Head |
|
||||
(yas/item "9CF008C4-A086-11D9-A5A2-000D93C8BE28") |
|
||||
;; Heading |
|
||||
(yas/item "65BA66DC-A07F-11D9-A5A2-000D93C8BE28") |
|
||||
;; Input |
|
||||
(yas/item "44180979-A08E-11D9-A5A2-000D93C8BE28") |
|
||||
;; Input with Label |
|
||||
(yas/item "D8DCCC81-749A-4E2A-B4BC-D109D5799CAA") |
|
||||
;; Link |
|
||||
(yas/item "77BFD0C0-A08A-11D9-A5A2-000D93C8BE28") |
|
||||
;; Mail Anchor |
|
||||
(yas/item "81DA4C74-A530-11D9-9BCD-000D93C8BE28") |
|
||||
;; Meta |
|
||||
(yas/item "DA99AC44-A083-11D9-A5A2-000D93C8BE28") |
|
||||
;; Option |
|
||||
(yas/item "5820372E-A093-4F38-B25C-B0CCC50A0FC4") |
|
||||
;; Script |
|
||||
(yas/item "6592050A-A087-11D9-A5A2-000D93C8BE28") |
|
||||
;; Script With External Source |
|
||||
(yas/item "7D676C4C-A087-11D9-A5A2-000D93C8BE28") |
|
||||
;; Select Box |
|
||||
(yas/item "26023CFF-C73F-4EF5-9803-E4DBA2CBEADD") |
|
||||
;; Style |
|
||||
(yas/item "3C518074-A088-11D9-A5A2-000D93C8BE28") |
|
||||
;; Table |
|
||||
(yas/item "57176082-A12F-11D9-A5A2-000D93C8BE28") |
|
||||
;; Text Area |
|
||||
(yas/item "AAC9D7B8-A12C-11D9-A5A2-000D93C8BE28") |
|
||||
;; Title |
|
||||
(yas/item "B62ECABE-A086-11D9-A5A2-000D93C8BE28"))) |
|
||||
|
|
||||
(yas/submenu "Includes" |
|
||||
(;; Ignoring Add Persistent Include |
|
||||
(yas/ignore-item "0D814247-7A00-46EE-A2A4-45FBBF4B1181") |
|
||||
;; Ignoring Update Document |
|
||||
(yas/ignore-item "4400BCE9-20E3-426E-B1D7-2C0BCA53BCF8") |
|
||||
;; Ignoring Help: Persistent Includes |
|
||||
(yas/ignore-item "9AFDEB2C-D9F0-423E-8211-EBB089F51F0C"))) |
|
||||
(yas/submenu "Format" |
|
||||
(;; Strong |
|
||||
(yas/item "4117D930-B6FA-4022-97E7-ECCAF4E70F63") |
|
||||
;; Emphasize |
|
||||
(yas/item "EBB98620-3292-4621-BA38-D8A9A65D9551"))) |
|
||||
(yas/submenu "Conditional Comments" |
|
||||
(;; IE Conditional Comment: Internet Explorer |
|
||||
(yas/item "0ED6DA73-F38F-4A65-B18F-3379D2BA9387") |
|
||||
;; IE Conditional Comment: Internet Explorer 5.0 only |
|
||||
(yas/item "3A517A94-001E-464D-8184-1FE56D0D0D70") |
|
||||
;; IE Conditional Comment: Internet Explorer 5.5 only |
|
||||
(yas/item "E3F8984E-7269-4981-9D30-967AB56A6ACE") |
|
||||
;; IE Conditional Comment: Internet Explorer 5.x |
|
||||
(yas/item "F3512848-7889-45DA-993B-0547976C8E6D") |
|
||||
;; IE Conditional Comment: Internet Explorer 6 and below |
|
||||
(yas/item "32BBB9AB-8732-4F91-A587-354941A27B69") |
|
||||
;; IE Conditional Comment: Internet Explorer 6 only |
|
||||
(yas/item "48DF7485-52EA-49B3-88AF-3A41F933F325") |
|
||||
;; IE Conditional Comment: Internet Explorer 7 and above |
|
||||
(yas/item "CBC24AF4-88E0-498B-BE50-934B9CF29EC7") |
|
||||
;; IE Conditional Comment: NOT Internet Explorer |
|
||||
(yas/item "F00170EE-4A82-413F-A88B-85293E69A88B"))) |
|
||||
|
|
||||
;; Wrap Selection in Open/Close Tag |
|
||||
(yas/item "BC8B8AE2-5F16-11D9-B9C3-000D93589AF6") |
|
||||
;; Wrap Each Selected Line in Open/Close Tag |
|
||||
(yas/item "991E7EBD-F3F5-469A-BA01-DC30E04AD472") |
|
||||
;; Wrap in <?= … ?> |
|
||||
(yas/item "912906A0-9A29-434B-AE98-E9DFDE6E48B4") |
|
||||
(yas/separator) |
|
||||
;; Ignoring Strip HTML Tags from Document / Selection |
|
||||
(yas/ignore-item "20D760B5-A127-11D9-A5A2-000D93C8BE28") |
|
||||
;; Ignoring Tidy |
|
||||
(yas/ignore-item "45F92B81-6F0E-11D9-A1E4-000D9332809C")) |
|
||||
'("7B7E945E-A112-11D9-A5A2-000D93C8BE28" |
|
||||
"3C44EABE-8D6F-4B1B-AB91-F419FAD1A0AD" |
|
||||
"9AFDEB2C-D9F0-423E-8211-EBB089F51F0C" |
|
||||
"CBD82CF3-74E9-4E7A-B3F6-9348754EB5AA" |
|
||||
"3463E85F-F500-49A0-8631-D78ED85F9D60" |
|
||||
"9B13543F-8356-443C-B6E7-D9259B604927" |
|
||||
"0D814247-7A00-46EE-A2A4-45FBBF4B1181" |
|
||||
"4400BCE9-20E3-426E-B1D7-2C0BCA53BCF8" |
|
||||
"6B024865-6095-4CE3-8EDD-DC6F2230C2FF" |
|
||||
"3DD8406C-A116-11D9-A5A2-000D93C8BE28" |
|
||||
"43C9E8AE-3E53-4B82-A1AF-56697BB3EF09" |
|
||||
"C183920D-A126-11D9-A5A2-000D93C8BE28" |
|
||||
"2C4C9673-B166-432A-8938-75A5CA622481" |
|
||||
"0658019F-3635-462E-AAC2-74E4FE508A9B" |
|
||||
"89E5CC0A-3EFF-4DEF-A299-2E9651DE6529" |
|
||||
"B8651C6E-A05E-11D9-86AC-000D93C8BE28" |
|
||||
"20D760B5-A127-11D9-A5A2-000D93C8BE28" |
|
||||
"45F92B81-6F0E-11D9-A1E4-000D9332809C" |
|
||||
"3F26240E-6E4A-11D9-B411-000D93589AF6" |
|
||||
"B23D6E15-6B33-11D9-86C1-000D93589AF6" |
|
||||
"C8B717C2-6B33-11D9-BB47-000D93589AF6" |
|
||||
"CD6D2CC6-6B33-11D9-BDFD-000D93589AF6" |
|
||||
"7B7E945E-A112-11D9-A5A2-000D93C8BE28" |
|
||||
"04332FA8-8157-46C4-9854-8C190FFD96C6" |
|
||||
"E6F19171-F664-4B4F-92DA-3E15E6CAD35C" |
|
||||
"26068A55-4C84-409D-BA00-162B55AF6961" |
|
||||
"EBEE6B51-29C7-4362-818F-A190CACD5296" |
|
||||
"65D38039-6B0A-48E9-9E49-43832ECC4107" |
|
||||
"CDE8EFD6-9DE2-4E8C-BB6A-52E8CCD2E977")) |
|
||||
|
|
||||
;; Unknown substitutions |
|
||||
;; |
|
||||
;; Substitutions for: content |
|
||||
;; |
|
||||
;; # as in Templates/XHTML 1.1/info.yasnippet |
|
||||
;; CDE8EFD6-9DE2-4E8C-BB6A-52E8CCD2E977 =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Snippets/IE Conditional Comment Internet Explorer.yasnippet |
|
||||
;; `(or (yas/selected-text) " IE Conditional Comment: Internet Explorer ")` =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Snippets/IE Conditional Comment Internet Explorer 5_0 only.yasnippet |
|
||||
;; `(or (yas/selected-text) " IE Conditional Comment: Internet Explorer 5.0 only ")` =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/CodeCompletion HTML Tags.yasnippet |
|
||||
;; 3463E85F-F500-49A0-8631-D78ED85F9D60 =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Snippets/Emphasize.yasnippet |
|
||||
;; `(yas/html-toggle-wrap yas/selected-text "em")` =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Templates/HTML 4.0 Transitional/info.yasnippet |
|
||||
;; E6F19171-F664-4B4F-92DA-3E15E6CAD35C =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Snippets/XHTML form.yasnippet |
|
||||
;; ${TM_FILENAME/(.*?)\..*/$1_submit/} =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Snippets/XHTML body.yasnippet |
|
||||
;; ${TM_FILENAME/(.*)\..*/\L$1/} =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Insert Entity.yasnippet |
|
||||
;; 89E5CC0A-3EFF-4DEF-A299-2E9651DE6529 =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Convert to HTML Entities.yasnippet |
|
||||
;; 3DD8406C-A116-11D9-A5A2-000D93C8BE28 =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Persistent Include.yasnippet |
|
||||
;; 0D814247-7A00-46EE-A2A4-45FBBF4B1181 =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Refresh All Active Browsers.yasnippet |
|
||||
;; B8651C6E-A05E-11D9-86AC-000D93C8BE28 =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Snippets/Strong.yasnippet |
|
||||
;; `(yas/html-toggle-wrap yas/selected-text "strong")` =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Snippets/IE Conditional Comment Internet Explorer 5_5 only.yasnippet |
|
||||
;; `(or (yas/selected-text) " IE Conditional Comment: Internet Explorer 5.5 only ")` =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in DragCommands/CSS Link.yasnippet |
|
||||
;; C8B717C2-6B33-11D9-BB47-000D93589AF6 =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Insert Close Tag.yasnippet |
|
||||
;; 0658019F-3635-462E-AAC2-74E4FE508A9B =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Decode Numeric URL Escapes in Line Selection.yasnippet |
|
||||
;; 2C4C9673-B166-432A-8938-75A5CA622481 =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Convert to named entities excl tags.yasnippet |
|
||||
;; 43C9E8AE-3E53-4B82-A1AF-56697BB3EF09 =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/About Persistent Includes.yasnippet |
|
||||
;; 9AFDEB2C-D9F0-423E-8211-EBB089F51F0C =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Snippets/XHTML meta.yasnippet |
|
||||
;; `yas/html-xhtml-attr` =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Templates/HTML 4.0 Strict/info.yasnippet |
|
||||
;; 04332FA8-8157-46C4-9854-8C190FFD96C6 =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Macros/Delete whitespace between tags.yasnippet |
|
||||
;; 7B7E945E-A112-11D9-A5A2-000D93C8BE28 =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in DragCommands/Anchor Tag.yasnippet |
|
||||
;; B23D6E15-6B33-11D9-86C1-000D93589AF6 =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Templates/XHTML 1.0 Transitional/info.yasnippet |
|
||||
;; 65D38039-6B0A-48E9-9E49-43832ECC4107 =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Snippets/XHTML title.yasnippet |
|
||||
;; ${TM_FILENAME/((.+)\..*)?/(?2:$2:Page Title)/} =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Tidy.yasnippet |
|
||||
;; 45F92B81-6F0E-11D9-A1E4-000D9332809C =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Strip HTML tags.yasnippet |
|
||||
;; 20D760B5-A127-11D9-A5A2-000D93C8BE28 =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Encrypt Line Selection (ROT 13).yasnippet |
|
||||
;; 9B13543F-8356-443C-B6E7-D9259B604927 =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Templates/XHTML 1.0 Strict/info.yasnippet |
|
||||
;; EBEE6B51-29C7-4362-818F-A190CACD5296 =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/W3C validation.yasnippet |
|
||||
;; 3F26240E-6E4A-11D9-B411-000D93589AF6 =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Convert Line Selection to URL Escapes.yasnippet |
|
||||
;; 6B024865-6095-4CE3-8EDD-DC6F2230C2FF =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Update Includes.yasnippet |
|
||||
;; 4400BCE9-20E3-426E-B1D7-2C0BCA53BCF8 =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/CodeCompletion HTML Attributes.yasnippet |
|
||||
;; CBD82CF3-74E9-4E7A-B3F6-9348754EB5AA =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Snippets/IE Conditional Comment Internet Explorer 6 and below.yasnippet |
|
||||
;; `(or (yas/selected-text) " IE Conditional Comment: Internet Explorer 6 and below ")` =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Snippets/IE Conditional Comment Internet Explorer 5_x.yasnippet |
|
||||
;; `(or (yas/selected-text) " IE Conditional Comment: Internet Explorer 5.x ")` =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in DragCommands/Image Tag.yasnippet |
|
||||
;; CD6D2CC6-6B33-11D9-BDFD-000D93589AF6 =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Snippets/IE Conditional Comment NOT Internet Explorer.yasnippet |
|
||||
;; `(or (yas/selected-text) " IE Conditional Comment: NOT Internet Explorer ")` =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Snippets/XHTML h1.yasnippet |
|
||||
;; `yas/selected-text` =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Templates/XHTML 1.0 Frameset/info.yasnippet |
|
||||
;; 26068A55-4C84-409D-BA00-162B55AF6961 =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Decode HTML Entities.yasnippet |
|
||||
;; C183920D-A126-11D9-A5A2-000D93C8BE28 =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Snippets/IE Conditional Comment Internet Explorer 7+.yasnippet |
|
||||
;; `(or (yas/selected-text) " IE Conditional Comment: Internet Explorer 7 and above ")` =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Snippets/IE Conditional Comment Internet Explorer 6 only.yasnippet |
|
||||
;; `(or (yas/selected-text) " IE Conditional Comment: Internet Explorer 6 only ")` =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; |
|
||||
|
|
||||
;; Substitutions for: condition |
|
||||
;; |
|
||||
;; # as in Snippets/XHTML head.yasnippet |
|
||||
;; text.html - text.html source =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/CodeCompletion HTML Attributes.yasnippet |
|
||||
;; text.html punctuation.definition.tag -source, text.html meta.tag -entity.other.attribute-name -source =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Snippets/Smart returnindent for tag pairs.yasnippet |
|
||||
;; meta.scope.between-tag-pair =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/CodeCompletion HTML Tags.yasnippet |
|
||||
;; text.html -entity.other.attribute-name -string.quoted, invalid.illegal.incomplete.html =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Snippets/Wrap Selection In Tag.yasnippet |
|
||||
;; text.html, =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Refresh All Active Browsers.yasnippet |
|
||||
;; text.html, source.css =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Templates/XHTML 1.1/info.yasnippet |
|
||||
;; text.html =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Documentation for Tag.yasnippet |
|
||||
;; text.html, text.html entity.name.tag =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Snippets/XHTML title.yasnippet |
|
||||
;; text.html - text.blog =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Snippets/Wrap in =.yasnippet |
|
||||
;; text.html string =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; |
|
||||
|
|
||||
;; Substitutions for: binding |
|
||||
;; |
|
||||
;; # as in Commands/Persistent Include.yasnippet |
|
||||
;; =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Snippets/XHTML   NonBreakingSpace.yasnippet |
|
||||
;; ~ =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Snippets/Smart returnindent for tag pairs.yasnippet |
|
||||
;;
=yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/W3C validation.yasnippet |
|
||||
;; ^V =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Insert Close Tag.yasnippet |
|
||||
;; ~@. =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Snippets/XHTML br.yasnippet |
|
||||
;; ^
=yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Insert Entity.yasnippet |
|
||||
;; @& =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Refresh All Active Browsers.yasnippet |
|
||||
;; @r =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/CodeCompletion HTML Tags.yasnippet |
|
||||
;; ~ =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Update Includes.yasnippet |
|
||||
;; ^@u =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Macros/Delete whitespace between tags.yasnippet |
|
||||
;; ^~ =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; # as in Commands/Tidy.yasnippet |
|
||||
;; ^H =yyas> (yas/unknown) |
|
||||
;; |
|
||||
;; |
|
||||
|
|
||||
;; .yas-setup.el for html-mode ends here |
|
||||
@ -1,88 +0,0 @@ |
|||||
(defun yas/objc-docset-query (query) |
|
||||
|
|
||||
) |
|
||||
(defvar yas/objc-method-names (make-vector 1023 0)) |
|
||||
(defvar yas/objc-class-names (make-vector 1023 0)) |
|
||||
|
|
||||
(defvar yas/objc-languages (list)) |
|
||||
(defvar yas/objc-defkinds (list)) |
|
||||
|
|
||||
|
|
||||
(defun yas/objc-extract-super-list () |
|
||||
(interactive) |
|
||||
(setq yas/objc-method-names (make-vector 1023 0) |
|
||||
yas/objc-class-names (make-vector 1023 0) |
|
||||
yas/objc-languages (list) |
|
||||
yas/objc-defkinds (list)) |
|
||||
(with-temp-buffer |
|
||||
(shell-command |
|
||||
"/Developer/usr/bin/docsetutil dump -skip-text /Developer/Documentation/DocSets/com.apple.adc.documentation.AppleSnowLeopard.CoreReference.docset/" |
|
||||
(current-buffer)) |
|
||||
(goto-char (point-min)) |
|
||||
(search-forward-regexp "API index contains .* tokens") |
|
||||
(while (search-forward-regexp "^\\([^/]*\\)/\\([^/]*\\)/\\([^/]*\\)/\\([^/]*\\)$" nil 'noerror) |
|
||||
(intern (match-string 3) yas/objc-class-names) |
|
||||
(intern (match-string 4) yas/objc-method-names) |
|
||||
(add-to-list 'yas/objc-languages (match-string 1)) |
|
||||
(add-to-list 'yas/objc-defkinds (match-string 2))))) |
|
||||
|
|
||||
;; (put (intern-soft (setq chosen (completing-read "Method: " yas/objc-method-names)) yas/objc-method-names) |
|
||||
;; 'someshit |
|
||||
;; 'someday) |
|
||||
|
|
||||
;; (completing-read "Class: " yas/objc-class-names) |
|
||||
|
|
||||
;; (get (intern-soft (setq chosen (completing-read "hey: " yas/objc-method-names)) yas/objc-method-names) |
|
||||
;; 'someshit) |
|
||||
|
|
||||
(defun yas/objc-current-method-signature () |
|
||||
(let ((orig-point (point)) |
|
||||
(start-point nil) |
|
||||
sig |
|
||||
orig-ppss |
|
||||
ppss) |
|
||||
(save-excursion |
|
||||
(condition-case nil |
|
||||
(while (not (eq (point) (point-min))) (backward-sexp)) |
|
||||
(error nil)) |
|
||||
(when (eq (preceding-char) ?\[) |
|
||||
(setq orig-ppss (syntax-ppss)) |
|
||||
(forward-sexp) |
|
||||
(skip-chars-forward " \t\n") |
|
||||
(setq ppss (syntax-ppss)) |
|
||||
(while (and (>= (car ppss) (car orig-ppss)) |
|
||||
(search-forward-regexp "[[:alpha:]]+:" nil 'noerror)) |
|
||||
(setq ppss (syntax-ppss)) |
|
||||
(when (eq (car ppss) (car orig-ppss)) |
|
||||
(setq sig |
|
||||
(concat (or sig "") (match-string-no-properties 0))))) |
|
||||
sig)))) |
|
||||
|
|
||||
(defun yas/objc-current-method-signature () |
|
||||
(let ((orig-point (point)) |
|
||||
(start-point nil) |
|
||||
sig |
|
||||
orig-ppss |
|
||||
ppss) |
|
||||
(save-excursion |
|
||||
(condition-case nil |
|
||||
(while (not (eq (point) (point-max))) (backward-sexp)) |
|
||||
(error )) |
|
||||
(when (eq (preceding-char) ?\[) |
|
||||
(setq orig-ppss (syntax-ppss)) |
|
||||
(forward-sexp) |
|
||||
(skip-chars-forward " \t\n") |
|
||||
(setq ppss (syntax-ppss)) |
|
||||
(condition-case nil |
|
||||
(while (and (>= (car ppss) (car orig-ppss)) |
|
||||
(search-forward-regexp "[[:alpha:]]+:" orig-point 'noerror)) |
|
||||
(setq ppss (syntax-ppss)) |
|
||||
(when (eq (car ppss) (car orig-ppss)) |
|
||||
(setq sig |
|
||||
(concat (or sig "") (match-string-no-properties 0)))) |
|
||||
(forward-sexp)) |
|
||||
(error nil)) |
|
||||
(save-excursion |
|
||||
(backward-word) |
|
||||
(concat sig (buffer-substring-no-properties (point) orig-point))) |
|
||||
sig)))) |
|
||||
59477
vendor/yasnippet/extras/imported/objc-mode/Support/alldefs.txt
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1257
vendor/yasnippet/extras/imported/rails-mode/.yas-setup.el
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1032
vendor/yasnippet/extras/imported/ruby-mode/.yas-setup.el
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,467 +0,0 @@ |
|||||
#!/usr/bin/env ruby |
|
||||
# -*- coding: utf-8 -*- |
|
||||
# textmate_import.rb --- import textmate snippets |
|
||||
# |
|
||||
# Copyright (C) 2009 Rob Christie, 2010 João Távora |
|
||||
# |
|
||||
# This is a quick script to generate YASnippets from TextMate Snippets. |
|
||||
# |
|
||||
# I based the script off of a python script of a similar nature by |
|
||||
# Jeff Wheeler: http://nokrev.com |
|
||||
# http://code.nokrev.com/?p=snippet-copier.git;a=blob_plain;f=snippet_copier.py |
|
||||
# |
|
||||
# Use textmate_import.rb --help to get usage information. |
|
||||
|
|
||||
require 'rubygems' |
|
||||
require 'plist' |
|
||||
require 'trollop' |
|
||||
require 'fileutils' |
|
||||
require 'shellwords' # String#shellescape |
|
||||
require 'ruby-debug' if $DEBUG |
|
||||
|
|
||||
|
|
||||
opts = Trollop::options do |
|
||||
opt :bundle_dir, "TextMate bundle directory", :short => '-d', :type => :string |
|
||||
opt :output_dir, "Output directory", :short => '-o', :type => :string |
|
||||
opt :glob, "Specific snippet file (or glob) inside <bundle_dir>", :short => '-g', :default => '*.{tmSnippet,tmCommand,plist,tmMacro}' |
|
||||
opt :pretty, 'Pretty prints multiple snippets when printing to standard out', :short => '-p' |
|
||||
opt :quiet, "Be quiet", :short => '-q' |
|
||||
opt :plist_file, "Use a specific plist file to derive menu information from", :type => :string |
|
||||
end |
|
||||
Trollop::die :bundle_dir, "must be provided" unless opts.bundle_dir |
|
||||
Trollop::die :bundle_dir, "must exist" unless File.directory? opts.bundle_dir |
|
||||
|
|
||||
Trollop::die :output_dir, "must be provided" unless opts.output_dir |
|
||||
Trollop::die :output_dir, "must exist" unless File.directory? opts.output_dir |
|
||||
|
|
||||
Trollop::die :plist_file, "must exist" if opts.plist_file && File.directory?(opts.plist_file) |
|
||||
|
|
||||
|
|
||||
# Represents and is capable of outputting the representation of a |
|
||||
# TextMate menu in terms of `yas/define-menu' |
|
||||
# |
|
||||
class TmSubmenu |
|
||||
|
|
||||
@@excluded_items = []; |
|
||||
def self.excluded_items; @@excluded_items; end |
|
||||
|
|
||||
attr_reader :items, :name |
|
||||
def initialize(name, hash) |
|
||||
@items = hash["items"] |
|
||||
@name = name |
|
||||
end |
|
||||
|
|
||||
def to_lisp(allsubmenus, |
|
||||
deleteditems, |
|
||||
indent = 0, |
|
||||
thingy = ["(", ")"]) |
|
||||
|
|
||||
first = true; |
|
||||
|
|
||||
string = "" |
|
||||
separator_useless = true; |
|
||||
items.each do |uuid| |
|
||||
if deleteditems && deleteditems.index(uuid) |
|
||||
$stderr.puts "#{uuid} has been deleted!" |
|
||||
next |
|
||||
end |
|
||||
string += "\n" |
|
||||
string += " " * indent |
|
||||
string += (first ? thingy[0] : (" " * thingy[0].length)) |
|
||||
|
|
||||
submenu = allsubmenus[uuid] |
|
||||
snippet = TmSnippet::snippets_by_uid[uuid] |
|
||||
unimplemented = TmSnippet::unknown_substitutions["content"][uuid] |
|
||||
if submenu |
|
||||
str = "(yas/submenu " |
|
||||
string += str + "\"" + submenu.name + "\"" |
|
||||
string += submenu.to_lisp(allsubmenus, deleteditems, |
|
||||
indent + str.length + thingy[0].length) |
|
||||
elsif snippet and not unimplemented |
|
||||
string += ";; " + snippet.name + "\n" |
|
||||
string += " " * (indent + thingy[0].length) |
|
||||
string += "(yas/item \"" + uuid + "\")" |
|
||||
separator_useless = false; |
|
||||
elsif snippet and unimplemented |
|
||||
string += ";; Ignoring " + snippet.name + "\n" |
|
||||
string += " " * (indent + thingy[0].length) |
|
||||
string += "(yas/ignore-item \"" + uuid + "\")" |
|
||||
separator_useless = true; |
|
||||
elsif (uuid =~ /---------------------/) |
|
||||
string += "(yas/separator)" unless separator_useless |
|
||||
end |
|
||||
first = false; |
|
||||
end |
|
||||
string += ")" |
|
||||
string += thingy[1] |
|
||||
|
|
||||
return string |
|
||||
end |
|
||||
|
|
||||
def self.main_menu_to_lisp (parsed_plist, modename) |
|
||||
mainmenu = parsed_plist["mainMenu"] |
|
||||
deleted = parsed_plist["deleted"] |
|
||||
|
|
||||
root = TmSubmenu.new("__main_menu__", mainmenu) |
|
||||
all = {} |
|
||||
|
|
||||
mainmenu["submenus"].each_pair do |k,v| |
|
||||
all[k] = TmSubmenu.new(v["name"], v) |
|
||||
end |
|
||||
|
|
||||
excluded = (mainmenu["excludedItems"] || []) + TmSubmenu::excluded_items |
|
||||
closing = "\n '(" |
|
||||
closing+= excluded.collect do |uuid| |
|
||||
"\"" + uuid + "\"" |
|
||||
end.join( "\n ") + "))" |
|
||||
|
|
||||
str = "(yas/define-menu " |
|
||||
return str + "'#{modename}" + root.to_lisp(all, |
|
||||
deleted, |
|
||||
str.length, |
|
||||
["'(" , closing]) |
|
||||
end |
|
||||
end |
|
||||
|
|
||||
|
|
||||
# Represents a textmate snippet |
|
||||
# |
|
||||
# - @file is the .tmsnippet/.plist file path relative to cwd |
|
||||
# |
|
||||
# - optional @info is a Plist.parsed info.plist found in the bundle dir |
|
||||
# |
|
||||
# - @@snippets_by_uid is where one can find all the snippets parsed so |
|
||||
# far. |
|
||||
# |
|
||||
# |
|
||||
class SkipSnippet < RuntimeError; end |
|
||||
class TmSnippet |
|
||||
@@known_substitutions = { |
|
||||
"content" => { |
|
||||
"${TM_RAILS_TEMPLATE_START_RUBY_EXPR}" => "<%= ", |
|
||||
"${TM_RAILS_TEMPLATE_END_RUBY_EXPR}" => " %>", |
|
||||
"${TM_RAILS_TEMPLATE_START_RUBY_INLINE}" => "<% ", |
|
||||
"${TM_RAILS_TEMPLATE_END_RUBY_INLINE}" => " -%>", |
|
||||
"${TM_RAILS_TEMPLATE_END_RUBY_BLOCK}" => "end" , |
|
||||
"${0:$TM_SELECTED_TEXT}" => "${0:`yas/selected-text`}", |
|
||||
/\$\{(\d+)\}/ => "$\\1", |
|
||||
"${1:$TM_SELECTED_TEXT}" => "${1:`yas/selected-text`}", |
|
||||
"${2:$TM_SELECTED_TEXT}" => "${2:`yas/selected-text`}", |
|
||||
'$TM_SELECTED_TEXT' => "`yas/selected-text`", |
|
||||
%r'\$\{TM_SELECTED_TEXT:([^\}]*)\}' => "`(or (yas/selected-text) \"\\1\")`", |
|
||||
%r'`[^`]+\n[^`]`' => Proc.new {|uuid, match| "(yas/multi-line-unknown " + uuid + ")"}}, |
|
||||
"condition" => { |
|
||||
/^source\..*$/ => "" }, |
|
||||
"binding" => {}, |
|
||||
"type" => {} |
|
||||
} |
|
||||
|
|
||||
def self.extra_substitutions; @@extra_substitutions; end |
|
||||
@@extra_substitutions = { |
|
||||
"content" => {}, |
|
||||
"condition" => {}, |
|
||||
"binding" => {}, |
|
||||
"type" => {} |
|
||||
} |
|
||||
|
|
||||
def self.unknown_substitutions; @@unknown_substitutions; end |
|
||||
@@unknown_substitutions = { |
|
||||
"content" => {}, |
|
||||
"condition" => {}, |
|
||||
"binding" => {}, |
|
||||
"type" => {} |
|
||||
} |
|
||||
|
|
||||
@@snippets_by_uid={} |
|
||||
def self.snippets_by_uid; @@snippets_by_uid; end |
|
||||
|
|
||||
def initialize(file,info=nil) |
|
||||
@file = file |
|
||||
@info = info |
|
||||
@snippet = TmSnippet::read_plist(file) |
|
||||
@@snippets_by_uid[self.uuid] = self; |
|
||||
raise SkipSnippet.new "not a snippet/command/macro." unless (@snippet["scope"] || @snippet["command"]) |
|
||||
raise SkipSnippet.new "looks like preferences."if @file =~ /Preferences\// |
|
||||
raise RuntimeError.new("Cannot convert this snippet #{file}!") unless @snippet; |
|
||||
end |
|
||||
|
|
||||
def name |
|
||||
@snippet["name"] |
|
||||
end |
|
||||
|
|
||||
def uuid |
|
||||
@snippet["uuid"] |
|
||||
end |
|
||||
|
|
||||
def key |
|
||||
@snippet["tabTrigger"] |
|
||||
end |
|
||||
|
|
||||
def condition |
|
||||
yas_directive "condition" |
|
||||
end |
|
||||
|
|
||||
def type |
|
||||
override = yas_directive "type" |
|
||||
if override |
|
||||
return override |
|
||||
else |
|
||||
return "# type: command\n" if @file =~ /(Commands\/|Macros\/)/ |
|
||||
end |
|
||||
end |
|
||||
|
|
||||
def binding |
|
||||
yas_directive "binding" |
|
||||
end |
|
||||
|
|
||||
def content |
|
||||
known = @@known_substitutions["content"] |
|
||||
extra = @@extra_substitutions["content"] |
|
||||
if direct = extra[uuid] |
|
||||
return direct |
|
||||
else |
|
||||
ct = @snippet["content"] |
|
||||
if ct |
|
||||
known.each_pair do |k,v| |
|
||||
if v.respond_to? :call |
|
||||
ct.gsub!(k) {|match| v.call(uuid, match)} |
|
||||
else |
|
||||
ct.gsub!(k,v) |
|
||||
end |
|
||||
end |
|
||||
extra.each_pair do |k,v| |
|
||||
ct.gsub!(k,v) |
|
||||
end |
|
||||
# the remaining stuff is an unknown substitution |
|
||||
# |
|
||||
[ %r'\$\{ [^/\}\{:]* / [^/]* / [^/]* / [^\}]*\}'x , |
|
||||
%r'\$\{[^\d][^}]+\}', |
|
||||
%r'`[^`]+`', |
|
||||
%r'\$TM_[\w_]+', |
|
||||
%r'\(yas/multi-line-unknown [^\)]*\)' |
|
||||
].each do |reg| |
|
||||
ct.scan(reg) do |match| |
|
||||
@@unknown_substitutions["content"][match] = self |
|
||||
end |
|
||||
end |
|
||||
return ct |
|
||||
else |
|
||||
@@unknown_substitutions["content"][uuid] = self |
|
||||
TmSubmenu::excluded_items.push(uuid) |
|
||||
return "(yas/unimplemented)" |
|
||||
end |
|
||||
end |
|
||||
end |
|
||||
|
|
||||
def to_yas |
|
||||
doc = "# -*- mode: snippet -*-\n" |
|
||||
doc << (self.type || "") |
|
||||
doc << "# uuid: #{self.uuid}\n" |
|
||||
doc << "# key: #{self.key}\n" if self.key |
|
||||
doc << "# contributor: Translated from textmate snippet by PROGRAM_NAME\n" |
|
||||
doc << "# name: #{self.name}\n" |
|
||||
doc << (self.binding || "") |
|
||||
doc << (self.condition || "") |
|
||||
doc << "# --\n" |
|
||||
doc << (self.content || "(yas/unimplemented)") |
|
||||
doc |
|
||||
end |
|
||||
|
|
||||
def self.canonicalize(filename) |
|
||||
invalid_char = /[^ a-z_0-9.+=~(){}\/'`&#,-]/i |
|
||||
|
|
||||
filename. |
|
||||
gsub(invalid_char, ''). # remove invalid characters |
|
||||
gsub(/ {2,}/,' '). # squeeze repeated spaces into a single one |
|
||||
rstrip # remove trailing whitespaces |
|
||||
end |
|
||||
|
|
||||
def yas_file() |
|
||||
File.join(TmSnippet::canonicalize(@file[0, @file.length-File.extname(@file).length]) + ".yasnippet") |
|
||||
end |
|
||||
|
|
||||
def self.read_plist(xml_or_binary) |
|
||||
begin |
|
||||
parsed = Plist::parse_xml(xml_or_binary) |
|
||||
return parsed if parsed |
|
||||
raise ArgumentError.new "Probably in binary format and parse_xml is very quiet..." |
|
||||
rescue StandardError => e |
|
||||
if (system "plutil -convert xml1 #{xml_or_binary.shellescape} -o /tmp/textmate_import.tmpxml") |
|
||||
return Plist::parse_xml("/tmp/textmate_import.tmpxml") |
|
||||
else |
|
||||
raise RuntimeError.new "plutil failed miserably, check if you have it..." |
|
||||
end |
|
||||
end |
|
||||
end |
|
||||
|
|
||||
private |
|
||||
|
|
||||
@@yas_to_tm_directives = {"condition" => "scope", "binding" => "keyEquivalent", "key" => "tabTrigger"} |
|
||||
def yas_directive(yas_directive) |
|
||||
# |
|
||||
# Merge "known" hardcoded substitution with "extra" substitutions |
|
||||
# provided in the .yas-setup.el file. |
|
||||
# |
|
||||
merged = @@known_substitutions[yas_directive]. |
|
||||
merge(@@extra_substitutions[yas_directive]) |
|
||||
# |
|
||||
# First look for an uuid-based direct substitution for this |
|
||||
# directive. |
|
||||
# |
|
||||
if direct = merged[uuid] |
|
||||
return "# #{yas_directive}: "+ direct + "\n" unless direct.empty? |
|
||||
else |
|
||||
tm_directive = @@yas_to_tm_directives[yas_directive] |
|
||||
val = tm_directive && @snippet[tm_directive] |
|
||||
if val and !val.delete(" ").empty? then |
|
||||
# |
|
||||
# Sort merged substitutions by length (bigger ones first, |
|
||||
# regexps last), and apply them to the value gotten for plist. |
|
||||
# |
|
||||
allsubs = merged.sort_by do |what, with| |
|
||||
if what.respond_to? :length then -what.length else 0 end |
|
||||
end |
|
||||
allsubs.each do |sub| |
|
||||
if val.gsub!(sub[0],sub[1]) |
|
||||
# puts "SUBBED #{sub[0]} for #{sub[1]}" |
|
||||
return "# #{yas_directive}: "+ val + "\n" unless val.empty? |
|
||||
end |
|
||||
end |
|
||||
# |
|
||||
# If we get here, no substitution matched, so mark this an |
|
||||
# unknown substitution. |
|
||||
# |
|
||||
@@unknown_substitutions[yas_directive][val] = self |
|
||||
return "## #{yas_directive}: \""+ val + "\n" |
|
||||
end |
|
||||
end |
|
||||
end |
|
||||
|
|
||||
end |
|
||||
|
|
||||
|
|
||||
if __FILE__ == $PROGRAM_NAME |
|
||||
# Read the the bundle's info.plist if can find it/guess it |
|
||||
# |
|
||||
info_plist_file = opts.plist_file || File.join(opts.bundle_dir,"info.plist") |
|
||||
info_plist = TmSnippet::read_plist(info_plist_file) if info_plist_file and File.readable? info_plist_file; |
|
||||
|
|
||||
# Calculate the mode name |
|
||||
# |
|
||||
modename = File.basename opts.output_dir || "major-mode-name" |
|
||||
|
|
||||
# Read in .yas-setup.el looking for the separator between auto-generated |
|
||||
# |
|
||||
original_dir = Dir.pwd |
|
||||
yas_setup_el_file = File.join(original_dir, opts.output_dir, ".yas-setup.el") |
|
||||
separator = ";; --**--" |
|
||||
whole, head , tail = "", "", "" |
|
||||
if File::exists? yas_setup_el_file |
|
||||
File.open yas_setup_el_file, 'r' do |file| |
|
||||
whole = file.read |
|
||||
head , tail = whole.split(separator) |
|
||||
end |
|
||||
else |
|
||||
head = ";; .yas-setup.el for #{modename}\n" + ";; \n" |
|
||||
end |
|
||||
|
|
||||
# Now iterate the tail part to find extra substitutions |
|
||||
# |
|
||||
tail ||= "" |
|
||||
head ||= "" |
|
||||
directive = nil |
|
||||
# puts "get this head #{head}" |
|
||||
head.each_line do |line| |
|
||||
case line |
|
||||
when /^;; Substitutions for:(.*)$/ |
|
||||
directive = $~[1].strip |
|
||||
# puts "found the directove #{directive}" |
|
||||
when /^;;(.*)[ ]+=yyas>(.*)$/ |
|
||||
replacewith = $~[2].strip |
|
||||
lookfor = $~[1] |
|
||||
lookfor.gsub!(/^[ ]*/, "") |
|
||||
lookfor.gsub!(/[ ]*$/, "") |
|
||||
# puts "found this wonderful substitution for #{directive} which is #{lookfor} => #{replacewith}" |
|
||||
unless !directive or replacewith =~ /yas\/unknown/ then |
|
||||
TmSnippet.extra_substitutions[directive][lookfor] = replacewith |
|
||||
end |
|
||||
end |
|
||||
end |
|
||||
|
|
||||
# Glob snippets into snippet_files, going into subdirs |
|
||||
# |
|
||||
Dir.chdir opts.bundle_dir |
|
||||
snippet_files_glob = File.join("**", opts.glob) |
|
||||
snippet_files = Dir.glob(snippet_files_glob) |
|
||||
|
|
||||
# Attempt to convert each snippet files in snippet_files |
|
||||
# |
|
||||
puts "Will try to convert #{snippet_files.length} snippets...\n" unless opts.quiet |
|
||||
|
|
||||
|
|
||||
# Iterate the globbed files |
|
||||
# |
|
||||
snippet_files.each do |file| |
|
||||
begin |
|
||||
$stdout.print "Processing \"#{File.join(opts.bundle_dir,file)}\"..." unless opts.quiet |
|
||||
snippet = TmSnippet.new(file,info_plist) |
|
||||
|
|
||||
file_to_create = File.join(original_dir, opts.output_dir, snippet.yas_file) |
|
||||
FileUtils.mkdir_p(File.dirname(file_to_create)) |
|
||||
File.open(file_to_create, 'w') do |f| |
|
||||
f.write(snippet.to_yas) |
|
||||
end |
|
||||
$stdout.print "done\n" unless opts.quiet |
|
||||
rescue SkipSnippet => e |
|
||||
$stdout.print "skipped! #{e.message}\n" unless opts.quiet |
|
||||
rescue RuntimeError => e |
|
||||
$stderr.print "failed! #{e.message}\n" |
|
||||
$strerr.print "#{e.backtrace.join("\n")}" unless opts.quiet |
|
||||
end |
|
||||
end |
|
||||
|
|
||||
# Attempt to decypher the menu |
|
||||
# |
|
||||
menustr = TmSubmenu::main_menu_to_lisp(info_plist, modename) if info_plist |
|
||||
puts menustr if $DEBUG |
|
||||
|
|
||||
# Write some basic .yas-* files |
|
||||
# |
|
||||
if opts.output_dir |
|
||||
FileUtils.mkdir_p opts.output_dir |
|
||||
FileUtils.touch File.join(original_dir, opts.output_dir, ".yas-make-groups") unless menustr |
|
||||
|
|
||||
# Now, output head + a new tail in (possibly new) .yas-setup.el |
|
||||
# file |
|
||||
# |
|
||||
File.open yas_setup_el_file, 'w' do |file| |
|
||||
file.puts head |
|
||||
file.puts separator |
|
||||
file.puts ";; Automatically generated code, do not edit this part" |
|
||||
file.puts ";; " |
|
||||
file.puts ";; Translated menu" |
|
||||
file.puts ";; " |
|
||||
file.puts menustr |
|
||||
file.puts |
|
||||
file.puts ";; Unknown substitutions" |
|
||||
file.puts ";; " |
|
||||
["content", "condition", "binding"].each do |type| |
|
||||
file.puts ";; Substitutions for: #{type}" |
|
||||
file.puts ";; " |
|
||||
# TmSnippet::extra_substitutions[type]. |
|
||||
# each_pair do |k,v| |
|
||||
# file.puts ";; " + k + "" + (" " * [1, 90-k.length].max) + " =yyas> " + v |
|
||||
# end |
|
||||
unknown = TmSnippet::unknown_substitutions[type]; |
|
||||
unknown.keys.uniq.each do |k| |
|
||||
file.puts ";; # as in " + unknown[k].yas_file |
|
||||
file.puts ";; " + k + "" + (" " * [1, 90-k.length].max) + " =yyas> (yas/unknown)" |
|
||||
file.puts ";; " |
|
||||
end |
|
||||
file.puts ";; " |
|
||||
file.puts |
|
||||
end |
|
||||
file.puts ";; .yas-setup.el for #{modename} ends here" |
|
||||
end |
|
||||
end |
|
||||
end |
|
||||
@ -1 +0,0 @@ |
|||||
cc-mode |
|
||||
@ -1,4 +0,0 @@ |
|||||
# name: v.begin(), v.end() |
|
||||
# key: beginend |
|
||||
# -- |
|
||||
${1:v}.begin(), $1.end |
|
||||
@ -1,9 +0,0 @@ |
|||||
# name: class ... { ... } |
|
||||
# key: class |
|
||||
# -- |
|
||||
class ${1:Name} |
|
||||
{ |
|
||||
public: |
|
||||
${1:$(yas/substr text "[^: ]*")}($2); |
|
||||
virtual ~${1:$(yas/substr text "[^: ]*")}(); |
|
||||
}; |
|
||||
@ -1,4 +0,0 @@ |
|||||
# name: namespace ... |
|
||||
# key: ns |
|
||||
# -- |
|
||||
namespace |
|
||||
@ -1,4 +0,0 @@ |
|||||
# name: template <typename ...> |
|
||||
# key: template |
|
||||
# -- |
|
||||
template <typename ${T}> |
|
||||
@ -1,5 +0,0 @@ |
|||||
# name: using namespace ... |
|
||||
# key: using |
|
||||
# -- |
|
||||
using namespace ${std}; |
|
||||
$0 |
|
||||
@ -1 +0,0 @@ |
|||||
cc-mode |
|
||||
@ -1,4 +0,0 @@ |
|||||
# name: FILE *fp = fopen(..., ...); |
|
||||
# key: fopen |
|
||||
# -- |
|
||||
FILE *${fp} = fopen(${"file"}, "${r}"); |
|
||||
@ -1,7 +0,0 @@ |
|||||
# -*- mode: snippet -*- |
|
||||
# name: printf |
|
||||
# contributor: joaotavora |
|
||||
# key: printf |
|
||||
# -- |
|
||||
printf ("${1:%s}\\n"${1:$(if (string-match "%" text) "," "\);") |
|
||||
}$2${1:$(if (string-match "%" text) "\);" "")} |
|
||||
@ -1 +0,0 @@ |
|||||
text-mode |
|
||||
@ -1,7 +0,0 @@ |
|||||
# name: do { ... } while (...) |
|
||||
# key: do |
|
||||
# -- |
|
||||
do |
|
||||
{ |
|
||||
$0 |
|
||||
} while (${1:condition}); |
|
||||
@ -1,7 +0,0 @@ |
|||||
# name: for (...; ...; ...) { ... } |
|
||||
# key: for |
|
||||
# -- |
|
||||
for (${1:int i = 0}; ${2:i < N}; ${3:++i}) |
|
||||
{ |
|
||||
$0 |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
# name: if (...) { ... } |
|
||||
# key: if |
|
||||
# -- |
|
||||
if (${1:condition}) |
|
||||
{ |
|
||||
$0 |
|
||||
} |
|
||||
@ -1,4 +0,0 @@ |
|||||
# name: #include "..." |
|
||||
# key: inc |
|
||||
# -- |
|
||||
#include "$1" |
|
||||
@ -1,4 +0,0 @@ |
|||||
# name: #include <...> |
|
||||
# key: inc |
|
||||
# -- |
|
||||
#include <$1> |
|
||||
@ -1,8 +0,0 @@ |
|||||
# name: int main(argc, argv) { ... } |
|
||||
# key: main |
|
||||
# -- |
|
||||
int main(int argc, char *argv[]) |
|
||||
{ |
|
||||
$0 |
|
||||
return 0; |
|
||||
} |
|
||||
@ -1,9 +0,0 @@ |
|||||
# name: #ifndef XXX; #define XXX; #endif |
|
||||
# key: once |
|
||||
# -- |
|
||||
#ifndef ${1:_`(upcase (file-name-nondirectory (file-name-sans-extension (buffer-file-name))))`_H_} |
|
||||
#define $1 |
|
||||
|
|
||||
$0 |
|
||||
|
|
||||
#endif /* $1 */ |
|
||||
@ -1,7 +0,0 @@ |
|||||
# name: struct ... { ... } |
|
||||
# key: struct |
|
||||
# -- |
|
||||
struct ${1:name} |
|
||||
{ |
|
||||
$0 |
|
||||
}; |
|
||||
@ -1 +0,0 @@ |
|||||
perl-mode |
|
||||
@ -1 +0,0 @@ |
|||||
cc-mode |
|
||||
@ -1,8 +0,0 @@ |
|||||
# contributor: Alejandro Espinoza Esparza <aespinoza@structum.com.mx> |
|
||||
# name: private attribute ....; |
|
||||
# key: attrib |
|
||||
# -- |
|
||||
/// <summary> |
|
||||
/// $3 |
|
||||
/// </summary> |
|
||||
private $1 $2; |
|
||||
@ -1,22 +0,0 @@ |
|||||
# contributor: Alejandro Espinoza Esparza <aespinoza@structum.com.mx> |
|
||||
# name: private attribute ....; public property ... ... { ... } |
|
||||
# key: attrib |
|
||||
# -- |
|
||||
/// <summary> |
|
||||
/// $3 |
|
||||
/// </summary> |
|
||||
private $1 $2; |
|
||||
|
|
||||
/// <summary> |
|
||||
/// $4 |
|
||||
/// </summary> |
|
||||
/// <value>$5</value> |
|
||||
public $1 $2 |
|
||||
{ |
|
||||
get { |
|
||||
return this.$2; |
|
||||
} |
|
||||
set { |
|
||||
this.$2 = value; |
|
||||
} |
|
||||
} |
|
||||
@ -1,22 +0,0 @@ |
|||||
# contributor: Alejandro Espinoza Esparza <aespinoza@structum.com.mx> |
|
||||
# name: private _attribute ....; public Property ... ... { ... } |
|
||||
# key: attrib |
|
||||
# -- |
|
||||
/// <summary> |
|
||||
/// $3 |
|
||||
/// </summary> |
|
||||
private $1 ${2:$(if (> (length text) 0) (format "_%s%s" (downcase (substring text 0 1)) (substring text 1 (length text))) "")}; |
|
||||
|
|
||||
/// <summary> |
|
||||
/// ${3:Description} |
|
||||
/// </summary> |
|
||||
/// <value><c>$1</c></value> |
|
||||
public ${1:Type} ${2:Name} |
|
||||
{ |
|
||||
get { |
|
||||
return this.${2:$(if (> (length text) 0) (format "_%s%s" (downcase (substring text 0 1)) (substring text 1 (length text))) "")}; |
|
||||
} |
|
||||
set { |
|
||||
this.${2:$(if (> (length text) 0) (format "_%s%s" (downcase (substring text 0 1)) (substring text 1 (length text))) "")} = value; |
|
||||
} |
|
||||
} |
|
||||
@ -1,22 +0,0 @@ |
|||||
# contributor: Alejandro Espinoza Esparza <aespinoza@structum.com.mx> |
|
||||
# name: class ... { ... } |
|
||||
# key: class |
|
||||
# -- |
|
||||
${5:public} class ${1:Name} |
|
||||
{ |
|
||||
#region Ctor & Destructor |
|
||||
/// <summary> |
|
||||
/// ${3:Standard Constructor} |
|
||||
/// </summary> |
|
||||
public $1($2) |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
/// <summary> |
|
||||
/// ${4:Default Destructor} |
|
||||
/// </summary> |
|
||||
public ~$1() |
|
||||
{ |
|
||||
} |
|
||||
#endregion |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
# contributor: Alejandro Espinoza Esparza <aespinoza@structum.com.mx> |
|
||||
# name: /// <summary> ... </summary> |
|
||||
# key: comment |
|
||||
# -- |
|
||||
/// <summary> |
|
||||
/// $1 |
|
||||
/// </summary> |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: Alejandro Espinoza Esparza <aespinoza@structum.com.mx> |
|
||||
# name: /// <param name="..."> ... </param> |
|
||||
# key: comment |
|
||||
# -- |
|
||||
/// <param name="$1">$2</param> |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: Alejandro Espinoza Esparza <aespinoza@structum.com.mx> |
|
||||
# name: /// <param name="..."> ... </param> |
|
||||
# key: comment |
|
||||
# -- |
|
||||
/// <returns>$1</returns> |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: Alejandro Espinoza Esparza <aespinoza@structum.com.mx> |
|
||||
# name: /// <exception cref="..."> ... </exception> |
|
||||
# key: comment |
|
||||
# -- |
|
||||
/// <exception cref="$1">$2</exception> |
|
||||
@ -1,11 +0,0 @@ |
|||||
# contributor: Alejandro Espinoza Esparza <aespinoza@structum.com.mx> |
|
||||
# name: public void Method { ... } |
|
||||
# key: method |
|
||||
# -- |
|
||||
/// <summary> |
|
||||
/// ${5:Description} |
|
||||
/// </summary>${2:$(if (string= (upcase text) "VOID") "" (format "%s%s%s" "\n/// <returns><c>" text "</c></returns>"))} |
|
||||
${1:public} ${2:void} ${3:MethodName}($4) |
|
||||
{ |
|
||||
$0 |
|
||||
} |
|
||||
@ -1,8 +0,0 @@ |
|||||
# contributor: Alejandro Espinoza Esparza <aespinoza@structum.com.mx> |
|
||||
# name: namespace .. { ... } |
|
||||
# key: namespace |
|
||||
# -- |
|
||||
namespace $1 |
|
||||
{ |
|
||||
$0 |
|
||||
} |
|
||||
@ -1,17 +0,0 @@ |
|||||
# contributor: Alejandro Espinoza Esparza <aespinoza@structum.com.mx> |
|
||||
# name: property ... ... { ... } |
|
||||
# key: prop |
|
||||
# -- |
|
||||
/// <summary> |
|
||||
/// $5 |
|
||||
/// </summary> |
|
||||
/// <value>$6</value> |
|
||||
$1 $2 $3 |
|
||||
{ |
|
||||
get { |
|
||||
return this.$4; |
|
||||
} |
|
||||
set { |
|
||||
this.$4 = value; |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
# contributor: Alejandro Espinoza Esparza <aespinoza@structum.com.mx> |
|
||||
# name: #region ... #endregion |
|
||||
# key: region |
|
||||
# -- |
|
||||
#region $1 |
|
||||
$0 |
|
||||
#endregion |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: Alejandro Espinoza Esparza <aespinoza@structum.com.mx> |
|
||||
# name: using ...; |
|
||||
# key: using |
|
||||
# -- |
|
||||
using $1; |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: Alejandro Espinoza Esparza <aespinoza@structum.com.mx> |
|
||||
# name: using System; |
|
||||
# key: using |
|
||||
# -- |
|
||||
using System; |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: Alejandro Espinoza Esparza <aespinoza@structum.com.mx> |
|
||||
# name: using System....; |
|
||||
# key: using |
|
||||
# -- |
|
||||
using System.$1; |
|
||||
@ -1 +0,0 @@ |
|||||
text-mode |
|
||||
@ -1,4 +0,0 @@ |
|||||
# name: background-color: ... |
|
||||
# key: bg |
|
||||
# -- |
|
||||
background-color: #${1:DDD}; |
|
||||
@ -1,4 +0,0 @@ |
|||||
# name: background-image: ... |
|
||||
# key: bg |
|
||||
# -- |
|
||||
background-image: url($1); |
|
||||
@ -1,4 +0,0 @@ |
|||||
# name: border size style color |
|
||||
# key: bor |
|
||||
# -- |
|
||||
border: ${1:1px} ${2:solid} #${3:999}; |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: rejeep <johan.rejeep@gmail.com> |
|
||||
# name: clear: ... |
|
||||
# key: cl |
|
||||
# -- |
|
||||
clear: $1; |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: rejeep <johan.rejeep@gmail.com> |
|
||||
# name: display: block |
|
||||
# key: disp |
|
||||
# -- |
|
||||
display: block; |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: rejeep <johan.rejeep@gmail.com> |
|
||||
# name: display: inline |
|
||||
# key: disp |
|
||||
# -- |
|
||||
display: inline; |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: rejeep <johan.rejeep@gmail.com> |
|
||||
# name: display: none |
|
||||
# key: disp |
|
||||
# -- |
|
||||
display: none; |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: rejeep <johan.rejeep@gmail.com> |
|
||||
# name: font-family: ... |
|
||||
# key: ff |
|
||||
# -- |
|
||||
font-family: $1; |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: rejeep <johan.rejeep@gmail.com> |
|
||||
# name: font-size: ... |
|
||||
# key: fs |
|
||||
# -- |
|
||||
font-size: ${12px}; |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: rejeep <johan.rejeep@gmail.com> |
|
||||
# name: margin-bottom: ... |
|
||||
# key: mar |
|
||||
# -- |
|
||||
margin-bottom: $1; |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: rejeep <johan.rejeep@gmail.com> |
|
||||
# name: margin-left: ... |
|
||||
# key: mar |
|
||||
# -- |
|
||||
margin-left: $1; |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: rejeep <johan.rejeep@gmail.com> |
|
||||
# name: margin: ... |
|
||||
# key: mar |
|
||||
# -- |
|
||||
margin: $1; |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: rejeep <johan.rejeep@gmail.com> |
|
||||
# name: margin top right bottom left |
|
||||
# key: mar |
|
||||
# -- |
|
||||
margin: ${top} ${right} ${bottom} ${left}; |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: rejeep <johan.rejeep@gmail.com> |
|
||||
# name: margin-right: ... |
|
||||
# key: mar |
|
||||
# -- |
|
||||
margin-right: $1; |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: rejeep <johan.rejeep@gmail.com> |
|
||||
# name: margin-top: ... |
|
||||
# key: mar |
|
||||
# -- |
|
||||
margin-top: $1; |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: rejeep <johan.rejeep@gmail.com> |
|
||||
# name: padding-bottom: ... |
|
||||
# key: pad |
|
||||
# -- |
|
||||
padding-bottom: $1; |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: rejeep <johan.rejeep@gmail.com> |
|
||||
# name: padding-left: ... |
|
||||
# key: pad |
|
||||
# -- |
|
||||
padding-left: $1; |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: rejeep <johan.rejeep@gmail.com> |
|
||||
# name: padding: ... |
|
||||
# key: pad |
|
||||
# -- |
|
||||
padding: $1; |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: rejeep <johan.rejeep@gmail.com> |
|
||||
# name: padding: top right bottom left |
|
||||
# key: pad |
|
||||
# -- |
|
||||
padding: ${top} ${right} ${bottom} ${left}; |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: rejeep <johan.rejeep@gmail.com> |
|
||||
# name: padding-right: ... |
|
||||
# key: pad |
|
||||
# -- |
|
||||
padding-right: $1; |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: rejeep <johan.rejeep@gmail.com> |
|
||||
# name: padding-top: ... |
|
||||
# key: pad |
|
||||
# -- |
|
||||
padding-top: $1; |
|
||||
@ -1,7 +0,0 @@ |
|||||
-*- coding: utf-8 -*- |
|
||||
Originally started by Xah Lee (xahlee.org) on 2009-02-22 |
|
||||
Released under GPL 3. |
|
||||
|
|
||||
Feel free to add missing ones or modify existing ones to improve. |
|
||||
|
|
||||
Those starting with “x-” are supposed to be idiom templates. Not sure it's very useful. They might start with “i-” or "id-" in the future. |
|
||||
@ -1 +0,0 @@ |
|||||
text-mode |
|
||||
@ -1,6 +0,0 @@ |
|||||
# contributor: Xah Lee (XahLee.org) |
|
||||
# name: add-hook |
|
||||
# key: add-hook |
|
||||
# key: ah |
|
||||
# -- |
|
||||
(add-hook HOOK$0 FUNCTION) |
|
||||
@ -1,6 +0,0 @@ |
|||||
# contributor: Xah Lee (XahLee.org) |
|
||||
# name: and |
|
||||
# key: and |
|
||||
# key: a |
|
||||
# -- |
|
||||
(and $0) |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: Xah Lee (XahLee.org) |
|
||||
# name: append |
|
||||
# key: append |
|
||||
# -- |
|
||||
(append $0 ) |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: Xah Lee (XahLee.org) |
|
||||
# name: apply |
|
||||
# key: apply |
|
||||
# -- |
|
||||
(apply $0 ) |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: Xah Lee (XahLee.org) |
|
||||
# name: aref |
|
||||
# key: aref |
|
||||
# -- |
|
||||
(aref ARRAY$0 INDEX) |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: Xah Lee (XahLee.org) |
|
||||
# name: aset |
|
||||
# key: aset |
|
||||
# -- |
|
||||
(aset ARRAY$0 IDX NEWELT) |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: Xah Lee (XahLee.org) |
|
||||
# name: assq |
|
||||
# key: assq |
|
||||
# -- |
|
||||
(assq KEY$0 LIST) |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: Xah Lee (XahLee.org) |
|
||||
# name: autoload |
|
||||
# key: autoload |
|
||||
# -- |
|
||||
(autoload 'FUNCNAME$0 "FILENAME" &optional "DOCSTRING" INTERACTIVE TYPE) |
|
||||
@ -1,6 +0,0 @@ |
|||||
# contributor: Xah Lee (XahLee.org) |
|
||||
# name: backward-char |
|
||||
# key: backward-char |
|
||||
# key: bc |
|
||||
# -- |
|
||||
(backward-char $0) |
|
||||
@ -1,6 +0,0 @@ |
|||||
# contributor: Xah Lee (XahLee.org) |
|
||||
# name: beginning-of-line |
|
||||
# key: beginning-of-line |
|
||||
# key: bol |
|
||||
# -- |
|
||||
(beginning-of-line) |
|
||||
@ -1,6 +0,0 @@ |
|||||
# contributor: Xah Lee (XahLee.org) |
|
||||
# name: bounds-of-thing-at-point |
|
||||
# key: bounds-of-thing-at-point |
|
||||
# key: botap |
|
||||
# -- |
|
||||
(bounds-of-thing-at-point '$0) ; symbol, list, sexp, defun, filename, url, email, word, sentence, whitespace, line, page ... |
|
||||
@ -1,6 +0,0 @@ |
|||||
# contributor: Xah Lee (XahLee.org) |
|
||||
# name: buffer-file-name |
|
||||
# key: buffer-file-name |
|
||||
# key: bfn |
|
||||
# -- |
|
||||
(buffer-file-name) |
|
||||
@ -1,6 +0,0 @@ |
|||||
# contributor: Xah Lee (XahLee.org) |
|
||||
# name: buffer-modified-p |
|
||||
# key: buffer-modified-p |
|
||||
# key: bmp |
|
||||
# -- |
|
||||
(buffer-modified-p $0) |
|
||||
@ -1,6 +0,0 @@ |
|||||
# contributor: Xah Lee (XahLee.org) |
|
||||
# name: buffer-substring-no-properties |
|
||||
# key: buffer-substring-no-properties |
|
||||
# key: bsnp |
|
||||
# -- |
|
||||
(buffer-substring-no-properties START$0 END) |
|
||||
@ -1,6 +0,0 @@ |
|||||
# contributor: Xah Lee (XahLee.org) |
|
||||
# name: buffer-substring |
|
||||
# key: buffer-substring |
|
||||
# key: bs |
|
||||
# -- |
|
||||
(buffer-substring START$0 END) |
|
||||
@ -1,5 +0,0 @@ |
|||||
# contributor: Xah Lee (XahLee.org) |
|
||||
# name: car |
|
||||
# key: car |
|
||||
# -- |
|
||||
(car $0) |
|
||||
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue