acme

package
v0.0.0-...-fafada5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2018 License: BSD-3-Clause, GooglePatentClause Imports: 10 Imported by: 0

Documentation

Overview

Package acme is a simple interface for interacting with acme windows.

Many of the functions in this package take a format string and optional parameters. In the documentation, the notation format, ... denotes the result of formatting the string and arguments using fmt.Sprintf.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteAll

func DeleteAll()

DeleteAll deletes all windows.

Types

type Event

type Event struct {
	// The two event characters, indicating origin and type of action
	C1, C2 rune

	// The character addresses of the action.
	// If the original event had an empty selection (OrigQ0=OrigQ1)
	// and was accompanied by an expansion (the 2 bit is set in Flag),
	// then Q0 and Q1 will indicate the expansion rather than the
	// original event.
	Q0, Q1 int

	// The Q0 and Q1 of the original event, even if it was expanded.
	// If there was no expansion, OrigQ0=Q0 and OrigQ1=Q1.
	OrigQ0, OrigQ1 int

	// The flag bits.
	Flag int

	// The number of bytes in the optional text.
	Nb int

	// The number of characters (UTF-8 sequences) in the optional text.
	Nr int

	// The optional text itself, encoded in UTF-8.
	Text []byte

	// The chorded argument, if present (the 8 bit is set in the flag).
	Arg []byte

	// The chorded location, if present (the 8 bit is set in the flag).
	Loc []byte
}

An Event represents an event originating in a particular window. The fields correspond to the fields in acme's event messages. See http://swtch.com/plan9port/man/man4/acme.html for details.

type LogEvent

type LogEvent struct {
	ID   int
	Op   string
	Name string
}

A LogEvent is a single event in the acme log file.

type LogReader

type LogReader struct {
	// contains filtered or unexported fields
}

A LogReader provides read access to the acme log file.

func Log

func Log() (*LogReader, error)

Log returns a reader reading the acme/log file.

func (*LogReader) Close

func (r *LogReader) Close() error

func (*LogReader) Read

func (r *LogReader) Read() (LogEvent, error)

Read reads an event from the acme log file.

type Win

type Win struct {
	// contains filtered or unexported fields
}

A Win represents a single acme window and its control files.

func New

func New() (*Win, error)

New creates a new window.

func Open

func Open(id int, ctl *client.Fid) (*Win, error)

Open connects to the existing window with the given id. If ctl is non-nil, Open uses it as the window's control file and takes ownership of it.

func (*Win) Addr

func (w *Win) Addr(format string, args ...interface{}) error

Addr writes format, ... to the window's addr file.

func (*Win) CloseFiles

func (w *Win) CloseFiles()

CloseFiles closes all the open files associated with the window w. (These file descriptors are cached across calls to Ctl, etc.)

func (*Win) Ctl

func (w *Win) Ctl(format string, args ...interface{}) error

Ctl writes the command format, ... to the window's ctl file.

func (*Win) Del

func (w *Win) Del(sure bool) error

Winctl deletes the window, writing `del' (or, if sure is true, `delete') to the ctl file.

func (*Win) EventChan

func (w *Win) EventChan() <-chan *Event

EventChan returns a channel on which events can be read. The first call to EventChan allocates a channel and starts a new goroutine that loops calling ReadEvent and sending the result into the channel. Subsequent calls return the same channel. Clients should not call ReadEvent after calling EventChan.

func (*Win) Fprintf

func (w *Win) Fprintf(file, format string, args ...interface{}) error

func (*Win) Name

func (w *Win) Name(format string, args ...interface{}) error

func (*Win) OpenEvent

func (w *Win) OpenEvent() error

func (*Win) Read

func (w *Win) Read(file string, b []byte) (n int, err error)

func (*Win) ReadAddr

func (w *Win) ReadAddr() (q0, q1 int, err error)

func (*Win) ReadAll

func (w *Win) ReadAll(file string) ([]byte, error)

ReadAll

func (*Win) ReadEvent

func (w *Win) ReadEvent() (e *Event, err error)

ReadEvent reads the next event from the window's event file.

func (*Win) Seek

func (w *Win) Seek(file string, offset int64, whence int) (int64, error)

func (*Win) Write

func (w *Win) Write(file string, b []byte) (n int, err error)

func (*Win) WriteEvent

func (w *Win) WriteEvent(e *Event) error

WriteEvent writes an event back to the window's event file, indicating to acme that the event should be handled internally.

type WinInfo

type WinInfo struct {
	ID   int
	Name string
}

func Windows

func Windows() ([]WinInfo, error)

Windows returns a list of the existing acme windows.

Directories

Path Synopsis
Watch runs a command each time files in the current directory change.
Watch runs a command each time files in the current directory change.
Acmego watches acme for .go files being written.
Acmego watches acme for .go files being written.
Editinacme can be used as $EDITOR in a Unix environment.
Editinacme can be used as $EDITOR in a Unix environment.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL