+2004-06-30 Teodor Zlatanov <tzz@lifelogs.com>
+
+ * gnus-registry.el (gnus-registry-trim): don't allow a negative
+ trim value
+
+2004-01-25 Paul Jarc <prj@po.cwru.edu>
+
+ * nnmaildir.el (nnmaildir--condcase, nnmaildir--enoent-p):
+ New macro and function.
+ (nnmaildir--new-number, nnmaildir-request-set-mark): Use them.
+
2004-06-29 Katsumi Yamaoka <yamaoka@jpl.org>
* mm-util.el (mm-enrich-utf-8-by-mule-ucs): Fix cleaning of
* message.el (message-idna-to-ascii-rhs-1): Don't choke on
invalid addresses.
-2004-06-21 Teodor Zlatanov <tzz@bwh.harvard.edu>
+2004-06-21 Teodor Zlatanov <tzz@lifelogs.com>
* spam.el: section markers changed, TODO list revised
(spam-backends): new master list of all installed backends
(if (null gnus-registry-max-entries)
alist ; just return the alist
;; else, when given max-entries, trim the alist
- (let ((timehash (make-hash-table
+ (let* ((timehash (make-hash-table
:size 4096
- :test 'equal)))
+ :test 'equal))
+ (trim-length (- (length alist) gnus-registry-max-entries))
+ (trim-length (if (natnump trim-length) trim-length 0)))
(maphash
(lambda (key value)
(puthash key (gnus-registry-fetch-extra key 'mtime) timehash))
;; we use the return value of this setq, which is the trimmed alist
(setq alist
(nthcdr
- (- (length alist) gnus-registry-max-entries)
+ trim-length
(sort alist
(lambda (a b)
(time-less-p
sender)
(maphash
(lambda (key value)
- (let ((this-sender (cdr
+ (let ((this-sender (cdr
(gnus-registry-fetch-extra key 'sender))))
(when (and single-match
this-sender
(put 'nnmaildir--with-work-buffer 'lisp-indent-function 0)
(put 'nnmaildir--with-nov-buffer 'lisp-indent-function 0)
(put 'nnmaildir--with-move-buffer 'lisp-indent-function 0)
+ (put 'nnmaildir--condcase 'lisp-indent-function 2)
)
]
(setq pos (match-end 0))))
string)
+(defmacro nnmaildir--condcase (errsym body &rest handler)
+ `(condition-case ,errsym
+ (let ((system-messages-locale "C")) ,body)
+ (error . ,handler)))
+
(defun nnmaildir--emlink-p (err)
(and (eq (car err) 'file-error)
(string= (caddr err) "too many links")))
+(defun nnmaildir--enoent-p (err)
+ (and (eq (car err) 'file-error)
+ (string= (caddr err) "no such file or directory")))
+
(defun nnmaildir--eexist-p (err)
(eq (car err) 'file-already-exists))
;; and failed.
(signal 'error `("Corrupt internal nnmaildir data" ,path-open)))
(setq path-link (concat numdir (number-to-string number-link)))
- (condition-case err
+ (nnmaildir--condcase err
(progn
(add-name-to-file path-open path-link)
(throw 'return number-link))
- (error
- (cond
- ((nnmaildir--emlink-p err)
- (setq make-new-file t
- number-open number-link))
- ((nnmaildir--eexist-p err)
- (let ((attr (file-attributes path-link)))
- (if (/= (nth 10 attr) ino-open)
- (setq number-open number-link
- number-link 0))))
- (t (signal (car err) (cdr err))))))))))
+ (cond
+ ((nnmaildir--emlink-p err)
+ (setq make-new-file t
+ number-open number-link))
+ ((nnmaildir--eexist-p err)
+ (let ((attr (file-attributes path-link)))
+ (if (/= (nth 10 attr) ino-open)
+ (setq number-open number-link
+ number-link 0))))
+ (t (signal (car err) (cdr err)))))))))
(defun nnmaildir--update-nov (server group article)
(let ((nnheader-file-coding-system 'binary)
nnmaildir--cur-server)
"24-hour timer expired")
(throw 'return nil))))
- (condition-case nil
- (add-name-to-file nnmaildir--file tmpfile)
+ (condition-case nil (add-name-to-file nnmaildir--file tmpfile)
(error
(write-region (point-min) (point-max) tmpfile nil 'no-message nil
'excl)
(unix-sync))) ;; no fsync :(
(cancel-timer 24h)
- (condition-case err
- (add-name-to-file tmpfile curfile)
+ (condition-case err (add-name-to-file tmpfile curfile)
(error
(setf (nnmaildir--srv-error nnmaildir--cur-server)
(concat "Error linking: " (prin1-to-string err)))
(setq mdir (nnmaildir--subdir marksdir (symbol-name mark))
permarkfile (concat mdir ":")
mfile (concat mdir (nnmaildir--art-prefix article)))
- (condition-case err
- (add-name-to-file permarkfile mfile)
- (error
- (cond
- ((nnmaildir--eexist-p err))
- ((and (eq (car err) 'file-error)
- (string= (caddr err) "no such file or directory"))
- (nnmaildir--mkdir mdir)
- (nnmaildir--mkfile permarkfile)
- (add-name-to-file permarkfile mfile))
- ((nnmaildir--emlink-p err)
- (let ((permarkfilenew (concat permarkfile "{new}")))
- (nnmaildir--mkfile permarkfilenew)
- (rename-file permarkfilenew permarkfile 'replace)
- (add-name-to-file permarkfile mfile)))
- (t (signal (car err) (cdr err)))))))
+ (nnmaildir--condcase err (add-name-to-file permarkfile mfile)
+ (cond
+ ((nnmaildir--eexist-p err))
+ ((nnmaildir--enoent-p err)
+ (nnmaildir--mkdir mdir)
+ (nnmaildir--mkfile permarkfile)
+ (add-name-to-file permarkfile mfile))
+ ((nnmaildir--emlink-p err)
+ (let ((permarkfilenew (concat permarkfile "{new}")))
+ (nnmaildir--mkfile permarkfilenew)
+ (rename-file permarkfilenew permarkfile 'replace)
+ (add-name-to-file permarkfile mfile)))
+ (t (signal (car err) (cdr err))))))
todo-marks))
set-action (lambda (article)
(funcall add-action)