comparison lisp/mh-e/mh-utils.el @ 68137:ec4727559827

* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here from mh-gnus.el. * mh-gnus.el: Require mh-acros. (mh-defmacro-compat, mh-defun-compat): Move to mh-acros.el. * mh-utils.el (url-unreserved-chars, url-hexify-string): Define if not defined. Copied from url-util.el in Emacs22 for Emacs 21.
author Bill Wohler <wohler@newt.com>
date Wed, 11 Jan 2006 21:02:35 +0000
parents 03bac2d0a4aa
children 3b7532a82079
comparison
equal deleted inserted replaced
68136:98275190ec04 68137:ec4727559827
1464 1464
1465 (defun mh-x-image-scale-with-convert (input output) 1465 (defun mh-x-image-scale-with-convert (input output)
1466 "Scale image in INPUT file and write to OUTPUT file using ImageMagick." 1466 "Scale image in INPUT file and write to OUTPUT file using ImageMagick."
1467 (call-process "convert" nil nil nil "-geometry" "96x48" input output)) 1467 (call-process "convert" nil nil nil "-geometry" "96x48" input output))
1468 1468
1469 ;; Copy of constant from url-util.el in Emacs 22; needed by Emacs 21.
1470 (if (not (boundp 'url-unreserved-chars))
1471 (defconst url-unreserved-chars
1472 '(
1473 ?a ?b ?c ?d ?e ?f ?g ?h ?i ?j ?k ?l ?m ?n ?o ?p ?q ?r ?s ?t ?u ?v ?w ?x ?y ?z
1474 ?A ?B ?C ?D ?E ?F ?G ?H ?I ?J ?K ?L ?M ?N ?O ?P ?Q ?R ?S ?T ?U ?V ?W ?X ?Y ?Z
1475 ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9
1476 ?- ?_ ?. ?! ?~ ?* ?' ?\( ?\))
1477 "A list of characters that are _NOT_ reserved in the URL spec.
1478 This is taken from RFC 2396."))
1479
1480 ;; Copy of function from url-util.el in Emacs 22; needed by Emacs 21.
1481 (mh-defun-compat url-hexify-string (str)
1482 "Escape characters in a string."
1483 (mapconcat
1484 (lambda (char)
1485 ;; Fixme: use a char table instead.
1486 (if (not (memq char url-unreserved-chars))
1487 (if (> char 255)
1488 (error "Hexifying multibyte character %s" str)
1489 (format "%%%02X" char))
1490 (char-to-string char)))
1491 str ""))
1492
1469 (defun mh-x-image-url-cache-canonicalize (url) 1493 (defun mh-x-image-url-cache-canonicalize (url)
1470 "Canonicalize URL. 1494 "Canonicalize URL.
1471 Replace the ?/ character with a ?! character and append .png. 1495 Replace the ?/ character with a ?! character and append .png.
1472 Also replaces special characters with `url-hexify-string' since 1496 Also replaces special characters with `url-hexify-string' since
1473 not all characters, such as :, are legal within Windows 1497 not all characters, such as :, are legal within Windows