gnu.jemacs.buffer

Class Buffer

Implemented Interfaces:
CharSeq, CharSequence, java.util.List, Consumable, Sequence
Known Direct Subclasses:
SwingBuffer, SwtBuffer

public abstract class Buffer
extends AbstractSequence
implements CharSeq

Field Summary

EKeymap[]
activeKeymaps
static java.util.Hashtable
buffers
Map buffer names to buffers.
static java.util.Hashtable
fileBuffers
Map file names to buffer.s
Marker
markMarker
Marker
pointMarker

Fields inherited from interface gnu.lists.Sequence

ATTRIBUTE_VALUE, BOOLEAN_VALUE, CDATA_VALUE, CHAR_VALUE, COMMENT_VALUE, DOCUMENT_VALUE, DOUBLE_VALUE, EOF_VALUE, FLOAT_VALUE, GROUP_VALUE, INT_S16_VALUE, INT_S32_VALUE, INT_S64_VALUE, INT_S8_VALUE, INT_U16_VALUE, INT_U32_VALUE, INT_U64_VALUE, INT_U8_VALUE, OBJECT_VALUE, PRIM_VALUE, PROCESSING_INSTRUCTION_VALUE, TEXT_BYTE_VALUE, eofValue

Constructor Summary

Buffer(String name)

Method Summary

void
backwardChar(int i)
char
charAt(int index)
int
charWidth(char ch, int column)
int
checkMark()
static Buffer
coerceBuffer(Object buf)
void
consume(int start, int count, Consumer out)
int
countColumns(char[] chars, int start, int count, int initial)
int
currentColumn()
int
currentColumn(int offset)
Return the column number at a specified offset.
EWindow
display(boolean notThisWindow, EFrame frame)
void
fill(char value)
void
fill(int fromIndex, int toIndex, char value)
static Buffer
findFile(String fname)
void
forwardChar(int i)
int
forwardLine(int lines)
long
forwardLine(int lines, int start)
Find the position a give number of lines forward or backward.
static String
generateNewBufferName(String start)
static Buffer
getBuffer(String name)
void
getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
static Buffer
getCurrent()
int
getDot()
String
getFileName()
abstract int
getLength()
EKeymap
getLocalKeymap()
Marker
getMarkMarker(boolean force)
String
getName()
int
getPoint()
Marker
getPointMarker(boolean share)
abstract CharSeq
getStringContent()
void
insert(Object value, Object style)
void
insert(String string, Object style)
abstract void
insert(String string, Object style, int ipos)
Insert string with given style at position pair.
void
insert(char ch, int count)
Insert count copies of ch at point.
void
insert(char ch, int count, Object style)
Insert count copies of ch at point.
void
insert(char[] chars, int offset, int count, Object style, int ipos)
Insert character with given style at position pair.
void
insertAll(Object[] values, Object style)
abstract void
insertFile(Reader in)
void
insertFile(String filename)
abstract void
invoke(Runnable doRun)
This is intended for Runnable's that may affect the state of the buffer.
int
length()
Get length of string, in characters.
int
lineStartOffset()
abstract int
lineStartOffset(int offset)
static void
makeBufferLocal(Object symbol, boolean all)
abstract int
maxDot()
int
minDot()
int
moveToColumn(int column, boolean force)
abstract InPort
openReader(int start, int count)
int
positionToOffset(Object position)
Convert an Emacs position (Marker, or 1-origin integer) to a (0-origin) buffer offset.
abstract void
redrawModeline()
abstract void
removeAll()
void
removeChar(int count)
abstract void
restorePointMark(long pointMark)
void
save()
abstract void
save(Writer out)
abstract long
savePointMark()
abstract long
scan(char target, int start, int end, int count, boolean allowQuit)
Search in BUF for COUNT instances of the character TARGET between START and END.
void
setCharAt(int index, char ch)
static void
setCurrent(Buffer buffer)
void
setDot(int i)
void
setFileName(String fname)
void
setLocalKeymap(EKeymap map)
void
setPoint(int i)
CharSequence
subSequence(int start, int end)
String
toString()
void
writeTo(int start, int count, java.io.Writer dest)
void
writeTo(java.io.Writer str)

Methods inherited from class gnu.lists.AbstractSequence

add, add, addAll, addAll, addPos, append, baseUriOfPos, clear, compare, compare, compare, consume, consumeNext, consumePosRange, contains, containsAll, copyPos, createPos, createRelativePos, elements, endPos, equals, equals, fill, fill, fillPosRange, firstAttributePos, firstChildPos, fromEndIndex, get, get, getAttribute, getAttributeLength, getContainingSequenceSize, getEffectiveIndex, getIndexDifference, getIterator, getIterator, getIteratorAtPos, getLowBound, getNextKind, getNextTypeName, getNextTypeObject, getPosNext, getPosPrevious, getSize, gotoAttributesStart, gotoChildrenStart, gotoParent, hasNext, hasPrevious, hashCode, indexOf, isAfterPos, isEmpty, iterator, lastIndexOf, listIterator, listIterator, nextIndex, nextIndex, nextMatching, nextPos, parentPos, previousPos, rank, releasePos, remove, remove, removeAll, removePos, removePosRange, retainAll, set, set, setPosNext, setPosPrevious, size, stableCompare, startPos, subList, subSequence, subSequencePos, toArray, toArray, toString, toString, unsupported

Field Details

activeKeymaps

public EKeymap[] activeKeymaps

buffers

public static java.util.Hashtable buffers
Map buffer names to buffers.

fileBuffers

public static java.util.Hashtable fileBuffers
Map file names to buffer.s

markMarker

public Marker markMarker

pointMarker

public Marker pointMarker

Constructor Details

Buffer

public Buffer(String name)

Method Details

