all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ted Zlatanov <tzz@lifelogs.com>
To: emacs-devel@gnu.org
Subject: Re: Modifying Emacs to use the Mac OS X Keychain Services
Date: Wed, 15 Jun 2011 10:12:16 -0500	[thread overview]
Message-ID: <87k4cnt9gv.fsf@lifelogs.com> (raw)
In-Reply-To: BANLkTin8ySbrD=ekziUs43B4dKwmpiTMXw@mail.gmail.com

On Tue, 14 Jun 2011 21:15:18 -0500 Ben Key <bkey76@gmail.com> 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




  reply	other threads:[~2011-06-15 15:12 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-12  2:28 Modifying Emacs to use the Mac OS X Keychain Services Ben Key
2011-06-12  4:18 ` Ben Key
2011-06-12 16:40   ` Eli Zaretskii
2011-06-12 22:23     ` Ted Zlatanov
2011-06-13  3:14     ` Ben Key
2011-06-14  3:12   ` Stefan Monnier
2011-06-15  2:15     ` Ben Key
2011-06-15 15:12       ` Ted Zlatanov [this message]
2011-06-15 16:30         ` Andreas Schwab
2011-06-15 20:02           ` Ted Zlatanov
2011-06-15 23:26         ` Stefan Monnier
2011-06-17 20:31           ` Chong Yidong
2011-06-12 22:21 ` Ted Zlatanov
  -- strict thread matches above, loose matches on Subject: below --
2011-06-11  0:30 Ben Key
2011-06-11  1:13 ` Ted Zlatanov
2011-06-05 23:23 Ben Key
2011-06-06  0:05 ` Ted Zlatanov
2011-06-01  2:04 Ben Key
2011-06-01  2:13 ` Ted Zlatanov
2011-06-05 18:54 ` Ben Key
2011-06-05 20:01   ` Ted Zlatanov
2011-06-06 20:26   ` Michael Albinus
2011-06-07  3:34     ` Ben Key
2011-06-07  7:58       ` Michael Albinus
     [not found]         ` <BANLkTin1DxY33iaQ5=9KJKD_gwQvsJwJ8Q@mail.gmail.com>
2011-06-08  5:50           ` Ben Key
2011-06-08 20:48             ` Ted Zlatanov
2012-07-27 15:20               ` Dave Abrahams
2012-07-28 12:16                 ` Harald Hanche-Olsen
2012-07-28 16:33                   ` Dave Abrahams
2012-07-28 16:45                     ` Harald Hanche-Olsen
2012-07-29 22:05                 ` Ted Zlatanov
2012-07-30 13:34                   ` Michael Albinus
2012-07-31 15:45                     ` Ted Zlatanov
2012-08-20 13:42                   ` Dave Abrahams
2012-08-20 13:49                   ` Dave Abrahams
2012-08-20 14:02                     ` Dave Abrahams
2011-05-30  1:08 Ben Key
2011-05-30  1:19 ` Daniel Colascione
2011-05-30 12:27 ` Ted Zlatanov
2011-05-28 18:32 Ben Key
2011-05-28  2:56 Ben Key
2011-05-28 11:09 ` Michael Albinus
2011-05-28 13:00   ` Ben Key
2011-05-28 14:32     ` Michael Albinus
2011-05-28 17:16       ` Ben Key
2011-05-28 18:13         ` Ted Zlatanov
2011-05-28 19:38         ` Michael Albinus
2011-05-28 15:11     ` Ted Zlatanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k4cnt9gv.fsf@lifelogs.com \
    --to=tzz@lifelogs.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.