comparison lisp/url/url-util.el @ 110744:dab4cfd7ea71

Cosmetic changes for some lisp/url files. * lisp/url/url-util.el (url-get-url-filename-chars): Don't eval-and-compile. (url-get-url-at-point): Don't use eval-when-compile. * lisp/url/url-cache.el (url-cache-create-filename-human-readable) (url-cache-create-filename-using-md5): * lisp/url/url-util.el (url-file-directory, url-file-nondirectory): Don't use eval-when-compile and regexp-quote.
author Glenn Morris <rgm@gnu.org>
date Sun, 03 Oct 2010 14:37:41 -0700
parents af844b79b99f
children 417b1e4d63cd
comparison
equal deleted inserted replaced
110743:9efd09876018 110744:dab4cfd7ea71
246 ;;;###autoload 246 ;;;###autoload
247 (defun url-file-directory (file) 247 (defun url-file-directory (file)
248 "Return the directory part of FILE, for a URL." 248 "Return the directory part of FILE, for a URL."
249 (cond 249 (cond
250 ((null file) "") 250 ((null file) "")
251 ((string-match (eval-when-compile (regexp-quote "?")) file) 251 ((string-match "\\?" file)
252 (file-name-directory (substring file 0 (match-beginning 0)))) 252 (file-name-directory (substring file 0 (match-beginning 0))))
253 (t (file-name-directory file)))) 253 (t (file-name-directory file))))
254 254
255 ;;;###autoload 255 ;;;###autoload
256 (defun url-file-nondirectory (file) 256 (defun url-file-nondirectory (file)
257 "Return the nondirectory part of FILE, for a URL." 257 "Return the nondirectory part of FILE, for a URL."
258 (cond 258 (cond
259 ((null file) "") 259 ((null file) "")
260 ((string-match (eval-when-compile (regexp-quote "?")) file) 260 ((string-match "\\?" file)
261 (file-name-nondirectory (substring file 0 (match-beginning 0)))) 261 (file-name-nondirectory (substring file 0 (match-beginning 0))))
262 (t (file-name-nondirectory file)))) 262 (t (file-name-nondirectory file))))
263 263
264 ;;;###autoload 264 ;;;###autoload
265 (defun url-parse-query-string (query &optional downcase allow-newlines) 265 (defun url-parse-query-string (query &optional downcase allow-newlines)
434 nil 434 nil
435 (if no-show 435 (if no-show
436 (url-recreate-url url-current-object) 436 (url-recreate-url url-current-object)
437 (message "%s" (url-recreate-url url-current-object))))) 437 (message "%s" (url-recreate-url url-current-object)))))
438 438
439 (eval-and-compile 439 (defvar url-get-url-filename-chars "-%.?@a-zA-Z0-9()_/:~=&"
440 (defvar url-get-url-filename-chars "-%.?@a-zA-Z0-9()_/:~=&" 440 "Valid characters in a URL.")
441 "Valid characters in a URL.")
442 )
443 441
444 (defun url-get-url-at-point (&optional pt) 442 (defun url-get-url-at-point (&optional pt)
445 "Get the URL closest to point, but don't change position. 443 "Get the URL closest to point, but don't change position.
446 Has a preference for looking backward when not directly on a symbol." 444 Has a preference for looking backward when not directly on a symbol."
447 ;; Not at all perfect - point must be right in the name. 445 ;; Not at all perfect - point must be right in the name.
455 (progn 453 (progn
456 (skip-chars-backward " \n\t\r({[]})") 454 (skip-chars-backward " \n\t\r({[]})")
457 (if (not (bobp)) 455 (if (not (bobp))
458 (backward-char 1))))) 456 (backward-char 1)))))
459 (if (and (char-after (point)) 457 (if (and (char-after (point))
460 (string-match (eval-when-compile 458 (string-match (concat "[" url-get-url-filename-chars "]")
461 (concat "[" url-get-url-filename-chars "]"))
462 (char-to-string (char-after (point))))) 459 (char-to-string (char-after (point)))))
463 (progn 460 (progn
464 (skip-chars-backward url-get-url-filename-chars) 461 (skip-chars-backward url-get-url-filename-chars)
465 (setq start (point)) 462 (setq start (point))
466 (skip-chars-forward url-get-url-filename-chars)) 463 (skip-chars-forward url-get-url-filename-chars))