Re: How to get the signature of function and method definitions

2011-11-14 Thread Thorsten
Henrik Sarvell hsarv...@gmail.com
writes:

Hi Henrik,

 Does it matter if you can see the definition instead of simply jumping
 to it?

not really.

 Because with the help of CTags I can jump to any defined function or
 method in a .l file.

I tried it once to set up TAG files, but I didn't really succeed. I think
I have to read a bit more in the Emacs manual and then try your tutorial
again. TAGS seem to be really usefull, not only for Picolisp, but
everywhere in Emacs.  

 With jump to documentation you basically get this functionality for
 the built in functions.

I really like this, since I'm still in a phase where I basically have to
look up (almost) every Picolisp function I use, and that was a bit
tedious using the web interface.

 On Sat, Nov 12, 2011 at 2:44 AM, Thorsten
 quintf...@googlemail.com wrote:

 Tomas Hlavaty t...@logand.com writes:

 Hi Tomas,

 I remember that Alex recently mentioned a method how to get the
 signature of any function or method definition loaded in the system.
 Unfortunately, I could not find the related post again.

 Any hints where I have to look  would be appreciated.

 have a look at

    $ git clone http://logand.com/git/swank-picolisp.git

 it does what you are after, even for C/asm functions.

 Thats quite impressive, thanks. I thought slime/swank is only for 
 communication
 with compiled lisps, but well ...

 I can open a picolisp file in slime-mode now, but I can't connect (with
 slime-connect):

 ,---
 | Connecting to Swank on port 4005.. [2 times] open-network-stream: make
 | client process failed: verbindungsaufbau abgelehnt, :name, SLIME
 | Lisp, :buffer, nil, :host, 127.0.0.1, :service, 4005
 `---

 I have to check my slime installation ...


 Is that still valid, or should it rather be 'pil ore 'plmod now?
 ,---
 | (setq slime-lisp-implementations
 |       `((picolisp (/usr/bin/picolisp/p) :init slime-init-picolisp)))
 `---

 So, the connection via swank replaces the connection via
 inferior-picolisp/commint - or uses it? And slime-mode replaces
 picolisp-mode, or adds new functionality to it?

 Thats new terrain, I only knew about swank from ENSIME, the emacs scala
 mode, never used slime/swank with a lisp.

 Cheers,
 --
 Thorsten

 --

 UNSUBSCRIBE:
mailto:picolisp@software-lab.de?subject=Unsubscribe

cheers
-- 
Thorsten

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: How to get the signature of function and method definitions

2011-11-14 Thread Alexander Burger
Hi Henrik, Thorsten,

  Because with the help of CTags I can jump to any defined function or
  method in a .l file.
 
 I tried it once to set up TAG files, but I didn't really succeed. I think
 I have to read a bit more in the Emacs manual and then try your tutorial
 again. TAGS seem to be really usefull, not only for Picolisp, but
 everywhere in Emacs.  

I think that the necessary tags are already there, or can be easily
generated. At least in the latest version of PicoLisp (this was extended
recently a bit).

You can - again - take the 'vi' function as example. It generates a
temporary file ~/.pil/tmp/pid/tags upon startup, so that all
functions defined in the current session are included. The other symbols
(all built-in functions and assembly-level labels, equates etc.) already
come with the distribution in src64/tags).

So, in 'vi', after you edit a function, e.g.

   : (vi 'doc)

you can move the cursor on other symbols, e.g. 'call' in the next line,
and hit Ctrl-']'. There, you may click on 'CDR', and so on.

I think it should be easy to adopt this mechanism to other editors.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: How to get the signature of function and method definitions

2011-11-14 Thread Alexander Burger
On Mon, Nov 14, 2011 at 01:38:56PM +0100, Alexander Burger wrote:
 I think that the necessary tags are already there, or can be easily

I'm assuming that emacs can use the 'vi' tag file format. Am I wrong?
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: How to get the signature of function and method definitions

2011-11-14 Thread Henrik Sarvell
It's at the end here:
http://www.prodevtips.com/2010/09/29/emacs-color-themes-tags-cedet-ecb-and-other-customizations/

Not much to it, I do things old school ie I put the download in
/opt/picolisp and simply cd there in a shell and do: ctags -e -R
--languages=-JavaScript,-PHP,-C,-Make,-HTML

This will recursively loop through all the folders and generate tags
for everything, for instance all my projects in /opt/picolisp/projects
and the standard library in /opt/picolisp/lib


On Mon, Nov 14, 2011 at 9:18 PM, Thorsten quintf...@googlemail.com wrote:

 Alexander Burger a...@software-lab.de writes:

 Hi Alex,
  On Mon, Nov 14, 2011 at 01:38:56PM +0100, Alexander Burger wrote:
  I think that the necessary tags are already there, or can be easily
 
  I'm assuming that emacs can use the 'vi' tag file format. Am I wrong?

 I must admit I'm a bit overwhelmed by all the new information and
 possibilities I learned about in this thread - will need some time to
 digest all that.

 Since Emacs is such a huge beast, I try to learn it step by step - and
 TAGS was one of the topics I couldn't get my head around easiliy, so I
 just left it for another attempt later on.

 Therefore, I can't really say much about the tag file formats at the
 moment, maybe Henrik can help.

 cheers
 --
 Thorsten

 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: How to get the signature of function and method definitions

2011-11-14 Thread Alexander Burger
Hi Henrik,

 Not much to it, I do things old school ie I put the download in
 /opt/picolisp and simply cd there in a shell and do: ctags -e -R
 --languages=-JavaScript,-PHP,-C,-Make,-HTML
 
 This will recursively loop through all the folders and generate tags
 for everything, for instance all my projects in /opt/picolisp/projects
 and the standard library in /opt/picolisp/lib

I see. However, I would see some problems with that:

- 'ctags' doesn't know how to handle the Lisp level functions like '*/',
  and their connection to 'doMulDiv'.

- In the folders may be several files that contain a (de foo (..) ..),
  and 'ctags' doesn't know which are loaded in the current project.

- 'ctags' cannot resolve methods with the same name for different
  classes, and associate each of them with its class.

If you simply let the PicoLisp runtime do it, you have it all in the
right place.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


re: tags

2011-11-14 Thread Doug Snead
FWIW ... here's something I use instead of ctags for picolisp. 

$ cat /usr/local/bin/lisptags

#!/bin/sh 
# make a tags file for pico lisp source files.
# use:
#   lisptags foo.l bar.l baz.l ... bof.l
# generate the file 'tags'
# [based on lisptags csh script by John Foderaro, c.1982]
awk '
/^[ \t]*\(d[em][ \t]/ { print $2 \t FILENAME \t?^ $0 $? }
/^[ \t]*\(class[ \t]/ { print $2 \t FILENAME \t?^ $0 $? }
' $* | sort  tags


Doug


--- On Mon, 11/14/11, Henrik Sarvell hsarv...@gmail.com wrote:

 From: Henrik Sarvell hsarv...@gmail.com
 Subject: Re: How to get the signature of function and method definitions
 To: picolisp@software-lab.de
 Date: Monday, November 14, 2011, 6:59 AM
 It's at the end here:
 http://www.prodevtips.com/2010/09/29/emacs-color-themes-tags-cedet-ecb-and-other-customizations/
 
 Not much to it, I do things old school ie I put the
 download in
 /opt/picolisp and simply cd there in a shell and do: ctags
 -e -R
 --languages=-JavaScript,-PHP,-C,-Make,-HTML
 

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: How to get the signature of function and method definitions

2011-11-14 Thread Henrik Sarvell
1.) Lisp level functions are handled anyway by the jump to documentation script.
2.) It's only a problem when jumping as you then jump to the incorrect
file but since I don't do much global functions anyway this is not a
problem for me, if I jump to http for instance I end up in the right
file.
3.) Correct and could become a potential annoyance when jumping,
unfortunately my autocompletion only locks on to the predefined lisp
functions and all definitions in all open buffers so there it is not a
problem (I was wrong before when I wrote in my article that it would
lock on tags too).

On Tue, Nov 15, 2011 at 12:22 AM, Alexander Burger a...@software-lab.de wrote:
 Hi Henrik,

 Not much to it, I do things old school ie I put the download in
 /opt/picolisp and simply cd there in a shell and do: ctags -e -R
 --languages=-JavaScript,-PHP,-C,-Make,-HTML

 This will recursively loop through all the folders and generate tags
 for everything, for instance all my projects in /opt/picolisp/projects
 and the standard library in /opt/picolisp/lib

 I see. However, I would see some problems with that:

 - 'ctags' doesn't know how to handle the Lisp level functions like '*/',
  and their connection to 'doMulDiv'.

 - In the folders may be several files that contain a (de foo (..) ..),
  and 'ctags' doesn't know which are loaded in the current project.

 - 'ctags' cannot resolve methods with the same name for different
  classes, and associate each of them with its class.

 If you simply let the PicoLisp runtime do it, you have it all in the
 right place.

 Cheers,
 - Alex
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: How to get the signature of function and method definitions

2011-11-14 Thread Thorsten
Alexander Burger a...@software-lab.de writes:


Hi Alex,
 On Mon, Nov 14, 2011 at 01:38:56PM +0100, Alexander Burger wrote:
 I think that the necessary tags are already there, or can be easily

 I'm assuming that emacs can use the 'vi' tag file format. Am I wrong?

I'm afraid not, I used 

,-
| M-. 
| (find-tag tagname optional next-p regexp-p)
`-

