(defconst mu-cite-version "8.0")
+;;; @ obsoletes
+;;;
+
+;; This part will be abolished in the near future.
+
+(eval-when-compile (require 'static))
+
+(defconst mu-cite-obsolete-variable-alist
+ '((mu-cite/default-methods-alist
+ mu-cite-default-methods-alist)
+ (mu-cite/cited-prefix-regexp
+ mu-cite-cited-prefix-regexp)
+ (mu-cite/prefix-format
+ mu-cite-prefix-format)
+ (mu-cite/top-format
+ mu-cite-top-format)
+ (mu-cite/instantiation-hook
+ mu-cite-instantiation-hook)
+ (mu-cite/pre-cite-hook
+ mu-cite-pre-cite-hook)
+ (mu-cite/post-cite-hook
+ mu-cite-post-cite-hook)
+ (mu-cite/get-field-value-method-alist
+ mu-cite-get-field-value-method-alist)
+ (mu-cite/ml-count-field-list
+ mu-cite-ml-count-field-list)))
+
+(static-if (featurep 'xemacs)
+ (dolist (def mu-cite-obsolete-variable-alist)
+ (apply (function define-obsolete-variable-alias) def)))
+
+
;;; @ set up
;;;
(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)))
+
(defcustom mu-cite-cited-prefix-regexp
"\\(^[^ \t\n<>]+>+[ \t]*\\|^[ \t]*$\\)"
"Regexp to match the citation prefix.
(defcustom mu-cite-prefix-format '(prefix-register-verbose "> ")
"List to represent citation prefix.
Each elements must be string or method name."
- :type (list 'repeat
- (nconc '(choice :tag "String or Method name")
- (mapcar
- (function
- (lambda (elem) (list 'choice-item (car elem))))
- mu-cite-default-methods-alist)
- '((symbol :tag "Other Method")
- (item "-")
- (choice-item :tag "String: \"> \"" "> ")
- (string :tag "Other String"))))
+ :type '(repeat
+ (choice :tag "String or Method name"
+ mu-cite-method
+ (item "-")
+ (choice-item :tag "String: \"> \"" "> ")
+ (string :tag "Other String")))
: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 (list 'repeat
- (nconc
- '(choice :tag "String or Method name")
- (mapcar
- (function
- (lambda (elem) (list 'choice-item (car elem))))
- mu-cite-default-methods-alist)
- '((symbol :tag "Other Method")
- (item "-")
- (choice-item :tag "String: \">>>>>\\t\"" ">>>>>\t")
- (choice-item :tag "String: \" wrote:\\n\"" " wrote:\n")
- (string :tag "Other String"))))
+ :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")))
:group 'mu-cite)
;;; @ hooks
;;;
-(defcustom mu-cite-load-hook nil
- "List of functions called after mu-cite is loaded.
-Use this hook to add your own methods to `mu-cite-default-methods-alist'."
- :type 'hook
- :group 'mu-cite)
-
(defcustom mu-cite-instantiation-hook nil
"List of functions called just before narrowing to the message."
:type 'hook
(insert top)
(setq last-point (point))
(while (< (point)(mark t))
- (unless (looking-at mu-cite-cited-prefix-regexp)
- (insert prefix))
+ (or (looking-at mu-cite-cited-prefix-regexp)
+ (insert prefix))
(forward-line 1))
(goto-char last-point))
(run-hooks 'mu-cite-post-cite-hook)))
(goto-char (point-min))
(let ((i 0)
(prefix
- (buffer-substring
- (progn (beginning-of-line)(point))
- (progn (end-of-line)(point))))
+ (buffer-substring (line-beginning-position)
+ (line-end-position)))
str ret)
(while (and (= (forward-line) 0)
(setq str (buffer-substring
(if (stringp ret)
ret
(cadr ret)))
- (incf i))
+ (setq i (1+ i)))
(cond ((> i 1) prefix)
((> i 0)
(goto-char (point-min))
(prefix (buffer-substring b e))
ps pe (s 0)
(nest (let ((i 0))
- (when (string-match "<[^<>]+>" prefix)
- (setq prefix (substring prefix 0 (match-beginning 0))))
+ (if (string-match "<[^<>]+>" prefix)
+ (setq prefix
+ (substring prefix 0 (match-beginning 0))))
(while (string-match
(concat "\\([" citation-mark-chars "]+\\)[ \t]*")
prefix s)
c1 c2)
(while (and (< p len)
(progn
- (setq c1 (aref str1 p)
- c2 (aref str2 p))
+ (setq c1 (sref str1 p)
+ c2 (sref str2 p))
(eq c1 c2)))
- (setq p (+ p (char-length c1))))
+ (setq p (char-next-index c1 p)))
(and (> p 0)
(let ((matched (substring str1 0 p))
(r1 (and (< p len1)(substring str1 p)))
(define-obsolete-function-alias
'mu-cite/get-value 'mu-cite-get-value)
-(eval-when-compile (require 'static))
-
-(static-when (featurep 'xemacs)
- (define-obsolete-variable-alias
- 'mu-cite/default-methods-alist
- 'mu-cite-default-methods-alist)
- (define-obsolete-variable-alias
- 'mu-cite/cited-prefix-regexp
- 'mu-cite-cited-prefix-regexp)
- (define-obsolete-variable-alias
- 'mu-cite/prefix-format
- 'mu-cite-prefix-format)
- (define-obsolete-variable-alias
- 'mu-cite/top-format
- 'mu-cite-top-format)
- (define-obsolete-variable-alias
- 'mu-cite/instantiation-hook
- 'mu-cite-instantiation-hook)
- (define-obsolete-variable-alias
- 'mu-cite/pre-cite-hook
- 'mu-cite-pre-cite-hook)
- (define-obsolete-variable-alias
- 'mu-cite/post-cite-hook
- 'mu-cite-post-cite-hook)
- (define-obsolete-variable-alias
- 'mu-cite/get-field-value-method-alist
- 'mu-cite-get-field-value-method-alist)
- (define-obsolete-variable-alias
- 'mu-cite/ml-count-field-list
- 'mu-cite-ml-count-field-list)
- )
-
;;; @ end
;;;
(run-hooks 'mu-cite-load-hook)
+;; This part will be abolished in the future.
+
+(static-unless (featurep 'xemacs)
+ (let ((rest mu-cite-obsolete-variable-alist)
+ def new-sym old-sym)
+ (while rest
+ (setq def (car rest))
+ (apply (function make-obsolete-variable) def)
+ (setq old-sym (car def)
+ new-sym (car (cdr def)))
+ (or (get new-sym 'saved-value) ; saved?
+ (not (eq (eval (car (get new-sym 'standard-value)))
+ (symbol-value new-sym))) ; set as new name?
+ (and (boundp old-sym) ; old name seems used
+ (or (eq (symbol-value new-sym)
+ (symbol-value old-sym))
+ (set new-sym (symbol-value old-sym)))))
+ (setq rest (cdr rest)))))
+
;;; mu-cite.el ends here