home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 21 / CD_ASCQ_21_040595.iso / dos / prg / c / freedos3 / source / emacs16d / _input.min < prev    next >
Encoding:
Text File  |  1991-08-09  |  10.2 KB  |  559 lines

  1.  
  2.  
  3.  
  4. Name:F:abort-recursive-edit
  5. [*]endrecurse-abort[*]
  6.  
  7.  
  8. Name:F:exit-recursive-edit
  9. [*]endrecurse[*]
  10.  
  11.  
  12. Name:F:recursive-edit
  13. Call with arg1 = code to execute if the user wishes to continue the function.
  14. [*]#(ds,k,##(gs,Funwind-recurse,#(Farglist)))
  15. #(mp,k,#(Farglist))
  16. #(ds,Fmode-parens,[##(Fmode-parens,ARG1)])
  17. #(mp,Fmode-parens,SELF,ARG1)
  18. #(Fdo-recursive-edit)
  19. #(==,##(result),endrecurse,(
  20.     arg1
  21. ),(
  22.     #(F:ring-the-bell)
  23. ))
  24. #(k,foo)
  25. [*]
  26.  
  27.  
  28. Name:Fcompleting-readline
  29. [*]#(ds,completing-set,(arg3))
  30. #(ds,completing-separator,(arg4))
  31. #(Freadline,(arg1),(arg2),Fcompleting-readline)[*]
  32.  
  33.  
  34. Name:Fcompleting-readline. 
  35. [*]#(ds,value,##(value)##(2nd-half))
  36. #(ds,2nd-half)
  37. #(Ffind-a-match,#(completing-set),(
  38.     #(bl)
  39.     again
  40. ),(
  41.     #(ds,value,
  42.         ##(gn,temp,##(nc,##(gs,value)))
  43.         #(ds,temp,##(temp))
  44.         #(==,##(fm,temp,#(completing-separator),!!!)##(rs,temp),!!!,(
  45.             ##(temp)
  46.         ),(
  47.             ##(fm,temp,#(completing-separator))
  48.             #(completing-separator)
  49.         ))
  50.     )
  51.     again
  52. ),(
  53.     #(ds,value,
  54.         ##(gn,temp,##(nc,##(gs,value)))
  55.         #(ds,temp,##(temp))
  56.         #(==,##(temp),,,(
  57.             #(==,##(fm,temp,#(completing-separator),!!!)##(rs,temp),!!!,(
  58.                 ##(temp)
  59.             ),(
  60.                 ##(fm,temp,#(completing-separator))
  61.                 #(completing-separator)
  62.             ))
  63.         ))
  64.     )
  65.     #(==,##(temp),,(
  66.         #(Freadline-an,(arg3))
  67.         #(..,#(Fcompleting-readline.?))
  68.     ))
  69.     again
  70. ))
  71. [*]
  72.  
  73.  
  74. Name:Fcompleting-readline.?
  75. [*]#(ds,temp,#(completing-set))
  76. #(ow,(
  77. Possible completions are:
  78. ))
  79. #(ds,temp,##(sa,#(temp)))
  80. #(mp,temp,,(,))
  81. #(Fmore)
  82. again[*]
  83.  
  84.  
  85. Name:Fcompleting-readline.C-i
  86. [*]#(ds,value,##(value)##(2nd-half))
  87. #(ds,2nd-half)
  88. #(Ffind-a-match,#(completing-set),(
  89.     #(ds,readline-msg, [No match])
  90.     #(bl)
  91.     again
  92. ),(
  93.     #(n?,longest-matched,(
  94.         #(==,##(value),##(temp),(
  95.             #(ds,readline-msg,( [Complete, but not unique]))
  96.         ))
  97.     ),(
  98.         #(==,##(value),##(temp),(
  99.             #(ds,readline-msg, [Sole completion])
  100.         ))
  101.     ))
  102.     #(ds,value,##(temp))
  103.     again
  104. ),(
  105.     #(ds,value,
  106.         ##(gn,temp,##(nc,##(gs,value)))
  107.         #(ds,temp,##(temp))
  108.         ##(temp)
  109.     )
  110.     #(Freadline-an,(arg3))
  111.     #(==,##(temp),,(
  112.         #(..,#(Fcompleting-readline.?))
  113.     ))
  114.     again
  115. ))[*]
  116.  
  117.  
  118. Name:Fcompleting-readline.Tab
  119. [*]#(Fcompleting-readline.C-i,(arg1))[*]
  120.  
  121.  
  122. Name:Fdo-recursive-edit
  123. [*]#(Fredisplay)#(d,#(g))#(==,##(gn,result,4)#(rs,result),endr,,(#(SELF)))[*]
  124.  
  125.  
  126. Name:Ferror
  127. Report arg1 as an error only if it is non-null.
  128. [*]#(==,arg1,,(
  129.     #(an)
  130. ),(
  131.     #(an,arg1!)
  132.     #(Fflush-input-buffer)
  133. ))
  134. [*]
  135.  
  136.  
  137. Name:Fget-key
  138. This is the prototype for #(g), the function to get keys from the user.
  139. [*]##(it,10000)[*]
  140.  
  141.  
  142. Name:Fget-key-with-prefixes
  143. This function will get a key even if they key is prefixed with something.
  144. [*]#(SELF-do,#(g))[*]
  145.  
  146.  
  147. Name:Fget-key-with-prefixes-do
  148. Extended to handle multiple prefixes, as in C-x 4 f
  149. [*]#(ds,temp,#(K.arg1))
  150. #(==,##(nc,##(fm,temp,:prefix-)),1,(
  151.     #(an,##(temp))
  152.     #(SELF,#(temp)#(g))
  153. ),arg1)
  154. [*]
  155.  
  156.  
  157. Name:Fhit-any-key
  158. Give the user a chance to see his overwritten output.  If they press anything
  159. other than space, use it as input.
  160. [*]#(ow,-----[Hit any key; only space is discarded]-----(
  161. ))
  162. #(ds,temp,#(n?,kbd-macro-g,(#(kbd-macro-g)),(#(g))))
  163. #(==,##(temp), ,,(
  164.     #(Fkbd-in,##(temp),x)
  165. ))
  166. #(rd)
  167. [*]
  168.  
  169.  
  170. Name:Finsist
  171. Insist upon a non-null arg1.
  172.   arg1 = argument to supply
  173.   arg2 = function to call with the argument.
  174.   arg3 = code to execute if they supply the argument.
  175. [*]#(==,(arg1),,(
  176.     #(ds,temp,arg2)
  177.     #(..,##(gn,temp,2))
  178.     #(ds,value,##(default.##(temp)))
  179.     #(Freadline,##(temp): ,(
  180.         #(ds,temp,arg2)
  181.         #(..,##(gn,temp,2))
  182.         #(ds,default.##(temp),##(value))
  183.         #(arg2,##(value))
  184.     ))
  185. ),(
  186.     arg3
  187. ))[*]
  188.  
  189.  
  190. Name:Fkbd-in
  191. Fake a keypress.  Use ##(kbd-in) as a keyboard buffer.  If it exists, just
  192. append the new key to it.  Otherwise, define g to fetch keys from the input
  193. buffer.  If arg2 is non-empty, prepend the key.
  194. #(Fkbd-in,x)#(Fkbd-in,y)
  195. #(Fkbd-in,x)#(Fkbd-in,C-g)#(Fkbd-in,y)
  196. [*]#(n?,kbd-in,,(
  197.     #(n?,kbd-macro-g,(
  198.         #(Fredefine,g,(#(Fkbd-macro-g,#(SELF-do))))
  199.     ),(
  200.         #(Fredefine,g,##(gs,SELF-do))
  201.     ))
  202. ))
  203. #(ds,kbd-in,
  204.     #(==,arg2,,,arg1<>)
  205.     #(==,arg1,C-g,,(##(kbd-in)))
  206.     #(==,arg2,,arg1<>)
  207. )[*]
  208.  
  209.  
  210. Name:Fkbd-in-do
  211. Fake a keypress.
  212. [*]##(fm,kbd-in,<>,(
  213.     #(es,kbd-in)
  214.     #(Funredefine,g)
  215.     #(g)
  216. ))[*]
  217.  
  218.  
  219. Name:Fkey2char.C-i
  220. Insert a Tab.
  221. [*](    )[*]
  222.  
  223.  
  224. Name:Fkey2char.Comma
  225. Comma self-inserts
  226. [*](,)[*]
  227.  
  228.  
  229. Name:Fkey2char.LPar
  230. LPar self-inserts
  231. [*]##(bc,40,d,a)[*]
  232.  
  233.  
  234. Name:Fkey2char.RPar
  235. RPar self-inserts
  236. [*]##(bc,41,d,a)[*]
  237.  
  238.  
  239. Name:Fkey2char.Tab
  240. Tab self inserts.
  241. [*](    )[*]
  242.  
  243.  
  244. Name:Fmessage
  245. Show a message to the user.  After the user presses a key, erase it.
  246. [*]#(ds,temp,arg1)
  247. #(an,#(temp))
  248. #(ds,mode-hook,
  249.     #    ##(fparens,(an,)##(temp))
  250.     (
  251.     #(rd)
  252.     #(ds,mode-hook,(
  253.         #(an)
  254.         #(rd)
  255.         #(es,mode-hook)
  256.     ))
  257. ))[*]
  258.  
  259.  
  260. Name:Fok-to-trash-buffer
  261. #(Fok-to-trash-buffer,FUNCTIONS) asks the user if it is ok to trash the
  262. buffer.  If the user responds with 'yes', then FUNCTIONS is executed.
  263. CRC: Added buffer name to prompt.
  264. [*]#(Fbuffer-modified,(
  265.     #(Fyes-or-no,Buffer ##(buffer-number.#(ba,-1)) has been changed - destroy it? ,(
  266.         arg1
  267.     ))
  268. ),(
  269.     arg1
  270. ),(
  271.     arg1
  272. ))
  273. [*]
  274.  
  275.  
  276. Name:Fquoted-char
  277. Prompt the user for a control character, and return the character.
  278. [*]#(an,Enter control character (\ for octal) ?)
  279. #(ds,temp,#(g))
  280. #(an)
  281. #(==,##(gn,temp,1),\,(
  282.     #(ds,value)
  283.     #(Freadline,Octal code:,(
  284.         #(ds,value,##(bc,##(value),o,a))
  285.     ))
  286.     ##(gn,value,1)
  287. ),(
  288.     #(rs,temp)
  289.     #(==,##(gn,temp,2),C-,(
  290.         ##(bc,##(--,##(bc,#(si,Fxlat-upper,##(gs,temp))),64),d,a)
  291.     ),(
  292.         #(rs,temp)
  293.         #(n?,Fkey2char.##(temp),(
  294.             #(Fkey2char.##(temp))
  295.         ),(
  296.             #(Fcase,##(temp),
  297.                 (Back Space,(##(bc,8,d,a))),
  298.                 (Return,(##(bc,13,d,a))),
  299.                 (Escape,(##(bc,27,d,a))),
  300.                 (Del,(##(bc,127,d,a))),
  301.                 (#(==,##(nc,##(temp)),1,(##(temp)),(#(bl))))
  302.             )
  303.         ))
  304.     ))
  305. ))[*]
  306.  
  307.  
  308. Name:Freadline
  309. Read a line of text from the minibuffer.
  310. On entry, #(value) is the default string.
  311. arg1=prompt
  312. arg2=string to execute if input is confirmed with return.  The users input
  313.      is in #(value)
  314. arg3=mode.
  315. The mode variable lets keys be redefined in readline mode.  For example,
  316. isearch defines ^S and ^R specially, and extended-command defines space and
  317. escape specially.
  318. [*]#(ds,2nd-half)
  319. #(Freadline-an,(arg1))
  320. #(SELF-do,#(Fget-key-with-prefixes),(arg1),(arg2),
  321.     #(==,arg3,,Freadline.,arg3),##(F-delete-or-append))
  322. #(es,2nd-half)[*]
  323.  
  324.  
  325. Name:Freadline-an
  326. [*]#(sv,fc,#(F-readline-color))
  327. #(an,arg1##(value),,##(2nd-half)##(readline-msg))
  328. #(es,readline-msg)
  329. #(sv,fc,#(F-fore-color))
  330. [*]
  331.  
  332.  
  333. Name:Freadline-do
  334. [*]#(==,
  335.     #(n?,arg4.arg1,(
  336.         #(arg4.arg1,(arg3),arg5,(arg2))
  337.     ),(
  338.         #(n?,Freadline.arg1,(
  339.             #(Freadline.arg1,(arg3),arg5)
  340.         ),(
  341.             #(Freadline.other,arg1,arg5)
  342.         ))
  343.     ))
  344. ,again,(
  345.     #(Freadline-an,(arg2))
  346.     #(SELF,#(Fget-key-with-prefixes),(arg2),(arg3),arg4)
  347. ))[*]
  348.  
  349.  
  350. Name:Freadline.Back Space
  351. Remove the rightmost character.
  352. [*]#(ds,value,##(gn,value,#(Fmax,0,#(--,##(nc,##(value)),1))))
  353. again
  354. [*]
  355.  
  356.  
  357. Name:Freadline.C-a
  358. [*]#(ds,2nd-half,##(value)##(2nd-half))
  359. #(ds,value)
  360. again
  361. [*]
  362.  
  363.  
  364. Name:Freadline.C-b
  365. [*]#(ds,value,
  366.     ##(gn,value,#(Fmax,0,#(--,##(nc,##(value)),1)))
  367.     #(ds,2nd-half,##(go,value)##(2nd-half))
  368. )again
  369. [*]
  370.  
  371.  
  372. Name:Freadline.C-c
  373. Quit the readline.
  374. [*]#(an)[*]
  375.  
  376.  
  377. Name:Freadline.C-d
  378. [*]#(..,##(go,2nd-half))
  379. #(ds,2nd-half,##(gn,2nd-half,10000))
  380. again
  381. [*]
  382.  
  383.  
  384. Name:Freadline.C-e
  385. [*]#(ds,value,##(value)##(2nd-half))
  386. #(ds,2nd-half)
  387. again
  388. [*]
  389.  
  390.  
  391. Name:Freadline.C-f
  392. [*]#(ds,value,##(value)##(go,2nd-half))
  393. #(ds,2nd-half,##(gn,2nd-half,10000))
  394. again
  395. [*]
  396.  
  397.  
  398. Name:Freadline.C-g
  399. If empty input, quit the readline, else empty the input.
  400. [*]#(==,##(value)##(2nd-half),,(
  401.     #(F:ring-the-bell)
  402. ),(
  403.     #(ds,value)
  404.     #(ds,2nd-half)
  405.     again
  406. ))[*]
  407.  
  408.  
  409. Name:Freadline.C-h
  410. Delete the rightmost character.
  411. [*]#(ds,value,##(gn,value,#(Fmax,0,#(--,##(nc,##(value)),1))))
  412. again
  413. [*]
  414.  
  415.  
  416. Name:Freadline.C-k
  417. [*]#(ds,2nd-half)
  418. again
  419. [*]
  420.  
  421.  
  422. Name:Freadline.C-l
  423. Read a character out of the text buffer.
  424. [*]#(==,arg2,,,(#(ds,value)))
  425. #(ds,value,##(value)##(rm,>))
  426. #(sp,>)
  427. again[*]
  428.  
  429.  
  430. Name:Freadline.C-m
  431. Accept the input.
  432. [*]#(ds,value,##(value)##(2nd-half))
  433. #(Fhistory-save,(##(value)))
  434. #(an)arg1
  435. [*]
  436.  
  437.  
  438. Name:Freadline.C-o
  439. Read a word out of the text buffer.
  440. [*]#(==,arg2,,,(#(ds,value)))
  441. #(ds,value,##(value)##(rm,}))
  442. #(sp,}+)
  443. again[*]
  444.  
  445.  
  446. Name:Freadline.C-q
  447. Get a control character and insert it.
  448. [*]#(ds,temp,#(Fquoted-char))
  449. #(==,##(temp),##(bc,13,d,a),(
  450.     #(==,arg2,,,(#(ds,value)))
  451.     #(ds,value,
  452.         ##(value)
  453.         ##(bc,13,d,a)
  454.         ##(bc,10,d,a)
  455.     )
  456.     again
  457. ),(
  458.     #(Freadline.other,(##(temp)),arg2)
  459. ))[*]
  460.  
  461.  
  462. Name:Freadline.C-y
  463. If this is the first time, kill the old value.  Yank.
  464. [*]#(==,arg2,,,(#(ds,value)))
  465. #(..,##(ba,
  466.     ##(ba,-1)
  467.     #(..,##(ba,1,a))
  468.     #(sp,##(bc,##(++,#(Fkill.head),48),d,a)>)
  469.     #(ds,value,
  470.         ##(value)
  471.         ##(rm,##(bc,##(++,#(Fkill.head),49),d,a))
  472.     )
  473. ))
  474. again
  475. [*]
  476.  
  477.  
  478. Name:Freadline.Del
  479. [*]#(Freadline.C-d)[*]
  480.  
  481.  
  482. Name:Freadline.Delete
  483. [*]#(Freadline.C-d)[*]
  484.  
  485.  
  486. Name:Freadline.Down Arrow
  487. [*]#(Freadline.M-n)[*]
  488.  
  489.  
  490. Name:Freadline.End
  491. [*]#(Freadline.C-e)[*]
  492.  
  493.  
  494. Name:Freadline.Home
  495. [*]#(Freadline.C-a)[*]
  496.  
  497.  
  498. Name:Freadline.Left Arrow
  499. [*]#(Freadline.C-b)[*]
  500.  
  501.  
  502. Name:Freadline.M-n
  503. [*]#(Fhistory-next)
  504. #(ds,value,#(history.##(history-ptr)))
  505. again
  506. [*]
  507.  
  508.  
  509. Name:Freadline.M-p
  510. [*]#(Fhistory-previous)
  511. #(ds,value,#(history.##(history-ptr)))
  512. again
  513. [*]
  514.  
  515.  
  516. Name:Freadline.Return
  517. Return accepts the input.
  518. [*]#(ds,value,##(value)##(2nd-half))
  519. #(Fhistory-save,(##(value)))
  520. #(an)arg1
  521. [*]
  522.  
  523.  
  524. Name:Freadline.Right Arrow
  525. [*]#(Freadline.C-f)[*]
  526.  
  527.  
  528. Name:Freadline.Up Arrow
  529. [*]#(Freadline.M-p)[*]
  530.  
  531.  
  532. Name:Freadline.other
  533. If this is the first time, kill the old value else add printables.
  534. [*]#(==,arg2,,,(#(ds,value)))
  535. #(ds,value,
  536.     ##(value)
  537.     #(n?,Fkey2char.arg1,(
  538.         #(Fkey2char.arg1)
  539.     ),(
  540.         #(==,##(nc,arg1),1,(arg1),(#(bl)))
  541.     ))
  542. )
  543. again
  544. [*]
  545.  
  546.  
  547. Name:Fy-or-n
  548. #(Fy-or-n,PROMPT,FUNCT) will wait for a key and execute FUNCT using #(Fr) if
  549. that key is 'y' or 'n'.  Doesn't execute FUNCT if C-g (cancel) is pressed.
  550. It keeps trying until a recognized key is hit.
  551. [*]#(an,arg1 ((y/n)) )
  552. #(Fcase,#(g)#(an),
  553.     (y,(#(Fr,(arg2),y))),
  554.     (n,(#(Fr,(arg2),n))),
  555.     (C-g,()),
  556.     (
  557.         #(Fflush-input-buffer)
  558.         #(SELF,(arg1),(arg2))
  559.     )
  560. )[*]