[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Modifying Emacs to use the Mac OS X Keychain Services
From: |
Ted Zlatanov |
Subject: |
Re: Modifying Emacs to use the Mac OS X Keychain Services |
Date: |
Wed, 15 Jun 2011 10:12:16 -0500 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) |
On Tue, 14 Jun 2011 21:15:18 -0500 Ben Key <address@hidden> wrote:
BK> Stefan Monnier wrote:
>> No, a simple type cast won't do. If the Lisp_Object is fully under your
>> control (so you always know you're the one who built it and never need
>> to check what kind of Lisp_Object it is), you can use
>> a Lisp_Misc_Save_value. "grep -i save_value src/*.[ch]" should get
>> you started.
BK> The Lisp_Object is not always under my control.
Why not? You're the only one providing ns-keychain-* functions.
I'm no expert on the Emacs internals, but I think you can do the
following:
The Lisp_Misc_Save_Value holds a void pointer and an integer. Just
provide convenience functions for yourself that take a
Lisp_Misc_Save_Value and set the pointer to the SecKeychainRef or
extract it back out. Use the `SAVE_VALUEP' and `XSAVE_VALUE' macros.
Then make a Lisp list of Lisp_Misc_Save_Value and that's your keychain
reference list. Make the head of the Lisp list a static symbol and
GC-protect it (see gnutls.c, for instance, on how to intern a symbol and
use `staticpro' on it in the syms_of_gnutls function). Emacs won't GC
the list then.
BK> Since the SecKeychainRef object will need to pass the boundary
BK> between internal Emacs code and Lisp code it cannot be considered to
BK> be always under my control.
Trust `staticpro' :)
BK> The problem is that I am not certain how to return a SecKeychainRef
BK> object from ns-keychain-open, ns-keychain-create, and
BK> ns-keychain-create-or-open so that they are callable from Lisp. Any
BK> suggestions are welcome.
I would return it as a Lisp_Misc_Save_Value and set a :ns-keychain-name
property on the value to get the keychain name (ditto for any other
keychain properties you want to preserve).
Ted
- Re: Modifying Emacs to use the Mac OS X Keychain Services, (continued)
- Re: Modifying Emacs to use the Mac OS X Keychain Services, Ben Key, 2011/06/10
- Re: Modifying Emacs to use the Mac OS X Keychain Services, Ben Key, 2011/06/11
- Re: Modifying Emacs to use the Mac OS X Keychain Services, Ben Key, 2011/06/12
- Re: Modifying Emacs to use the Mac OS X Keychain Services, Stefan Monnier, 2011/06/13
- Re: Modifying Emacs to use the Mac OS X Keychain Services, Ben Key, 2011/06/14
- Re: Modifying Emacs to use the Mac OS X Keychain Services,
Ted Zlatanov <=
- Re: Modifying Emacs to use the Mac OS X Keychain Services, Andreas Schwab, 2011/06/15
- Re: Modifying Emacs to use the Mac OS X Keychain Services, Ted Zlatanov, 2011/06/15
- Re: Modifying Emacs to use the Mac OS X Keychain Services, Stefan Monnier, 2011/06/15
- Re: Modifying Emacs to use the Mac OS X Keychain Services, Chong Yidong, 2011/06/17
Re: Modifying Emacs to use the Mac OS X Keychain Services, Ted Zlatanov, 2011/06/12