XXIIVV
Custom Acme picture
20P04 — Custom Acme

Notes on the Plan9 ACME development toolkit.

Acme is the classic text editor for the Plan9 operating system. The killer feature of Acme is how it integrates into surrounding system. Acme is not trying to be a complete environment by itself. Acme acts as a glue which links together other programs and tools. With Acme the OS becomes your IDE.

Middle clicking on a word or some selected text *executes* that command. Right-clicking on a file can potentially open up a new window, depending on which program is registered to handle the file type. You can close windows by right-clicking on an empty spot on the desktop, choose Delete and then right click on the window.

acme links

Newcolcreate a new column of windows
Delcoldelete a column
Newcreate a new window (edit it’s tag to be a file name and you would be creating a new file; you would need to click on “Put” to put the file in the file system).
Putwrite the body to disk. The file is the one named in the tag.
Getrefresh the body (e.g. if it’s a directory, reread it and show it).
SnarfWhat other window systems call “Copy”.
PasteCan you guess it?
FontToggles between the monospace and default font
Exitexit acme

Clicking mouse3 on selected text can do various operations:

Acme Theme

My current theme for acme can be installed by modifying the /sys/src/cmd/acme/acme.c file and adding the following lines in the iconinit function:

void
iconinit(void)
{
  Rectangle r;
  Image *tmp;

  /* Blue */ 
  tagcols[BACK] = display->white;
  tagcols[HIGH] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x72DEC2FF);
  tagcols[BORD] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x72DEC2FF);
  tagcols[TEXT] = display->black;
  tagcols[HTEXT] = display->white;

  /* Yellow */
  textcols[BACK] = allocimagemix(display, DPaleyellow, DWhite);
  textcols[HIGH] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x72DEC2FF);
  /* Halftone */
  textcols[BORD] = allocimage(display, Rect(0,0,2,2), CMAP8, 1, 0x000000FF);
  draw(textcols[BORD], Rect(1,1,2,2), display->white, nil, ZP);
  draw(textcols[BORD], Rect(0,0,1,1), display->white, nil, ZP);
  textcols[TEXT] = display->black;
  textcols[HTEXT] = display->black;

  if(button){
    freeimage(button);
    freeimage(modbutton);
    freeimage(colbutton);
  }
  /* Button */
  r = Rect(0, 0, Scrollwid, font->height+1);
  button = allocimage(display, r, screen->chan, 0, DNofill);
  draw(button, r, tagcols[BORD], nil, r.min);
  r.max.x -= 4;
  fillellipse(button, (Point){r.min.x + 5, r.min.y + 7}, 3, 3, display->white, ZP);
  /* Mod Button */
  r = button->r;
  modbutton = allocimage(display, r, screen->chan, 0, DNofill);
  draw(modbutton, r, tagcols[BORD], nil, r.min);
  r = insetrect(r, 2);
  fillellipse(modbutton, (Point){r.min.x + 3, r.min.y + 5}, 3, 3, display->black, ZP);
  r = button->r;
  colbutton = allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x72DEC2FF);
  but2col = allocimage(display, r, screen->chan, 1, 0x000000FF);
  but3col = allocimage(display, r, screen->chan, 1, 0x72DEC2FF);
}

I don't like that the scrollbar touches the side of the window, to fix that, you can modify the textscrdraw function in the /sys/src/cmd/acme/scrl.c file, and change the following lines:

if(!eqrect(r2, t->lastsr)){
  t->lastsr = r2;
  draw(b, r1, t->cols[BORD], nil, ZP);
  r2.max.x = r2.max.x+1;
  draw(b, r2, t->cols[TEXT], nil, ZP);
  r2.min.x = r2.max.x-1;
  draw(b, r2, t->cols[BORD], nil, ZP);
  draw(t->b, r, b, nil, Pt(0, r1.min.y));
}

Current fonts

Default/lucidasans/euro.8.font
Fixed/fixed/unicode.8x13B.font
— Submit an edit to acme.htm(92 lines)

incoming(2): usagi plan9