From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Maus Subject: Re: [PATCH] org-capture - using `file' as template Date: Wed, 14 Jul 2010 09:08:36 +0200 Message-ID: <87hbk27d6z.wl%dmaus@ictsoc.de> References: <87bpaavlpo.fsf@alterecco.net> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="===============2031872891==" Return-path: Received: from [140.186.70.92] (port=49498 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OYw5h-0000al-V0 for emacs-orgmode@gnu.org; Wed, 14 Jul 2010 03:09:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OYw5f-0003Zy-10 for emacs-orgmode@gnu.org; Wed, 14 Jul 2010 03:09:12 -0400 Received: from mysql1.xlhost.de ([213.202.242.106]:37053) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OYw5e-0003Zo-QD for emacs-orgmode@gnu.org; Wed, 14 Jul 2010 03:09:10 -0400 In-Reply-To: <87bpaavlpo.fsf@alterecco.net> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Johan Friis Cc: emacs-orgmode@gnu.org --===============2031872891== Content-Type: multipart/signed; boundary="pgp-sign-Multipart_Wed_Jul_14_09:08:35_2010-1"; micalg=pgp-sha256; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit --pgp-sign-Multipart_Wed_Jul_14_09:08:35_2010-1 Content-Type: text/plain; charset=US-ASCII Johan Friis wrote: >Setting up capture to use templates from file in the latest git seemed >to cause some errors. I looked into it and wrote this small patch. It >could probably use some love, seeing as I am quite new to org-mode, >elisp and emacs in general. Welcome aboard! >The error I was getting was related to testing (string-match ...) on >a list. The fix is to check if txt is a list before doing the test. In >addition I updated the customize interface to use `file' instead of >`file-contents'. This seems to be the current way of doing things. Yep, I can reproduce the error. Some comments on the proposed fix: Using (not (listp txt)) works but is not exactly what we want to check. To avoid string-match failing txt must be a string. Obviously a string is not a list but "not a list" is not necessarily a string. (when (or (not txt) (stringp txt)) (when (or (not txt) (not (string-match "\\S-" txt)))) ...) If we need to make sure txt is a string before calling string-match, we can put the check in front of string-match. (when (or (not txt) (and (stringp txt) (not (string-match "\\S-" txt)))) ...) We can do this because the Lisp interpreter leaves the `and' as soon as one of it's arguments is nil. I.e. (not (string-match "\\S-" txt)) is not evaluated if (stringp txt) returns nil. >Please note: This is my first time posting here. Please let me know if >there are some rules to follow that I missed. And thanks for a great >piece of software :) Current rules are documented here: http://orgmode.org/worg/org-contribute.php HTH, -- David -- OpenPGP... 0x99ADB83B5A4478E6 Jabber.... dmjena@jabber.org Email..... dmaus@ictsoc.de --pgp-sign-Multipart_Wed_Jul_14_09:08:35_2010-1 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iF4EABEIAAYFAkw9YnMACgkQma24O1pEeOZ2ogEAw1UFI2mm+xwQEN4s1RllMS2Y YV/s7D/pDLclvBA3VLsBALVPTl3ZjdbrVoq9vkEVTAkWuSDmFj79xJfsSewZSUEn =4psi -----END PGP SIGNATURE----- --pgp-sign-Multipart_Wed_Jul_14_09:08:35_2010-1-- --===============2031872891== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============2031872891==--