ze
Loading...
Searching...
No Matches
Files | Functions
Collaboration diagram for Plugins:

Files

file  plugins.c
 Guile/Scheme plugin and keybinding implementation.
 

Functions

void initKeyBindings (void)
 Initialize the in-memory key binding table.
 
void loadPlugins (void)
 Load Scheme plugins from "$HOME/.ze/plugins" (all .scm files).
 
SCM scmBindKey (SCM keySpec, SCM proc)
 Bind a key specification to a Scheme procedure.
 
int pluginsHandleKey (unsigned char code)
 If a Scheme binding exists for the key, invoke it.
 
void editorExec (void)
 Prompt for and evaluate a single Scheme expression (mini-REPL).
 
SCM scmBufferToString (void)
 Return the entire buffer as a Scheme string.
 
SCM scmBufferLineCount (void)
 Get the number of lines in the current buffer.
 
SCM scmGetLine (SCM idx_scm)
 Get the contents of a line by index.
 
SCM scmSetLine (SCM idx_scm, SCM str_scm)
 Replace the contents of a line.
 
SCM scmInsertLine (SCM idx_scm, SCM str_scm)
 Insert a new line at index.
 
SCM scmAppendLine (SCM str_scm)
 Append a new line at the end of the buffer.
 
SCM scmDeleteLine (SCM idx_scm)
 Delete a line by index.
 
SCM scmInsertText (SCM str_scm)
 Insert text at the cursor position, interpreting newlines.
 
SCM scmInsertChar (SCM ch_scm)
 Insert a single character at the cursor.
 
SCM scmInsertNewline (void)
 Insert a newline at the cursor position.
 
SCM scmDeleteChar (void)
 Delete the character to the left of the cursor (backspace).
 
SCM scmGetCursor (void)
 Get current cursor position.
 
SCM scmSetCursor (SCM x_scm, SCM y_scm)
 Set cursor position, clamped to the current buffer.
 
SCM scmMoveCursor (SCM dir_scm)
 Move the cursor in a direction.
 
SCM scmScreenSize (void)
 Get the editor screen size in rows and columns.
 
SCM scmOpenFile (SCM path_scm)
 Open a file into the editor.
 
SCM scmSaveFile (void)
 Save the current buffer to disk.
 
SCM scmGetFilename (void)
 Get the current filename, if any.
 
SCM scmSetFilename (SCM path_scm)
 Set the current filename and reselect syntax highlighting.
 
SCM scmPrompt (SCM msg_scm)
 Prompt the user and return their input.
 
SCM scmRefreshScreen (void)
 Force a screen refresh.
 
SCM scmSearchForward (SCM query_scm)
 Search forward for a substring and jump to the next match.
 
SCM scmSelectSyntaxForFilename (SCM path_scm)
 Select syntax based on a filename, without opening the file.
 
SCM scmGetFiletype (void)
 Get the current filetype name from syntax highlighting.
 
SCM scmUnbindKey (SCM keySpec)
 Remove a key binding.
 
SCM scmListBindings (void)
 List all key bindings.
 
SCM scmBufferDirty (void)
 Check whether the current buffer has unsaved changes.
 
SCM scmSetBufferDirty (SCM bool_scm)
 Mark the current buffer dirty/clean.
 
SCM scmCloneTemplate (void)
 Clone a template into the current buffer (interactive selection).
 
SCM pluginsGetHook (const char *name)
 Fetch a registered hook by name.
 

Detailed Description

Function Documentation

◆ editorExec()

void editorExec ( void  )

Prompt for and evaluate a single Scheme expression (mini-REPL).

◆ initKeyBindings()

void initKeyBindings ( void  )

Initialize the in-memory key binding table.

◆ loadPlugins()

void loadPlugins ( void  )

Load Scheme plugins from "$HOME/.ze/plugins" (all .scm files).

◆ pluginsGetHook()

SCM pluginsGetHook ( const char *  name)

Fetch a registered hook by name.

Recognized names: "preDirOpenHook", "postDirOpenHook", "preFileOpenHook", "postFileOpenHook", "preSaveHook", "postSaveHook".

