From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/86641 Path: news.gmane.org!not-for-mail From: Lars Huttar Newsgroups: gmane.comp.tex.context Subject: confusion about expansion Date: Wed, 12 Mar 2014 10:00:05 -0400 Message-ID: <53206865.1090800@sil.org> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1394632822 30654 80.91.229.3 (12 Mar 2014 14:00:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 12 Mar 2014 14:00:22 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed Mar 12 15:00:32 2014 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WNjhu-0000Dm-Dy for gctc-ntg-context-518@m.gmane.org; Wed, 12 Mar 2014 15:00:30 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 822E8101EB; Wed, 12 Mar 2014 15:00:29 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id RrkPFktB5rig; Wed, 12 Mar 2014 15:00:26 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id CB38D101E3; Wed, 12 Mar 2014 15:00:26 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id C89D7101E3 for ; Wed, 12 Mar 2014 15:00:25 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id p+93KPlZ7wYs for ; Wed, 12 Mar 2014 15:00:19 +0100 (CET) Original-Received: from filter2-til.mf.surf.net (filter2-til.mf.surf.net [194.171.167.218]) by balder.ntg.nl (Postfix) with ESMTP id 6A203101E1 for ; Wed, 12 Mar 2014 15:00:09 +0100 (CET) Original-Received: from mail-qa0-f45.google.com (mail-qa0-f45.google.com [209.85.216.45]) by filter2-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id s2CE06rq029220 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Wed, 12 Mar 2014 15:00:08 +0100 Original-Received: by mail-qa0-f45.google.com with SMTP id hw13so9839828qab.4 for ; Wed, 12 Mar 2014 07:00:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:content-type:content-transfer-encoding; bh=I2QQYID/2qkXCE48482+2a8ocTVOiLzF3CU8GtmjbMM=; b=hDmeySz2IsTeydr95VqUuKe97ZYEo8678h9dQfVcQPLHRVJAaisO+mBn0n7o77fQQo +0zMV4r+INPXSB9Krsj9nkOL16Ooj/pDeiasa2tw1mrIUXQ7DxLT5AB89uDYCF3cVInL n8d2/pkR+9T1N1o33P+27RaSXK8eJJch5YTXf9RP/CTYTRnMEeeiI6+zxCoW+TZ5BVyi 9+UfziorPO6T9OEYlyUm5qNbMomQgJ68KWJkSg330872t8LsMC91Z+jvjJwyuDWI5L5m hHQWKfEyDj2CzhL/uJci3U9EjICp5QplUtABFeO47U5msS8e3ECM/TWblssfOs3axhgt tUbA== X-Gm-Message-State: ALoCoQmQHgkwRqu1W0nUIqyMKSskDolWs11gzAsUsRdeWNCcwTY5hhyynIwWs40KZEGcviKPHtjD X-Received: by 10.140.46.74 with SMTP id j68mr53053782qga.71.1394632806168; Wed, 12 Mar 2014 07:00:06 -0700 (PDT) Original-Received: from [172.22.10.178] ([162.40.29.3]) by mx.google.com with ESMTPSA id f48sm26032528qge.5.2014.03.12.07.00.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Mar 2014 07:00:05 -0700 (PDT) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 X-Bayes-Prob: 0.0001 (Score 0, tokens from: ntg-context@ntg.nl, base:default, @@RPTN) X-CanIt-Geo: ip=209.85.216.45; country=US; region=CA; city=Mountain View; postalcode=94043; latitude=37.4192; longitude=-122.0574; metrocode=807; areacode=650; http://maps.google.com/maps?q=37.4192,-122.0574&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0TLAC07tM - e979f76b1b34 - 20140312 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.218 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:86641 Archived-At: Hello, I've got a running page head like this in my document: \def\CurrentUser{\cldcontext{os.resultof"whoami"}} \def\Markname { Compiled \date by \CurrentUser \LUATEX +\ConTeXt\ \contextversion } and later: \setlayer[cropmark][preset=lefttop,x=3cm,y=-1.5\lineheight]{\Markname} But when I run this, I get a UCS error that seems to indicate that the *result* of \CurrentUser ("waxhaw\huttar") is getting parsed as a command sequence. Here's the error: ! Undefined control sequence. 1 >> % see ConTeXt wiki http://wiki.contextgarden.net/Imposition#Cut_marks 2 3 %% TODO: make sure this doesn't reevaluate every time 4 %% the command sequence is used! 5 \define\CurrentUser{\cldcontext{os.resultof"whoami"}} 6 7 \def\Markname { Compiled \date by \CurrentUser \LUATEX +\ConTeXt\ \conte xtversion. SVN } ... l.1 waxhaw\huttar \cldcontext #1x-\directlua {context(#1)} \Markname #- Compiled \date by \CurrentUser \LUATEX +\ConTeXt \ \contextvers... l.24 ...t=lefttop,x=3cm,y=-1.5\lineheight]{\Markname } How can I change the definition of \CurrentUser, or \Markname, to output the result of \CurrentUser as-is, instead of parsing the result? I tried (somewhat blindly) changing \def to \define, but it didn't make any difference. At the same time, I want to make sure that the processor won't be making an OS system call to "whoami" every time \CurrentUser is evaluated: I want it to happen only once, when \CurrentUser is defined. Here is my complete working example: \def\CurrentUser{\cldcontext{os.resultof"whoami"}} \def\Markname { Compiled \date by \CurrentUser \LUATEX +\ConTeXt\ \contextversion. } \setuplayout[location=middle,marking=on] \definelayer[cropmark][state=repeat,width=\paperwidth,height=\paperheight] \setupbackgrounds[page][background=cropmark] \setlayer[cropmark][preset=lefttop,x=3cm,y=-1.5\lineheight]{\Markname} \starttext Foo \stoptext Thanks for any help. Lars ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________