on 'while' in a picolisp source-file in @/src64. and got the following
message:

,-
| visit-tags-table-buffer:
| File /home/tj1/bin/picoLisp/src64/tags is not a valid tags table
`-

Is that ctags or etags or something else what 'vi' uses? 


,---
| *emacs-tags* *emacs_tags* *E430*  
| Emacs style tag files are only supported if Vim was compiled with the 
| |+emacs_tags| feature enabled.  Sorry, there is no explanation about Emacs tag
| files here, it is only supported for backwards compatibility :-). 
|   
| Lines in Emacs tags files can be very long.  Vim only deals with lines of up  
| to about 510 bytes.  To see whether lines are ignored set 'verbose' to 5 or   
| higher.   
|   
| http://vimdoc.sourceforge.net/htmldoc/tagsrch.html
`---

If 'vi' uses (exuberant) ctags, it seems you could produce an etags TAGS
file for emacs by simply running 'ctags -e'. 


,-
| Despite the wealth of available options, defaults are set so that ctags |
| is most commonly executed without any options (e.g. ctags *, or ctags|
| −R), which will create a tag file in the current directory for all |
| recognized source files. The options described below are provided merely|
| to allow custom tailoring to meet special needs.|
| |
| −e  |
| |
| Enable etags mode, which will create a tag file for use with the Emacs  |
| editor. Alternatively, if ctags is invoked by a name containing the |
| string etags (either by renaming, or creating a link to, the  |
| executable), etags mode will be enabled. This option must appear before |
| the first file name.|
| http://ctags.sourceforge.net/ctags.html#HOW%20TO%20USE%20WITH%20GNU%20EMACS |
| |
`-

cheers
-- 
Thorsten

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: tags

2011-11-14 Thread Thorsten
Doug Snead semaphore_2...@yahoo.com
writes:

Hi Doug,

 FWIW ... here's something I use instead of ctags for picolisp. 

 $ cat /usr/local/bin/lisptags

 #!/bin/sh 
 # make a tags file for pico lisp source files.
 # use:
 #   lisptags foo.l bar.l baz.l ... bof.l
 # generate the file 'tags'
 # [based on lisptags csh script by John Foderaro, c.1982]
 awk '
 /^[ \t]*\(d[em][ \t]/ { print $2 \t FILENAME \t?^ $0 $? }
 /^[ \t]*\(class[ \t]/ { print $2 \t FILENAME \t?^ $0 $? }
 ' $* | sort  tags


 Doug

Are these tag files readable for emacs? 
Since tags seems to be sorted, I guess not, since etags apparently are
not sorted. 


 --- On Mon, 11/14/11, Henrik Sarvell hsarv...@gmail.com wrote:

 From: Henrik Sarvell hsarv...@gmail.com
 Subject: Re: How to get the signature of function and method definitions
 To: picolisp@software-lab.de
 Date: Monday, November 14, 2011, 6:59 AM
 It's at the end here:
 http://www.prodevtips.com/2010/09/29/emacs-color-themes-tags-cedet-ecb-and-other-customizations/
 
 Not much to it, I do things old school ie I put the
 download in
 /opt/picolisp and simply cd there in a shell and do: ctags
 -e -R
 --languages=-JavaScript,-PHP,-C,-Make,-HTML
 

cheers
-- 
Thorsten

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: How to get the signature of function and method definitions

2011-11-14 Thread Alexander Burger
Hi Thorsten,

 ,-
 | visit-tags-table-buffer:
 | File /home/tj1/bin/picoLisp/src64/tags is not a valid tags table
 `-
 
 Is that ctags or etags or something else what 'vi' uses? 

