From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: Modifying Emacs to use the Mac OS X Keychain Services Date: Sat, 28 May 2011 13:13:59 -0500 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87vcwuae1k.fsf@lifelogs.com> References: <8762ov84k3.fsf@gmx.de> <87aae67v6e.fsf@gmx.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1306606467 19795 80.91.229.12 (28 May 2011 18:14:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 28 May 2011 18:14:27 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 28 20:14:21 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QQO1k-0001k1-RF for ged-emacs-devel@m.gmane.org; Sat, 28 May 2011 20:14:20 +0200 Original-Received: from localhost ([::1]:54997 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQO1k-0002WV-Cn for ged-emacs-devel@m.gmane.org; Sat, 28 May 2011 14:14:20 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:56483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQO1i-0002WQ-1G for emacs-devel@gnu.org; Sat, 28 May 2011 14:14:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QQO1d-0000Na-2R for emacs-devel@gnu.org; Sat, 28 May 2011 14:14:17 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:36893) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQO1c-0000NW-Q5 for emacs-devel@gnu.org; Sat, 28 May 2011 14:14:13 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QQO1b-0001hX-Is for emacs-devel@gnu.org; Sat, 28 May 2011 20:14:11 +0200 Original-Received: from c-67-186-102-106.hsd1.il.comcast.net ([67.186.102.106]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 28 May 2011 20:14:11 +0200 Original-Received: from tzz by c-67-186-102-106.hsd1.il.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 28 May 2011 20:14:11 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 56 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: c-67-186-102-106.hsd1.il.comcast.net X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:YN0SyPXYqJvw4p8M1l/VGUz7rYM= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:139844 Archived-At: On Sat, 28 May 2011 12:16:53 -0500 Ben Key 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