Function: url-history-save-history
url-history-save-history is an interactive and byte-compiled function
defined in url-history.el.gz.
Signature
(url-history-save-history &optional FNAME)
Documentation
Write the global history file into url-history-file.
The type of data written is determined by what is in the file to begin with. If the type of storage cannot be determined, then prompt the user for what type to save as.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/url/url-history.el.gz
(defun url-history-save-history (&optional fname)
"Write the global history file into `url-history-file'.
The type of data written is determined by what is in the file to begin
with. If the type of storage cannot be determined, then prompt the
user for what type to save as."
(interactive)
(when url-history-changed-since-last-save
(or fname (setq fname (expand-file-name url-history-file)))
(if (condition-case nil
(progn
(url-make-private-file fname)
nil)
(error t))
(message "Error accessing history file `%s'" fname)
(let ((make-backup-files nil)
(version-control nil)
(require-final-newline t)
(count 0))
(with-temp-buffer
(maphash (lambda (key value)
(while (string-match "[\r\n]+" key)
(setq key (concat (substring key 0 (match-beginning 0))
(substring key (match-end 0) nil))))
(setq count (1+ count))
(insert "(puthash \"" key "\""
(if (not (stringp value)) " '" "")
(prin1-to-string value)
" url-history-hash-table)\n"))
url-history-hash-table)
;; We used to add this in the file, but it just makes the code
;; more complex with no benefit. Worse: it makes it harder to
;; preserve preexisting history when loading the history file.
;; (goto-char (point-min))
;; (insert (format
;; "(setq url-history-hash-table (make-hash-table :size %d :test 'equal))\n"
;; (/ count 4)))
;; (goto-char (point-max))
(insert "\n")
(write-file fname)))
(setq url-history-changed-since-last-save nil))))