Commits

Anonymous committed 2ae7eb2

Updated yasnippet

Comments (0)

Files changed (776)

 tramp
 calc.el
 vendor/smartparens/.git/*
+vendor/yasnippet/yasnippet-debug.el
+vendor/yasnippet/yasnippet-tests.el
+vendor/yasnippet/.git/*
+vendor/yasnippet/.gitignore
+vendor/yasnippet/.gitmodules
+vendor/yasnippet/doc/*
+vendor/yasnippet/README.mdown
+vendor/yasnippet/README.org
+vendor/yasnippet/Rakefile

files/yasnippet.el

 
 (require 'dropdown-list)
 
-(yas/global-mode 1)
+(yas-global-mode 1)
 
-(yas/load-directory "~/.emacs.d/vendor/yasnippet/snippets")
+(setq yas-snippet-dirs '("~/.emacs.d/vendor/yasnippet/snippets"))
 
-(setq yas/prompt-functions '(yas/ido-prompt
-							 yas/dropdown-prompt
-							 yas/completing-prompt))
+(setq yas-prompt-functions '(yas-ido-prompt))
 
 ;; Replace yasnippets's TAB
-(add-hook 'yas/minor-mode-hook
-		  (lambda () (define-key yas/minor-mode-map
-					   (kbd "TAB") 'smart-tab))) ; was yas/expand
+(add-hook 'yas-minor-mode-hook
+          (lambda () (define-key yas-minor-mode-map
+                       (kbd "TAB") 'smart-tab))) ; was yas/expand

vendor/yasnippet/dropdown-list.el

-;;; 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
+;;; dropdown-list.el --- Drop-down menu interface
+;;
+;; Filename: dropdown-list.el
+;; Description: Drop-down menu interface
+;; Copyright (C) 2008-2012 Free Software Foundation, Inc.
+;; Author: Jaeyoun Chung [jay.chung@gmail.com]
+;; Maintainer:
+;; Authors: pluskid <pluskid@gmail.com>,  João Távora <joaotavora@gmail.com>
+;; 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 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, see <http://www.gnu.org/licenses/>.
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; 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
+;; Local Variables:
+;; coding: utf-8
+;; byte-compile-warnings: (not cl-functions)
+;; End:

vendor/yasnippet/extras/imported/html-mode/.yas-setup.el

+;; .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
+                        (cdr (assoc (upcase tag-at-point) yas-html-tag-description-urls)))))
+    (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 &nbsp 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")
+