From d4602ae46d75d217e916c582e8ad5c68cec4fc49 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Wed, 28 Jul 1999 06:33:43 +0000 Subject: [PATCH] (mu-cite-ml-count-field-list): Modify tag string for `choice'; use `const' with the arg nil for the menu separator; delete element which value is nil when the symbol value is set. (mu-cite-top-format): New implementation for customization using `mu-cite-choose-top-format' and `mu-cite-custom-set-variable'. (mu-cite-prefix-format): New implementation for customization using `mu-cite-choose-prefix-format' and `mu-cite-custom-set-variable'. (mu-cite-custom-set-variable): New function. (mu-cite-choose-top-format): New widget. (mu-cite-choose-prefix-format): New widget. (widget-mu-cite-method-prompt-value): Abolish function. (mu-cite-method): Abolish widget. (widget-mu-cite-method-prompt-value-history): Abolish variable. (mu-cite-method-list): Abolish function. --- mu-cite.el | 93 ++++++++++++++++++++++++++++-------------------------------- 1 file changed, 43 insertions(+), 50 deletions(-) diff --git a/mu-cite.el b/mu-cite.el index c2fa92b..6c2e2e5 100644 --- a/mu-cite.el +++ b/mu-cite.el @@ -178,45 +178,45 @@ (function mu-bbdb-get-prefix-register-verbose-method)) )) -(defun mu-cite-method-list () - (mapcar (function car) mu-cite-default-methods-alist)) - ;;; @ formats ;;; -(defvar widget-mu-cite-method-prompt-value-history nil - "History of input to `widget-mu-cite-method-prompt-value'.") - -(define-widget 'mu-cite-method 'symbol - "A mu-cite-method." - :format "%{%t%}: %v" - :tag "Method" - :prompt-history 'widget-mu-cite-method-prompt-value-history - :prompt-value 'widget-mu-cite-method-prompt-value - :action 'widget-mu-cite-method-action) - -(defun widget-mu-cite-method-prompt-value (widget prompt value unbound) - ;; Read mu-cite-method from minibuffer. - (intern - (completing-read (format "%s (default %s) " prompt value) - (mapcar (function - (lambda (sym) - (list (symbol-name sym)) - )) - (mu-cite-method-list))))) - -(defun widget-mu-cite-method-action (widget &optional event) - ;; Read a mu-cite-method from the minibuffer. - (let ((answer - (widget-mu-cite-method-prompt-value - widget - (widget-apply widget :menu-tag-get) - (widget-value widget) - t))) - (widget-value-set widget answer) - (widget-apply widget :notify widget event) - (widget-setup))) +(define-widget 'mu-cite-choose-prefix-format 'group + "Widget for entering a prefix citation method." + :convert-widget + (function + (lambda (widget) + (list 'choice + :tag "Method or String" + :args (nconc + (mapcar + (function (lambda (elem) (list 'choice-item (car elem)))) + mu-cite-default-methods-alist) + '((symbol :tag "Method") + (const :tag "-" nil) + (choice-item :tag "String: \"> \"" "> ") + (string))))))) + +(define-widget 'mu-cite-choose-top-format 'group + "Widget for entering a top citation method." + :convert-widget + (function + (lambda (widget) + (list 'choice + :tag "Method or String" + :args (nconc + (mapcar + (function (lambda (elem) (list 'choice-item (car elem)))) + mu-cite-default-methods-alist) + '((symbol :tag "Method") + (const :tag "-" nil) + (choice-item :tag "String: \">>>>>\\t\"" ">>>>>\t") + (choice-item :tag "String: \" wrote:\\n\"" " wrote:\n") + (string :tag "String"))))))) + +(defun mu-cite-custom-set-variable (symbol value) + (set-default symbol (delq nil value))) (defcustom mu-cite-cited-prefix-regexp "\\(^[^ \t\n<>]+>+[ \t]*\\|^[ \t]*$\\)" @@ -228,24 +228,15 @@ If match, mu-cite doesn't insert citation prefix." (defcustom mu-cite-prefix-format '(prefix-register-verbose "> ") "List to represent citation prefix. Each elements must be string or method name." - :type '(repeat - (choice :tag "String or Method name" - mu-cite-method - (item "-") - (choice-item :tag "String: \"> \"" "> ") - (string :tag "Other String"))) + :type '(repeat mu-cite-choose-prefix-format) + :set (function mu-cite-custom-set-variable) :group 'mu-cite) (defcustom mu-cite-top-format '(in-id ">>>>>\t" from " wrote:\n") "List to represent top string of citation. Each elements must be string or method name." - :type '(repeat - (choice :tag "String or Method name" - mu-cite-method - (item "-") - (choice-item :tag "String: \">>>>>\\t\"" ">>>>>\t") - (choice-item :tag "String: \" wrote:\\n\"" " wrote:\n") - (string :tag "Other String"))) + :type '(repeat mu-cite-choose-top-format) + :set (function mu-cite-custom-set-variable) :group 'mu-cite) @@ -293,13 +284,15 @@ registered in variable `mu-cite-get-field-value-method-alist' is called." (defcustom mu-cite-ml-count-field-list '("X-Ml-Count" "X-Mail-Count" "X-Seqno" "X-Sequence" "Mailinglist-Id") "List of header fields which contain sequence number of mailing list." - :type '(repeat (choice (choice-item "X-Ml-Count") + :type '(repeat (choice :tag "Field Name" + (choice-item "X-Ml-Count") (choice-item "X-Mail-Count") (choice-item "X-Seqno") (choice-item "X-Sequence") (choice-item "Mailinglist-Id") - (item "-") + (const :tag "-" nil) (string :tag "Other"))) + :set (function mu-cite-custom-set-variable) :group 'mu-cite) (defun mu-cite-get-ml-count-method () -- 1.7.10.4