[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: |
Sat, 28 May 2011 13:13:59 -0500 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) |
On Sat, 28 May 2011 12:16:53 -0500 Ben Key <address@hidden> wrote:
BK> The point is, I can implement ns- equivalents in C for most, if not all of
BK> the functions defined in secrets.el with the same parameters and nearly the
BK> same behavior. I may even be able to make them behave exactly the same as
BK> their secrets.el counterparts.
BK> Once the functions are defined in C, we can later decide how to call them
BK> from Lisp. We can decide to call them from secrets.el by having each of the
BK> functions use the following psudeo code
BK> (if (fboundp 'ns-{func})
BK> call ns-{func}
BK> use dbus)
BK> or we could add another auth source to auth-source.el. Either way would
BK> work for me.
It should definitely be another auth source. auth-source.el could use
the similarities between the Secrets and Keychain APIs to simplify the
code as you suggest.
BK> Perhaps I should just focus on writing the ns- equivalents of each of the
BK> secrets.el functions and we can decide later how to call them. What do you
BK> think?
Yes, please.
BK> Note: I am not exactly certain how to parse the attributes parameter of my
BK> proposed ns-secrets-create-item function. If someone can point me to an
BK> example of how to process something like that in C it would be helpful.
Do you mean you want them to look like this (example from secrets.el):
((:user . "joe") (:host ."remote-host"))
You don't have to do it that way, but it's probably easiest to keep your
API similar to secrets.el. So in C, just go through the list. Start
with x = the list and do:
(x, cell, key, and val are Lisp_Objects)
while (! NILP (x))
{
cell = Fcar(x)
key = Fcar(cell)
val = Fcdr(cell)
(... use key and val ...)
x = Fcdr(x)
}
Expect the key to be a symbol and the val to be a string, so you may
want to convert them or throw an error if they are not. I hope this is
helpful.
Ted