[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

stealing a code snippet

Someoone on the emacs-devel list found a bug in pathna me encoding of
trash-files, and I see a fix already exists in emacs-w3m. Can I 'steal'
the code? Under what attribution conditions? Here's an elisp explanation of
the issue:

  ((stolen-from-emacs-w3m-url-decode-string (str &optional coding regexp)
     (or regexp (setq regexp "%\\(?:\\([0-9a-f][0-9a-f]\\)\\|0d%0a\\)"))
     (let ((start 0)
         (case-fold-search t))
         (set-buffer-multibyte nil)
         (while (string-match regexp str start)
         (insert (substring str start (match-beginning 0))
         	(if (match-beginning 1)
         	    (string-to-number (match-string 1 str) 16)
         (setq start (match-end 0)))
         (insert (substring str start))
          (or (if (listp coding)
                (with-coding-priority coding
                  (car (detect-coding-region (point-min) (point-max))))
 (dolist (str '("/ssh%3aford%3a/tmp/xxx"
   (insert (format "\n\nurl-unhex: %s\nw3m-url-decode: %s"
     (url-unhex-string str)
     (stolen-from-emacs-w3m-url-decode-string str)))))

CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0