Hi Mayer,

Thanks very much for your response!  I didn't know joe was this super flexible.

Note that >> mode,"o" << no longer works (in 3.7), it has to be replaced by >> mode,"rdonly",rtn <<.  It would be nice to get this updated in the default config file.

I figured out I didn't want to automatically run p4 every time I start modifying a file, I prefer to have the explicit ^T O key sequence do the magic.  I implemented this by defining some macros, namely:

:def makerw if,"joe(sys,\"joe-rwro rw \",name,rtn)",then,mode,"rdonly",rtn,else,msg,"FAILED: \"joe-rwro rw ",name,"\"",rtn,endif
:def makero if,"joe(sys,\"joe-rwro ro \",name,rtn)",then,mode,"rdonly",rtn,else,msg,"FAILED: \"joe-rwro ro ",name,"\"",rtn,endif
:def togglerwro if,"rdonly",then,makerw,else,makero,endif

and then changed ^T O's behavior under ":defmenu root" from
mode,"rdonly",rtn O Read only %Zrdonly%
to
togglerwro O Read only %Zrdonly%

and finally wrote a joe-rwro script that takes either "rw" or "ro" as the new desired mode as its first arg, and the filename as the second.  The script checks if the file is under a p4 client, and if it is, it executes "p4 edit" or "p4 revert -a" on the filename.


Thanks very much again, this will save me lot of time and make my work more convenient! :-)

egmont



On Thu, Jan 7, 2010 at 3:30 PM, Mayer August <amayer@cosy.sbg.ac.at> wrote:
Hello Egmont,

I'm no expert on joe, but this question interested me, so I did some
research. In the default joerc, I found the following disabled lines
(joe 3.5):

 Perforce macro: use this macro (put in first column) to have joe
"p4 edit"
 a file you're about to change.

 -mfirst if,"rdonly && joe(sys,\"p4 edit
\",name,rtn)",then,mode,"o",msg,"executed \"p4 edit ",name,
"\"",rtn,endif

I did not try this out, but it seems that by removing the leading
space in this line in your joerc, joe would automatically try to do a
p4 edit on readonly files. You could also put something like this in
a :def macro and assign it to a keystroke.

Many greetings        August



On 06.01.2010, at 12:17, Egmont Koblinger wrote:

> Hi guys,
>
> Is it possible to launch an external command from joe, giving it
> the current file's name as an argument?
>
> Use case: I open tons of read-only files (e.g. joe `grep -rl
> FooBar .`), find the few ones out of these which I have to actually
> edit, but I have to make them writable first (e.g. execute the
> command "p4 edit <filename>").  What I do currently is I make the
> terminal wide enough so that the filename is not cropped in joe's
> header, and copy-paste it to another terminal window.
>
> Something like a placeholder for the Shell (^K !) command that gets
> substituted by the filename would be a good start, then I'd have to
> type something like "^K ! p4 edit %% Enter" (and also "^T O" to
> make it writable inside joe).  An even shorter shortcut key
> sequence would be even more awesome :)
>
> If it's not possible, please consider this as a feature request! ;-)
>
>
> thanks,
> egmont
> ----------------------------------------------------------------------
> --------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast
> and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> _______________________________________________
> Joe-editor-general mailing list
> Joe-editor-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/joe-editor-general


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Joe-editor-general mailing list
Joe-editor-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joe-editor-general