2000-01-12 20:50:20 +00:00
|
|
|
|
;;; eudc.el --- Emacs Unified Directory Client
|
|
|
|
|
|
2011-01-25 04:08:28 +00:00
|
|
|
|
;; Copyright (C) 1998-2011 Free Software Foundation, Inc.
|
2000-01-12 20:50:20 +00:00
|
|
|
|
|
2002-01-16 08:22:15 +00:00
|
|
|
|
;; Author: Oscar Figueiredo <oscar@cpe.fr>
|
|
|
|
|
;; Maintainer: Pavel Jan<61>k <Pavel@Janik.cz>
|
2002-01-06 16:41:07 +00:00
|
|
|
|
;; Keywords: comm
|
2000-01-12 20:50:20 +00:00
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 07:31:51 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2000-01-12 20:50:20 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 07:31:51 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
2000-01-12 20:50:20 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 07:31:51 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
2000-01-12 20:50:20 +00:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
;; This package provides a common interface to query directory servers using
|
|
|
|
|
;; different protocols such as LDAP, CCSO PH/QI or BBDB. Queries can be
|
|
|
|
|
;; made through an interactive form or inline. Inline query strings in
|
|
|
|
|
;; buffers are expanded with appropriately formatted query results
|
|
|
|
|
;; (especially used to expand email addresses in message buffers). EUDC
|
|
|
|
|
;; also interfaces with the BBDB package to let you register query results
|
|
|
|
|
;; into your own BBDB database.
|
|
|
|
|
|
|
|
|
|
;;; Usage:
|
|
|
|
|
;; EUDC comes with an extensive documentation, please refer to it.
|
|
|
|
|
;;
|
|
|
|
|
;; The main entry points of EUDC are:
|
|
|
|
|
;; `eudc-query-form': Query a directory server from a query form
|
|
|
|
|
;; `eudc-expand-inline': Query a directory server for the e-mail address
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;; of the name before cursor and insert it in the
|
2000-01-12 20:50:20 +00:00
|
|
|
|
;; buffer
|
|
|
|
|
;; `eudc-get-phone': Get a phone number from a directory server
|
|
|
|
|
;; `eudc-get-email': Get an e-mail address from a directory server
|
|
|
|
|
;; `eudc-customize': Customize various aspects of EUDC
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
(require 'wid-edit)
|
|
|
|
|
|
|
|
|
|
(eval-and-compile
|
|
|
|
|
(if (not (fboundp 'make-overlay))
|
|
|
|
|
(require 'overlay))
|
|
|
|
|
(if (not (fboundp 'unless))
|
|
|
|
|
(require 'cl)))
|
|
|
|
|
|
|
|
|
|
(unless (fboundp 'custom-menu-create)
|
|
|
|
|
(autoload 'custom-menu-create "cus-edit"))
|
|
|
|
|
|
|
|
|
|
(require 'eudc-vars)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;{{{ Internal cooking
|
|
|
|
|
|
|
|
|
|
;;{{{ Internal variables and compatibility tricks
|
|
|
|
|
|
|
|
|
|
(defvar eudc-form-widget-list nil)
|
2008-04-04 22:45:01 +00:00
|
|
|
|
|
|
|
|
|
(defvar eudc-mode-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
(define-key map "q" 'kill-this-buffer)
|
|
|
|
|
(define-key map "x" 'kill-this-buffer)
|
|
|
|
|
(define-key map "f" 'eudc-query-form)
|
|
|
|
|
(define-key map "b" 'eudc-try-bbdb-insert)
|
|
|
|
|
(define-key map "n" 'eudc-move-to-next-record)
|
|
|
|
|
(define-key map "p" 'eudc-move-to-previous-record)
|
|
|
|
|
map))
|
|
|
|
|
(set-keymap-parent eudc-mode-map widget-keymap)
|
2000-01-12 20:50:20 +00:00
|
|
|
|
|
2005-08-30 10:23:09 +00:00
|
|
|
|
(defvar mode-popup-menu)
|
|
|
|
|
|
2000-01-12 20:50:20 +00:00
|
|
|
|
;; List of known servers
|
|
|
|
|
;; Alist of (SERVER . PROTOCOL)
|
|
|
|
|
(defvar eudc-server-hotlist nil)
|
|
|
|
|
|
|
|
|
|
;; List of variables that have server- or protocol-local bindings
|
|
|
|
|
(defvar eudc-local-vars nil)
|
|
|
|
|
|
2002-01-06 15:06:14 +00:00
|
|
|
|
;; Protocol local. Query function
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(defvar eudc-query-function nil)
|
|
|
|
|
|
|
|
|
|
;; Protocol local. A function that retrieves a list of valid attribute names
|
|
|
|
|
(defvar eudc-list-attributes-function nil)
|
|
|
|
|
|
|
|
|
|
;; Protocol local. A mapping between EUDC attribute names and corresponding
|
|
|
|
|
;; protocol specific names. The following names are defined by EUDC and may be
|
|
|
|
|
;; included in that list: `name' , `firstname', `email', `phone'
|
|
|
|
|
(defvar eudc-protocol-attributes-translation-alist nil)
|
|
|
|
|
|
|
|
|
|
;; Protocol local. Mapping between protocol attribute names and BBDB field
|
|
|
|
|
;; names
|
|
|
|
|
(defvar eudc-bbdb-conversion-alist nil)
|
|
|
|
|
|
|
|
|
|
;; Protocol/Server local. Hook called upon switching to that server
|
|
|
|
|
(defvar eudc-switch-to-server-hook nil)
|
|
|
|
|
|
|
|
|
|
;; Protocol/Server local. Hook called upon switching from that server
|
|
|
|
|
(defvar eudc-switch-from-server-hook nil)
|
|
|
|
|
|
|
|
|
|
;; Protocol local. Whether the protocol supports queries with no specified
|
|
|
|
|
;; attribute name
|
|
|
|
|
(defvar eudc-protocol-has-default-query-attributes nil)
|
|
|
|
|
|
|
|
|
|
(defun eudc-cadr (obj)
|
|
|
|
|
(car (cdr obj)))
|
|
|
|
|
|
|
|
|
|
(defun eudc-cdar (obj)
|
|
|
|
|
(cdr (car obj)))
|
|
|
|
|
|
|
|
|
|
(defun eudc-caar (obj)
|
|
|
|
|
(car (car obj)))
|
|
|
|
|
|
|
|
|
|
(defun eudc-cdaar (obj)
|
|
|
|
|
(cdr (car (car obj))))
|
|
|
|
|
|
|
|
|
|
(defun eudc-plist-member (plist prop)
|
|
|
|
|
"Return t if PROP has a value specified in PLIST."
|
|
|
|
|
(if (not (= 0 (% (length plist) 2)))
|
|
|
|
|
(error "Malformed plist"))
|
|
|
|
|
(catch 'found
|
|
|
|
|
(while plist
|
|
|
|
|
(if (eq prop (car plist))
|
|
|
|
|
(throw 'found t))
|
|
|
|
|
(setq plist (cdr (cdr plist))))
|
|
|
|
|
nil))
|
|
|
|
|
|
|
|
|
|
;; Emacs' plist-get lacks third parameter
|
|
|
|
|
(defun eudc-plist-get (plist prop &optional default)
|
|
|
|
|
"Extract a value from a property list.
|
|
|
|
|
PLIST is a property list, which is a list of the form
|
2002-09-16 02:49:22 +00:00
|
|
|
|
\(PROP1 VALUE1 PROP2 VALUE2...). This function returns the value
|
2000-01-12 20:50:20 +00:00
|
|
|
|
corresponding to the given PROP, or DEFAULT if PROP is not
|
|
|
|
|
one of the properties on the list."
|
|
|
|
|
(if (eudc-plist-member plist prop)
|
|
|
|
|
(plist-get plist prop)
|
|
|
|
|
default))
|
|
|
|
|
|
|
|
|
|
(defun eudc-lax-plist-get (plist prop &optional default)
|
|
|
|
|
"Extract a value from a lax property list.
|
|
|
|
|
|
|
|
|
|
PLIST is a lax property list, which is a list of the form (PROP1
|
|
|
|
|
VALUE1 PROP2 VALUE2...), where comparisons between properties are done
|
|
|
|
|
using `equal' instead of `eq'. This function returns the value
|
|
|
|
|
corresponding to PROP, or DEFAULT if PROP is not one of the
|
|
|
|
|
properties on the list."
|
|
|
|
|
(if (not (= 0 (% (length plist) 2)))
|
|
|
|
|
(error "Malformed plist"))
|
|
|
|
|
(catch 'found
|
|
|
|
|
(while plist
|
|
|
|
|
(if (equal prop (car plist))
|
|
|
|
|
(throw 'found (car (cdr plist))))
|
|
|
|
|
(setq plist (cdr (cdr plist))))
|
|
|
|
|
default))
|
|
|
|
|
|
|
|
|
|
(if (not (fboundp 'split-string))
|
|
|
|
|
(defun split-string (string &optional pattern)
|
|
|
|
|
"Return a list of substrings of STRING which are separated by PATTERN.
|
|
|
|
|
If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"."
|
|
|
|
|
(or pattern
|
|
|
|
|
(setq pattern "[ \f\t\n\r\v]+"))
|
|
|
|
|
(let (parts (start 0))
|
|
|
|
|
(when (string-match pattern string 0)
|
|
|
|
|
(if (> (match-beginning 0) 0)
|
|
|
|
|
(setq parts (cons (substring string 0 (match-beginning 0)) nil)))
|
|
|
|
|
(setq start (match-end 0))
|
|
|
|
|
(while (and (string-match pattern string start)
|
|
|
|
|
(> (match-end 0) start))
|
|
|
|
|
(setq parts (cons (substring string start (match-beginning 0)) parts)
|
|
|
|
|
start (match-end 0))))
|
|
|
|
|
(nreverse (if (< start (length string))
|
|
|
|
|
(cons (substring string start) parts)
|
|
|
|
|
parts)))))
|
|
|
|
|
|
|
|
|
|
(defun eudc-replace-in-string (str regexp newtext)
|
|
|
|
|
"Replace all matches in STR for REGEXP with NEWTEXT.
|
|
|
|
|
Value is the new string."
|
|
|
|
|
(let ((rtn-str "")
|
|
|
|
|
(start 0)
|
|
|
|
|
match prev-start)
|
|
|
|
|
(while (setq match (string-match regexp str start))
|
|
|
|
|
(setq prev-start start
|
|
|
|
|
start (match-end 0)
|
|
|
|
|
rtn-str
|
|
|
|
|
(concat rtn-str
|
|
|
|
|
(substring str prev-start match)
|
|
|
|
|
newtext)))
|
|
|
|
|
(concat rtn-str (substring str start))))
|
|
|
|
|
|
2002-01-06 15:06:14 +00:00
|
|
|
|
;;}}}
|
2000-01-12 20:50:20 +00:00
|
|
|
|
|
|
|
|
|
;;{{{ Server and Protocol Variable Routines
|
|
|
|
|
|
|
|
|
|
(defun eudc-server-local-variable-p (var)
|
|
|
|
|
"Return non-nil if VAR has server-local bindings."
|
|
|
|
|
(eudc-plist-member (get var 'eudc-locals) 'server))
|
|
|
|
|
|
|
|
|
|
(defun eudc-protocol-local-variable-p (var)
|
|
|
|
|
"Return non-nil if VAR has protocol-local bindings."
|
|
|
|
|
(eudc-plist-member (get var 'eudc-locals) 'protocol))
|
|
|
|
|
|
|
|
|
|
(defun eudc-default-set (var val)
|
|
|
|
|
"Set the EUDC default value of VAR to VAL.
|
|
|
|
|
The current binding of VAR is not changed."
|
2002-10-18 08:52:37 +00:00
|
|
|
|
(put var 'eudc-locals
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(plist-put (get var 'eudc-locals) 'default val))
|
|
|
|
|
(add-to-list 'eudc-local-vars var))
|
|
|
|
|
|
|
|
|
|
(defun eudc-protocol-set (var val &optional protocol)
|
|
|
|
|
"Set the PROTOCOL-local binding of VAR to VAL.
|
|
|
|
|
If omitted PROTOCOL defaults to the current value of `eudc-protocol'.
|
|
|
|
|
The current binding of VAR is changed only if PROTOCOL is omitted."
|
|
|
|
|
(if (eq 'unbound (eudc-variable-default-value var))
|
|
|
|
|
(eudc-default-set var (symbol-value var)))
|
|
|
|
|
(let* ((eudc-locals (get var 'eudc-locals))
|
|
|
|
|
(protocol-locals (eudc-plist-get eudc-locals 'protocol)))
|
|
|
|
|
(setq protocol-locals (plist-put protocol-locals (or protocol
|
|
|
|
|
eudc-protocol) val))
|
2002-10-18 08:52:37 +00:00
|
|
|
|
(setq eudc-locals
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(plist-put eudc-locals 'protocol protocol-locals))
|
|
|
|
|
(put var 'eudc-locals eudc-locals)
|
|
|
|
|
(add-to-list 'eudc-local-vars var)
|
|
|
|
|
(unless protocol
|
|
|
|
|
(eudc-update-variable var))))
|
2002-01-06 15:06:14 +00:00
|
|
|
|
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(defun eudc-server-set (var val &optional server)
|
|
|
|
|
"Set the SERVER-local binding of VAR to VAL.
|
|
|
|
|
If omitted SERVER defaults to the current value of `eudc-server'.
|
|
|
|
|
The current binding of VAR is changed only if SERVER is omitted."
|
|
|
|
|
(if (eq 'unbound (eudc-variable-default-value var))
|
|
|
|
|
(eudc-default-set var (symbol-value var)))
|
|
|
|
|
(let* ((eudc-locals (get var 'eudc-locals))
|
|
|
|
|
(server-locals (eudc-plist-get eudc-locals 'server)))
|
|
|
|
|
(setq server-locals (plist-put server-locals (or server
|
|
|
|
|
eudc-server) val))
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(setq eudc-locals
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(plist-put eudc-locals 'server server-locals))
|
|
|
|
|
(put var 'eudc-locals eudc-locals)
|
|
|
|
|
(add-to-list 'eudc-local-vars var)
|
|
|
|
|
(unless server
|
|
|
|
|
(eudc-update-variable var))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun eudc-set (var val)
|
|
|
|
|
"Set the most local (server, protocol or default) binding of VAR to VAL.
|
|
|
|
|
The current binding of VAR is also set to VAL"
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(cond
|
2000-01-12 20:50:20 +00:00
|
|
|
|
((not (eq 'unbound (eudc-variable-server-value var)))
|
|
|
|
|
(eudc-server-set var val))
|
|
|
|
|
((not (eq 'unbound (eudc-variable-protocol-value var)))
|
|
|
|
|
(eudc-protocol-set var val))
|
|
|
|
|
(t
|
|
|
|
|
(eudc-default-set var val)))
|
|
|
|
|
(set var val))
|
|
|
|
|
|
|
|
|
|
(defun eudc-variable-default-value (var)
|
|
|
|
|
"Return the default binding of VAR.
|
|
|
|
|
Return `unbound' if VAR has no EUDC default value."
|
|
|
|
|
(let ((eudc-locals (get var 'eudc-locals)))
|
|
|
|
|
(if (and (boundp var)
|
|
|
|
|
eudc-locals)
|
|
|
|
|
(eudc-plist-get eudc-locals 'default 'unbound)
|
|
|
|
|
'unbound)))
|
|
|
|
|
|
|
|
|
|
(defun eudc-variable-protocol-value (var &optional protocol)
|
|
|
|
|
"Return the value of VAR local to PROTOCOL.
|
|
|
|
|
Return `unbound' if VAR has no value local to PROTOCOL.
|
|
|
|
|
PROTOCOL defaults to `eudc-protocol'"
|
|
|
|
|
(let* ((eudc-locals (get var 'eudc-locals))
|
|
|
|
|
protocol-locals)
|
|
|
|
|
(if (not (and (boundp var)
|
|
|
|
|
eudc-locals
|
|
|
|
|
(eudc-plist-member eudc-locals 'protocol)))
|
|
|
|
|
'unbound
|
|
|
|
|
(setq protocol-locals (eudc-plist-get eudc-locals 'protocol))
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(eudc-lax-plist-get protocol-locals
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(or protocol
|
|
|
|
|
eudc-protocol) 'unbound))))
|
|
|
|
|
|
|
|
|
|
(defun eudc-variable-server-value (var &optional server)
|
|
|
|
|
"Return the value of VAR local to SERVER.
|
|
|
|
|
Return `unbound' if VAR has no value local to SERVER.
|
|
|
|
|
SERVER defaults to `eudc-server'"
|
|
|
|
|
(let* ((eudc-locals (get var 'eudc-locals))
|
|
|
|
|
server-locals)
|
|
|
|
|
(if (not (and (boundp var)
|
|
|
|
|
eudc-locals
|
|
|
|
|
(eudc-plist-member eudc-locals 'server)))
|
|
|
|
|
'unbound
|
|
|
|
|
(setq server-locals (eudc-plist-get eudc-locals 'server))
|
2002-10-18 08:52:37 +00:00
|
|
|
|
(eudc-lax-plist-get server-locals
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(or server
|
|
|
|
|
eudc-server) 'unbound))))
|
|
|
|
|
|
|
|
|
|
(defun eudc-update-variable (var)
|
|
|
|
|
"Set the value of VAR according to its locals.
|
|
|
|
|
If the VAR has a server- or protocol-local value corresponding
|
|
|
|
|
to the current `eudc-server' and `eudc-protocol' then it is set
|
|
|
|
|
accordingly. Otherwise it is set to its EUDC default binding"
|
|
|
|
|
(let (val)
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(cond
|
2000-01-12 20:50:20 +00:00
|
|
|
|
((not (eq 'unbound (setq val (eudc-variable-server-value var))))
|
|
|
|
|
(set var val))
|
|
|
|
|
((not (eq 'unbound (setq val (eudc-variable-protocol-value var))))
|
|
|
|
|
(set var val))
|
|
|
|
|
((not (eq 'unbound (setq val (eudc-variable-default-value var))))
|
|
|
|
|
(set var val)))))
|
|
|
|
|
|
|
|
|
|
(defun eudc-update-local-variables ()
|
|
|
|
|
"Update all EUDC variables according to their local settings."
|
|
|
|
|
(interactive)
|
|
|
|
|
(mapcar 'eudc-update-variable eudc-local-vars))
|
|
|
|
|
|
|
|
|
|
(eudc-default-set 'eudc-query-function nil)
|
|
|
|
|
(eudc-default-set 'eudc-list-attributes-function nil)
|
|
|
|
|
(eudc-default-set 'eudc-protocol-attributes-translation-alist nil)
|
|
|
|
|
(eudc-default-set 'eudc-bbdb-conversion-alist nil)
|
|
|
|
|
(eudc-default-set 'eudc-switch-to-server-hook nil)
|
|
|
|
|
(eudc-default-set 'eudc-switch-from-server-hook nil)
|
|
|
|
|
(eudc-default-set 'eudc-protocol-has-default-query-attributes nil)
|
|
|
|
|
(eudc-default-set 'eudc-attribute-display-method-alist nil)
|
|
|
|
|
|
|
|
|
|
;;}}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Add PROTOCOL to the list of supported protocols
|
|
|
|
|
(defun eudc-register-protocol (protocol)
|
|
|
|
|
(unless (memq protocol eudc-supported-protocols)
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(setq eudc-supported-protocols
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(cons protocol eudc-supported-protocols))
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(put 'eudc-protocol 'custom-type
|
2000-01-12 20:50:20 +00:00
|
|
|
|
`(choice :menu-tag "Protocol"
|
2002-01-06 15:06:14 +00:00
|
|
|
|
,@(mapcar (lambda (s)
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(list 'string ':tag (symbol-name s)))
|
|
|
|
|
eudc-supported-protocols))))
|
|
|
|
|
(or (memq protocol eudc-known-protocols)
|
|
|
|
|
(setq eudc-known-protocols
|
|
|
|
|
(cons protocol eudc-known-protocols))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun eudc-translate-query (query)
|
|
|
|
|
"Translate attribute names of QUERY.
|
|
|
|
|
The translation is done according to
|
|
|
|
|
`eudc-protocol-attributes-translation-alist'."
|
|
|
|
|
(if eudc-protocol-attributes-translation-alist
|
2011-05-23 17:57:17 +00:00
|
|
|
|
(mapcar (lambda (attribute)
|
|
|
|
|
(let ((trans (assq (car attribute)
|
|
|
|
|
(symbol-value eudc-protocol-attributes-translation-alist))))
|
|
|
|
|
(if trans
|
|
|
|
|
(cons (cdr trans) (cdr attribute))
|
|
|
|
|
attribute)))
|
2000-01-12 20:50:20 +00:00
|
|
|
|
query)
|
2002-01-06 15:06:14 +00:00
|
|
|
|
query))
|
2000-01-12 20:50:20 +00:00
|
|
|
|
|
|
|
|
|
(defun eudc-translate-attribute-list (list)
|
|
|
|
|
"Translate a list of attribute names LIST.
|
|
|
|
|
The translation is done according to
|
|
|
|
|
`eudc-protocol-attributes-translation-alist'."
|
|
|
|
|
(if eudc-protocol-attributes-translation-alist
|
|
|
|
|
(let (trans)
|
2011-05-23 17:57:17 +00:00
|
|
|
|
(mapcar (lambda (attribute)
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(setq trans (assq attribute
|
|
|
|
|
(symbol-value eudc-protocol-attributes-translation-alist)))
|
|
|
|
|
(if trans
|
|
|
|
|
(cdr trans)
|
|
|
|
|
attribute))
|
|
|
|
|
list))
|
|
|
|
|
list))
|
|
|
|
|
|
2002-01-16 08:22:15 +00:00
|
|
|
|
(defun eudc-select (choices beg end)
|
|
|
|
|
"Choose one from CHOICES using a completion.
|
|
|
|
|
BEG and END delimit the text which is to be replaced."
|
|
|
|
|
(let ((replacement))
|
|
|
|
|
(setq replacement
|
2005-11-01 07:07:25 +00:00
|
|
|
|
(completing-read "Multiple matches found; choose one: "
|
2002-01-16 08:22:15 +00:00
|
|
|
|
(mapcar 'list choices)))
|
|
|
|
|
(delete-region beg end)
|
|
|
|
|
(insert replacement)))
|
2000-01-12 20:50:20 +00:00
|
|
|
|
|
|
|
|
|
(defun eudc-query (query &optional return-attributes no-translation)
|
|
|
|
|
"Query the current directory server with QUERY.
|
|
|
|
|
QUERY is a list of cons cells (ATTR . VALUE) where ATTR is an attribute
|
|
|
|
|
name and VALUE the corresponding value.
|
2002-01-06 15:06:14 +00:00
|
|
|
|
If NO-TRANSLATION is non-nil, ATTR is translated according to
|
2000-01-12 20:50:20 +00:00
|
|
|
|
`eudc-protocol-attributes-translation-alist'.
|
2002-01-06 15:06:14 +00:00
|
|
|
|
RETURN-ATTRIBUTES is a list of attributes to return defaulting to
|
2000-01-12 20:50:20 +00:00
|
|
|
|
`eudc-default-return-attributes'."
|
|
|
|
|
(unless eudc-query-function
|
|
|
|
|
(error "Don't know how to perform the query"))
|
|
|
|
|
(if no-translation
|
|
|
|
|
(funcall eudc-query-function query (or return-attributes
|
|
|
|
|
eudc-default-return-attributes))
|
2002-01-06 15:06:14 +00:00
|
|
|
|
|
|
|
|
|
(funcall eudc-query-function
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(eudc-translate-query query)
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(cond
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(return-attributes
|
|
|
|
|
(eudc-translate-attribute-list return-attributes))
|
|
|
|
|
((listp eudc-default-return-attributes)
|
|
|
|
|
(eudc-translate-attribute-list eudc-default-return-attributes))
|
|
|
|
|
(t
|
|
|
|
|
eudc-default-return-attributes)))))
|
|
|
|
|
|
|
|
|
|
(defun eudc-format-attribute-name-for-display (attribute)
|
|
|
|
|
"Format a directory attribute name for display.
|
2002-01-06 15:06:14 +00:00
|
|
|
|
ATTRIBUTE is looked up in `eudc-user-attribute-names-alist' and replaced
|
2000-01-12 20:50:20 +00:00
|
|
|
|
by the corresponding user name if any. Otherwise it is capitalized and
|
|
|
|
|
underscore characters are replaced by spaces."
|
|
|
|
|
(let ((match (assq attribute eudc-user-attribute-names-alist)))
|
|
|
|
|
(if match
|
|
|
|
|
(cdr match)
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(capitalize
|
|
|
|
|
(mapconcat 'identity
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(split-string (symbol-name attribute) "_")
|
|
|
|
|
" ")))))
|
|
|
|
|
|
|
|
|
|
(defun eudc-print-attribute-value (field)
|
|
|
|
|
"Insert the value of the directory FIELD at point.
|
2002-01-06 15:06:14 +00:00
|
|
|
|
The directory attribute name in car of FIELD is looked up in
|
|
|
|
|
`eudc-attribute-display-method-alist' and the corresponding method,
|
2000-01-12 20:50:20 +00:00
|
|
|
|
if any, is called to print the value in cdr of FIELD."
|
|
|
|
|
(let ((match (assoc (downcase (car field))
|
|
|
|
|
eudc-attribute-display-method-alist))
|
|
|
|
|
(col (current-column))
|
|
|
|
|
(val (cdr field)))
|
|
|
|
|
(if match
|
|
|
|
|
(progn
|
|
|
|
|
(eval (list (cdr match) val))
|
|
|
|
|
(insert "\n"))
|
|
|
|
|
(mapcar
|
|
|
|
|
(function
|
|
|
|
|
(lambda (val-elem)
|
|
|
|
|
(indent-to col)
|
|
|
|
|
(insert val-elem "\n")))
|
|
|
|
|
(cond
|
|
|
|
|
((listp val) val)
|
|
|
|
|
((stringp val) (split-string val "\n"))
|
|
|
|
|
((null val) '(""))
|
|
|
|
|
(t (list val)))))))
|
|
|
|
|
|
|
|
|
|
(defun eudc-print-record-field (field column-width)
|
|
|
|
|
"Print the record field FIELD.
|
|
|
|
|
FIELD is a list (ATTR VALUE1 VALUE2 ...) or cons-cell (ATTR . VAL)
|
2002-01-06 15:06:14 +00:00
|
|
|
|
COLUMN-WIDTH is the width of the first display column containing the
|
2000-01-12 20:50:20 +00:00
|
|
|
|
attribute name ATTR."
|
|
|
|
|
(let ((field-beg (point)))
|
|
|
|
|
;; The record field that is passed to this function has already been processed
|
|
|
|
|
;; by `eudc-format-attribute-name-for-display' so we don't need to call it
|
|
|
|
|
;; again to display the attribute name
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(insert (format (concat "%" (int-to-string column-width) "s: ")
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(car field)))
|
|
|
|
|
(put-text-property field-beg (point) 'face 'bold)
|
|
|
|
|
(indent-to (+ 2 column-width))
|
|
|
|
|
(eudc-print-attribute-value field)))
|
|
|
|
|
|
|
|
|
|
(defun eudc-display-records (records &optional raw-attr-names)
|
2002-01-06 15:06:14 +00:00
|
|
|
|
"Display the record list RECORDS in a formatted buffer.
|
2000-01-12 20:50:20 +00:00
|
|
|
|
If RAW-ATTR-NAMES is non-nil, the raw attribute names are displayed
|
|
|
|
|
otherwise they are formatted according to `eudc-user-attribute-names-alist'."
|
2004-11-01 07:47:18 +00:00
|
|
|
|
(let (inhibit-read-only
|
2000-01-12 20:50:20 +00:00
|
|
|
|
precords
|
|
|
|
|
(width 0)
|
|
|
|
|
beg
|
|
|
|
|
first-record
|
|
|
|
|
attribute-name)
|
2004-11-01 07:47:18 +00:00
|
|
|
|
(with-output-to-temp-buffer "*Directory Query Results*"
|
|
|
|
|
(with-current-buffer standard-output
|
|
|
|
|
(setq buffer-read-only t)
|
|
|
|
|
(setq inhibit-read-only t)
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(insert "Directory Query Result\n")
|
|
|
|
|
(insert "======================\n\n\n")
|
|
|
|
|
(if (null records)
|
|
|
|
|
(insert "No match found.\n"
|
|
|
|
|
(if eudc-strict-return-matches
|
|
|
|
|
"Try setting `eudc-strict-return-matches' to nil or change `eudc-default-return-attributes'.\n"
|
|
|
|
|
""))
|
|
|
|
|
;; Replace field names with user names, compute max width
|
|
|
|
|
(setq precords
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(mapcar
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(function
|
2004-11-01 07:47:18 +00:00
|
|
|
|
(lambda (record)
|
|
|
|
|
(mapcar
|
|
|
|
|
(function
|
|
|
|
|
(lambda (field)
|
|
|
|
|
(setq attribute-name
|
|
|
|
|
(if raw-attr-names
|
|
|
|
|
(symbol-name (car field))
|
|
|
|
|
(eudc-format-attribute-name-for-display (car field))))
|
|
|
|
|
(if (> (length attribute-name) width)
|
|
|
|
|
(setq width (length attribute-name)))
|
|
|
|
|
(cons attribute-name (cdr field))))
|
|
|
|
|
record)))
|
|
|
|
|
records))
|
|
|
|
|
;; Display the records
|
|
|
|
|
(setq first-record (point))
|
2007-10-13 03:02:57 +00:00
|
|
|
|
(mapc
|
2004-11-01 07:47:18 +00:00
|
|
|
|
(function
|
|
|
|
|
(lambda (record)
|
|
|
|
|
(setq beg (point))
|
|
|
|
|
;; Map over the record fields to print the attribute/value pairs
|
2007-10-13 03:02:57 +00:00
|
|
|
|
(mapc (function
|
|
|
|
|
(lambda (field)
|
|
|
|
|
(eudc-print-record-field field width)))
|
|
|
|
|
record)
|
2004-11-01 07:47:18 +00:00
|
|
|
|
;; Store the record internal format in some convenient place
|
|
|
|
|
(overlay-put (make-overlay beg (point))
|
|
|
|
|
'eudc-record
|
|
|
|
|
(car records))
|
|
|
|
|
(setq records (cdr records))
|
|
|
|
|
(insert "\n")))
|
|
|
|
|
precords))
|
|
|
|
|
(insert "\n")
|
|
|
|
|
(widget-create 'push-button
|
|
|
|
|
:notify (lambda (&rest ignore)
|
|
|
|
|
(eudc-query-form))
|
|
|
|
|
"New query")
|
|
|
|
|
(widget-insert " ")
|
|
|
|
|
(widget-create 'push-button
|
|
|
|
|
:notify (lambda (&rest ignore)
|
|
|
|
|
(kill-this-buffer))
|
|
|
|
|
"Quit")
|
|
|
|
|
(eudc-mode)
|
|
|
|
|
(widget-setup)
|
|
|
|
|
(if first-record
|
|
|
|
|
(goto-char first-record))))))
|
2000-01-12 20:50:20 +00:00
|
|
|
|
|
|
|
|
|
(defun eudc-process-form ()
|
|
|
|
|
"Process the query form in current buffer and display the results."
|
|
|
|
|
(let (query-alist
|
|
|
|
|
value)
|
|
|
|
|
(if (not (and (boundp 'eudc-form-widget-list)
|
|
|
|
|
eudc-form-widget-list))
|
|
|
|
|
(error "Not in a directory query form buffer")
|
2007-10-13 03:02:57 +00:00
|
|
|
|
(mapc (function
|
|
|
|
|
(lambda (wid-field)
|
|
|
|
|
(setq value (widget-value (cdr wid-field)))
|
|
|
|
|
(if (not (string= value ""))
|
|
|
|
|
(setq query-alist (cons (cons (car wid-field) value)
|
|
|
|
|
query-alist)))))
|
|
|
|
|
eudc-form-widget-list)
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(kill-buffer (current-buffer))
|
|
|
|
|
(eudc-display-records (eudc-query query-alist) eudc-use-raw-directory-names))))
|
2002-01-06 15:06:14 +00:00
|
|
|
|
|
2000-01-12 20:50:20 +00:00
|
|
|
|
|
|
|
|
|
(defun eudc-filter-duplicate-attributes (record)
|
|
|
|
|
"Filter RECORD according to `eudc-duplicate-attribute-handling-method'."
|
|
|
|
|
(let ((rec record)
|
|
|
|
|
unique
|
|
|
|
|
duplicates
|
|
|
|
|
result)
|
|
|
|
|
|
|
|
|
|
;; Search for multiple records
|
|
|
|
|
(while (and rec
|
|
|
|
|
(not (listp (eudc-cdar rec))))
|
|
|
|
|
(setq rec (cdr rec)))
|
|
|
|
|
|
|
|
|
|
(if (null (eudc-cdar rec))
|
|
|
|
|
(list record) ; No duplicate attrs in this record
|
2007-10-13 03:02:57 +00:00
|
|
|
|
(mapc (function
|
|
|
|
|
(lambda (field)
|
|
|
|
|
(if (listp (cdr field))
|
|
|
|
|
(setq duplicates (cons field duplicates))
|
|
|
|
|
(setq unique (cons field unique)))))
|
|
|
|
|
record)
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(setq result (list unique))
|
|
|
|
|
;; Map over the record fields that have multiple values
|
2007-10-13 03:02:57 +00:00
|
|
|
|
(mapc
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(function
|
|
|
|
|
(lambda (field)
|
|
|
|
|
(let ((method (if (consp eudc-duplicate-attribute-handling-method)
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(cdr
|
|
|
|
|
(assq
|
|
|
|
|
(or
|
|
|
|
|
(car
|
|
|
|
|
(rassq
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(car field)
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(symbol-value
|
2000-01-12 20:50:20 +00:00
|
|
|
|
eudc-protocol-attributes-translation-alist)))
|
|
|
|
|
(car field))
|
|
|
|
|
eudc-duplicate-attribute-handling-method))
|
|
|
|
|
eudc-duplicate-attribute-handling-method)))
|
|
|
|
|
(cond
|
|
|
|
|
((or (null method) (eq 'list method))
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(setq result
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(eudc-add-field-to-records field result)))
|
|
|
|
|
((eq 'first method)
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(setq result
|
|
|
|
|
(eudc-add-field-to-records (cons (car field)
|
|
|
|
|
(eudc-cadr field))
|
2000-01-12 20:50:20 +00:00
|
|
|
|
result)))
|
|
|
|
|
((eq 'concat method)
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(setq result
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(eudc-add-field-to-records (cons (car field)
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(mapconcat
|
2000-01-12 20:50:20 +00:00
|
|
|
|
'identity
|
|
|
|
|
(cdr field)
|
|
|
|
|
"\n")) result)))
|
|
|
|
|
((eq 'duplicate method)
|
|
|
|
|
(setq result
|
|
|
|
|
(eudc-distribute-field-on-records field result)))))))
|
|
|
|
|
duplicates)
|
|
|
|
|
result)))
|
|
|
|
|
|
|
|
|
|
(defun eudc-filter-partial-records (records attrs)
|
2002-01-06 16:41:07 +00:00
|
|
|
|
"Eliminate records that do not contain all ATTRS from RECORDS."
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(delq nil
|
|
|
|
|
(mapcar
|
|
|
|
|
(function
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(lambda (rec)
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(if (eval (cons 'and
|
|
|
|
|
(mapcar
|
|
|
|
|
(function
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(lambda (attr)
|
|
|
|
|
(consp (assq attr rec))))
|
|
|
|
|
attrs)))
|
|
|
|
|
rec)))
|
|
|
|
|
records)))
|
2002-01-06 15:06:14 +00:00
|
|
|
|
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(defun eudc-add-field-to-records (field records)
|
|
|
|
|
"Add FIELD to each individual record in RECORDS and return the resulting list."
|
|
|
|
|
(mapcar (function
|
|
|
|
|
(lambda (r)
|
|
|
|
|
(cons field r)))
|
|
|
|
|
records))
|
|
|
|
|
|
|
|
|
|
(defun eudc-distribute-field-on-records (field records)
|
|
|
|
|
"Duplicate each individual record in RECORDS according to value of FIELD.
|
|
|
|
|
Each copy is added a new field containing one of the values of FIELD."
|
|
|
|
|
(let (result
|
|
|
|
|
(values (cdr field)))
|
|
|
|
|
;; Uniquify values first
|
|
|
|
|
(while values
|
|
|
|
|
(setcdr values (delete (car values) (cdr values)))
|
|
|
|
|
(setq values (cdr values)))
|
2007-10-13 03:02:57 +00:00
|
|
|
|
(mapc
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(function
|
|
|
|
|
(lambda (value)
|
|
|
|
|
(let ((result-list (copy-sequence records)))
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(setq result-list (eudc-add-field-to-records
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(cons (car field) value)
|
|
|
|
|
result-list))
|
|
|
|
|
(setq result (append result-list result))
|
|
|
|
|
)))
|
|
|
|
|
(cdr field))
|
|
|
|
|
result))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun eudc-mode ()
|
|
|
|
|
"Major mode used in buffers displaying the results of directory queries.
|
|
|
|
|
There is no sense in calling this command from a buffer other than
|
|
|
|
|
one containing the results of a directory query.
|
|
|
|
|
|
|
|
|
|
These are the special commands of EUDC mode:
|
|
|
|
|
q -- Kill this buffer.
|
|
|
|
|
f -- Display a form to query the current directory server.
|
|
|
|
|
n -- Move to next record.
|
|
|
|
|
p -- Move to previous record.
|
|
|
|
|
b -- Insert record at point into the BBDB database."
|
|
|
|
|
(interactive)
|
|
|
|
|
(kill-all-local-variables)
|
|
|
|
|
(setq major-mode 'eudc-mode)
|
|
|
|
|
(setq mode-name "EUDC")
|
|
|
|
|
(use-local-map eudc-mode-map)
|
* emulation/edt-mapper.el (function-key-map):
(edt-map-key): Make it a function instead of using fset. Inline
edt-gnu-map-key and edt-lucid-map-key. Use featurep 'xemacs.
(edt-gnu-map-key, edt-lucid-map-key): Remove.
(edt-x-emacs-p): Remove.
(edt-emacs-variant, edt-window-system, edt-xserver):
Use featurep 'xemacs.
* net/eudc.el: Use (featurep 'xemacs) instead of the string test.
Replace eudc-xemacs-p with its definition.
(eudc-xemacs-p, eudc-emacs-p, eudc-xemacs-mule-p)
(eudc-emacs-mule-p): Remove.
(eudc-install-menu, eudc-mode): Replace eudc-emacs-p and
eudc-xemacs-p with feature tests.
* net/eudc-bob.el (eudc-bob-generic-menu, eudc-bob-mail-keymap)
(eudc-bob-url-keymap, eudc-bob-sound-keymap)
(eudc-bob-generic-keymap, eudc-bob-popup-menu)
(eudc-bob-toggle-inline-display):
* net/eudc-hotlist.el (eudc-hotlist-emacs-menu): Replace
eudc-emacs-p and eudc-xemacs-p with feature tests.
* net/eudcb-ph.el (eudc-ph-open-session): Replace
eudc-xemacs-mule-p with its former definition.
* progmodes/octave-mod.el (octave-xemacs-p): Remove.
(octave-abbrev-start): Replace octave-xemacs-p with
(featurep 'xemacs).
* progmodes/vera-mode.el (vera-xemacs): Remove.
(vera-mode-syntax-table): Replace vera-xemacs with
(featurep 'xemacs).
* progmodes/vhdl-mode.el (vhdl-xemacs): Remove.
(vhdl-doc-mode, vhdl-doc-variable, vhdl-compile-init)
(vhdl-speedbar-initialize, vhdl-ps-print-init)
(vhdl-forward-comment, vhdl-mode-map-init, vhdl-show-messages)
(vhdl-emacs-22, vhdl-emacs-21): Replace vhdl-xemacs
with (featurep 'xemacs).
* progmodes/antlr-mode.el (cond-emacs-xemacs-macfn, defunx)
(save-buffer-state-x):
* obsolete/fast-lock.el (fast-lock-verbose):
* emulation/viper-init.el (viper-xemacs-p)
(viper-cond-compile-for-xemacs-or-emacs):
* emacs-lisp/checkdoc.el (checkdoc-minor-mode-map):
* ps-print.el (case-fold-search):
* ediff-hook.el (ediff-cond-compile-for-xemacs-or-emacs):
* calculator.el (calculator-help): Use featurep 'xemacs.
2007-10-21 17:22:04 +00:00
|
|
|
|
(if (not (featurep 'xemacs))
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(easy-menu-define eudc-emacs-menu eudc-mode-map "" (eudc-menu))
|
|
|
|
|
(setq mode-popup-menu (eudc-menu)))
|
2005-05-26 15:23:59 +00:00
|
|
|
|
(run-mode-hooks 'eudc-mode-hook))
|
2000-01-12 20:50:20 +00:00
|
|
|
|
|
2002-01-06 15:06:14 +00:00
|
|
|
|
;;}}}
|
2000-01-12 20:50:20 +00:00
|
|
|
|
|
|
|
|
|
;;{{{ High-level interfaces (interactive functions)
|
|
|
|
|
|
|
|
|
|
(defun eudc-customize ()
|
|
|
|
|
"Customize the EUDC package."
|
|
|
|
|
(interactive)
|
|
|
|
|
(customize-group 'eudc))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun eudc-set-server (server protocol &optional no-save)
|
|
|
|
|
"Set the directory server to SERVER using PROTOCOL.
|
2002-01-06 15:06:14 +00:00
|
|
|
|
Unless NO-SAVE is non-nil, the server is saved as the default
|
2000-01-12 20:50:20 +00:00
|
|
|
|
server for future sessions."
|
|
|
|
|
(interactive (list
|
|
|
|
|
(read-from-minibuffer "Directory Server: ")
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(intern (completing-read "Protocol: "
|
2011-05-23 17:57:17 +00:00
|
|
|
|
(mapcar (lambda (elt)
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(cons (symbol-name elt)
|
|
|
|
|
elt))
|
|
|
|
|
eudc-known-protocols)))))
|
|
|
|
|
(unless (or (member protocol
|
|
|
|
|
eudc-supported-protocols)
|
|
|
|
|
(load (concat "eudcb-" (symbol-name protocol)) t))
|
|
|
|
|
(error "Unsupported protocol: %s" protocol))
|
|
|
|
|
(run-hooks 'eudc-switch-from-server-hook)
|
|
|
|
|
(setq eudc-protocol protocol)
|
|
|
|
|
(setq eudc-server server)
|
|
|
|
|
(eudc-update-local-variables)
|
|
|
|
|
(run-hooks 'eudc-switch-to-server-hook)
|
2009-10-02 03:48:36 +00:00
|
|
|
|
(if (called-interactively-p 'interactive)
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(message "Current directory server is now %s (%s)" eudc-server eudc-protocol))
|
|
|
|
|
(if (null no-save)
|
|
|
|
|
(eudc-save-options)))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2004-11-01 07:47:18 +00:00
|
|
|
|
(defun eudc-get-email (name &optional error)
|
|
|
|
|
"Get the email field of NAME from the directory server.
|
|
|
|
|
If ERROR is non-nil, report an error if there is none."
|
|
|
|
|
(interactive "sName: \np")
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(or eudc-server
|
|
|
|
|
(call-interactively 'eudc-set-server))
|
|
|
|
|
(let ((result (eudc-query (list (cons 'name name)) '(email)))
|
|
|
|
|
email)
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(if (null (cdr result))
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(setq email (eudc-cdaar result))
|
2004-11-01 07:47:18 +00:00
|
|
|
|
(error "Multiple match--use the query form"))
|
|
|
|
|
(if error
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(if email
|
|
|
|
|
(message "%s" email)
|
|
|
|
|
(error "No record matching %s" name)))
|
|
|
|
|
email))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2004-11-01 07:47:18 +00:00
|
|
|
|
(defun eudc-get-phone (name &optional error)
|
|
|
|
|
"Get the phone field of NAME from the directory server.
|
|
|
|
|
If ERROR is non-nil, report an error if there is none."
|
|
|
|
|
(interactive "sName: \np")
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(or eudc-server
|
|
|
|
|
(call-interactively 'eudc-set-server))
|
|
|
|
|
(let ((result (eudc-query (list (cons 'name name)) '(phone)))
|
|
|
|
|
phone)
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(if (null (cdr result))
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(setq phone (eudc-cdaar result))
|
2004-11-01 07:47:18 +00:00
|
|
|
|
(error "Multiple match--use the query form"))
|
|
|
|
|
(if error
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(if phone
|
|
|
|
|
(message "%s" phone)
|
|
|
|
|
(error "No record matching %s" name)))
|
|
|
|
|
phone))
|
|
|
|
|
|
|
|
|
|
(defun eudc-get-attribute-list ()
|
|
|
|
|
"Return a list of valid attributes for the current server.
|
|
|
|
|
When called interactively the list is formatted in a dedicated buffer
|
|
|
|
|
otherwise a list of symbols is returned."
|
|
|
|
|
(interactive)
|
|
|
|
|
(if eudc-list-attributes-function
|
2009-10-02 03:48:36 +00:00
|
|
|
|
(let ((entries (funcall eudc-list-attributes-function
|
|
|
|
|
(called-interactively-p 'interactive))))
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(if entries
|
2009-10-02 03:48:36 +00:00
|
|
|
|
(if (called-interactively-p 'interactive)
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(eudc-display-records entries t)
|
|
|
|
|
entries)))
|
|
|
|
|
(error "The %s protocol has no support for listing attributes" eudc-protocol)))
|
|
|
|
|
|
|
|
|
|
(defun eudc-format-query (words format)
|
|
|
|
|
"Use FORMAT to build a EUDC query from WORDS."
|
|
|
|
|
(let (query
|
|
|
|
|
query-alist
|
|
|
|
|
key val cell)
|
|
|
|
|
(if format
|
|
|
|
|
(progn
|
|
|
|
|
(while (and words format)
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(setq query-alist (cons (cons (car format) (car words))
|
2000-01-12 20:50:20 +00:00
|
|
|
|
query-alist))
|
|
|
|
|
(setq words (cdr words)
|
|
|
|
|
format (cdr format)))
|
|
|
|
|
;; If the same attribute appears more than once, merge
|
|
|
|
|
;; the corresponding values
|
|
|
|
|
(setq query-alist (nreverse query-alist))
|
|
|
|
|
(while query-alist
|
|
|
|
|
(setq key (eudc-caar query-alist)
|
|
|
|
|
val (eudc-cdar query-alist)
|
|
|
|
|
cell (assq key query))
|
|
|
|
|
(if cell
|
|
|
|
|
(setcdr cell (concat (cdr cell) " " val))
|
|
|
|
|
(setq query (cons (car query-alist) query)))
|
|
|
|
|
(setq query-alist (cdr query-alist)))
|
|
|
|
|
query)
|
|
|
|
|
(if eudc-protocol-has-default-query-attributes
|
|
|
|
|
(mapconcat 'identity words " ")
|
|
|
|
|
(list (cons 'name (mapconcat 'identity words " ")))))))
|
|
|
|
|
|
|
|
|
|
(defun eudc-extract-n-word-formats (format-list n)
|
|
|
|
|
"Extract a list of N-long formats from FORMAT-LIST.
|
|
|
|
|
If none try N - 1 and so forth."
|
|
|
|
|
(let (formats)
|
|
|
|
|
(while (and (null formats)
|
|
|
|
|
(> n 0))
|
2002-10-18 08:52:37 +00:00
|
|
|
|
(setq formats
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(delq nil
|
2011-05-23 17:57:17 +00:00
|
|
|
|
(mapcar (lambda (format)
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(if (= n
|
|
|
|
|
(length format))
|
|
|
|
|
format
|
|
|
|
|
nil))
|
|
|
|
|
format-list)))
|
|
|
|
|
(setq n (1- n)))
|
|
|
|
|
formats))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun eudc-expand-inline (&optional replace)
|
|
|
|
|
"Query the directory server, and expand the query string before point.
|
|
|
|
|
The query string consists of the buffer substring from the point back to
|
2002-01-06 15:06:14 +00:00
|
|
|
|
the preceding comma, colon or beginning of line.
|
|
|
|
|
The variable `eudc-inline-query-format' controls how to associate the
|
2000-01-12 20:50:20 +00:00
|
|
|
|
individual inline query words with directory attribute names.
|
2002-01-06 15:06:14 +00:00
|
|
|
|
After querying the server for the given string, the expansion specified by
|
2000-01-12 20:50:20 +00:00
|
|
|
|
`eudc-inline-expansion-format' is inserted in the buffer at point.
|
2002-01-16 08:22:15 +00:00
|
|
|
|
If REPLACE is non-nil, then this expansion replaces the name in the buffer.
|
|
|
|
|
`eudc-expansion-overwrites-query' being non-nil inverts the meaning of REPLACE.
|
2002-01-06 15:06:14 +00:00
|
|
|
|
Multiple servers can be tried with the same query until one finds a match,
|
2000-01-12 20:50:20 +00:00
|
|
|
|
see `eudc-inline-expansion-servers'"
|
|
|
|
|
(interactive)
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(if (memq eudc-inline-expansion-servers
|
2000-01-12 20:50:20 +00:00
|
|
|
|
'(current-server server-then-hotlist))
|
|
|
|
|
(or eudc-server
|
|
|
|
|
(call-interactively 'eudc-set-server))
|
|
|
|
|
(or eudc-server-hotlist
|
|
|
|
|
(error "No server in the hotlist")))
|
|
|
|
|
(let* ((end (point))
|
|
|
|
|
(beg (save-excursion
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(if (re-search-backward "\\([:,]\\|^\\)[ \t]*"
|
Replace still more end-of-line etc with line-end-position, etc.
* lisp/gnus/nnbabyl.el (nnbabyl-request-move-article, nnbabyl-delete-mail)
(nnbabyl-check-mbox): Use point-at-bol.
* lisp/cedet/semantic/lex.el (semantic-lex-ignore-comments, semantic-flex):
* lisp/cedet/semantic/grammar.el (semantic-grammar-epilogue):
* lisp/cedet/ede/speedbar.el (ede-find-nearest-file-line):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/ede/autoconf-edit.el (autoconf-delete-parameter):
Use point-at-bol and point-at-eol.
* lisp/vc/emerge.el (emerge-line-number-in-buf):
* lisp/textmodes/ispell.el (ispell-region):
* lisp/textmodes/fill.el (current-fill-column):
* lisp/progmodes/xscheme.el (xscheme-send-current-line):
* lisp/progmodes/vhdl-mode.el (vhdl-current-line, vhdl-line-copy):
* lisp/progmodes/tcl.el (tcl-hairy-scan-for-comment):
* lisp/progmodes/sh-script.el (sh-handle-prev-do):
* lisp/progmodes/meta-mode.el (meta-indent-line):
* lisp/progmodes/idlwave.el (idlwave-goto-comment, idlwave-fill-paragraph)
(idlwave-in-quote):
* lisp/progmodes/idlw-shell.el (idlwave-shell-current-frame)
(idlwave-shell-update-bp-overlays, idlwave-shell-sources-filter):
* lisp/progmodes/fortran.el (fortran-looking-at-if-then):
* lisp/progmodes/etags.el (find-tag-in-order, etags-snarf-tag):
* lisp/progmodes/cperl-mode.el (cperl-sniff-for-indent)
(cperl-find-pods-heres):
* lisp/progmodes/ada-mode.el (ada-get-current-indent, ada-narrow-to-defun):
* lisp/net/quickurl.el (quickurl-list-insert):
* lisp/net/ldap.el (ldap-search-internal):
* lisp/net/eudc.el (eudc-expand-inline):
* lisp/mail/sendmail.el (sendmail-send-it):
* lisp/mail/mspools.el (mspools-visit-spool, mspools-get-spool-name):
* lisp/emulation/viper-cmd.el (viper-paren-match, viper-backward-indent)
(viper-brac-function):
* lisp/calc/calc-yank.el (calc-do-grab-region):
* lisp/calc/calc-keypd.el (calc-keypad-press):
* lisp/term.el (term-move-columns, term-insert-spaces):
* lisp/speedbar.el (speedbar-highlight-one-tag-line):
* lisp/simple.el (current-word):
* lisp/mouse-drag.el (mouse-drag-should-do-col-scrolling):
* lisp/info.el (Info-find-node-in-buffer-1, Info-follow-reference)
(Info-scroll-down):
* lisp/hippie-exp.el (he-line-beg):
* lisp/epa.el (epa--marked-keys):
* lisp/dired-aux.el (dired-kill-line, dired-do-kill-lines)
(dired-update-file-line, dired-add-entry, dired-remove-entry)
(dired-relist-entry):
* lisp/buff-menu.el (Buffer-menu-buffer):
* lisp/array.el (current-line):
* lisp/allout.el (allout-resolve-xref)
(allout-latex-verbatim-quote-curr-line):
Replace yet more uses of end-of-line etc with line-end-position.
2010-11-09 05:33:07 +00:00
|
|
|
|
(point-at-bol) 'move)
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(goto-char (match-end 0)))
|
|
|
|
|
(point)))
|
|
|
|
|
(query-words (split-string (buffer-substring beg end) "[ \t]+"))
|
|
|
|
|
query-formats
|
|
|
|
|
response
|
|
|
|
|
response-string
|
|
|
|
|
response-strings
|
|
|
|
|
(eudc-former-server eudc-server)
|
|
|
|
|
(eudc-former-protocol eudc-protocol)
|
|
|
|
|
servers)
|
|
|
|
|
|
|
|
|
|
;; Prepare the list of servers to query
|
|
|
|
|
(setq servers (copy-sequence eudc-server-hotlist))
|
|
|
|
|
(setq servers
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(cond
|
2000-01-12 20:50:20 +00:00
|
|
|
|
((eq eudc-inline-expansion-servers 'hotlist)
|
|
|
|
|
eudc-server-hotlist)
|
|
|
|
|
((eq eudc-inline-expansion-servers 'server-then-hotlist)
|
|
|
|
|
(cons (cons eudc-server eudc-protocol)
|
|
|
|
|
(delete (cons eudc-server eudc-protocol) servers)))
|
|
|
|
|
((eq eudc-inline-expansion-servers 'current-server)
|
|
|
|
|
(list (cons eudc-server eudc-protocol)))
|
|
|
|
|
(t
|
|
|
|
|
(error "Wrong value for `eudc-inline-expansion-servers': %S"
|
|
|
|
|
eudc-inline-expansion-servers))))
|
|
|
|
|
(if (and eudc-max-servers-to-query
|
|
|
|
|
(> (length servers) eudc-max-servers-to-query))
|
|
|
|
|
(setcdr (nthcdr (1- eudc-max-servers-to-query) servers) nil))
|
|
|
|
|
|
|
|
|
|
(condition-case signal
|
|
|
|
|
(progn
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(setq response
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(catch 'found
|
|
|
|
|
;; Loop on the servers
|
|
|
|
|
(while servers
|
|
|
|
|
(eudc-set-server (eudc-caar servers) (eudc-cdar servers) t)
|
2002-01-06 15:06:14 +00:00
|
|
|
|
|
2000-01-12 20:50:20 +00:00
|
|
|
|
;; Determine which formats apply in the query-format list
|
|
|
|
|
(setq query-formats
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(or
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(eudc-extract-n-word-formats eudc-inline-query-format
|
|
|
|
|
(length query-words))
|
|
|
|
|
(if (null eudc-protocol-has-default-query-attributes)
|
|
|
|
|
'(name))))
|
2002-01-06 15:06:14 +00:00
|
|
|
|
|
2000-01-12 20:50:20 +00:00
|
|
|
|
;; Loop on query-formats
|
|
|
|
|
(while query-formats
|
|
|
|
|
(setq response
|
|
|
|
|
(eudc-query
|
|
|
|
|
(eudc-format-query query-words (car query-formats))
|
|
|
|
|
(eudc-translate-attribute-list
|
|
|
|
|
(cdr eudc-inline-expansion-format))))
|
|
|
|
|
(if response
|
|
|
|
|
(throw 'found response))
|
|
|
|
|
(setq query-formats (cdr query-formats)))
|
|
|
|
|
(setq servers (cdr servers)))
|
|
|
|
|
;; No more servers to try... no match found
|
|
|
|
|
nil))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(if (null response)
|
|
|
|
|
(error "No match")
|
2002-01-06 15:06:14 +00:00
|
|
|
|
|
2000-01-12 20:50:20 +00:00
|
|
|
|
;; Process response through eudc-inline-expansion-format
|
|
|
|
|
(while response
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(setq response-string (apply 'format
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(car eudc-inline-expansion-format)
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(mapcar (function
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(lambda (field)
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(or (cdr (assq field (car response)))
|
2000-01-12 20:50:20 +00:00
|
|
|
|
"")))
|
|
|
|
|
(eudc-translate-attribute-list
|
|
|
|
|
(cdr eudc-inline-expansion-format)))))
|
|
|
|
|
(if (> (length response-string) 0)
|
|
|
|
|
(setq response-strings
|
|
|
|
|
(cons response-string response-strings)))
|
|
|
|
|
(setq response (cdr response)))
|
2002-01-06 15:06:14 +00:00
|
|
|
|
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(if (or
|
|
|
|
|
(and replace (not eudc-expansion-overwrites-query))
|
|
|
|
|
(and (not replace) eudc-expansion-overwrites-query))
|
2002-01-16 08:22:15 +00:00
|
|
|
|
(kill-ring-save beg end))
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(cond
|
2000-01-12 20:50:20 +00:00
|
|
|
|
((or (= (length response-strings) 1)
|
|
|
|
|
(null eudc-multiple-match-handling-method)
|
|
|
|
|
(eq eudc-multiple-match-handling-method 'first))
|
2002-01-16 08:22:15 +00:00
|
|
|
|
(delete-region beg end)
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(insert (car response-strings)))
|
|
|
|
|
((eq eudc-multiple-match-handling-method 'select)
|
2002-01-16 08:22:15 +00:00
|
|
|
|
(eudc-select response-strings beg end))
|
2000-01-12 20:50:20 +00:00
|
|
|
|
((eq eudc-multiple-match-handling-method 'all)
|
2005-11-01 07:07:25 +00:00
|
|
|
|
(delete-region beg end)
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(insert (mapconcat 'identity response-strings ", ")))
|
|
|
|
|
((eq eudc-multiple-match-handling-method 'abort)
|
2002-01-16 08:22:15 +00:00
|
|
|
|
(error "There is more than one match for the query"))))
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(or (and (equal eudc-server eudc-former-server)
|
|
|
|
|
(equal eudc-protocol eudc-former-protocol))
|
|
|
|
|
(eudc-set-server eudc-former-server eudc-former-protocol t)))
|
2009-09-18 07:07:33 +00:00
|
|
|
|
(error
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(or (and (equal eudc-server eudc-former-server)
|
|
|
|
|
(equal eudc-protocol eudc-former-protocol))
|
|
|
|
|
(eudc-set-server eudc-former-server eudc-former-protocol t))
|
|
|
|
|
(signal (car signal) (cdr signal))))))
|
2002-01-06 15:06:14 +00:00
|
|
|
|
|
2000-01-12 20:50:20 +00:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun eudc-query-form (&optional get-fields-from-server)
|
|
|
|
|
"Display a form to query the directory server.
|
|
|
|
|
If given a non-nil argument GET-FIELDS-FROM-SERVER, the function first
|
|
|
|
|
queries the server for the existing fields and displays a corresponding form."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(let ((fields (or (and get-fields-from-server
|
|
|
|
|
(eudc-get-attribute-list))
|
|
|
|
|
eudc-query-form-attributes))
|
|
|
|
|
(buffer (get-buffer-create "*Directory Query Form*"))
|
|
|
|
|
prompts
|
|
|
|
|
widget
|
|
|
|
|
(width 0)
|
|
|
|
|
inhibit-read-only
|
|
|
|
|
pt)
|
|
|
|
|
(switch-to-buffer buffer)
|
|
|
|
|
(setq inhibit-read-only t)
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(kill-all-local-variables)
|
|
|
|
|
(make-local-variable 'eudc-form-widget-list)
|
|
|
|
|
(widget-insert "Directory Query Form\n")
|
|
|
|
|
(widget-insert "====================\n\n")
|
|
|
|
|
(widget-insert "Current server is: " (or eudc-server
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(progn
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(call-interactively 'eudc-set-server)
|
|
|
|
|
eudc-server))
|
|
|
|
|
"\n")
|
|
|
|
|
(widget-insert "Protocol : " (symbol-name eudc-protocol) "\n")
|
|
|
|
|
;; Build the list of prompts
|
|
|
|
|
(setq prompts (if eudc-use-raw-directory-names
|
|
|
|
|
(mapcar 'symbol-name (eudc-translate-attribute-list fields))
|
|
|
|
|
(mapcar (function
|
|
|
|
|
(lambda (field)
|
|
|
|
|
(or (and (assq field eudc-user-attribute-names-alist)
|
|
|
|
|
(cdr (assq field eudc-user-attribute-names-alist)))
|
|
|
|
|
(capitalize (symbol-name field)))))
|
|
|
|
|
fields)))
|
|
|
|
|
;; Loop over prompt strings to find the longest one
|
2007-10-13 03:02:57 +00:00
|
|
|
|
(mapc (function
|
|
|
|
|
(lambda (prompt)
|
|
|
|
|
(if (> (length prompt) width)
|
|
|
|
|
(setq width (length prompt)))))
|
|
|
|
|
prompts)
|
2002-01-06 15:06:14 +00:00
|
|
|
|
;; Insert the first widget out of the mapcar to leave the cursor
|
|
|
|
|
;; in the first field
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(widget-insert "\n\n" (format (concat "%" (int-to-string width) "s: ") (car prompts)))
|
|
|
|
|
(setq pt (point))
|
|
|
|
|
(setq widget (widget-create 'editable-field :size 15))
|
|
|
|
|
(setq eudc-form-widget-list (cons (cons (car fields) widget)
|
|
|
|
|
eudc-form-widget-list))
|
|
|
|
|
(setq fields (cdr fields))
|
|
|
|
|
(setq prompts (cdr prompts))
|
2007-10-13 03:02:57 +00:00
|
|
|
|
(mapc (function
|
|
|
|
|
(lambda (field)
|
|
|
|
|
(widget-insert "\n\n" (format (concat "%" (int-to-string width) "s: ") (car prompts)))
|
|
|
|
|
(setq widget (widget-create 'editable-field
|
|
|
|
|
:size 15))
|
|
|
|
|
(setq eudc-form-widget-list (cons (cons field widget)
|
|
|
|
|
eudc-form-widget-list))
|
|
|
|
|
(setq prompts (cdr prompts))))
|
|
|
|
|
fields)
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(widget-insert "\n\n")
|
|
|
|
|
(widget-create 'push-button
|
|
|
|
|
:notify (lambda (&rest ignore)
|
|
|
|
|
(eudc-process-form))
|
|
|
|
|
"Query Server")
|
|
|
|
|
(widget-insert " ")
|
|
|
|
|
(widget-create 'push-button
|
|
|
|
|
:notify (lambda (&rest ignore)
|
|
|
|
|
(eudc-query-form))
|
|
|
|
|
"Reset Form")
|
|
|
|
|
(widget-insert " ")
|
|
|
|
|
(widget-create 'push-button
|
|
|
|
|
:notify (lambda (&rest ignore)
|
|
|
|
|
(kill-this-buffer))
|
|
|
|
|
"Quit")
|
|
|
|
|
(goto-char pt)
|
|
|
|
|
(use-local-map widget-keymap)
|
|
|
|
|
(widget-setup))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defun eudc-bookmark-server (server protocol)
|
|
|
|
|
"Add SERVER using PROTOCOL to the EUDC `servers' hotlist."
|
|
|
|
|
(interactive "sDirectory server: \nsProtocol: ")
|
|
|
|
|
(if (member (cons server protocol) eudc-server-hotlist)
|
|
|
|
|
(error "%s:%s is already in the hotlist" protocol server)
|
|
|
|
|
(setq eudc-server-hotlist (cons (cons server protocol) eudc-server-hotlist))
|
|
|
|
|
(eudc-install-menu)
|
|
|
|
|
(eudc-save-options)))
|
|
|
|
|
|
|
|
|
|
(defun eudc-bookmark-current-server ()
|
|
|
|
|
"Add current server to the EUDC `servers' hotlist."
|
|
|
|
|
(interactive)
|
|
|
|
|
(eudc-bookmark-server eudc-server eudc-protocol))
|
|
|
|
|
|
|
|
|
|
(defun eudc-save-options ()
|
|
|
|
|
"Save options to `eudc-options-file'."
|
|
|
|
|
(interactive)
|
* textmodes/two-column.el (2C-split):
* textmodes/texnfo-upd.el (texinfo-multi-file-included-list):
* textmodes/tex-mode.el (tex-set-buffer-directory):
* textmodes/spell.el (spell-region, spell-string):
* textmodes/reftex.el (reftex-erase-buffer):
(reftex-get-file-buffer-force, reftex-kill-temporary-buffers):
* textmodes/reftex-toc.el (reftex-toc-promote-action):
* textmodes/reftex-sel.el (reftex-get-offset, reftex-insert-docstruct)
(reftex-select-item):
* textmodes/reftex-ref.el (reftex-label-info-update)
(reftex-offer-label-menu):
* textmodes/reftex-index.el (reftex-index-change-entry)
(reftex-index-phrases-info):
* textmodes/reftex-global.el (reftex-create-tags-file)
(reftex-save-all-document-buffers, reftex-ensure-write-access):
* textmodes/reftex-dcr.el (reftex-echo-ref, reftex-echo-cite)
(reftex-view-crossref-from-bibtex):
* textmodes/reftex-cite.el (reftex-bibtex-selection-callback)
(reftex-extract-bib-entries-from-thebibliography)
(reftex-all-used-citation-keys, reftex-create-bibtex-file):
* textmodes/refbib.el (r2b-capitalize-title):
(r2b-convert-buffer, r2b-help):
* textmodes/page-ext.el (pages-directory)
(pages-directory-goto-with-mouse):
* textmodes/bibtex.el (bibtex-validate-globally):
* textmodes/bib-mode.el (bib-capitalize-title):
* textmodes/artist.el (artist-clear-buffer, artist-system):
* progmodes/xscheme.el (global-set-scheme-interaction-buffer):
(local-set-scheme-interaction-buffer, xscheme-process-filter)
(verify-xscheme-buffer, xscheme-enter-interaction-mode)
(xscheme-enter-debugger-mode, xscheme-debugger-mode-p)
(xscheme-send-control-g-interrupt, xscheme-start-process)
(xscheme-process-sentinel, xscheme-cd):
* progmodes/verilog-mode.el (verilog-read-always-signals)
(verilog-set-define, verilog-getopt-file)
(verilog-module-inside-filename-p):
* progmodes/sh-script.el:
* progmodes/python.el (python-pdbtrack-get-source-buffer)
(python-pdbtrack-grub-for-buffer, python-execute-file):
* progmodes/octave-inf.el (inferior-octave):
* progmodes/idlwave.el (idlwave-scan-user-lib-files)
(idlwave-shell-compile-helper-routines, idlwave-set-local)
(idlwave-display-completion-list-xemacs, idlwave-list-abbrevs)
(idlwave-display-completion-list-emacs, idlwave-list-load-path-shadows)
(idlwave-completion-fontify-classes, idlwave-display-calling-sequence):
* progmodes/idlw-shell.el (idlwave-shell-examine-display-clear)
(idlwave-shell-filter, idlwave-shell-examine-highlight)
(idlwave-shell-sentinel, idlwave-shell-filter-directory)
(idlwave-shell-display-line, idlwave-shell-set-bp-in-module)
(idlwave-shell-examine-display, idlwave-shell-run-region)
(idlwave-shell-filter-bp, idlwave-shell-save-and-action)
(idlwave-shell-sources-filter, idlwave-shell-goto-next-error):
* progmodes/idlw-help.el (idlwave-help-get-special-help)
(idlwave-help-get-help-buffer):
* progmodes/gud.el (gud-basic-call, gud-find-class)
(gud-tooltip-activate-mouse-motions-if-enabled):
* progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe):
* progmodes/ebrowse.el (ebrowse-member-table, ebrowse-save-tree-as)
(ebrowse-view-exit-fn, ebrowse-tags-list-members-in-file)
(ebrowse-tags-next-file):
* progmodes/ebnf2ps.el (ebnf-generate-eps, ebnf-generate-eps)
(ebnf-eps-production-list, ebnf-begin-file, ebnf-log)
(ebnf-eps-finish-and-write):
* progmodes/cpp.el (cpp-edit-save):
* progmodes/cperl-mode.el (cperl-pod-to-manpage):
* progmodes/cc-defs.el (c-emacs-features):
* progmodes/antlr-mode.el (antlr-invalidate-context-cache)
(antlr-directory-dependencies):
* progmodes/ada-xref.el (ada-gnat-parse-gpr, ada-get-ali-file-name)
(ada-run-application, ada-find-in-src-path, ada-goto-parent)
(ada-find-any-references, ada-make-filename-from-adaname)
(ada-make-body-gnatstub):
* obsolete/rnews.el (news-list-news-groups):
* obsolete/resume.el (resume-suspend-hook,resume-write-buffer-to-file):
* obsolete/iso-acc.el (iso-acc-minibuf-setup):
* net/rcirc.el (rcirc-debug):
* net/newst-treeview.el (newsticker--treeview-list-add-item)
(newsticker--treeview-list-clear, newsticker-treeview-browse-url)
(newsticker--treeview-list-update-faces, newsticker-treeview-save)
(newsticker--treeview-item-show-text, newsticker--treeview-item-show)
(newsticker--treeview-tree-update-tag,newsticker--treeview-buffer-init)
(newsticker-treeview-show-item, newsticker--treeview-unfold-node)
(newsticker--treeview-list-clear-highlight)
(newsticker--treeview-list-update-highlight)
(newsticker--treeview-list-highlight-start)
(newsticker--treeview-tree-update-highlight)
(newsticker--treeview-get-selected-item)
(newsticker-treeview-mark-list-items-old)
(newsticker--treeview-set-current-node):
* net/newst-plainview.el (newsticker--buffer-set-uptodate):
* net/newst-backend.el (newsticker--get-news-by-funcall)
(newsticker--get-news-by-wget, newsticker--image-get)
(newsticker--image-sentinel):
* net/mairix.el (mairix-rmail-fetch-field, mairix-gnus-fetch-field):
* net/eudcb-ph.el (eudc-ph-do-request, eudc-ph-open-session):
(eudc-ph-close-session):
* net/eudc.el (eudc-save-options):
* language/thai-word.el (thai-update-word-table):
* language/japan-util.el (japanese-string-conversion):
* international/titdic-cnv.el (tsang-quick-converter)
(ziranma-converter, ctlau-converter):
* international/mule-cmds.el (describe-language-environment):
* international/ja-dic-cnv.el (skkdic-convert-okuri-ari)
(skkdic-convert-postfix, skkdic-convert-prefix):
(skkdic-convert-okuri-nasi, skkdic-convert):
* emacs-lisp/re-builder.el (reb-update-overlays):
* emacs-lisp/pp.el (pp-to-string, pp-display-expression):
* emacs-lisp/gulp.el (gulp-send-requests):
* emacs-lisp/find-gc.el (trace-call-tree):
* emacs-lisp/eieio-opt.el (eieio-browse, eieio-describe-class)
(eieio-describe-generic):
* emacs-lisp/eieio-base.el (eieio-persistent-read):
* emacs-lisp/edebug.el (edebug-outside-excursion):
* emacs-lisp/debug.el (debugger-make-xrefs):
* emacs-lisp/cust-print.el (custom-prin1-to-string):
* emacs-lisp/chart.el (chart-new-buffer):
* emacs-lisp/authors.el (authors-scan-el, authors-scan-change-log):
Use with-current-buffer.
* textmodes/artist.el (artist-system): Don't call
copy-sequence on a fresh string.
* progmodes/idlw-shell.el (easymenu setup): Use dolist.
2009-10-31 02:38:34 +00:00
|
|
|
|
(with-current-buffer (find-file-noselect eudc-options-file t)
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
;; delete the previous setq
|
|
|
|
|
(let ((standard-output (current-buffer))
|
|
|
|
|
provide-p
|
|
|
|
|
set-hotlist-p
|
|
|
|
|
set-server-p)
|
|
|
|
|
(catch 'found
|
|
|
|
|
(while t
|
|
|
|
|
(let ((sexp (condition-case nil
|
|
|
|
|
(read (current-buffer))
|
|
|
|
|
(end-of-file (throw 'found nil)))))
|
|
|
|
|
(if (listp sexp)
|
|
|
|
|
(cond
|
|
|
|
|
((eq (car sexp) 'eudc-set-server)
|
|
|
|
|
(delete-region (save-excursion
|
|
|
|
|
(backward-sexp)
|
|
|
|
|
(point))
|
|
|
|
|
(point))
|
|
|
|
|
(setq set-server-p t))
|
|
|
|
|
((and (eq (car sexp) 'setq)
|
|
|
|
|
(eq (eudc-cadr sexp) 'eudc-server-hotlist))
|
|
|
|
|
(delete-region (save-excursion
|
|
|
|
|
(backward-sexp)
|
|
|
|
|
(point))
|
|
|
|
|
(point))
|
|
|
|
|
(setq set-hotlist-p t))
|
|
|
|
|
((and (eq (car sexp) 'provide)
|
|
|
|
|
(equal (eudc-cadr sexp) '(quote eudc-options-file)))
|
|
|
|
|
(setq provide-p t)))
|
|
|
|
|
(if (and provide-p
|
|
|
|
|
set-hotlist-p
|
|
|
|
|
set-server-p)
|
|
|
|
|
(throw 'found t))))))
|
|
|
|
|
(if (eq (point-min) (point-max))
|
|
|
|
|
(princ ";; This file was automatically generated by eudc.el.\n\n"))
|
|
|
|
|
(or provide-p
|
|
|
|
|
(princ "(provide 'eudc-options-file)\n"))
|
|
|
|
|
(or (bolp)
|
|
|
|
|
(princ "\n"))
|
|
|
|
|
(delete-blank-lines)
|
|
|
|
|
(princ "(eudc-set-server ")
|
|
|
|
|
(prin1 eudc-server)
|
|
|
|
|
(princ " '")
|
|
|
|
|
(prin1 eudc-protocol)
|
|
|
|
|
(princ " t)\n")
|
|
|
|
|
(princ "(setq eudc-server-hotlist '")
|
|
|
|
|
(prin1 eudc-server-hotlist)
|
|
|
|
|
(princ ")\n")
|
|
|
|
|
(save-buffer))))
|
|
|
|
|
|
|
|
|
|
(defun eudc-move-to-next-record ()
|
|
|
|
|
"Move to next record, in a buffer displaying directory query results."
|
|
|
|
|
(interactive)
|
|
|
|
|
(if (not (eq major-mode 'eudc-mode))
|
|
|
|
|
(error "Not in a EUDC buffer")
|
|
|
|
|
(let ((pt (next-overlay-change (point))))
|
|
|
|
|
(if (< pt (point-max))
|
|
|
|
|
(goto-char (1+ pt))
|
|
|
|
|
(error "No more records after point")))))
|
|
|
|
|
|
|
|
|
|
(defun eudc-move-to-previous-record ()
|
|
|
|
|
"Move to previous record, in a buffer displaying directory query results."
|
|
|
|
|
(interactive)
|
|
|
|
|
(if (not (eq major-mode 'eudc-mode))
|
|
|
|
|
(error "Not in a EUDC buffer")
|
|
|
|
|
(let ((pt (previous-overlay-change (point))))
|
|
|
|
|
(if (> pt (point-min))
|
|
|
|
|
(goto-char pt)
|
|
|
|
|
(error "No more records before point")))))
|
|
|
|
|
|
|
|
|
|
;;}}}
|
|
|
|
|
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;{{{ Menus and keymaps
|
2000-01-12 20:50:20 +00:00
|
|
|
|
|
|
|
|
|
(require 'easymenu)
|
|
|
|
|
|
|
|
|
|
(defconst eudc-custom-generated-menu (cdr (custom-menu-create 'eudc)))
|
|
|
|
|
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(defconst eudc-tail-menu
|
2000-01-12 20:50:20 +00:00
|
|
|
|
`(["---" nil nil]
|
2008-04-04 22:45:01 +00:00
|
|
|
|
["Query with Form" eudc-query-form
|
|
|
|
|
:help "Display a form to query the directory server"]
|
|
|
|
|
["Expand Inline Query" eudc-expand-inline
|
|
|
|
|
:help "Query the directory server, and expand the query string before point"]
|
2002-01-06 15:06:14 +00:00
|
|
|
|
["Insert Record into BBDB" eudc-insert-record-at-point-into-bbdb
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(and (or (featurep 'bbdb)
|
|
|
|
|
(prog1 (locate-library "bbdb") (message "")))
|
|
|
|
|
(overlays-at (point))
|
2008-04-04 22:45:01 +00:00
|
|
|
|
(overlay-get (car (overlays-at (point))) 'eudc-record))
|
|
|
|
|
:help "Insert record at point into the BBDB database"]
|
2002-01-06 15:06:14 +00:00
|
|
|
|
["Insert All Records into BBDB" eudc-batch-export-records-to-bbdb
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(and (eq major-mode 'eudc-mode)
|
|
|
|
|
(or (featurep 'bbdb)
|
2008-04-04 22:45:01 +00:00
|
|
|
|
(prog1 (locate-library "bbdb") (message ""))))
|
|
|
|
|
:help "Insert all the records returned by a directory query into BBDB"]
|
2000-01-12 20:50:20 +00:00
|
|
|
|
["---" nil nil]
|
2008-04-04 22:45:01 +00:00
|
|
|
|
["Get Email" eudc-get-email
|
|
|
|
|
:help "Get the email field of NAME from the directory server"]
|
|
|
|
|
["Get Phone" eudc-get-phone
|
|
|
|
|
:help "Get the phone field of name from the directory server"]
|
|
|
|
|
["List Valid Attribute Names" eudc-get-attribute-list
|
|
|
|
|
:help "Return a list of valid attributes for the current server"]
|
2000-01-12 20:50:20 +00:00
|
|
|
|
["---" nil nil]
|
|
|
|
|
,(cons "Customize" eudc-custom-generated-menu)))
|
|
|
|
|
|
2002-01-06 15:06:14 +00:00
|
|
|
|
|
|
|
|
|
(defconst eudc-server-menu
|
2000-01-12 20:50:20 +00:00
|
|
|
|
'(["---" nil nil]
|
2008-04-04 22:45:01 +00:00
|
|
|
|
["Bookmark Current Server" eudc-bookmark-current-server
|
|
|
|
|
:help "Add current server to the EUDC `servers' hotlist"]
|
|
|
|
|
["Edit Server List" eudc-edit-hotlist
|
|
|
|
|
:help "Edit the hotlist of directory servers in a specialized buffer"]
|
|
|
|
|
["New Server" eudc-set-server
|
|
|
|
|
:help "Set the directory server to SERVER using PROTOCOL"]))
|
2000-01-12 20:50:20 +00:00
|
|
|
|
|
|
|
|
|
(defun eudc-menu ()
|
|
|
|
|
(let (command)
|
|
|
|
|
(append '("Directory Search")
|
|
|
|
|
(list
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(append
|
2000-01-12 20:50:20 +00:00
|
|
|
|
'("Server")
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(mapcar
|
|
|
|
|
(function
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(lambda (servspec)
|
|
|
|
|
(let* ((server (car servspec))
|
|
|
|
|
(protocol (cdr servspec))
|
|
|
|
|
(proto-name (symbol-name protocol)))
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(setq command (intern (concat "eudc-set-server-"
|
|
|
|
|
server
|
|
|
|
|
"-"
|
2000-01-12 20:50:20 +00:00
|
|
|
|
proto-name)))
|
|
|
|
|
(if (not (fboundp command))
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(fset command
|
2000-01-12 20:50:20 +00:00
|
|
|
|
`(lambda ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(eudc-set-server ,server (quote ,protocol))
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(message "Selected directory server is now %s (%s)"
|
|
|
|
|
,server
|
2000-01-12 20:50:20 +00:00
|
|
|
|
,proto-name))))
|
|
|
|
|
(vector (format "%s (%s)" server proto-name)
|
|
|
|
|
command
|
|
|
|
|
:style 'radio
|
|
|
|
|
:selected `(equal eudc-server ,server)))))
|
|
|
|
|
eudc-server-hotlist)
|
|
|
|
|
eudc-server-menu))
|
|
|
|
|
eudc-tail-menu)))
|
|
|
|
|
|
|
|
|
|
(defun eudc-install-menu ()
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(cond
|
* emulation/edt-mapper.el (function-key-map):
(edt-map-key): Make it a function instead of using fset. Inline
edt-gnu-map-key and edt-lucid-map-key. Use featurep 'xemacs.
(edt-gnu-map-key, edt-lucid-map-key): Remove.
(edt-x-emacs-p): Remove.
(edt-emacs-variant, edt-window-system, edt-xserver):
Use featurep 'xemacs.
* net/eudc.el: Use (featurep 'xemacs) instead of the string test.
Replace eudc-xemacs-p with its definition.
(eudc-xemacs-p, eudc-emacs-p, eudc-xemacs-mule-p)
(eudc-emacs-mule-p): Remove.
(eudc-install-menu, eudc-mode): Replace eudc-emacs-p and
eudc-xemacs-p with feature tests.
* net/eudc-bob.el (eudc-bob-generic-menu, eudc-bob-mail-keymap)
(eudc-bob-url-keymap, eudc-bob-sound-keymap)
(eudc-bob-generic-keymap, eudc-bob-popup-menu)
(eudc-bob-toggle-inline-display):
* net/eudc-hotlist.el (eudc-hotlist-emacs-menu): Replace
eudc-emacs-p and eudc-xemacs-p with feature tests.
* net/eudcb-ph.el (eudc-ph-open-session): Replace
eudc-xemacs-mule-p with its former definition.
* progmodes/octave-mod.el (octave-xemacs-p): Remove.
(octave-abbrev-start): Replace octave-xemacs-p with
(featurep 'xemacs).
* progmodes/vera-mode.el (vera-xemacs): Remove.
(vera-mode-syntax-table): Replace vera-xemacs with
(featurep 'xemacs).
* progmodes/vhdl-mode.el (vhdl-xemacs): Remove.
(vhdl-doc-mode, vhdl-doc-variable, vhdl-compile-init)
(vhdl-speedbar-initialize, vhdl-ps-print-init)
(vhdl-forward-comment, vhdl-mode-map-init, vhdl-show-messages)
(vhdl-emacs-22, vhdl-emacs-21): Replace vhdl-xemacs
with (featurep 'xemacs).
* progmodes/antlr-mode.el (cond-emacs-xemacs-macfn, defunx)
(save-buffer-state-x):
* obsolete/fast-lock.el (fast-lock-verbose):
* emulation/viper-init.el (viper-xemacs-p)
(viper-cond-compile-for-xemacs-or-emacs):
* emacs-lisp/checkdoc.el (checkdoc-minor-mode-map):
* ps-print.el (case-fold-search):
* ediff-hook.el (ediff-cond-compile-for-xemacs-or-emacs):
* calculator.el (calculator-help): Use featurep 'xemacs.
2007-10-21 17:22:04 +00:00
|
|
|
|
((and (featurep 'xemacs) (featurep 'menubar))
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(add-submenu '("Tools") (eudc-menu)))
|
* emulation/edt-mapper.el (function-key-map):
(edt-map-key): Make it a function instead of using fset. Inline
edt-gnu-map-key and edt-lucid-map-key. Use featurep 'xemacs.
(edt-gnu-map-key, edt-lucid-map-key): Remove.
(edt-x-emacs-p): Remove.
(edt-emacs-variant, edt-window-system, edt-xserver):
Use featurep 'xemacs.
* net/eudc.el: Use (featurep 'xemacs) instead of the string test.
Replace eudc-xemacs-p with its definition.
(eudc-xemacs-p, eudc-emacs-p, eudc-xemacs-mule-p)
(eudc-emacs-mule-p): Remove.
(eudc-install-menu, eudc-mode): Replace eudc-emacs-p and
eudc-xemacs-p with feature tests.
* net/eudc-bob.el (eudc-bob-generic-menu, eudc-bob-mail-keymap)
(eudc-bob-url-keymap, eudc-bob-sound-keymap)
(eudc-bob-generic-keymap, eudc-bob-popup-menu)
(eudc-bob-toggle-inline-display):
* net/eudc-hotlist.el (eudc-hotlist-emacs-menu): Replace
eudc-emacs-p and eudc-xemacs-p with feature tests.
* net/eudcb-ph.el (eudc-ph-open-session): Replace
eudc-xemacs-mule-p with its former definition.
* progmodes/octave-mod.el (octave-xemacs-p): Remove.
(octave-abbrev-start): Replace octave-xemacs-p with
(featurep 'xemacs).
* progmodes/vera-mode.el (vera-xemacs): Remove.
(vera-mode-syntax-table): Replace vera-xemacs with
(featurep 'xemacs).
* progmodes/vhdl-mode.el (vhdl-xemacs): Remove.
(vhdl-doc-mode, vhdl-doc-variable, vhdl-compile-init)
(vhdl-speedbar-initialize, vhdl-ps-print-init)
(vhdl-forward-comment, vhdl-mode-map-init, vhdl-show-messages)
(vhdl-emacs-22, vhdl-emacs-21): Replace vhdl-xemacs
with (featurep 'xemacs).
* progmodes/antlr-mode.el (cond-emacs-xemacs-macfn, defunx)
(save-buffer-state-x):
* obsolete/fast-lock.el (fast-lock-verbose):
* emulation/viper-init.el (viper-xemacs-p)
(viper-cond-compile-for-xemacs-or-emacs):
* emacs-lisp/checkdoc.el (checkdoc-minor-mode-map):
* ps-print.el (case-fold-search):
* ediff-hook.el (ediff-cond-compile-for-xemacs-or-emacs):
* calculator.el (calculator-help): Use featurep 'xemacs.
2007-10-21 17:22:04 +00:00
|
|
|
|
((not (featurep 'xemacs))
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(cond
|
2002-09-20 23:51:44 +00:00
|
|
|
|
((fboundp 'easy-menu-create-menu)
|
|
|
|
|
(define-key
|
|
|
|
|
global-map
|
|
|
|
|
[menu-bar tools directory-search]
|
|
|
|
|
(cons "Directory Search"
|
|
|
|
|
(easy-menu-create-menu "Directory Search" (cdr (eudc-menu))))))
|
2000-01-12 20:50:20 +00:00
|
|
|
|
((fboundp 'easy-menu-add-item)
|
|
|
|
|
(let ((menu (eudc-menu)))
|
|
|
|
|
(easy-menu-add-item nil '("tools") (easy-menu-create-menu (car menu)
|
|
|
|
|
(cdr menu)))))
|
|
|
|
|
((fboundp 'easy-menu-create-keymaps)
|
|
|
|
|
(easy-menu-define eudc-menu-map eudc-mode-map "Directory Client Menu" (eudc-menu))
|
2002-01-06 15:06:14 +00:00
|
|
|
|
(define-key
|
2000-01-12 20:50:20 +00:00
|
|
|
|
global-map
|
2002-01-06 15:06:14 +00:00
|
|
|
|
[menu-bar tools eudc]
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(cons "Directory Search"
|
|
|
|
|
(easy-menu-create-keymaps "Directory Search" (cdr (eudc-menu))))))
|
|
|
|
|
(t
|
|
|
|
|
(error "Unknown version of easymenu"))))
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Load time initializations :
|
|
|
|
|
|
|
|
|
|
;;; Load the options file
|
|
|
|
|
(if (and (not noninteractive)
|
|
|
|
|
(and (locate-library eudc-options-file)
|
2005-01-22 10:36:05 +00:00
|
|
|
|
(progn (message "") t)) ; Remove modeline message
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(not (featurep 'eudc-options-file)))
|
|
|
|
|
(load eudc-options-file))
|
2002-01-06 15:06:14 +00:00
|
|
|
|
|
2000-01-12 20:50:20 +00:00
|
|
|
|
;;; Install the full menu
|
|
|
|
|
(unless (featurep 'infodock)
|
|
|
|
|
(eudc-install-menu))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; The following installs a short menu for EUDC at XEmacs startup.
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun eudc-load-eudc ()
|
|
|
|
|
"Load the Emacs Unified Directory Client.
|
|
|
|
|
This does nothing except loading eudc by autoload side-effect."
|
|
|
|
|
(interactive)
|
|
|
|
|
nil)
|
|
|
|
|
|
2000-01-14 12:00:59 +00:00
|
|
|
|
;;;###autoload
|
2008-04-04 22:45:01 +00:00
|
|
|
|
(cond
|
|
|
|
|
((not (featurep 'xemacs))
|
|
|
|
|
(defvar eudc-tools-menu
|
|
|
|
|
(let ((map (make-sparse-keymap "Directory Search")))
|
|
|
|
|
(define-key map [phone]
|
2009-10-23 05:15:26 +00:00
|
|
|
|
`(menu-item ,(purecopy "Get Phone") eudc-get-phone
|
|
|
|
|
:help ,(purecopy "Get the phone field of name from the directory server")))
|
2008-04-04 22:45:01 +00:00
|
|
|
|
(define-key map [email]
|
2009-10-23 05:15:26 +00:00
|
|
|
|
`(menu-item ,(purecopy "Get Email") eudc-get-email
|
|
|
|
|
:help ,(purecopy "Get the email field of NAME from the directory server")))
|
2009-11-11 06:06:43 +00:00
|
|
|
|
(define-key map [separator-eudc-email] menu-bar-separator)
|
2008-04-04 22:45:01 +00:00
|
|
|
|
(define-key map [expand-inline]
|
2009-10-23 05:15:26 +00:00
|
|
|
|
`(menu-item ,(purecopy "Expand Inline Query") eudc-expand-inline
|
|
|
|
|
:help ,(purecopy "Query the directory server, and expand the query string before point")))
|
2008-04-04 22:45:01 +00:00
|
|
|
|
(define-key map [query]
|
2009-10-23 05:15:26 +00:00
|
|
|
|
`(menu-item ,(purecopy "Query with Form") eudc-query-form
|
|
|
|
|
:help ,(purecopy "Display a form to query the directory server")))
|
2009-11-11 06:06:43 +00:00
|
|
|
|
(define-key map [separator-eudc-query] menu-bar-separator)
|
2008-04-04 22:45:01 +00:00
|
|
|
|
(define-key map [new]
|
2009-10-23 05:15:26 +00:00
|
|
|
|
`(menu-item ,(purecopy "New Server") eudc-set-server
|
|
|
|
|
:help ,(purecopy "Set the directory server to SERVER using PROTOCOL")))
|
2008-04-04 22:45:01 +00:00
|
|
|
|
(define-key map [load]
|
2009-10-23 05:15:26 +00:00
|
|
|
|
`(menu-item ,(purecopy "Load Hotlist of Servers") eudc-load-eudc
|
|
|
|
|
:help ,(purecopy "Load the Emacs Unified Directory Client")))
|
2008-04-04 22:45:01 +00:00
|
|
|
|
map))
|
|
|
|
|
(fset 'eudc-tools-menu (symbol-value 'eudc-tools-menu)))
|
|
|
|
|
(t
|
|
|
|
|
(let ((menu '("Directory Search"
|
|
|
|
|
["Load Hotlist of Servers" eudc-load-eudc t]
|
|
|
|
|
["New Server" eudc-set-server t]
|
|
|
|
|
["---" nil nil]
|
|
|
|
|
["Query with Form" eudc-query-form t]
|
|
|
|
|
["Expand Inline Query" eudc-expand-inline t]
|
|
|
|
|
["---" nil nil]
|
|
|
|
|
["Get Email" eudc-get-email t]
|
|
|
|
|
["Get Phone" eudc-get-phone t])))
|
|
|
|
|
(if (not (featurep 'eudc-autoloads))
|
|
|
|
|
(if (featurep 'xemacs)
|
|
|
|
|
(if (and (featurep 'menubar)
|
|
|
|
|
(not (featurep 'infodock)))
|
|
|
|
|
(add-submenu '("Tools") menu))
|
|
|
|
|
(require 'easymenu)
|
|
|
|
|
(cond
|
|
|
|
|
((fboundp 'easy-menu-add-item)
|
|
|
|
|
(easy-menu-add-item nil '("tools")
|
|
|
|
|
(easy-menu-create-menu (car menu)
|
|
|
|
|
(cdr menu))))
|
|
|
|
|
((fboundp 'easy-menu-create-keymaps)
|
|
|
|
|
(define-key
|
|
|
|
|
global-map
|
|
|
|
|
[menu-bar tools eudc]
|
|
|
|
|
(cons "Directory Search"
|
|
|
|
|
(easy-menu-create-keymaps "Directory Search"
|
|
|
|
|
(cdr menu)))))))))))
|
2002-01-06 15:06:14 +00:00
|
|
|
|
|
2000-01-14 12:00:59 +00:00
|
|
|
|
;;}}}
|
2002-01-06 15:06:14 +00:00
|
|
|
|
|
2000-01-12 20:50:20 +00:00
|
|
|
|
(provide 'eudc)
|
|
|
|
|
|
|
|
|
|
;;; eudc.el ends here
|