I hate to say this, but there seems to be a bug in your program,
given a room list
Code:
(setq lst4 '(("100CRC") ("100ZOA") ("120") ("100MSV") ("100VSH") ("100MSQ") ("100MSR")
("100MST") ("100MSM") ("100MSN") ("100MSL") ("100MSK") ("100VSG") ("100VSF")
("100MSI") ("100MSH") ("100MSE") ("100ELB") ("100MSD") ("100ELA") ("100VSE")
("100VSD") ("129") ("100CRB") ("A141") ("100MSA") ("100ESA") ("108") ("136")
("174") ("100VSA") ("106") ("100VSC") ("116") ("100VSB") ("100CRA") ("100STA")
("140") ("160") ("171") ("101") ("100STC") ("100STB") ("150") ("114") ("118")
("134A") ("144") ("165") ("177A") ("177") ("175") ("167") ("163") ("161")
("155") ("178") ("176") ("170") ("172") ("153") ("149") ("149A") ("147")
("143") ("141") ("137") ("135") ("133") ("131") ("139") ("138B") ("138A")
("138") ("134") ("130") ("132") ("126") ("130A") ("124") ("122") ("116A")
("110") ("115") ("119") ("117") ("113") ("107") ("105") ("145") ("146")
("100PLB"))
)
Returns:
Code:
(("101") ("105") ("106") ("107") ("108") ("110") ("113") ("114") ("115")
("116") ("116A") ("117") ("118") ("119") ("120") ("122") ("124") ("126")
("129") ("130") ("130A") ("131") ("132") ("133") ("134") ("134A") ("135")
("136") ("137") ("138") ("138A") ("138B") ("139") ("140") ("141") ("A141")
("143") ("144") ("145") ("146") ("147") ("149") ("149A") ("150") ("153")
("155") ("160") ("161") ("163") ("165") ("167") ("170") ("171") ("172") ("174")
("175") ("176") ("177") ("177A") ("178"))
All the 100xxx room numbers were dropped.
If I change the cond section to
Code:
(cond
((or (wcmatch n "###") (wcmatch n "@##")) (_Add "*" n "*")
)
((wcmatch n "@###") (_Add (substr n 1 1) (substr n 2) "*"))
((or (wcmatch n "@###@") (wcmatch n "@###@@") (wcmatch n "@###@@@") )
(_Add (substr n 1 1) (substr n 2 3) (substr n 5))
)
((or (wcmatch n "###@") (wcmatch n "###@@") (wcmatch n "###@@@"))
(_Add "*" (substr n 1 3) (substr n 4))
)
((or (wcmatch n "@@##@") (wcmatch n "@@##@@") (wcmatch n "@@##@@@"))
(_Add (substr n 1 1) (substr n 2 3) (substr n 5))
)
(_Add "*" n "*") ;needed to do this if all conditions above are not met, so room numbers do not get deleted from sorted list
)
seems to correct the problem.