From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/77483 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.gnus.general Subject: Re: auth-source-search Date: Thu, 03 Mar 2011 16:14:20 -0600 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87zkpbzwar.fsf@lifelogs.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1299190517 4499 80.91.229.12 (3 Mar 2011 22:15:17 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 3 Mar 2011 22:15:17 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M25806@lists.math.uh.edu Thu Mar 03 23:15:08 2011 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PvGnc-00025h-AH for ding-account@gmane.org; Thu, 03 Mar 2011 23:15:08 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1PvGn7-0006He-CH; Thu, 03 Mar 2011 16:14:37 -0600 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1PvGn5-0006HK-BM for ding@lists.math.uh.edu; Thu, 03 Mar 2011 16:14:35 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1PvGn3-0002vI-Nl for ding@lists.math.uh.edu; Thu, 03 Mar 2011 16:14:34 -0600 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1PvGn1-0002Q8-Hq for ding@gnus.org; Thu, 03 Mar 2011 23:14:31 +0100 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PvGn1-0001nG-3X for ding@gnus.org; Thu, 03 Mar 2011 23:14:31 +0100 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 ; Thu, 03 Mar 2011 23:14:31 +0100 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 ; Thu, 03 Mar 2011 23:14:31 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 27 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.110014 (No Gnus v0.14) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:5GmmeaNxgxnXmVS9ly6XX/KzVGM= X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:77483 Archived-At: On Thu, 03 Mar 2011 21:00:57 +0100 Richard Riley wrote: RR> (add-hook 'org-mobile-pre-push-hook RR> '(lambda() RR> (setq org-mobile-encryption-password (funcall (plist-get (car (auth-source-search :host '("orgmobile"))) ':secret))))) I would do it like this: (let* ((auth (auth-source-search :host "z.lifelogs.com")) (secret (plist-get (nth 0 auth) :secret)) (secret (if (functionp secret) (funcall secret) secret))) secret) The differences with your code: 1) it works if the secret is not returned, or if the secret is not a function 2) it picks the first result safely and works if there's no results 3) quoting :secret is not necessary 4) you can use a string for searching, it doesn't have to be a list I will fix up auth.texi, I promise. I was waiting for the API to quiet down, which I think it has. I'll add examples of usage including this. Ted