('how to forget to automate the things you works with daily!?')
Code: Select all
#!/usr/bin/newlisp
;-- to get the original symbols from newlisp
;-- thow shall only use the magic list
(setq sugar (string "newlisp-" (sys-info -2) ".jsf"))
;-- Round and round the garden walkes a teddy beer..
(setq tea (join (exec {newlisp -e "(dump)"}) "\n"))
;-- one step...
(find-all "type=263 contents=(.*) \<" tea (push $1 bag))
;-- two step...
(setq spoon (last (sort (map length bag))))
(delete-file sugar)
(append-file sugar
[text]# (Automated) JOE syntax highlight file for newLISP
# These colors are for the text console.
# You will definitely need different colors for a terminal under X.
# The range of colors is found in your c.jsf file.
# Deprecated commands will blink annoyingly :-)
#
# on Linux UBUNTU 8.04 this file goes into /etc/joe/syntax/lisp.jsf
# or into $HOME/.joe/syntax/lisp.jsf on all Unix
# L Wix [xman-et-myrealbox-dot-com]
# Thanks to Norman (newdep)
# 10 Nov 2004
# 27 Jan 2005, L.M. updated to v.8.4.1
# 28 Jan 2005, L.M. made comments (did not work om Joe 3.1)
[/text]
)
(append-file sugar
{# made [text] .. [/text] tags work}
)
(append-file sugar
[text]
# 25 June 2008, L.M updated for version 9.4.0
# 22 Sept 2008, L.M updated for version 9.9.x -> 10.0 added setf
# 29 Sept 2008, L.M updated for version 9.9.x -> 10.0 added copy
# 21 Oct 2008, L.M. exclude MAIN from highlighting
# 18 Nov 2008, Norman, created the automated newlisp.jsf generator
#
# usage:
# cp newlisp-xxxx.jsf /etc/joe/syntax/newlisp.jsf
# and adjust the /etc/joe/ftyperc
#
# version 1.4
=Idle
=Comment green
=String bold black
=Text bold black
=Escape bold green
=Paren red
=Quote bold
=Prim cyan
=Tag bold blue
=Depr blink
:idle Idle
* idle
";" comment recolor=-1
"#" comment recolor=-1
"\"" string recolor=-1
"{" brace_string recolor=-1
"()" paren recolor=-1
"'" quote recolor=-1
"[" tag_o1 recolor=-1
"!=%&*+/<>^|~a-zA-Z_\-" ident buffer
:comment Comment
* comment
"\n" idle
:string String
* string
"\"" idle
"\\" string_escape recolor=-1
:string_escape Escape
* string
"\n" string recolor=-2
:brace_string String
* brace_string
"}" idle
:paren Paren
* idle noeat
:quote Quote
* idle noeat
:ident Idle
* idle noeat strings
[/text]
)
;-- tidely tidely there...
(setq bag (sort bag))
(dolist (x bag)
(append-file sugar (string (dup " ") {"} x {"} (dup " " (+ (- spoon (length x)) 2)) "prim\n")))
;-- there is always a happy end with newlisp ;-)
(append-file sugar
[text]
done
"\-\"a-zA-Z_0-9!#@$%^&*+={}|/\\:';,.<>/?~`" ident
:prim Prim
* idle noeat
:tag_o1 Tag
* idle noeat
"t" tag_o2
:tag_o2 Tag
* idle noeat
"e" tag_o3
:tag_o3 Tag
* idle noeat
"x" tag_o4
:tag_o4 Tag
* idle noeat
"t" tag_o5
:tag_o5 Tag
* idle noeat
"]" long_text
:long_text Text
* long_text
"[" close_tag buffer recolor=-1
:close_tag Tag
* long_text noeat strings
[/text]
)
(append-file sugar
{ "[/text]" tag_closed
done
"[]/etx" close_tag
:tag_closed Tag
* idle noeat
:depr Depr
* idle noeat
}
)
;-- oH yes.. enjoy!
(exit)