Yes, so this seems indeed to be te case.


 ...
 If 'vi' uses (exuberant) ctags, it seems you could produce an etags TAGS
 file for emacs by simply running 'ctags -e'. 

There must surely be a way.

Then the easiest would probably be (if the intention is anyway to write
an emacs version of 'vi'), to modify this part of 'vi'

  (out (tmp tags)
 (let D (pack (pwd) /)
(for This (sort (all))
   (let? P (path (: *Dbg 1 -1))
  (prinl
 This
 ^I
 (unless (= `(char /) (char P)) D)
 P
 ^I
 (: *Dbg 1 1) ) ) ) ) )

to output an emacs compatible format.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: How to get the signature of function and method definitions

2011-11-14 Thread Thorsten
Tomas Hlavaty t...@logand.com writes:

Hi Henrik, Hi Tomas,
thanks for your help so far. 

I now have slime and sbcl installed and working, and I downloaded
swank-picolisp and copied your configuration except the picolisp command 

,---
| usr/bin/picolisp/p
`---

I have a problem there, I tried

,
| home/tj1/bin/picolisp/pil   |
| home/tj1/bin/picolisp/plmod |
| home/tj1/bin/picolisp/bin/pil   |
| home/tj1/bin/picolisp/bin/plmod |
| home/tj1/bin/picolisp/bin/psh |
`

but no matter which one  I use, and I always get an error, e.g. 

,--
| (prog (load  
| /home/tj1/bin/picolisp/lib/swank-picolisp/swank-picolisp.l)
| (swank-start /tmp/slime.20688))
|  
| Can't exec program:  
| /home/tj1/bin/picolisp/bin/psh   
`--

Now I'm a bit confused - which command should I use, and is that related
to file permissions (they seem alright to me) or something else?
Do you use recent versions of picolisp?


here is the backtrace I get when I try to open a test2.l file:

,-
| Debugger entered--Lisp error: (error Process inferior-lisp not 
| running) process-send-string(#process inferior-lisp (prog (load 
| \/home/tj1/bin/picolisp/lib/swank-picolisp/swank-picolisp.l\) 
| (swank-start \/tmp/slime.20688\))\n) (let ((str ...)) (goto-char 
| (process-mark process)) (insert-before-markers str) (process-send-string
| process str)) (save-current-buffer (set-buffer (process-buffer process))
| (make-local-variable (quote slime-inferior-lisp-args)) (setq
| slime-inferior-lisp-args args) (let (...) (goto-char ...)   
| (insert-before-markers str) (process-send-string process str))) 
| (with-current-buffer (process-buffer process) (make-local-variable  
| (quote slime-inferior-lisp-args)) (setq slime-inferior-lisp-args args)  
| (let (...) (goto-char ...) (insert-before-markers str)  
| (process-send-string process str))) (let* ((--cl-rest-- args)   
| (coding-system ...) (init ...)) (with-current-buffer (process-buffer
| process) (make-local-variable ...) (setq slime-inferior-lisp-args args) 
| (let ... ... ... ...))) (progn (let* (... ... ...) (with-current-buffer 
| ... ... ... ...))) (destructuring-bind (key coding-system init 
| allow-other-keys) args (with-current-buffer (process-buffer process)   
| (make-local-variable ...) (setq slime-inferior-lisp-args args) (let ... 
| ... ... ...))) slime-start-swank-server(#process inferior-lisp
| (:program /home/tj1/bin/picolisp/bin/psh :program-args nil :buffer
| *inferior-lisp* :coding-system iso-latin-1-unix :init 
| slime-init-picolisp :name picolisp :init-function nil :env nil))
| slime-inferior-connect(#process inferior-lisp (:program   
| /home/tj1/bin/picolisp/bin/psh :program-args nil :buffer  
| *inferior-lisp* :coding-system iso-latin-1-unix :init 
| slime-init-picolisp :name picolisp :init-function nil :env nil)) (let   
| ((proc ...)) (slime-inferior-connect proc args) (pop-to-buffer  
| (process-buffer proc))) (let ((args ...)) (slime-check-coding-system
| coding-system) (when (slime-bytecode-stale-p)   
| (slime-urge-bytecode-recompile)) (let (...) (slime-inferior-connect proc
| args) (pop-to-buffer ...))) (catch (quote --cl-block-slime-start--) (let
| (...) (slime-check-coding-system coding-system) (when ... ...) (let ... 
| ... ...))) (cl-block-wrapper (catch (quote --cl-block-slime-start--)
| (let ... ... ... ...))) (block slime-start (let (...)   
| (slime-check-coding-system coding-system) (when ... ...) (let ... ...   
| ...))) (let* ((program ...) (program-args ...) (directory ...)  
| (coding-system ...) (init ...) (name ...) (buffer ...) (init-function   
| ...) (env ...)) (let (...) (while --cl-keys-- ...)) (block slime-start  
| (let ... ... ... ...))) slime-start(:name picolisp :program 
| /home/tj1/bin/picolisp/bin/psh :program-args nil :init
| slime-init-picolisp) apply(slime-start (:name picolisp :program 
| /home/tj1/bin/picolisp/bin/psh :program-args nil :init
| slime-init-picolisp)) slime-start*((:name picolisp :program 
| /home/tj1/bin/picolisp/bin/psh :program-args nil :init
| slime-init-picolisp)) (let ((inferior-lisp-program ...) 
| (slime-net-coding-system ...)) (slime-start* (cond ... ...))) slime()   
|