π€: Symbol has exported from EDITOR
package;
β: Definition is not contained in Editor source code;
Move the POINT
1 character before / after. Like a shorthand of character-offset
N=1 or -1 but slightly faster.
Move the POINT
to the COLUMN
of its current regular line.
Move the POINT
to the OFFSET
position of current buffer. Similar with (setf point-position)
, but must be called with the buffer locked.
Search character CHAR before / after the POINT. Return non-NIL and move the POINT to the position of that character if found, return NIL otherwise.
The value succesfully returned is a POINT, but it probably is not the same point with POINT and can be invalid, so do not use it.
Giving X position in pixels, Y in line-number, relative with WINDOW
, return a nearest point of the position. If POINT
is a valid editor point, move the POINT
to that position instead of return a new point.
Must be called with both window and buffer locked. See Locking Window.
Return 5 values: The horizontal character offset and vertical character offset of the POINT
, relative with the visible area of WINDOW
; The character at that point; The editor face at that point; The position of that point at its buffer (= how many characters before it).
Return the horizontal and vertical position of POINT
in pixels, relative with the visible area of WINDOW
, as 2 values.
Some source are inside searchcom.lisp
of the Editor source code.
Use get-search-pattern
(or new-search-pattern
) and find-pattern
to search through buffer programmatically.
Make a new search-pattern
using STRING and DIRECTION. DIRECTION can be :forward
, :forward-regexp
, :backward
, :backward-regexp
. If DIRECTION is :forward-regexp
or :backward-regexp
, treat STRING as a LW regular expression and search with the expression. If DIRECTION is not indicate a RegEXP, search string in the way specified by default-search-kind
Editor variable (:string-insensitive
by default).
Calling new-search-pattern
under the hood.
Return a newly constructed search-pattern
.
KIND can be one of :string-sensitive
, :string-insensitive
and :string-regexp
;
DIRECTION can be one of :forward
and :backward
;
PATTERN can be a string.
Find the SEARCH-PATTERN 1 time, starting at POINT. LIMIT should be a point if provided.
If success, POINT will be moved to the beginning (lower position, no matter which direction) of the match, and return the length of the match (a number). Unless NIL and the POINT will not be moved.
Find regex pattern starting at POINT.
PATTERN must be a LW precompiled regular-expression
TEXT-END should be a point, indicating the search limit.
This function must be called inside a lock. It can be more efficient than find-pattern
if you're reusing the precompiled regex.
The two functions use the same function to handle Regex search under the hood:
find-regexp-pattern-from-line
and underlyingsearch-for-regexp
.*search-pattern-experts*
seems contain handlers forfind-pattern
.
It seems that only 2 functions for window locking are reserved:
Lock WINDOW
and call FUNC
. FUNC
is called with one argument that's the WINDOW
itself.
Lock WINDOW
, and lock BUFFER
as for modification, then call FUNCTION
with ARG
. The FUNCTION
will receive 3 arguments: WINDOW
, BUFFER
and ARG
.
The text property of the buffer are constructed by a continuous sequence of text-property-region
s, splitted by text-property-point
. See the notes at the head of text-properties.lisp
of the Editor source code.
The text-property content is a plist that can hold any keys and values. the 'editor::face
property is used to implement face facility of LW Editor.
They're same with Emacs's corresponding functions. Notes that all points are editor:point
.
If modification
is non-NIL, the change (of-course include the change of text properties) of the function made will be recorded into buffer's undo history using record-text-property-undo
.
When modifying the value of a property using functions like
put-text-property
andalter-text-property
, make sure you are giving them a fresh-new object, but not the original object modified, e.g. modified list usingnconc
ordelete
.That's because these functions will merge the
text-property-region
s automatically, by comparing if two value objects are same using EQ (inside thesame-properties-p
function). Thus if you give a original object modified, the region of your modification may expand to its neighbours.
(remove-text-properties start end properties :modification t)
(put-text-property start end property value :modification t)
(merge-text-property-list start end 'editor::face value)
Functions related with text-property-region
.
See text-properties.lisp
of Editor source code for more details.
Retrieve the underlying text-property-region-plist
of a region.
This is the only function to retrieve text-property-region-plist
, since LW has shaked its accessor. To set the plist, use the interface functions above.
Same with region-text-property
, but take the *default-text-properties*
count as the default-default.
Giving editor:point
s START and END, Return a text-property-region
starting at START and ending at or before END. Second value indicates if it exactly ends at END. The third values can be :before
, :after
or :both
, indicating whether the region has been chopped at its two sides.
If START is inside a text-property-region
, the region will be chopped to be started at START; If the region is longer than END, chop the region to make it end at END;
If the region is shorter than END, return the early-ended region with second value NIL
.
Just like Emacs's buffer-string.
Make a buffer string. Properties is a list of (start end plist)
representing the text-property-region
relative with the %string
(constructed by bounded-text-properties-in
function).
Example:
(editor::make-buffer-string
:%string "test"
:properties `((0 4 (editor:face ,editor::*highlight-face*))))
Insert buffer-string to POINT
.
Retrieve a buffer-string between START and END. Same with Emacs's buffer-substring
.
Must be called inside buffer or START point locked.
Concatenate two buffer-strings.
Much performant than Emacs's overlay, although lacking (= need hacking) for some functions.
They're basically same with Emacs's corresponding functions.
copy-point
, and the copied points will be used as start & end of the overlay. START-KIND & END-KIND can be one of :before-insert
, :after-insert
or :temporary
(default), specifying the kind of new points. They have same functionality with FRONT-ADVANCE
& REAR-ADVANCE
options of Emacs's make-overlay
, with :after-insert
behaves like advance, :before-insert
behaves like not-advance.overlay
object slotsProperties can be put into overlays using overlay-put
, and retrieved using overlay-get
.
All Property Names Are Symbols Inside the EDITOR Package (May Not Exported).
editor:window
, the visual effect of the overlay will only be shown on that window.virtural-string
shown at the start or end of the overlay. The value can be:virtural-string
object created by make-virtual-string
generate-virtual-string-from-vector
generate-virtual-string-from-vector
or virtual-string-append-string
.searchcoms.lisp
and definition-folding.lisp
for details and example.(Probably most of) Global hooks are defined with docstrings inside the init-editor.lisp
of the Editor source code. All of them are worked. Use add-global-hook
to add hook object. Hook object can be a function or fbounded symbol. Symbol is recommended as it's easy to be removed using remove-global-hook
.
Buffer-local hooks:
set-buffer-after-change-hook
with ADD parameter non-NIL or NIL to add or remove.(buffer change-start-offset old-offset new-offset)
. offsets are numbers representing positions inside buffer.add-to-buffer-before-command-hooks
& remove-from-buffer-before-command-hooks
to add or removed. Hook added using add-temporary-to-buffer-before-command-hooks
will only be triggered once, then it will be removed.(buffer command-function command-args)
.