General, minor reformatting across the board

And an offering of blood to our great lord Byte Compiler-sama.
This commit is contained in:
Henrik Lissner 2019-07-21 23:31:42 +02:00
parent 3595ff62ee
commit 060ede0e2e
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
30 changed files with 125 additions and 112 deletions

View file

@ -61,13 +61,14 @@ character.")
"HTML encode/decode TEXT. Based on Xah's replace HTML named entities function
@ http://ergoemacs.org/emacs/elisp_replace_html_entities_command.html"
(interactive "<!><r>")
(seq-doseq (rep +web-entities-list)
(let ((from (elt rep (if decode-p 0 1)))
(to (elt rep (if decode-p 1 0)))
case-fold-search)
(when (and (not (equal from " "))
(string-match-p (regexp-quote from) text))
(setq text (replace-regexp-in-string (regexp-quote from) to text t t)))))
(mapc (lambda (rep)
(let ((from (elt rep (if decode-p 0 1)))
(to (elt rep (if decode-p 1 0)))
case-fold-search)
(when (and (not (equal from " "))
(string-match-p (regexp-quote from) text))
(setq text (replace-regexp-in-string (regexp-quote from) to text t t)))))
+web-entities-list)
text)
(defun +web--entities-region (beg end &optional decode-p)
@ -75,14 +76,15 @@ character.")
function @ http://ergoemacs.org/emacs/elisp_replace_html_entities_command.html"
(save-restriction
(narrow-to-region beg end)
(seq-doseq (rep +web-entities-list)
(let ((from (elt rep (if decode-p 0 1)))
(to (elt rep (if decode-p 1 0)))
case-fold-search)
(unless (equal from " ")
(goto-char (point-min))
(while (search-forward from nil t)
(replace-match to 'FIXEDCASE 'LITERAL)))))))
(mapc (lambda (rep)
(let ((from (elt rep (if decode-p 0 1)))
(to (elt rep (if decode-p 1 0)))
case-fold-search)
(unless (equal from " ")
(goto-char (point-min))
(while (search-forward from nil t)
(replace-match to 'FIXEDCASE 'LITERAL)))))
+web-entities-list)))
;;;###autoload
(defun +web-encode-entities (text)