picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

complete.l (954B)


      1 # 03apr12abu
      2 # (c) Software Lab. Alexander Burger
      3 
      4 (if (opt)
      5    (let "Lst" (chop @)
      6       (if (= "-" (car "Lst"))
      7          (let "Pre" (pop '"Lst")
      8             (when (member (car "Lst") '("\"" "'"))
      9                (setq "Pre" (pop '"Lst")) )
     10             (let "Str" (pack "Lst")
     11                (for "Sym" (all)
     12                   (and
     13                      (pre? "Str" "Sym")
     14                      (getd "Sym")
     15                      (prinl "Pre" "Sym" (and (= "-" "Pre") " ")) ) ) ) )
     16          (let ("Path" (rot (split "Lst" "/"))  "Str" (pack (car "Path")))
     17             (setq "Path" (and (cdr "Path") (pack (glue "/" @) "/")))
     18             (for "Sym" (dir "Path" T)
     19                (when (pre? "Str" "Sym")
     20                   (prinl "Path"
     21                      (replace (chop "Sym") " " "\\ ")
     22                      (if (=T (car (info (pack "Path" "Sym"))))
     23                         "/"
     24                         " " ) ) ) ) ) ) )
     25    (prinl '+) )
     26 
     27 # vi:et:ts=3:sw=3