[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Quotes





Okay, you wanted programming: Here's programming. I've always
thought it a pity that whereas programs such as WordPerfect
offered "smart quotes," Xywin was stuck with the typewriter
kind--unless one ran that thing that also gave ligatures and
stuff.

I like seeing quotes as I'm typing them. And I also thought, if
I'm having trouble with the text save-gets, what about the
programming save-gets. Perhaps they haven't been tampered with.

And it worked. Some, I know, decry such automatic, nonthinking
feedback, but I'm lazy. I like typographic quotes, apostrophes
and so on. The program is set on the double-quote key, but can be
modified to include one for the apostrophe (or European quotes
for that matter). (I agree that braces are about the best
substitute for the double-angle brackets.)

{LB-r-quote to enable "smart quotes"}XD {GL-var}

The program begins with the program name, because I'm always
forgetting what I call them. It first cancels the define state
because (1) it relies on a define and (2) Xywin has removed
VA$RS for reading the character on the cursor. (Special note to
Annie if she's gotten this far: You needn't feel too bad because
VA$RS wasn't in 3+.)


{LB-var}{SV33,
}{SV68,[264]}{SV70,[265]}{GL-begin}

When I think of it, I always define variables first. And there
are three "variables" here. The first determines what is an "open
quote," and I thought that a character following a space, a tab,
or a carriage return should qualify. If anyone thinks of any
other good characters, now's the time . . . Afterward, I put the
open quote to 68 and the close to 70, because we all know that
open and close quotes look like 69.

{LB-begin}GT DF CL DZ {SV22}XD CR {GL-check}

Too bad I can't think of a way to put function calls in color
here! But I begin with going to text (GT); start a define (DF);
move the cursor to the left (CL); end the define (DZ) [which
isn't really necessary in Win but it looks tidy]; save the define
to SV22 [which one could do beginning with 3.54]; remove the
define state (XD); push the cursor back (CR). And then we look at
what we have.

{LB-check}{IF({IS22}?{IS33}=>0)}{PV68}{EX}{EI}{PV70}{EX}

The if statement says that if the character contained in IS22 is
within IS33 (which equal or greater than zero means), then put in
the open quote (and end the program); if it isn't, put in the
close quote. [Note that Xy now offers several different epsilons:
one needs character number 238.]

I put the file (r-quote.pm) in the XW directory via the easiest
way I knew: I copied another line and put between the codes ldpm
r-quote.pm,&q. I then put &q to my quote key in the shift table.
(You're supposed to change the cap-lock table too; I didn't
bother--for now anyway.)

I didn't turn the display off and on because it seems very fast;
if one does notice a lag, that's the time to use it.

Of course, there are some problems with it; pressing the quote
key with the intention of putting it in a search string will
fail; but the old quote symbol is available in a lot of other
tables for that or one could copy the typographic quote into the
search string. Xywin does give that alternative. Another problem
is that the very first character typed becomes an open quote (I
don't know why), but if you try to insert a quote before the very
first character in an open file, the quote will appear AFTER the
first character. I suppose one could add an exception routine--in
which case turning the display off and on would make sense.

--Chet
---
 ? SLMR 2.1a ? Art + write + dtp = chet.gottfried@xxxxxxxx