From rlpowell at digitalkingdom.org Sun Oct 12 08:27:41 2008 From: rlpowell at digitalkingdom.org (Robin Lee Powell) Date: Sun, 12 Oct 2008 01:27:41 -0700 Subject: [cl-who-devel] Vertical whitespace Message-ID: <20081012082741.GG18774@digitalkingdom.org> Is it possible to control production of vertical whitespace in cl-who output? Having everything on one line gets really old after a while. -Robin -- They say: "The first AIs will be built by the military as weapons." And I'm thinking: "Does it even occur to you to try for something other than the default outcome?" -- http://shorl.com/tydruhedufogre http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/ From edi at agharta.de Sun Oct 12 09:33:49 2008 From: edi at agharta.de (Edi Weitz) Date: Sun, 12 Oct 2008 11:33:49 +0200 Subject: [cl-who-devel] Vertical whitespace In-Reply-To: <20081012082741.GG18774@digitalkingdom.org> (Robin Lee Powell's message of "Sun, 12 Oct 2008 01:27:41 -0700") References: <20081012082741.GG18774@digitalkingdom.org> Message-ID: On Sun, 12 Oct 2008 01:27:41 -0700, Robin Lee Powell wrote: > Is it possible to control production of vertical whitespace in > cl-who output? Read the documentation. (Search for "indentation".) > Having everything on one line gets really old after a while. Browsery usually don't complain... Cheers, Edi. From rlpowell at digitalkingdom.org Sun Oct 12 10:55:35 2008 From: rlpowell at digitalkingdom.org (Robin Lee Powell) Date: Sun, 12 Oct 2008 03:55:35 -0700 Subject: [cl-who-devel] Vertical whitespace In-Reply-To: References: <20081012082741.GG18774@digitalkingdom.org> Message-ID: <20081012105535.GI18774@digitalkingdom.org> On Sun, Oct 12, 2008 at 11:33:49AM +0200, Edi Weitz wrote: > On Sun, 12 Oct 2008 01:27:41 -0700, Robin Lee Powell > wrote: > > > Is it possible to control production of vertical whitespace in > > cl-who output? > > Read the documentation. (Search for "indentation".) I looked for "newline". Whoops. Thanks. -Robin -- They say: "The first AIs will be built by the military as weapons." And I'm thinking: "Does it even occur to you to try for something other than the default outcome?" -- http://shorl.com/tydruhedufogre http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/ From kengruven at gmail.com Sun Oct 26 00:15:40 2008 From: kengruven at gmail.com (Ken Harris) Date: Sat, 25 Oct 2008 17:15:40 -0700 Subject: [cl-who-devel] Specifying prologues (and a digression into special variables) Message-ID: Hi, I'm using cl-who for a project where I want to generate 2 kinds of XML, and each has their own prologue. I started by passing these as literals to the keyword parameter :prologue, but I'd like to pull them out into constants, and eventually one will need to be computed at runtime. At first, I tried just passing an expression to :prologue, but that obviously failed (because defmacro evaluates it at macroexpand-time, not run-time, I think): (defconstant +my-prologue+ "header") (with-html-output-to-string (s nil :prologue +my-prologue+) (:a)) => " " Then I went and read Erann Gat's "Idiot's Guide to Special Variables". It doesn't mention macros, but I figured I could get close with something like this, but no, it ignores my *prologue* setting: (let ((*prologue* "header")) (with-html-output-to-string (s nil :prologue t) (:a))) => " " So obviously I'm missing the boat on special variables and defmacro. I know I could just setq *prologue* before calling cl-who (or even cruder approaches), but that seems awkward, and I'd like to learn what's going on with special variables and macros. As an aside, special variables and macros aren't behaving the same in my 2 Lisp implementations (all of the above is with SBCL), so it seems that at least somebody out there thinks the same way as me: :-) (defvar *special* 5) (defun show-special () *special*) (defmacro with-special () *special*) (show-special) (let ((*special* 10)) (show-special)) (with-special) (let ((*special* 10)) (with-special)) ;; CLISP 2.43: 5, 10, 5, 10 ;; SBCL 1.0.13: 5, 10, 5, 5 If anybody could shed some light on this, and show how to most naturally use an expression as a :prologue with cl-who, it'd be much appreciated. Thanks! - Ken From sky at viridian-project.de Sun Oct 26 12:07:48 2008 From: sky at viridian-project.de (Leslie P. Polzer) Date: Sun, 26 Oct 2008 13:07:48 +0100 (CET) Subject: [cl-who-devel] Specifying prologues (and a digression into special variables) In-Reply-To: References: Message-ID: <64984.88.73.228.52.1225022868.squirrel@mail.stardawn.org> Dear Ken, > So obviously I'm missing the boat on special variables and defmacro. > I know I could just setq *prologue* before calling cl-who (or even > cruder approaches), but that seems awkward, Awkward indeed! But if you put it into a well-separated function it's not that bad. > and I'd like to learn what's going on with special variables and macros. Yes, that's important. > As an aside, special variables and macros aren't behaving the same in > my 2 Lisp implementations (all of the above is with SBCL), so it seems > that at least somebody out there thinks the same way as me: :-) > > (defvar *special* 5) > (defun show-special () *special*) > (defmacro with-special () *special*) > (show-special) > (let ((*special* 10)) (show-special)) > (with-special) > (let ((*special* 10)) (with-special)) > > ;; CLISP 2.43: 5, 10, 5, 10 > ;; SBCL 1.0.13: 5, 10, 5, 5 Don't take my word for it, but my guess is that you've fallen right into the compiler/interpreter trap. SBCL is a compiler-only implementation and CLISP interprets code by default. I'll leave it as an exercise to you what exactly happens here. > If anybody could shed some light on this, and show how to most > naturally use an expression as a :prologue with cl-who, it'd be much > appreciated. Not sure here either but take a look at the macro: (defmacro with-html-output ((var &optional stream &key prologue ((:indent *indent*) *indent*)) &body body) (when (and *indent* (not (integerp *indent*))) (setq *indent* 0)) (when (eq prologue t) (setq prologue *prologue*)) `(let ((,var ,(or stream var))) ,(tree-to-commands body var prologue))) *prologue* gets evaluated at macro expansion time, and I suppose special bindings are not in effect then. Wild guess. Wade through the spec to find out. Or maybe someone else can point it out. The solution here is using macros to define your own prologues. > Thanks! Thanks for checking out Common Lisp! Leslie -- LinkedIn Profile: http://www.linkedin.com/in/polzer Xing Profile: https://www.xing.com/profile/LeslieP_Polzer Blog: http://blog.viridian-project.de/ From kengruven at gmail.com Mon Oct 27 21:12:13 2008 From: kengruven at gmail.com (Ken Harris) Date: Mon, 27 Oct 2008 14:12:13 -0700 Subject: [cl-who-devel] Specifying prologues (and a digression into special variables) In-Reply-To: <64984.88.73.228.52.1225022868.squirrel@mail.stardawn.org> References: <64984.88.73.228.52.1225022868.squirrel@mail.stardawn.org> Message-ID: Hi Leslie, Thanks for responding! I think I'm still in detox from a long Ruby project. :-) I think I was thinking that part of the macroexpansion would occur at runtime or something. I'm now trying to use it more as it seems to have been intended to be used. > The solution here is using macros to define your > own prologues. Maybe, but for now, I'm just prepending my own prologue outside of the (with-html-output...) call. I want to get something working fast, and there are more interesting parts of the problem to attack. - Ken From kengruven at gmail.com Tue Oct 28 19:29:22 2008 From: kengruven at gmail.com (Ken Harris) Date: Tue, 28 Oct 2008 12:29:22 -0700 Subject: [cl-who-devel] Case sensitivity idea Message-ID: Hi again, I'm using cl-who for generating a lot of HTML and lowercase XML, and a tiny bit of mixed-case XML. (I don't know who thought up mixed-case XML schemas, but I swear it's not my fault. For that matter, neither is the XML. :-) To generate mixed-case XML, I should turn off *downcase-tokens-p*, and then wrap every existing :foo like :|foo| in all my cl-who calls, just to be able to generate a couple mixedCase XML attributes. This idea doesn't thrill me. (Or I could change the readtable-case, but that'll mean changing all my code to upper-case, and I'm not excited about that, either.) What if there was another mode (call it, say, *downcase-tokens-unless-mixedcase-p*) for case handling, whose rule was: - "downcase tokens, *unless* the token's string representation is mixed-case (in which case leave it alone)" That way, I could say (:a :href "/foo") like normal, but also (:|feGaussianBlur| :|stdDeviation| 2), and everything would work like it looks and like I want. I suppose it would be impossible to generate all-uppercase tags in this mode, but (a) I don't think I've ever seen an XML schema that required any all-caps tags, and (b) in *downcase-tokens-p* mode, there are tags it's impossible to generate, so I'm thinking "any tag in any mode" isn't a strict requirement. Thoughts? I could whip up a patch, if somebody else thought this was a decent approach... - Ken From sky at viridian-project.de Wed Oct 29 09:53:07 2008 From: sky at viridian-project.de (Leslie P. Polzer) Date: Wed, 29 Oct 2008 10:53:07 +0100 (CET) Subject: [cl-who-devel] Case sensitivity idea In-Reply-To: References: Message-ID: <63274.88.73.195.210.1225273987.squirrel@mail.stardawn.org> > I suppose it would be impossible to generate all-uppercase tags in > this mode, but (a) I don't think I've ever seen an XML schema that > required any all-caps tags, and (b) in *downcase-tokens-p* mode, there > are tags it's impossible to generate, so I'm thinking "any tag in any > mode" isn't a strict requirement. (a) certainly doesn't hold. A popular format like XML is bound to generate any type of abomination. > Thoughts? I could whip up a patch, if somebody else thought this was > a decent approach... I like it, you only need to get Edi to apply it now ;) Leslie