Documentation
¶
Overview ¶
Package memory is what nem remembers from one session to the next: what was typed at each kind of prompt, the files opened most recently, and where point was in each file when it was left.
It is one small JSON file in the state directory, beside the backups. Saving merges with what is on disk rather than overwriting it, so two nem windows open at once add to one history instead of each erasing the other's.
Index ¶
Constants ¶
const FileName = "memory.json"
FileName is the memory's file, in the state directory.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Memory ¶
type Memory struct {
History map[string][]string `json:"history"`
Recent []string `json:"recent"`
Places map[string]Place `json:"places"`
// contains filtered or unexported fields
}
Memory is the remembered state. The zero value is empty and does not persist; Load gives one that does.
func Load ¶
Load reads the memory kept in dir, or starts an empty one there if there is none yet. A file that cannot be parsed is set aside rather than trusted or deleted: losing a history is a nuisance, but it is not worth an error that stops the editor starting.
func (*Memory) AddHistory ¶
AddHistory records s as the most recent entry at prompts of this kind.
func (*Memory) HistoryOf ¶
HistoryOf is what has been entered at prompts of this kind, most recent first.
type Place ¶
type Place struct {
Line int `json:"line"`
Col int `json:"col"`
Top int `json:"top"`
// Used is when the place was recorded, in Unix seconds: the most recent
// wins a merge, and the oldest go first when there are too many.
Used int64 `json:"used"`
}
Place is where point was in a file, and the first line on screen.