gofmt and acme (p9p)

891 views
Skip to first unread message

Christopher Hobbs

unread,
Sep 4, 2012, 12:23:38 AM9/4/12
to golan...@googlegroups.com
I'm not sure if this would be better suited for 9fans or some other list, but being that it involved gofmt, I figured I'd start here.

Lately, I've become enamored with acme in p9p and I've been trying to use it for a few projects.  I had a struct all tabbed out (tabs, not spaces) with nice columns, then after running gofmt, it looked like this:  http://f.cl.ly/items/1o3X1t1n3e3v3D1A1l0J/Screen%20Shot%202012-09-03%20at%2023.17.11%20.png

I read somewhere that gofmt uses tabs, but it appears to have replaced the tabs I added with spaces.  If I open the same (post gofmt) file with vim, everything looks all pretty as usual:  http://f.cl.ly/items/3j3y3t0j0x3m3X0o313a/Screen%20Shot%202012-09-03%20at%2023.20.26%20.png

Note that I have vim set up to use two spaces rather than tabs (coming from the Ruby world, here) and that file was originally created in vim.  Could my previous use of spaces rather than tabs be throwing gofmt off?

Jesse McNelis

unread,
Sep 4, 2012, 12:27:50 AM9/4/12
to Christopher Hobbs, golan...@googlegroups.com
On Tue, Sep 4, 2012 at 2:23 PM, Christopher Hobbs <ch...@altbit.org> wrote:
> Lately, I've become enamored with acme in p9p and I've been trying to use it
> for a few projects. I had a struct all tabbed out (tabs, not spaces) with
> nice columns, then after running gofmt, it looked like this:
> http://f.cl.ly/items/1o3X1t1n3e3v3D1A1l0J/Screen%20Shot%202012-09-03%20at%2023.17.11%20.png

Variable width font.

> I read somewhere that gofmt uses tabs, but it appears to have replaced the
> tabs I added with spaces. If I open the same (post gofmt) file with vim,
> everything looks all pretty as usual:
> http://f.cl.ly/items/3j3y3t0j0x3m3X0o313a/Screen%20Shot%202012-09-03%20at%2023.20.26%20.png

Fixed width font.

> Note that I have vim set up to use two spaces rather than tabs (coming from
> the Ruby world, here) and that file was originally created in vim. Could my
> previous use of spaces rather than tabs be throwing gofmt off?

gofmt uses tabs for indentation and spaces for alignment.


--
=====================
http://jessta.id.au

Christopher Hobbs

unread,
Sep 4, 2012, 12:29:56 AM9/4/12
to golan...@googlegroups.com, Christopher Hobbs, jes...@jessta.id.au
Ack... I don't know why I didn't catch that!  Thanks for the reply!

ron minnich

unread,
Sep 4, 2012, 12:39:50 AM9/4/12
to Christopher Hobbs, golan...@googlegroups.com, jes...@jessta.id.au
There are some nice fixed width fonts out there for Acme users who
like things to line up.

ron

Christopher Hobbs

unread,
Sep 4, 2012, 1:05:11 AM9/4/12
to golan...@googlegroups.com, Christopher Hobbs, jes...@jessta.id.au
I settled on unicode.7x13.font from p9p.  It looks pretty nice.  I understand the minimalism behind acme (and plan9), but I just can't deal with variable fonts now that I've noticed them.

Aram Hăvărneanu

unread,
Sep 4, 2012, 4:14:39 AM9/4/12
to Christopher Hobbs, golan...@googlegroups.com, jes...@jessta.id.au
> I just can't deal
> with variable fonts now that I've noticed them.

But before noticing them, you could :-). It's all in your mind, you
expect variable width fonts to be "wrong" :-).

I used in acme the beautiful variable fonts from B&W for a long time,
and I still prefer them, but after started to do Go almost
exclusively, I moved to the fixed width Anonymous Pro to fix the gofmt
issue. This is what it looks like: http://i.imgur.com/6EBOf.png

--
Aram Hăvărneanu

Anssi Porttikivi

