emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New Emacs facilities from Gnus


From: Reiner Steib
Subject: Re: New Emacs facilities from Gnus
Date: Wed, 07 Nov 2007 19:02:18 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

On Wed, Nov 07 2007, Stefan Monnier wrote:

>> Couldn't we use a test to check if the "good" version of `ldap-search'
>> is available so that the code in both versions (of smime.el?) stays
>> identical?
>
> Maybe a simpler approach is to change (fboundp 'smime-ldap-search)?

But (require 'smime-ldap) would fail so the user would get an error.
Or am I missing something?

How about this patch (and deleting `smime-ldap.el' in Emacs)?  Cf. the
tests in `smime-ldap-search'.

--8<---------------cut here---------------start------------->8---
--- smime.el    28 Oct 2007 09:18:28 -0000      1.14
+++ smime.el    7 Nov 2007 18:01:39 -0000
@@ -122,7 +122,6 @@
 ;;; Code:
 
 (require 'dig)
-(require 'smime-ldap)
 (require 'password)
 (eval-when-compile (require 'cl))
 
@@ -590,8 +589,17 @@
 
 (defun smime-cert-by-ldap-1 (mail host)
   "Get cetificate for MAIL from the ldap server at HOST."
-  (let ((ldapresult (smime-ldap-search (concat "mail=" mail)
-                                      host '("userCertificate") nil))
+  (let ((ldapresult
+        (funcall
+         (if (or (featurep 'xemacs)
+                 ;; For Emacs >= 22 we don't need smime-ldap.el
+                 (>= emacs-major-version 22))
+             (progn
+               (require 'smime-ldap)
+               'smime-ldap-search)
+           'ldap-search)
+         (concat "mail=" mail)
+         host '("userCertificate") nil))
        (retbuf (generate-new-buffer (format "*certificate for %s*" mail)))
        cert)
     (if (and (>= (length ldapresult) 1)

--8<---------------cut here---------------end--------------->8---

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]