yasnippetは、Emacs用のTextmateのスニペット構文の特に優れた実装です。これで、Textmateのすべてのスニペットを読み込むことができます。あなたはそれをインストールする場合は、私が書いたこのスニペットは、あなたが欲しいものを行う必要があります。
(defun wrap-region-or-point-with-html-tag (start end)
"Wraps the selected text or the point with a tag"
(interactive "r")
(let (string)
(if mark-active
(list (setq string (buffer-substring start end))
(delete-region start end)))
(yas/expand-snippet (point)
(point)
(concat "<${1:p}>" string "$0</${1:$(replace-regexp-in-string \" .*\" \"\" text)}>"))))
(global-set-key (kbd "C-W") 'wrap-region-or-point-with-html-tag)
はEDIT:。(オーケー、これはこれを固定での私の最後の試みであることを正確にTextMateののバージョンのようなものですそれも後の文字を無視します。終了タグのスペース)
ご迷惑をおかけして申し訳ありません。この関数は、領域内の各行を編集する必要があります。 sgml-mode
deratives、マーク領域については
(defun wrap-lines-in-region-with-html-tag (start end)
"Wraps the selected text or the point with a tag"
(interactive "r")
(let (string)
(if mark-active
(list (setq string (buffer-substring start end))
(delete-region start end)))
(yas/expand-snippet
(replace-regexp-in-string "\\(<$1>\\).*\\'" "<${1:p}>"
(mapconcat
(lambda (line) (format "%s" line))
(mapcar
(lambda (match) (concat "<$1>" match "</${1:$(replace-regexp-in-string \" .*\" \"\" text)}>"))
(split-string string "[\r\n]")) "\n") t nil 1) (point) (point))))