Re: [9fans] git and (p9p) acme

2012-06-14 Thread Mathieu Lonjaret
It happened again. and I've just realized it's simply what you had
warned about: since it was an --amend and I didn't change anything in
the message there was no change to the ls -l output, hence E did
nothing when I Put.

On Fri, Apr 27, 2012 at 12:20 AM, Mathieu Lonjaret
mathieu.lonja...@gmail.com wrote:
 I've just retried on the machine where I had the problem and it now
 just works. No need even for awd indeed.
 I'll try and reproduce the behavior, but I just don't see what I may
 have done different the previous times...

 thanks,
 Mathieu

 On Thu, Apr 26, 2012 at 5:32 AM, Russ Cox r...@swtch.com wrote:
 On Wed, Apr 25, 2012 at 5:35 PM, Mathieu Lonjaret
 mathieu.lonja...@gmail.com wrote:
 So, are you saying E just works out of the box for you as the $EDITOR
 for git/hg?

 Yes.  Note that E waits for the file to change by running
 ls -l on the file in a loop.  If for some reason doing the Put
 does not change the ls -l output (date+size, primarily) then
 E will not exit.  If you are having trouble I would suggest
 putting some echo statements in the script or just doing
 'set -e' at the top so that it echoes each statement as it
 executes (including the all-important comparison).

 I cannot imagine why using awd would change the behavior
 of the E script.

 Russ



Re: [9fans] git and (p9p) acme

2012-04-27 Thread Christian Neukirchen
lyn...@orthanc.ca (Lyndon Nerenberg) writes:

 On 2012-04-25, at 2:02 PM, Russ Cox wrote:

 Are you sure you are running 'sam foo' and not 'sam foo '?
 Sam 'blocks' until you quit out of it, just like acme or vi or ed.

 It doesn't load the file for the user to edit.

It does, but it doesnt show the buffer by default.  Just right-click and
select it.

-- 
Christian Neukirchen  chneukirc...@gmail.com  http://chneukirchen.org



Re: [9fans] git and (p9p) acme

2012-04-26 Thread Rob Pike
set -x

-rob



Re: [9fans] git and (p9p) acme

2012-04-26 Thread dexen deVries
On Wednesday 25 of April 2012 23:35:59 Mathieu Lonjaret wrote:
 So, are you saying E just works out of the box for you as the $EDITOR
 for git/hg?
 Or did you have to tweak a few things like what Aram and Dexen describe?

worked out-of-box; I only add plumbing for PHP stuff -- and start plumber in 
~/.profile

use $VISUAL rather than $EDITOR to ensure it is used only under X Windows

-- 
dexen deVries



Weightless and alone
you speed through the eerie nothingness of space
you circle 'round the Moon
and journey back
to face the punishing torment of re-entry

-- LUNA-C, ``Supaset8 (full release)'', #24m52s
#file / line in PHP format
type is text
data matches '(.+) on line ([0-9]+)'
arg isfile $1
data set $file
attr add addr=$2
plumb to edit

include /usr/local/plan9/plumb/initial.plumbing

export VISUAL=E

if [ $DISPLAY ]; then
nohup plumber /dev/null /dev/null 2/dev/null 
fi


Re: [9fans] git and (p9p) acme

2012-04-26 Thread Mathieu Lonjaret
I've just retried on the machine where I had the problem and it now
just works. No need even for awd indeed.
I'll try and reproduce the behavior, but I just don't see what I may
have done different the previous times...

thanks,
Mathieu

On Thu, Apr 26, 2012 at 5:32 AM, Russ Cox r...@swtch.com wrote:
 On Wed, Apr 25, 2012 at 5:35 PM, Mathieu Lonjaret
 mathieu.lonja...@gmail.com wrote:
 So, are you saying E just works out of the box for you as the $EDITOR
 for git/hg?

 Yes.  Note that E waits for the file to change by running
 ls -l on the file in a loop.  If for some reason doing the Put
 does not change the ls -l output (date+size, primarily) then
 E will not exit.  If you are having trouble I would suggest
 putting some echo statements in the script or just doing
 'set -e' at the top so that it echoes each statement as it
 executes (including the all-important comparison).

 I cannot imagine why using awd would change the behavior
 of the E script.

 Russ



Re: [9fans] git and (p9p) acme

