lang/web: add bang to :enhtml & :dehtml
BANG = copy result to clipboard instead of inserting into buffer.
This commit is contained in:
parent
7033b589cb
commit
a15ab4a3f2
1 changed files with 12 additions and 7 deletions
|
@ -2,20 +2,25 @@
|
||||||
;;;###if (featurep! :editor evil)
|
;;;###if (featurep! :editor evil)
|
||||||
|
|
||||||
;;;###autoload (autoload '+web:encode-html-entities "lang/web/autoload/evil" nil t)
|
;;;###autoload (autoload '+web:encode-html-entities "lang/web/autoload/evil" nil t)
|
||||||
(evil-define-operator +web:encode-html-entities (beg end &optional input)
|
(evil-define-operator +web:encode-html-entities (beg end &optional bang input)
|
||||||
"Encodes HTML entities in INPUT or the selected region."
|
"Encodes HTML entities in INPUT or the selected region."
|
||||||
(interactive "<r><a>")
|
(interactive "<r><!><a>")
|
||||||
(cond (input
|
(cond (input
|
||||||
(insert (+web-encode-entities input)))
|
(let ((result (+web-encode-entities input)))
|
||||||
|
(if bang
|
||||||
|
(kill-new result)
|
||||||
|
(insert result))))
|
||||||
((and beg end)
|
((and beg end)
|
||||||
(+web/encode-entities-region beg end))))
|
(+web/encode-entities-region beg end))))
|
||||||
|
|
||||||
;;;###autoload (autoload '+web:decode-html-entities "lang/web/autoload/evil" nil t)
|
;;;###autoload (autoload '+web:decode-html-entities "lang/web/autoload/evil" nil t)
|
||||||
(evil-define-operator +web:decode-html-entities (beg end &optional input)
|
(evil-define-operator +web:decode-html-entities (beg end &optional bang input)
|
||||||
"Decodes HTML entities in INPUT or the selected region."
|
"Decodes HTML entities in INPUT or the selected region."
|
||||||
(interactive "<r><a>")
|
(interactive "<r><!><a>")
|
||||||
(cond (input
|
(cond (input
|
||||||
(insert (+web-decode-entities input)))
|
(let ((result (+web-decode-entities input)))
|
||||||
|
(if bang
|
||||||
|
(kill-new result)
|
||||||
|
(insert result))))
|
||||||
((and beg end)
|
((and beg end)
|
||||||
(+web/decode-entities-region beg end))))
|
(+web/decode-entities-region beg end))))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue