[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [StrongED] show invisible characters



In message <2a8def7b52.jim@xxxxxxxxxxxxxxxxxxxx> you wrote:

> In the Stronghelp, I discovered the section about Functions.
> But I can't see anything about how to use them -- where to type them?

These are for use in Modefiles.
 
> Thought I might be able to achieve the making-visible by storing a few = 
> simple replace functions as a script somehow, and Ctrl-drag this to 
> StrongEd's "Apply" target whenever I need it. (I read about this in an = 
> Archive article showing how a script in a language such as Lua or Awk 
> can be dragged there, so I was hoping StrongEd's own functions would 
> work.)
> 
> Something like this if I have the syntax right:
> 
>      #! stronged
>      replace (" ","·",all)  ---- space becomes dot (Char 183)
>      replace (" ","?",all)  ---- hardspace becomes Char 143
>      replace ($,"¶"$,all)   ---- insert character 182 at newline
> 
> Had to chuckle at the resulting error message from StrongEd:  
> "Don't know how to call StrongEd."
> 
> Am I barking up a completely wrong tree?

Courtesy forbids any but the most elliptic reply. For Ctrl-drag to
the "Apply" smarticon to work you need something in a scripting language that
your copy of StrongED understands. Unfortunately StrongED's functions
do not qualify. Try this Lua script instead

#! lua
-- GCW 06/04/2012
local write,lines in io
local replace = { [" "] = ".", ["\160"] = "\143" }
local find = "[%s\160]"
for line in lines(arg[1]) do
  write((line:gsub(find,replace)),"\182\n")
end -- for

-- 
Gavin Wraith (gavin@xxxxxxxxxxxxxxx)
Home page: http://www.wra1th.plus.com/

--
To unsubscribe send a mail to StrongED+unsubscribe@xxxxxxxxxxxxxx