backwardChar

public void backwardChar(int i)

charAt

public char charAt(int index)
Specified by:
charAt in interface CharSeq

charWidth

public int charWidth(char ch,
                     int column)

checkMark

public int checkMark()

coerceBuffer

public static Buffer coerceBuffer(Object buf)

consume

public void consume(int start,
                    int count,
                    Consumer out)
Specified by:
consume in interface CharSeq

countColumns

public int countColumns(char[] chars,
                        int start,
                        int count,
                        int initial)

currentColumn

public int currentColumn()

currentColumn

public int currentColumn(int offset)
Return the column number at a specified offset.

display

public EWindow display(boolean notThisWindow,
                       EFrame frame)

fill

public void fill(char value)
Specified by:
fill in interface CharSeq

fill

public void fill(int fromIndex,
                 int toIndex,
                 char value)
Specified by:
fill in interface CharSeq

findFile

public static Buffer findFile(String fname)

forwardChar

public void forwardChar(int i)

forwardLine

public int forwardLine(int lines)

forwardLine

public final long forwardLine(int lines,
                              int start)
Find the position a give number of lines forward or backward. A side-effect-free version of Emacs's forward-line function.
Parameters:
lines - number of lines forward (or backward if negative)
start - initial position (buffer offset)
Returns:
(SHORTAGE<<32|POS)

generateNewBufferName

public static String generateNewBufferName(String start)

getBuffer

public static Buffer getBuffer(String name)

getChars

public void getChars(int srcBegin,
                     int srcEnd,
                     char[] dst,
                     int dstBegin)
Specified by:
getChars in interface CharSeq

getCurrent

public static Buffer getCurrent()

getDot

public int getDot()

getFileName

public String getFileName()

getLength

public abstract int getLength()

getLocalKeymap

public EKeymap getLocalKeymap()

getMarkMarker

public Marker getMarkMarker(boolean force)

getName

public String getName()

getPoint

public int getPoint()

getPointMarker

public Marker getPointMarker(boolean share)

getStringContent

public abstract CharSeq getStringContent()

insert

public void insert(Object value,
                   Object style)

insert

public void insert(String string,
                   Object style)

insert

public abstract void insert(String string,
                            Object style,
                            int ipos)
Insert string with given style at position pair.

insert

public void insert(char ch,
                   int count)
Insert count copies of ch at point.

insert

public void insert(char ch,
                   int count,
                   Object style)
Insert count copies of ch at point.

insert

public void insert(char[] chars,
                   int offset,
                   int count,
                   Object style,
                   int ipos)
Insert character with given style at position pair.

insertAll

public void insertAll(Object[] values,
                      Object style)

insertFile

public abstract void insertFile(Reader in)
            throws Exception

insertFile

public void insertFile(String filename)

invoke

public abstract void invoke(Runnable doRun)
This is intended for Runnable's that may affect the state of the buffer. The implementation should make shure that the GUI is properly updated before control returns
Parameters:
doRun -

length

public final int length()
Get length of string, in characters. Synonym for size(), for compatibility with String and StringBuffer.
Specified by:
length in interface CharSeq

lineStartOffset

public int lineStartOffset()

lineStartOffset

public abstract int lineStartOffset(int offset)

makeBufferLocal

public static void makeBufferLocal(Object symbol,
                                   boolean all)
Parameters:
all - true if make-variable-buffer-local, false if make-local-variable FIXME

maxDot

public abstract int maxDot()

minDot

public int minDot()

moveToColumn

public int moveToColumn(int column,
                        boolean force)

openReader

public abstract InPort openReader(int start,
                                  int count)

positionToOffset

public int positionToOffset(Object position)
Convert an Emacs position (Marker, or 1-origin integer) to a (0-origin) buffer offset.

redrawModeline

public abstract void redrawModeline()

removeAll

public abstract void removeAll()

removeChar

public void removeChar(int count)

restorePointMark

public abstract void restorePointMark(long pointMark)

save

public void save()

save

public abstract void save(Writer out)
            throws Exception

savePointMark

public abstract long savePointMark()

scan

public abstract long scan(char target,
                          int start,
                          int end,
                          int count,
                          boolean allowQuit)
Search in BUF for COUNT instances of the character TARGET between START and END. If COUNT is positive, search forwards; END must be >= START. If COUNT is negative, search backwards for the -COUNTth instance; END must be <= START. If COUNT is zero, do anything you please; run rogue, for all I care. If END is zero, use beginning or end of (FIXME: accessible part of) the buffer, as appropriate for the direction indicated by COUNT. If we find COUNT instances, SHORTAGE is zero, and return the position after the COUNTth match. Note that for reverse motion this is not the same as the usual convention for Emacs motion commands. If we don't find COUNT instances before reaching END, set SHORTAGE to the number of TARGETs left unfound, and return (shortage<<32|END).
Returns:
(SHORTAGE<<32|POS)

setCharAt

public void setCharAt(int index,
                      char ch)
Specified by:
setCharAt in interface CharSeq

setCurrent

public static void setCurrent(Buffer buffer)

setDot

public void setDot(int i)

setFileName

public void setFileName(String fname)

setLocalKeymap

public void setLocalKeymap(EKeymap map)

setPoint

public final void setPoint(int i)

subSequence

public CharSequence subSequence(int start,
                                int end)
Specified by:
subSequence in interface CharSeq

toString

public String toString()
Specified by:
toString in interface CharSeq
Overrides:
toString in interface AbstractSequence

writeTo

public void writeTo(int start,
                    int count,
                    java.io.Writer dest)
            throws java.io.IOException
Specified by:
writeTo in interface CharSeq

writeTo

public void writeTo(java.io.Writer str)
            throws java.io.IOException
Specified by:
writeTo in interface CharSeq