unread,
Sep 4, 2012, 4:25:50 AM9/4/12
to golan...@googlegroups.com
I have played with Acme every now and then, but never used it for real. Could you summarize your setup for Acme/Go/p2p, and your work procedures? I am also wondering, if I could move my text file based Getting Things Done methodology to Acme/others and Dropbox (I am now using Simplenote online/iPhone)...

roger peppe

unread,
Sep 4, 2012, 4:40:52 AM9/4/12
to Christopher Hobbs, golan...@googlegroups.com
Personally I use the default variable width font and live with the
unaligned struct fields. It's rarely that much of an issue, and when
I care, I middle-click "Font" in the tag and I can see the aligned version.

Nice to see another acme user BTW!

Altbit.org

unread,
Sep 4, 2012, 11:26:52 AM9/4/12
to Aram Hăvărneanu, golan...@googlegroups.com, jes...@jessta.id.au
Well, the primary issue was aligning structs. I didn't know about the setup mentioned earlier in the thread (middle click to select font) and that resolved the issue. Part of the appeal of acme was the attractive font.

--
C.M. Hobbs
http://altbit.org

Christopher Hobbs

unread,
Sep 4, 2012, 11:39:00 PM9/4/12
to golan...@googlegroups.com, Aram Hăvărneanu, jes...@jessta.id.au
I just realized this never made it to the list, sorry for the duplicate posts.  Blame it on my lack of coffee this morning...  Here's my reply:

I'm in a state of flux right now, but I'll do my best to describe the
way I work.

For the last year or so, I've maintained a VPS that I just ssh into
for all of my Day Job (TM) work.  I generally use vim and tmux in
pretty bare bones/minimalist configurations.  I've been using vim (and
vi) for the better part of 15 years, but once in a while I like to try
new editors.  When I'm remote, I just use an iPad and a keyboard to
ssh in and work.  Feel free to heckle me about that, I'm used to it.

A recent gig required me to learn Go and that led me to looking into
plan9 again.  Looking into plan9 naturally led me to p9p after reading
about Russ Cox and Rob Pike's setups.  I started using acme a week or
two ago and have been using it whenever possible now.

As for my setup, I still maintain my remote vps since I don't have any
means of using acme on the run.  I'm looking at buying a laptop to
replace my iPad for working remotely as I'm seriously considering
switching to acme as my primary editor.

On my remote machine, I have my test database and my normal
development setup.  Locally, I run acme (now with one of the fixed
width fonts).  In acme, I keep an rc shell open where I run gofmt and
then commit and push my code.  I then hop into my remote server, pull
the code and run my app.

This isn't the most optimal situation.  My next step is to get a local
instance of postgres running so I can skip the remote server
alltogether if I'm not on the road.  If I need to work while I'm out
and about, I can just pull the repo and use my old tooling as normal.
Rather than installing a local copy of postgres, I may even open up
the remote database and just connect to it from my local machine.

As for a GTD or documentation option, I tend to use a paper notebook
and a pencil to keep all of my notes.  Lately, I've found that with
projects like golang-weekly (shameless self plug), I've been using
textfiles to manage issue notes. I looked at wikifs as an option, but
I don't believe it runs under p9p.

My plan now is to either install werc somewhere, which is a little
heavy handed, or simply provide file paths as references in text files
which I can then right click on as if it were a wiki.  Not entirely
elegant, but I think it would get the job done.

Sorry for the rambling, I think it was good for me to reflect on my
current setup and where I'm going anyway.  Thanks for asking.

Christopher Hobbs

unread,
Sep 22, 2012, 12:57:14 AM9/22/12
to nate...@gmail.com, golan...@googlegroups.com, jes...@jessta.id.au
My screenshot was in OSX using acme from p9p.

On Fri, Sep 21, 2012 at 11:35 PM, <nate...@gmail.com> wrote:
> So that screen shot is of acme running in windows? It isn't acme-sac though
> is it?
>
>> issue. This is what it looks like: http://i.imgur.com/6EBOf.png
>>
>
>



--
Christopher M. Hobbs
http://altbit.org

dane

