From 984becce0aed22af6a63f98b79f47cbe2dab32d9 Mon Sep 17 00:00:00 2001 From: teranisi Date: Mon, 12 Jun 2000 04:54:22 +0000 Subject: [PATCH] 2000-06-12 Yuuichi Teranishi * wl-address.el (wl-ldap-search): Use `with-temp-buffer'. Use `let' instead of `let*'. Require 'wl-vars. * wl-vars.el (wl-ldap-server): Moved from wl-address.el. Define as defcustom. (wl-ldap-base): Ditto. (wl-use-ldap): Ditto. 2000-06-09 Takeshi Chiba * wl-address.el (wl-ldap-search): New function. (wl-complete-field-body): Use `wl-ldap-search'. (wl-ldap-server): New variable. (wl-ldap-base): Ditto. (wl-use-ldap): Ditto. 2000-06-08 OKAZAKI Tetsurou * wl-score.el (wl-score-guess-like-gnus): Use `elmo-string' (Pointed out by Mito ). --- wl/ChangeLog | 21 +++++++++++++++++++++ wl/wl-address.el | 40 ++++++++++++++++++++++++++++++++++++---- wl/wl-score.el | 4 ++-- wl/wl-vars.el | 17 ++++++++++++++++- 4 files changed, 75 insertions(+), 7 deletions(-) diff --git a/wl/ChangeLog b/wl/ChangeLog index e824479..a4f51f3 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,5 +1,26 @@ +2000-06-12 Yuuichi Teranishi + + * wl-address.el (wl-ldap-search): Use `with-temp-buffer'. + Use `let' instead of `let*'. + Require 'wl-vars. + + * wl-vars.el (wl-ldap-server): Moved from wl-address.el. + Define as defcustom. + (wl-ldap-base): Ditto. + (wl-use-ldap): Ditto. + +2000-06-09 Takeshi Chiba + + * wl-address.el (wl-ldap-search): New function. + (wl-complete-field-body): Use `wl-ldap-search'. + (wl-ldap-server): New variable. + (wl-ldap-base): Ditto. + (wl-use-ldap): Ditto. + 2000-06-08 OKAZAKI Tetsurou + * wl-score.el (wl-score-guess-like-gnus): Use `elmo-string' + (Pointed out by Mito ). * wl-summary.el (wl-summary-redisplay-no-mime): Update buffer-local variables like `wl-summary-redisplay-internal'. (wl-summary-redisplay-all-header): Likewise. Update diff --git a/wl/wl-address.el b/wl/wl-address.el index 23e7edb..063d919 100644 --- a/wl/wl-address.el +++ b/wl/wl-address.el @@ -4,7 +4,7 @@ ;; Author: Yuuichi Teranishi ;; Keywords: mail, net news -;; Time-stamp: <2000-04-10 09:29:44 teranisi> +;; Time-stamp: <00/06/12 13:41:52 teranisi> ;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen). @@ -31,6 +31,7 @@ ;; (require 'wl-util) +(require 'wl-vars) (require 'std11) (defvar wl-address-complete-header-regexp "^\\(To\\|From\\|Cc\\|Bcc\\|Mail-Followup-To\\|Reply-To\\|Return-Receipt-To\\):") @@ -40,6 +41,26 @@ (defvar wl-address-completion-list nil) (defvar wl-address-petname-hash nil) +(defun wl-ldap-search (pat &optional cl) + "make completion-list by ldap search" + (let ((ldap-pat (concat "mail=" pat "*")) + (ret cl) + addr) + (with-temp-buffer + (call-process "ldapsearch" nil (current-buffer) + t "-L" "-b" wl-ldap-base + "-h" wl-ldap-server ldap-pat "mail") + (goto-char (point-min)) + (while (re-search-forward "^\\(mail: \\)\\(.*\\)$" nil t) + (progn + (setq addr (match-string 2)) + (setq addr (cons addr addr)) + (if ret + (setq ret (append ret (list addr))) + (setq ret (list addr)))))) + ret)) + + (defun wl-complete-field-to () (interactive) (let ((cl wl-address-completion-list)) @@ -51,6 +72,7 @@ (interactive) (let ((case-fold-search t) epand-char skip-chars + (use-ldap nil) completion-list) (if (wl-draft-on-field-p) (wl-complete-field) @@ -62,11 +84,14 @@ (point))) (save-excursion (beginning-of-line) + (setq use-ldap nil) (while (and (looking-at "^[ \t]") (not (= (point) (point-min)))) (forward-line -1)) (cond ((looking-at wl-address-complete-header-regexp) (setq completion-list wl-address-completion-list) + (if wl-use-ldap + (setq use-ldap t)) (setq epand-char ?@)) ((looking-at wl-folder-complete-header-regexp) (setq completion-list wl-folder-entity-hashtb) @@ -74,7 +99,7 @@ ((looking-at wl-newsgroups-complete-header-regexp) (setq completion-list wl-folder-newsgroups-hashtb))))) (wl-complete-field-body completion-list - epand-char skip-chars) + epand-char skip-chars use-ldap) (indent-for-tab-command))))) (defvar wl-completion-buf-name "*Completions*") @@ -150,7 +175,7 @@ (if (setq comp-win (get-buffer-window comp-buf)) (delete-window comp-win))))))) -(defun wl-complete-field-body (completion-list &optional epand-char skip-chars) +(defun wl-complete-field-body (completion-list &optional epand-char skip-chars use-ldap) (interactive) (let* ((end (point)) (start (save-excursion @@ -162,8 +187,15 @@ (pattern (buffer-substring start end)) (len (length pattern)) (cl completion-list)) + (if use-ldap + (progn + (setq completion-list (wl-ldap-search pattern cl)) + (setq cl completion-list))) (if (null cl) - nil + (if use-ldap + (progn + (message "Can't find completion for \"%s\"" pattern) + (ding))) (setq completion (try-completion pattern cl)) (cond ((eq completion t) (wl-complete-insert start end pattern completion-list) diff --git a/wl/wl-score.el b/wl/wl-score.el index 2b6553b..0332224 100644 --- a/wl/wl-score.el +++ b/wl/wl-score.el @@ -5,7 +5,7 @@ ;; Author: Masahiro MURATA ;; Keywords: mail, net news -;; Time-stamp: <00/03/14 19:35:28 teranisi> +;; Time-stamp: <00/06/12 13:22:49 teranisi> ;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen). @@ -339,7 +339,7 @@ See `wl-score-simplify-buffer-fuzzy' for details." (let* (score-list (spec (elmo-folder-get-spec folder)) (method (symbol-name (car spec))) - (fld-name (car (cdr spec)))) + (fld-name (elmo-string (car (cdr spec))))) (when (stringp fld-name) (while (string-match "[\\/:,;*?\"<>|]" fld-name) (setq fld-name (replace-match "." t nil fld-name))) diff --git a/wl/wl-vars.el b/wl/wl-vars.el index e79dbdc..b5e43dd 100644 --- a/wl/wl-vars.el +++ b/wl/wl-vars.el @@ -4,7 +4,7 @@ ;; Author: Yuuichi Teranishi ;; Keywords: mail, net news -;; Time-stamp: <2000-05-18 17:04:43 teranisi> +;; Time-stamp: <00/06/12 13:43:58 teranisi> ;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen). @@ -586,6 +586,21 @@ Default is for 'reply-to-all'." :type 'file :group 'wl) +(defcustom wl-ldap-server "localhost" + "*LDAP server." + :type '(string :tag "Server") + :group 'wl) + +(defcustom wl-ldap-base "c=US" + "*LDAP base." + :type '(string :tag "Base") + :group 'wl) + +(defcustom wl-use-ldap nil + "*If non-nil, use LDAP for address completion." + :type 'boolean + :group 'wl) + (defcustom wl-folder-info-save t "If non-nil, save elmo-folder-info-alist." :type 'boolean -- 1.7.10.4