Parameters
nameC string name of the hook.
Returns
Scheme object for the hook or SCM_BOOL_F if unset/unknown.

◆ pluginsHandleKey()

int pluginsHandleKey ( unsigned char  code)

If a Scheme binding exists for the key, invoke it.

Parameters
codeKey code.
Returns
1 if a binding was invoked, 0 otherwise.

◆ scmAppendLine()

SCM scmAppendLine ( SCM  str_scm)

Append a new line at the end of the buffer.

Note
Scheme procedure: append-line! text
Parameters
str_scmScheme string new line text.
Returns
SCM_BOOL_T.

◆ scmBindKey()

SCM scmBindKey ( SCM  keySpec,
SCM  proc 
)

Bind a key specification to a Scheme procedure.

Note
Scheme procedure: bind-key key-spec proc
Parameters
keySpecScheme string like "C-x", "C-s", or "a".
procScheme procedure to call when the key is pressed.
Returns
SCM_BOOL_T on success, SCM_BOOL_F on failure.

◆ scmBufferDirty()

SCM scmBufferDirty ( void  )

Check whether the current buffer has unsaved changes.

Note
Scheme procedure: buffer-dirty?
Returns
Scheme boolean.

◆ scmBufferLineCount()

SCM scmBufferLineCount ( void  )

Get the number of lines in the current buffer.

Note
Scheme procedure: buffer-line-count
Returns
Scheme integer line count.

◆ scmBufferToString()

SCM scmBufferToString ( void  )

Return the entire buffer as a Scheme string.

Note
Scheme procedure: buffer->string
Returns
Scheme string containing the full buffer contents.

◆ scmCloneTemplate()

SCM scmCloneTemplate ( void  )

Clone a template into the current buffer (interactive selection).

Note
Scheme procedure: clone-template!
Returns
SCM_BOOL_T.

◆ scmDeleteChar()

SCM scmDeleteChar ( void  )

Delete the character to the left of the cursor (backspace).

Note
Scheme procedure: delete-char!
Returns
SCM_BOOL_T.

◆ scmDeleteLine()

SCM scmDeleteLine ( SCM  idx_scm)

Delete a line by index.

Note
Scheme procedure: delete-line! idx
Parameters
idx_scmScheme integer line index (0-based).
Returns
SCM_BOOL_T on success, SCM_BOOL_F if out of range.

◆ scmGetCursor()

SCM scmGetCursor ( void  )

Get current cursor position.

Note
Scheme procedure: get-cursor
Returns
Scheme pair (x . y) in editor column/line coordinates.

◆ scmGetFilename()

SCM scmGetFilename ( void  )

Get the current filename, if any.

Note
Scheme procedure: get-filename
Returns
Scheme string filename, or SCM_BOOL_F if unnamed.

◆ scmGetFiletype()

SCM scmGetFiletype ( void  )

Get the current filetype name from syntax highlighting.

Note
Scheme procedure: get-filetype
Returns
Scheme string filetype, or SCM_BOOL_F if none.

◆ scmGetLine()

SCM scmGetLine ( SCM  idx_scm)

Get the contents of a line by index.

Note
Scheme procedure: get-line idx
Parameters
idx_scmScheme integer line index (0-based).
Returns
Scheme string for the line, or SCM_BOOL_F if out of range.

◆ scmInsertChar()

SCM scmInsertChar ( SCM  ch_scm)

Insert a single character at the cursor.

Note
Scheme procedure: insert-char! ch
Parameters
ch_scmEither a Scheme integer char code or a one-char string.
Returns
SCM_BOOL_T.

◆ scmInsertLine()

SCM scmInsertLine ( SCM  idx_scm,
SCM  str_scm 
)

Insert a new line at index.

Note
Scheme procedure: insert-line! idx text
Parameters
idx_scmScheme integer index (clamped to [0, line-count]).
str_scmScheme string new line text (without trailing newline).
Returns
SCM_BOOL_T.

◆ scmInsertNewline()

SCM scmInsertNewline ( void  )

Insert a newline at the cursor position.

