diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-10-30 09:39:45 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-10-30 09:40:06 -0400 |
commit | 3fa4cca3d244f51e471e7779c934278731fc21e9 (patch) | |
tree | 40b2d2a1c103c92564c437531e7f53df68bf46c0 | |
parent | 311c95fd67c219565fc750afedea3867f087aef7 (diff) | |
download | emacs-3fa4cca3d244f51e471e7779c934278731fc21e9.tar.gz |
* lisp/url/url-util.el (url-insert-entities-in-string): Simplify
-rw-r--r-- | lisp/url/url-util.el | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el index 147a643c9fd..95c0fe14f3b 100644 --- a/lisp/url/url-util.el +++ b/lisp/url/url-util.el @@ -63,9 +63,9 @@ If a list, it is a list of the types of messages to be logged." (and (listp url-debug) (memq tag url-debug))) (with-current-buffer (get-buffer-create "*URL-DEBUG*") (goto-char (point-max)) - (insert (symbol-name tag) " -> " (apply 'format args) "\n") + (insert (symbol-name tag) " -> " (apply #'format args) "\n") (if (numberp url-debug) - (apply 'message args))))) + (apply #'message args))))) ;;;###autoload (defun url-parse-args (str &optional nodowncase) @@ -125,23 +125,13 @@ conversion. Replaces these characters as follows: < ==> < > ==> > \" ==> "" - (if (string-match "[&<>\"]" string) - (with-current-buffer (get-buffer-create " *entity*") - (erase-buffer) - (buffer-disable-undo (current-buffer)) - (insert string) - (goto-char (point-min)) - (while (progn - (skip-chars-forward "^&<>\"") - (not (eobp))) - (insert (cdr (assq (char-after (point)) - '((?\" . """) - (?& . "&") - (?< . "<") - (?> . ">"))))) - (delete-char 1)) - (buffer-string)) - string)) + (replace-regexp-in-string "[&<>\"]" + (lambda (c) (cdr (assq (aref c 0) + '((?\" . """) + (?& . "&") + (?< . "<") + (?> . ">"))))) + string)) ;;;###autoload (defun url-normalize-url (url) @@ -169,7 +159,7 @@ Will not do anything if `url-show-status' is nil." (= url-lazy-message-time (setq url-lazy-message-time (time-convert nil 'integer)))) nil - (apply 'message args))) + (apply #'message args))) ;;;###autoload (defun url-get-normalized-date (&optional specified-time) @@ -186,7 +176,7 @@ Will not do anything if `url-show-status' is nil." #'string-trim-left "29.1") (define-obsolete-function-alias 'url-pretty-length - 'file-size-human-readable "24.4") + #'file-size-human-readable "24.4") ;;;###autoload (defun url-display-message (fmt &rest args) @@ -206,7 +196,7 @@ Will not do anything if `url-show-status' is nil." (round (* 100 (/ x (float y))))) ;;;###autoload -(defalias 'url-basepath 'url-file-directory) +(defalias 'url-basepath #'url-file-directory) ;;;###autoload (defun url-file-directory (file) @@ -395,8 +385,7 @@ if character N is allowed." (aref url-encoding-table byte))) (if (multibyte-string-p string) (encode-coding-string string 'utf-8) - string) - "")) + string))) (defconst url-host-allowed-chars ;; Allow % to avoid re-encoding %-encoded sequences. |