From: hmurata Date: Tue, 21 Nov 2006 13:44:22 +0000 (+0000) Subject: (elmo-safe-plist-get): New alias or macro. X-Git-Tag: wl-2_15_6-fixes~109 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=3790e4621c55fa7c78626cc3f9a14193c33e930f;p=elisp%2Fwanderlust.git (elmo-safe-plist-get): New alias or macro. (elmo-progress-notify): Use it instead of `plist-get'. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 907faf2..9b00073 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,8 @@ +2006-11-21 Hiroya Murata + + * elmo-util.el (elmo-safe-plist-get): New alias or macro. + (elmo-progress-notify): Use it instead of `plist-get'. + 2006-11-19 Yoichi NAKAYAMA * elmo.el (elmo-generic-folder-append-messages): Remove unused diff --git a/elmo/elmo-util.el b/elmo/elmo-util.el index 5b774f0..641c218 100644 --- a/elmo/elmo-util.el +++ b/elmo/elmo-util.el @@ -96,6 +96,14 @@ (put 'elmo-with-enable-multibyte 'lisp-indent-function 0) (def-edebug-spec elmo-with-enable-multibyte t) +(static-if (condition-case nil + (plist-get '(one) 'other) + (error t)) + (defmacro elmo-safe-plist-get (plist prop) + `(ignore-errors + (plist-get ,plist ,prop))) + (defalias 'elmo-safe-plist-get 'plist-get)) + (eval-when-compile (unless (fboundp 'coding-system-base) (defalias 'coding-system-base 'ignore)) @@ -1221,14 +1229,14 @@ If optional DELETE-FUNCTION is speficied, it is used as delete procedure." (if (or (elmo-progress-counter-total counter) (and (elmo-progress-counter-set-total counter - (plist-get params :total)) + (elmo-safe-plist-get params :total)) (elmo-progress-call-callback counter 'query))) (progn (elmo-progress-counter-set-value counter - (or (plist-get params :set) + (or (elmo-safe-plist-get params :set) (+ (elmo-progress-counter-value counter) - (or (plist-get params :inc) + (or (elmo-safe-plist-get params :inc) (car params) 1)))) (elmo-progress-call-callback counter))