Note
Scheme procedure: insert-newline!
Returns
SCM_BOOL_T.

◆ scmInsertText()

SCM scmInsertText ( SCM  str_scm)

Insert text at the cursor position, interpreting newlines.

Note
Scheme procedure: insert-text! text
Parameters
str_scmScheme string text (may contain newlines).
Returns
SCM_BOOL_T.

◆ scmListBindings()

SCM scmListBindings ( void  )

List all key bindings.

Note
Scheme procedure: list-bindings
Returns
Scheme list of pairs (key . procedure).

◆ scmMoveCursor()

SCM scmMoveCursor ( SCM  dir_scm)

Move the cursor in a direction.

Note
Scheme procedure: move-cursor! dir
Parameters
dir_scmScheme string: "left", "right", "up", or "down".
Returns
SCM_BOOL_T.

◆ scmOpenFile()

SCM scmOpenFile ( SCM  path_scm)

Open a file into the editor.

Note
Scheme procedure: open-file! path
Parameters
path_scmScheme string path.
Returns
SCM_BOOL_T.

◆ scmPrompt()

SCM scmPrompt ( SCM  msg_scm)

Prompt the user and return their input.

Note
Scheme procedure: prompt message
Parameters
msg_scmScheme string prompt message (printf-style not supported).
Returns
Scheme string response, or SCM_BOOL_F on cancel.

◆ scmRefreshScreen()

SCM scmRefreshScreen ( void  )

Force a screen refresh.

Note
Scheme procedure: refresh-screen!
Returns
SCM_BOOL_T.

◆ scmSaveFile()

SCM scmSaveFile ( void  )

Save the current buffer to disk.

Note
Scheme procedure: save-file!
Returns
SCM_BOOL_T.

◆ scmScreenSize()

SCM scmScreenSize ( void  )

Get the editor screen size in rows and columns.

Note
Scheme procedure: screen-size
Returns
Scheme pair (rows . cols).

◆ scmSearchForward()

SCM scmSearchForward ( SCM  query_scm)

Search forward for a substring and jump to the next match.

Note
Scheme procedure: search-forward! query
Parameters
query_scmScheme string to search for.
Returns
Pair (y . x) of the match position, or SCM_BOOL_F if not found.

◆ scmSelectSyntaxForFilename()

SCM scmSelectSyntaxForFilename ( SCM  path_scm)

Select syntax based on a filename, without opening the file.

Note
Scheme procedure: select-syntax-for-filename! path
Parameters
path_scmScheme string path whose extension drives syntax.
Returns
SCM_BOOL_T.

◆ scmSetBufferDirty()

SCM scmSetBufferDirty ( SCM  bool_scm)

Mark the current buffer dirty/clean.

Note
Scheme procedure: set-buffer-dirty! bool
Parameters
bool_scmScheme boolean.
Returns
SCM_BOOL_T.

◆ scmSetCursor()

SCM scmSetCursor ( SCM  x_scm,
SCM  y_scm 
)

Set cursor position, clamped to the current buffer.

Note
Scheme procedure: set-cursor! x y
Parameters
x_scmScheme integer column.
y_scmScheme integer line.
Returns
SCM_BOOL_T.

◆ scmSetFilename()

SCM scmSetFilename ( SCM  path_scm)

Set the current filename and reselect syntax highlighting.

Note
Scheme procedure: set-filename! path
Parameters
path_scmScheme string path.
Returns
SCM_BOOL_T.

◆ scmSetLine()

SCM scmSetLine ( SCM  idx_scm,
SCM  str_scm 
)

Replace the contents of a line.

Note
Scheme procedure: set-line! idx text
Parameters
idx_scmScheme integer line index (0-based).
str_scmScheme string new contents.
Returns
SCM_BOOL_T on success, SCM_BOOL_F if index is out of range.

◆ scmUnbindKey()

SCM scmUnbindKey ( SCM  keySpec)

Remove a key binding.

Note
Scheme procedure: unbind-key key-spec
Parameters
keySpecScheme string key specification (e.g., "C-x", "a").
Returns
SCM_BOOL_T.