mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-14 05:23:04 +00:00
Fixes some html mode snippets/commands
This commit is contained in:
parent
9d1757a707
commit
9d3d2e102c
@ -10,21 +10,25 @@
|
|||||||
(interactive)
|
(interactive)
|
||||||
(let (word-begin
|
(let (word-begin
|
||||||
word-end
|
word-end
|
||||||
|
(line-beginning-position (line-beginning-position))
|
||||||
(orig-point (point))
|
(orig-point (point))
|
||||||
retval)
|
retval)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(forward-word -1)
|
(when (and (forward-word -1)
|
||||||
(setq word-begin (point))
|
(setq word-begin (point))
|
||||||
(forward-word 1)
|
(forward-word 1)
|
||||||
(setq word-end (point)))
|
(setq word-end (point))
|
||||||
(when (and (< word-begin orig-point)
|
(< word-begin orig-point)
|
||||||
(>= word-end (point)))
|
(>= word-end orig-point)
|
||||||
|
(<= (line-beginning-position) word-begin)
|
||||||
|
;; (not (string-match "^[\s\t]+$" " "))
|
||||||
|
)
|
||||||
(setq retval
|
(setq retval
|
||||||
(cons
|
(cons
|
||||||
(buffer-substring-no-properties word-begin orig-point)
|
(buffer-substring-no-properties word-begin orig-point)
|
||||||
(buffer-substring-no-properties word-end orig-point)))
|
(buffer-substring-no-properties word-end orig-point)))
|
||||||
(delete-region word-begin word-end)
|
(delete-region word-begin word-end)
|
||||||
retval)))
|
retval))))
|
||||||
|
|
||||||
|
|
||||||
(defun yas/html-first-word (string)
|
(defun yas/html-first-word (string)
|
||||||
@ -75,4 +79,5 @@
|
|||||||
(backward-word)
|
(backward-word)
|
||||||
(looking-at "\\\w+></\\\w+>")))
|
(looking-at "\\\w+></\\\w+>")))
|
||||||
|
|
||||||
|
(defun yas/html-id-from-string (string)
|
||||||
|
(replace-regexp-in-string " " "_" (downcase string)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user