unread,
Sep 22, 2012, 9:28:43 AM9/22/12
to golan...@googlegroups.com
Acme sounds interesting but from what I have read you need a mouse with 3 buttons to use it.
So it is not usable on a laptop without an external mouse?
I am not sure if I got this right.

Optimally I would not want to have to use a mouse at all while working.

Christopher Hobbs

unread,
Sep 22, 2012, 10:10:20 AM9/22/12
to dane, golan...@googlegroups.com
Yes, a three button mouse is required. Some laptops have three buttons, but you can emulate the third button my holding shift and clicking the second button. 

I've been using vi(m) exclusively for the last 15 odd years and have switched to acme the last three months. The mouse is less a hindrance than you might think because acme uses a mouse a little different than most traditional interfaces. I miss acme's mouse functions when using chrome or some other GUI application. 

The only perceived drawback I can think of is you can't use it in a terminal, so I sometimes miss the ability to use it when I'm mobile. 

All of this is highly subjective though. Use what works for you. I just happened to fall in love with acme. It's always good to try new things. 

--
Christopher M. Hobbs
--
 
 

Steve McCoy

unread,
Sep 22, 2012, 11:44:03 AM9/22/12
to golan...@googlegroups.com
On OSX, Option+Click simulates button 2. It makes chording impossible, but it gets the job done most of the time. Although if you hate the concept of mice more than actual mice, you won't like acme. That said, you may think you know mice, but acme will show you new possibilities, so give it a try if you're curious.

Peter S

unread,
Sep 22, 2012, 11:58:07 AM9/22/12
to Steve McCoy, golan...@googlegroups.com
(Forgot to include the group the first time.)

Chording is reported to be working on Mac: see the comments by rsc at http://research.swtch.com/acme .

And of course anyone who is interested in Acme should watch the video on the page.

Here is the relevant comment: "On a 1-button Mac laptop, option-click is button 2 and command-click is button 3. I had to experiment to write that sentence: my fingers know what to do and I don't even think about it anymore. Chording works too: or example, copy is hold down mouse button, highlight, type option, type command, let go of mouse button. But we made option-X,C,V work a while back and they're certainly more convenient in that environment."

Peter

--
 
 

Aram Hăvărneanu

unread,
Sep 22, 2012, 12:06:37 PM9/22/12
to nate...@gmail.com, golan...@googlegroups.com, Christopher Hobbs, jes...@jessta.id.au
> So that screen shot is of acme running in windows? It isn't acme-sac though
> is it?

It's p9p acme running on a Linux machine, viewed through ssh X forwarding.

--
Aram Hăvărneanu

Steve McCoy

unread,
Sep 22, 2012, 12:11:11 PM9/22/12
to golan...@googlegroups.com, Steve McCoy
True, but I'm not dexterous enough for that :)

dane

unread,
Sep 22, 2012, 12:22:16 PM9/22/12
to golan...@googlegroups.com
Well I am kind of curious, but it seems inconvenient that it is impossible to use the system without a mouse. Sometimes I sit on the couch and code stuff, and I guess using the trackpad is not really an option.

roger peppe

unread,
Sep 22, 2012, 4:36:59 PM9/22/12
to dane, golan...@googlegroups.com
Lenovo Thinkpad machines work well for acme - they have three buttons
and a trackpoint "nipple". I use the trackpad for two finger scrolling
if the mouse pointer's not near a scroll bar.
> --
>
>

Russ Cox

unread,
Sep 24, 2012, 12:01:53 AM9/24/12
to dane, golan...@googlegroups.com
On Sat, Sep 22, 2012 at 12:22 PM, dane <david.n...@gmail.com> wrote:
> Well I am kind of curious, but it seems inconvenient that it is impossible
> to use the system without a mouse. Sometimes I sit on the couch and code
> stuff, and I guess using the trackpad is not really an option.

It works fine. I use a MacBook Air trackpad and a Thinkpad X201
trackpad and they're both fine. On the Mac it takes a day or two to
get used to the use of option and command clicking on the Mac and then
it's completely automatic. On the Thinkpad there actually are three
buttons.

Russ
Reply all
Reply to author
Forward
0 new messages