Interactive documentation
- 
				cormullion
 - Posts: 2038
 - Joined: Tue Nov 29, 2005 8:28 pm
 - Location: latiitude 50N longitude 3W
 - Contact:
 
Interactive documentation
I've been spending a lot of time looking through the documentation, and I just wondered - has an interactive documentation tool been developed for newLISP? I'm thinking of a quick way of finding out the syntax of functions... I seem to remember some function in Common Lisp that did something similar...
			
			
									
									
						You may look here:
http://www.alh.net/newlisp/phpbb/viewto ... hlight=doc
http://www.alh.net/newlisp/phpbb/viewtopic.php?t=378
(Of cource for your own code, not for native commands)
			
			
									
									http://www.alh.net/newlisp/phpbb/viewto ... hlight=doc
http://www.alh.net/newlisp/phpbb/viewtopic.php?t=378
(Of cource for your own code, not for native commands)
Hans-Peter
						- 
				cormullion
 - Posts: 2038
 - Joined: Tue Nov 29, 2005 8:28 pm
 - Location: latiitude 50N longitude 3W
 - Contact:
 
- 
				cormullion
 - Posts: 2038
 - Joined: Tue Nov 29, 2005 8:28 pm
 - Location: latiitude 50N longitude 3W
 - Contact:
 
That's a great idea! I've managed to get a similar effect when using my text editor (which has a "Find in reference" command for the selected word)... 
If you're using BBEdit or TextWrangler on MacOS, type this command to customise the Find in reference command for newLISP:
and the relevant page will be displayed. The '%@' means the selected word, apparently. (Change 'bbedit' to 'textwrangler' if you're using the free version.)
I haven't even started to look at newlisp-tk yet ... So much to do :-)
			
			
									
									
						If you're using BBEdit or TextWrangler on MacOS, type this command to customise the Find in reference command for newLISP:
Code: Select all
defaults write com.barebones.bbedit Services:ADCReferenceSearchTemplate "file:///usr/share/newlisp/doc/newlisp_manual.html#%@"I haven't even started to look at newlisp-tk yet ... So much to do :-)
Try this on OSX when running newLISP in a terminal window:
A similar thing is possible in Linux/UNIX or Win32 when replacing 'open' with the name of the browser application.
Lutz
			
			
									
									
						Code: Select all
(define-macro (help func) 
  (if (primitive? (eval func)) 
    (!  (format "open http://newlisp.org/newlisp_manual.html#%s" (name func))) 
    (format "%s is not a built-in function" (name func))))
;; try
(help println) => pops up manual in your default browser and positions to 'println'
(help foo) => "foo is not a built-in function"
Lutz
if you have lynx installed on yur Linux/UNIX/OSX box you can use the following very fast method:
I have this in my /usr/share/newlisp/init.lsp file. It is almost instantly because lynx ( a character based web growser) loads very fast.
Lutz
			
			
									
									
						Code: Select all
(define-macro (help func)
  (if (primitive? (eval func))
    (!  (format "lynx /usr/share/newlisp/doc/newlisp_manual.html#%s" (name func)))
    (format "%s is not a built-in function" (name func))))
Lutz
- 
				cormullion
 - Posts: 2038
 - Joined: Tue Nov 29, 2005 8:28 pm
 - Location: latiitude 50N longitude 3W
 - Contact:
 
- 
				cormullion
 - Posts: 2038
 - Joined: Tue Nov 29, 2005 8:28 pm
 - Location: latiitude 50N longitude 3W
 - Contact:
 
You certainly won't like this version I'm currently using:
but it's so quick I can't help using it. It's wonderful how even a beginner like me can do this sort of thing in (new)LISP...
			
			
									
									
						Code: Select all
(define-macro (?? func) 
	"(?? println) => displays syntax for func "
  (if (primitive? (eval func))
    (begin 
    	(set 'file (open "/usr/share/newlisp/doc/newlisp_manual.html" "read"))
		(search file (string {<a NAME="} (name func) {">} ) )
		(read-buffer file 'buff 500 )
		(replace  "<.+>" buff "" 512 )
		(replace ">" buff ">")
		(replace "<" buff "<")
		(println buff "...")
		(close file)))) - 
				cormullion
 - Posts: 2038
 - Joined: Tue Nov 29, 2005 8:28 pm
 - Location: latiitude 50N longitude 3W
 - Contact:
 
Take the newlisp-tk.tcl from 8.7.4 source.But I am quite sure it could be done in newLISP-TK with TCL.
time for newLISP-TK 1.31 ??
Here we go:
Add a var to config vars (here windows version):
Code: Select all
set Ide(HelpFile) "$env(PROGRAMFILES)/newlisp/newlisp_manual.html"
Code: Select all
proc CommandHelp { widget } {
	global selectionBuff Ide
	catch [set selectionBuff [selection get -displayof $widget ]]
	exec $Ide(HelpProgram) $Ide(HelpFile)#$selectionBuff
	}
Code: Select all
bind $txt <F1> { CommandHelp %W }
time for newLISP-TK 1.31 ??
;-)
Hans-Peter
						Lutz,
also nice to put it there, but can you add also the key-binding?
When you have platform concerns you can add it like this in SetupConsole:
Windows user usually use F1 as the help-key.
;-)
			
			
									
									also nice to put it there, but can you add also the key-binding?
When you have platform concerns you can add it like this in SetupConsole:
Code: Select all
	if { $Ide(platform) == "windows" } {
		bind $txt <F1> { CommandHelp %W }
	}
;-)
Hans-Peter