2012-04-25 Thread Russ Cox
I guess it depends on what you expect to break.
I like using the E script because (once you learn not
to click Put, which doesn't take too long) after I click
Put the window is still there with my work in it in case
the tool I just sent it to chooses to blow up and
discard my efforts.

Russ



Re: [9fans] git and (p9p) acme

2012-04-25 Thread Mathieu Lonjaret
Indeed.

On Fri, Apr 20, 2012 at 9:39 PM, Mark van Atten
mark.vanat...@univ-paris1.fr wrote:
 Mathieu Lonjaret mathieu.lonja...@gmail.com a écrit :


 http://sqweek.net/plan9/acmeedit


 Nice, it almost works out of the box.
 I got a 9p error message when using it:
 9p: write error: ill-formed control message


 In /lib/acme.rc, there is

 fn newwindow {
        winctl=`{9p read acme/new/ctl}
        winid=$winctl(1)
        winctl noscroll
 }

 I think the noscroll no longer functions; I commented it out, and then
 acmeedit no longer produces the error message.

 Best wishes,
 Mark.

 --
 Directeur de recherches, CNRS
 IHPST, 13 rue du Four, 75006 Paris, France
 tel ++ 33 (0)1 43 54 60 36, fax ++ 33 (0)1 43 25 29 48
 http://www-ihpst.univ-paris1.fr/en/6,mark_van_atten.html


 --
 Ce message a ete verifie par MailScanner
 pour des virus ou des polluriels et rien de
 suspect n'a ete trouve.




Re: [9fans] git and (p9p) acme

2012-04-25 Thread Lyndon Nerenberg

On 2012-04-25, at 1:21 PM, Russ Cox wrote:

 I like using the E script because (once you learn not
 to click Put, which doesn't take too long) after I click
 Put the window is still there with my work in it in case
 the tool I just sent it to chooses to blow up and
 discard my efforts.

If 'sam file' did the obvious thing this would be much less of a problem.



Re: [9fans] git and (p9p) acme

2012-04-25 Thread Russ Cox
On Wed, Apr 25, 2012 at 4:30 PM, Lyndon Nerenberg lyn...@orthanc.ca wrote:
 If 'sam file' did the obvious thing this would be much less of a problem.

What is not obvious about what 'sam file' does?



Re: [9fans] git and (p9p) acme

2012-04-25 Thread Lyndon Nerenberg

On 2012-04-25, at 1:36 PM, Russ Cox wrote:

 What is not obvious about what 'sam file' does?

Plugging 'sam file' into a script does not launch the editor with the specified 
file in a window for the user to edit, and then save out.

People are clamouring for a (visual) 'ed foo' replacement.  Acme can't do that. 
 Sam can, but it needs some unintuitive arguments.  If 'E foo' wrapped sam up 
in the proper glue to make it fake out 'vi foo' as far as the atomic editing 
from the command line needs that started this thread, that would be wonderful.

That aside, I think rio+acme provides enough glue to make it possible to have 
an 'E' script that launches an acme window and blocks until the window is 
closed.  If I have time over the weekend I'll fiddle about and see what comes 
out.


Re: [9fans] git and (p9p) acme

2012-04-25 Thread John Floren
On Wed, Apr 25, 2012 at 1:46 PM, Lyndon Nerenberg lyn...@orthanc.ca wrote:

 On 2012-04-25, at 1:36 PM, Russ Cox wrote:

 What is not obvious about what 'sam file' does?

 Plugging 'sam file' into a script does not launch the editor with the 
 specified file in a window for the user to edit, and then save out.

Works for me... this is what I do when writing commit messages in hg.
Sure, you have to go into the right-button menu and open the file
window, but it's 2 mouse clicks and I find sam a lot more convenient
than acme for this kind of quick edit.

What behavior are you seeing?

john



Re: [9fans] git and (p9p) acme

2012-04-25 Thread Russ Cox
On Wed, Apr 25, 2012 at 4:46 PM, Lyndon Nerenberg lyn...@orthanc.ca wrote:
 Plugging 'sam file' into a script does not launch the editor with the 
 specified file in a window for the user to edit, and then save
out.

Sure it does.  And so does 'acme file', if you are on Plan 9 or
if you are on plan9port and don't already have acme running.

The point of the E script is to let you edit in the editor you're
already using instead of opening a new one.

Russ



Re: [9fans] git and (p9p) acme

2012-04-25 Thread Lyndon Nerenberg

On 2012-04-25, at 1:51 PM, John Floren wrote:

 What behavior are you seeing?

A lack of expectation.  I.e. I expect 'sam foo' to, well, edit 'foo'.  'acme 
foo' does that, as does 'ed foo.'  From a UI perspective, the 'sam foo' 
behaviour is as non-intuitive as it gets.

If 'sam foo' (i.e. with a single filename argument) loaded the file into the 
edit window, it would mimic the behaviour of almost every other editor out 
there.

--lyndon




Re: [9fans] git and (p9p) acme

2012-04-25 Thread Lyndon Nerenberg

On 2012-04-25, at 1:56 PM, Russ Cox wrote:

 The point of the E script is to let you edit in the editor you're
 already using instead of opening a new one.

But none of those commands will block until the file is saved, and that's the 
issue.


Re: [9fans] git and (p9p) acme

2012-04-25 Thread Russ Cox
On Wed, Apr 25, 2012 at 4:57 PM, Lyndon Nerenberg lyn...@orthanc.ca wrote:
 A lack of expectation.  I.e. I expect 'sam foo' to, well, edit 'foo'.  'acme 
 foo' does that, as does 'ed foo.'  From a UI perspective, the 'sam foo' 
 behaviour is as non-intuitive as it gets.

 If 'sam foo' (i.e. with a single filename argument) loaded the file into the 
 edit window, it would mimic the behaviour of almost every other editor out 
 there.

Are you complaining that 'sam foo' pops up a sam window and
you have to click to place the new window for foo instead of having
the window automatically placed?

Otherwise, I don't know what you're talking about.
sam foo starts a copy of sam editing foo.

Russ



Re: [9fans] git and (p9p) acme

2012-04-25 Thread Lyndon Nerenberg

On 2012-04-25, at 1:58 PM, Russ Cox wrote:

 Otherwise, I don't know what you're talking about.

Yes you do.



Re: [9fans] git and (p9p) acme

2012-04-25 Thread Russ Cox
On Wed, Apr 25, 2012 at 4:59 PM, Lyndon Nerenberg lyn...@orthanc.ca wrote:
 But none of those commands will block until the file is saved, and that's the 
 issue.

Are you sure you are running 'sam foo' and not 'sam foo '?
Sam 'blocks' until you quit out of it, just like acme or vi or ed.

Russ



Re: [9fans] git and (p9p) acme

2012-04-25 Thread Lyndon Nerenberg

On 2012-04-25, at 2:02 PM, Russ Cox wrote:

 Are you sure you are running 'sam foo' and not 'sam foo '?
 Sam 'blocks' until you quit out of it, just like acme or vi or ed.

It doesn't load the file for the user to edit.  Given a single file on the 
command line, the obvious behaviour should be to load the file the user asked 
to edit.


Re: [9fans] git and (p9p) acme

2012-04-25 Thread Lyndon Nerenberg

On 2012-04-25, at 2:02 PM, Russ Cox wrote:

 Are you sure you are running 'sam foo' and not 'sam foo '?
 Sam 'blocks' until you quit out of it, just like acme or vi or ed.

And you're right -- blocking behaviour isn't the problem with sam.



Re: [9fans] git and (p9p) acme

2012-04-25 Thread Russ Cox
 It doesn't load the file for the user to edit.

You must be running a different sam than I am.
I would make a video and post it on YouTube
but I am too lazy.

Russ



Re: [9fans] git and (p9p) acme

2012-04-25 Thread Mathieu Lonjaret
So, are you saying E just works out of the box for you as the $EDITOR
for git/hg?
Or did you have to tweak a few things like what Aram and Dexen describe?

I wouldn't mind using E as it is, with Put being the trigger to the
tool (git in that case), but it does not seem to be working here.

On Wed, Apr 25, 2012 at 10:21 PM, Russ Cox r...@swtch.com wrote:
 I guess it depends on what you expect to break.
 I like using the E script because (once you learn not
 to click Put, which doesn't take too long) after I click
 Put the window is still there with my work in it in case
 the tool I just sent it to chooses to blow up and
 discard my efforts.

 Russ



Re: [9fans] git and (p9p) acme

2012-04-25 Thread Aram Hăvărneanu
 So, are you saying E just works out of the box for you as the $EDITOR
 for git/hg?
 Or did you have to tweak a few things like what Aram and Dexen describe?

I guess all you need to run up awd in your cd alias. I think I stole
my cd function from Russ.

-- 
Aram Hăvărneanu



Re: [9fans] git and (p9p) acme

2012-04-25 Thread Aram Hăvărneanu
 I guess all you need to run up awd in your cd alias. I think I stole
 my cd function from Russ.

Actually, the way one does this is documented in label(1). Beware that
this requires X, hence the $DISPLAY check in my profile.

-- 
Aram Hăvărneanu



Re: [9fans] git and (p9p) acme

2012-04-25 Thread Mathieu Lonjaret
Indeed, it seems like awd was all that was needed.
Thanks!

On Wed, Apr 25, 2012 at 11:49 PM, Aram Hăvărneanu ara...@mgk.ro wrote:
 I guess all you need to run up awd in your cd alias. I think I stole
 my cd function from Russ.

 Actually, the way one does this is documented in label(1). Beware that
 this requires X, hence the $DISPLAY check in my profile.

 --
 Aram Hăvărneanu




Re: [9fans] git and (p9p) acme

2012-04-25 Thread Russ Cox
On Wed, Apr 25, 2012 at 5:35 PM, Mathieu Lonjaret
mathieu.lonja...@gmail.com wrote:
 So, are you saying E just works out of the box for you as the $EDITOR
 for git/hg?

Yes.  Note that E waits for the file to change by running
ls -l on the file in a loop.  If for some reason doing the Put
does not change the ls -l output (date+size, primarily) then
E will not exit.  If you are having trouble I would suggest
putting some echo statements in the script or just doing
'set -e' at the top so that it echoes each statement as it
executes (including the all-important comparison).

I cannot imagine why using awd would change the behavior
of the E script.

Russ



Re: [9fans] git and (p9p) acme

2012-04-20 Thread Mathieu Lonjaret
Thanks Dexen and Aram for the explanation.

On Fri, Apr 20, 2012 at 6:04 PM, sqweek sqw...@gmail.com wrote:
 On 19 April 2012 19:51, Mathieu Lonjaret mathieu.lonja...@gmail.com wrote:
 Is anyone using git with p9p acme set as the editor?
 snip
 I use E instead (which I thought was meant for that), git does not
 notice when I Put the file, so it just hangs there.

  I never tried using EDITOR=E, instead wrote my own little script. I'm
 a little compulsive when it comes to hitting Put, so my script
 actually waits until you delete the acme window. Also you can hit
 Cancel to have the script exit non-zero. Anyway this is what I use
 for $EDITOR/$VISUAL:

 http://sqweek.net/plan9/acmeedit

Nice, it almost works out of the box.
I got a 9p error message when using it:
9p: write error: ill-formed control message
but it actually does the job anyway.
Thanks!

I'll investigate later on to see which part fails exactly.



Re: [9fans] git and (p9p) acme

2012-04-19 Thread dexen deVries
hi list,


On Thursday 19 of April 2012 13:51:40 Mathieu Lonjaret wrote:
 Is anyone using git with p9p acme set as the editor?

i have the following in ~dexen/.profile
export VISUAL=E
if [ $DISPLAY ]; then
nohup plumber /dev/null /dev/null 2/dev/null 
fi


plus a few custom rules in ~dexen/lib/plumbing to deal with PHP's `FILE on 
line LINE' convention in error messages etc.


 Most things here work fine (as long as the pager is set to cat or
 something like that), but I've been having problems with 'git commit
 --amend'. If I use B as the $EDITOR, git considers the log file edited
 as soon as it is opened in acme (and does not wait for a Put), and if
 I use E instead (which I thought was meant for that), git does not
 notice when I Put the file, so it just hangs there.
 Am I missing something? is there a simple solution to that?

i use `git gui' for commits, but had similar problem with `git rebase -i'. git 
did not notice change in file when i merely re-ordered commits, cause the total 
length stays the same, and mtime somehow doesn't get listed by `ls -l'.

git notices change of file when the editor exit()s. E has a simple loop around 
`ls -l $1' to detect file change; exit()s when it notices change in ls' output. 
if you have strange output of `ls', E may not notice change.

a possible workaround is to change length of the file -- add something  in the 
comment (hashed-out) section of commit message. in case of `git rebase -i', 
change `edit' to `e'.

or re-implement E, really.

caveat:
using VISUAL=E with git, be wary of saving the file several times; the first 
Put 
will cause git to go ahead and subsequent changes to file will most likely be 
ignored.


cheers,
-- 
dexen deVries


Weightless and alone
you speed through the eerie nothingness of space
you circle 'round the Moon
and journey back
to face the punishing torment of re-entry

-- LUNA-C, ``Supaset8 (full release)'', #24m52s




Re: [9fans] git and (p9p) acme

2012-04-19 Thread Aram Hăvărneanu
 Is anyone using git with p9p acme set as the editor?
 Most things here work fine (as long as the pager is set to cat or
 something like that), but I've been having problems with 'git commit
 --amend'. If I use B as the $EDITOR, git considers the log file edited
 as soon as it is opened in acme (and does not wait for a Put), and if
 I use E instead (which I thought was meant for that), git does not
 notice when I Put the file, so it just hangs there.
 Am I missing something? is there a simple solution to that?

I do. Rather than remembering what I did, I'll link to my environment:

  http://code.google.com/p/aram-dotfiles/source/browse/

Check the big Plan 9 branch in profile:

  http://code.google.com/p/aram-dotfiles/source/browse/profile

-- 
Aram Hăvărneanu



Re: [9fans] git and (p9p) acme

2012-04-19 Thread Aram Hăvărneanu
dexen deVries wrote:
 caveat:
 using VISUAL=E with git, be wary of saving the file several times; the first 
 Put
 will cause git to go ahead and subsequent changes to file will most likely be
 ignored.

Great caveat, it bit me once.

-- 
Aram Hăvărneanu