(defvar w3m-history-sort-function 'w3m-history-sort-time) (defun w3m-history-sort-time (x1 y1) (let ((x (cdr x1)) (y (cdr y1))) (cond ((null x) nil) ((null y) t) ((> (nth 0 x) (nth 0 y)) t) ((= (nth 0 x) (nth 0 y)) (if (> (nth 1 x) (nth 1 y)) t nil)) (t nil)))) (defun w3m-history-sort-url (x1 y1) (string< (car x1) (car y1))) (defun w3m-history (&optional arg) (interactive "P") (if (null arg) (w3m-goto-url "about://history/") (let* ((file (expand-file-name "arrived.html" w3m-profile-directory)) (url (w3m-expand-file-name-as-url file)) (file-coding-system w3m-output-coding-system) (coding-system-for-write w3m-output-coding-system) name time alist) (when w3m-arrived-db (mapatoms (lambda (sym) (when (and sym (setq name (symbol-name sym)) (not (string= url name)) (not (string-match "^about" name))) (setq time (w3m-arrived-last-modified name)) (setq alist (cons (cons name time) alist)))) w3m-arrived-db) (setq alist (sort alist (lambda (x y) (funcall w3m-history-sort-function x y))))) (if (null alist) (message "Nothing in DataBase.") (with-temp-buffer (insert "arraived URL history\n") (insert "

arraived URL history in DataBase

\n") (insert "\n") (while alist (insert (format "")) (insert "\n") (setq alist (cdr alist))) (insert "
%s" (car (car alist)) (car (car alist)))) (when (cdr (car alist)) (insert "" (format-time-string "%Y-%m-%d %T" (cdr (car alist))) "
") (insert "\n") (write-region (point-min) (point-max) file nil 'nomsg)) (w3m-goto-url url)))))