Fix typo in eww-make-unique-file-name

* lisp/net/eww.el (eww-make-unique-file-name): Make this function
actually work.
This commit is contained in:
Lars Ingebrigtsen 2016-02-04 16:05:05 +11:00
parent 7f81825073
commit d90ab1e221

View file

@ -1469,21 +1469,21 @@ Differences in #targets are ignored."
string))) string)))
(defun eww-make-unique-file-name (file directory) (defun eww-make-unique-file-name (file directory)
(cond (cond
((zerop (length file)) ((zerop (length file))
(setq file "!")) (setq file "!"))
((string-match "\\`[.]" file) ((string-match "\\`[.]" file)
(setq file (concat "!" file)))) (setq file (concat "!" file))))
(let ((count 1) (let ((count 1)
(stem file) (stem file)
(suffix "")) (suffix ""))
(when (string-match "\\`\\(.*\\)\\([.][^.]+\\)" file) (when (string-match "\\`\\(.*\\)\\([.][^.]+\\)" file)
(setq stem (match-string 1) (setq stem (match-string 1 file)
suffix (match-string 2))) suffix (match-string 2)))
(while (file-exists-p (expand-file-name file directory)) (while (file-exists-p (expand-file-name file directory))
(setq file (format "%s(%d)%s" stem count suffix)) (setq file (format "%s(%d)%s" stem count suffix))
(setq count (1+ count))) (setq count (1+ count)))
(expand-file-name file directory))) (expand-file-name file directory)))
(defun eww-set-character-encoding (charset) (defun eww-set-character-encoding (charset)
"Set character encoding to CHARSET. "Set character encoding to CHARSET.