module Ed_sourceview: sig
.. end
The sourceview view, to edit any text file.
val get_att : string -> (string * string) list -> string option
get_att name pairs
return the value associated to the given name in the
given list of pairs, or None if no value is associated to the name.
val get_att_f : ?default:'a ->
(string -> 'a) -> string -> (string * string) list -> 'a option
default
: can be used to set a default value to return when no value
is associated to the given name.
val languages_manager : GSourceView.source_languages_manager
The language manager. It is the same as Gtksv_utils.languages_manager
,
to share preferences between all views using this languages manager.
val lang_of_filename : string -> GSourceView.source_language option
val utf8_of_filename : ?full:bool -> string -> string
Return an UTF-8 string from the given filename.
full
: can be used to get the complete filename true
instead of
the basename false
. Default is false
.
val location_of_string : string -> [> `Char of int | `Linechar of int * int ] option
Parse a location string. Can be of form n
to indicate character number n
,
or l,c
to indicate line l
, character c
.
val string_of_location : int * int -> string
Create a string to represent the given (line, character) location.
val location_of_iter : GText.iter -> int * int
Return the (line, character) position of the given GText.iter
.
val open_buffers_file : string Pervasives.ref
The name of the file where to load and store the list of open buffers.
val read_open_buffers_file : string -> (string * (string * string) list) list
val write_open_buffers_file : string ->
< attributes : (string * string) list; filename : string; .. > list -> unit
val buffer_name_history : string list Pervasives.ref
The history of buffers. First element is the most recently used.
The list contains the names of buffers.
val remove_buffer_from_history : string -> unit
val make_buffer_first_in_history : string -> unit
val pastable_history : Ed_minibuffer.minibuffer_history
An history of pastable text, uasble in a minibuffer.
class my_buffer : unit ->
object
.. end
Buffers
A buffer is a GSourceview.source_buffer
with some additional methods.
Modes
class type mode = object
.. end
class empty_mode :
mode
val register_mode : ?replace:bool -> mode -> unit
Register a mode.
Raises Failure
if a mode with the same name already exists.
replace
: can be used to indicate that if there is already
a mode with the same name, it should be replaced. Default is false
.
val get_mode : string -> mode
Get the mode with the given name.
Raises Not_found
if no such mode was registered.
val available_mode_names : unit -> string list
The list of registered modes.
Buffered files
Buffered files are buffered associated to a file.
class buffered_file : ?attributes:(string * string) list -> ?loc:int * int -> name:string -> filename:string -> my_buffer ->
object
.. end
Sourceview views
TODO: methods acting on buffer contents should be moved to
Ed_sourceview.buffered_file
or Ed_sourceview.my_buffer
classes.
class sourceview : ?attributes:(string * string) list -> Ed_view.topwin -> (< attributes : (string * string) list; backward_char : unit;
backward_line : unit; backward_word : unit; beginning_of_line : unit;
box : GObj.widget; buffer_modified : bool; buffer_name : string;
close : unit; connect_buffer_events : unit; copy : (unit -> unit) option;
current_line : int; cut : (unit -> unit) option;
cut_to_selection : ?concat:[ `APPEND | `PREPEND ] ->
start:GText.iter -> stop:GText.iter -> unit -> unit;
delete_char : bool -> unit; destroy : unit; display_buffer_name : unit;
display_encoding : unit; display_location : unit; display_mode : unit;
display_modified : unit; display_state : unit; display_stx_mode : unit;
do_save : unit; dup : Ed_view.topwin -> Ed_view.gui_view option;
end_of_line : unit; file : buffered_file; filename :
string; forward_char : unit; forward_line : unit; forward_word : unit;
goto_char : int -> unit; goto_line : int -> unit; grab_focus : unit;
has_focus : bool; insert : string -> unit;
key_bindings : (Okey.keyhit_state * string) list;
kill_line : append:bool -> unit;
kill_word : ?concat:[ `APPEND | `PREPEND ] -> bool -> unit; kind :
string; label : string; menus : (string * GToolbox.menu_entry list) list;
minibuffer : Ed_minibuffer.minibuffer; my_set_label : unit;
on_cursor_moved : unit; paste : (unit -> unit) option;
place_cursor : ?scroll:bool -> GText.iter -> unit; redo : unit;
reload : (unit -> unit) option; save : (unit -> unit) option;
save_as : (unit -> unit) option; set_encoding : string option -> unit;
set_file : ?focus_in:bool -> buffered_file -> unit;
set_label : string -> unit; set_location : int * int -> unit;
set_mode : mode option -> unit;
set_my_location : int * int -> unit;
set_on_destroy : (unit -> unit) -> unit;
set_on_focus_in : (unit -> unit) -> unit;
set_on_label_change : (string -> unit) -> unit;
set_scroll_on_change : unit;
set_syntax_mode : GSourceView.source_language -> unit;
set_wrap_mode : Gtk.Tags.wrap_mode -> unit;
source_buffer : my_buffer;
source_view : GSourceView.source_view;
switch_line_markers : ?v:bool -> unit -> unit;
switch_line_numbers : ?v:bool -> unit -> unit; transpose_chars : unit;
transpose_lines : unit; transpose_words : unit; undo : unit;
unset_scroll_on_change : unit; update_my_location : unit; .. > ->
unit) -> ((< attributes : (string * string) list; backward_char : unit;
backward_line : unit; backward_word : unit; beginning_of_line : unit;
box : GObj.widget; buffer_modified : bool; buffer_name : string;
close : unit; connect_buffer_events : unit; copy : (unit -> unit) option;
current_line : int; cut : (unit -> unit) option;
cut_to_selection : ?concat:[ `APPEND | `PREPEND ] ->
start:GText.iter -> stop:GText.iter -> unit -> unit;
delete_char : bool -> unit; destroy : unit; display_buffer_name :
unit; display_encoding : unit; display_location : unit;
display_mode : unit; display_modified : unit; display_state : unit;
display_stx_mode : unit; do_save : unit;
dup : Ed_view.topwin -> Ed_view.gui_view option; end_of_line : unit;
file : buffered_file; filename : string;
forward_char : unit; forward_line : unit; forward_word : unit;
goto_char : int -> unit; goto_line : int -> unit; grab_focus : unit;
has_focus : bool; insert : string -> unit;
key_bindings : (Okey.keyhit_state * string) list;
kill_line : append:bool -> unit;
kill_word : ?concat:[ `APPEND | `PREPEND ] -> bool -> unit; kind :
string; label : string; menus : (string * GToolbox.menu_entry list) list;
minibuffer : Ed_minibuffer.minibuffer; my_set_label : unit;
on_cursor_moved : unit; paste : (unit -> unit) option;
place_cursor : ?scroll:bool -> GText.iter -> unit; redo : unit;
reload : (unit -> unit) option; save : (unit -> unit) option;
save_as : (unit -> unit) option; set_encoding : string option -> unit;
set_file : ?focus_in:bool -> buffered_file -> unit;
set_label : string -> unit; set_location : int * int -> unit;
set_mode : mode option -> unit;
set_my_location : int * int -> unit;
set_on_destroy : (unit -> unit) -> unit;
set_on_focus_in : (unit -> unit) -> unit;
set_on_label_change : (string -> unit) -> unit;
set_scroll_on_change : unit;
set_syntax_mode : GSourceView.source_language -> unit;
set_wrap_mode : Gtk.Tags.wrap_mode -> unit;
source_buffer : my_buffer;
source_view : GSourceView.source_view;
switch_line_markers : ?v:bool -> unit -> unit;
switch_line_numbers : ?v:bool -> unit -> unit; transpose_chars : unit;
transpose_lines : unit; transpose_words : unit; undo : unit;
unset_scroll_on_change : unit; update_my_location : unit; .. >
as 'a) ->
'b) -> (buffered_file -> Ed_view.topwin -> Ed_view.gui_view) -> (string -> string -> unit) -> buffered_file ->
object
.. end
Associating buffered_files
and modes
val mode_name_of_filename : string -> string option
val mode_of_filename : string -> mode option
Management of views
val views : sourceview list Pervasives.ref
val buffers : buffered_file list Pervasives.ref
val active_sourceview : sourceview option Pervasives.ref
val set_active_sourceview : sourceview -> unit
val get_fresh_buffer_name : string -> string
val create_buffer : ?attributes:(string * string) list -> string -> buffered_file
val get_buffer : ?attributes:(string * string) list -> string -> buffered_file
val get_buffer_by_name : string -> buffered_file
val remove_buffer : < filename : string; name : string; .. > -> unit
val on_view_destroy : sourceview -> unit
val create_view : ?attributes:(string * string) list ->
Ed_view.topwin -> buffered_file -> sourceview
val dup : buffered_file -> Ed_view.topwin -> Ed_view.gui_view
val file_rename : string -> string -> unit
val open_file : Ed_view.topwin ->
Ed_view.gui_view ->
?attributes:(string * string) list ->
string -> [> `New_view of Ed_view.gui_view | `Use_view of Ed_view.gui_view ]
class factory :
Ed_view.view_factory
Commands
val register_com : prefix:string ->
string ->
string array ->
?more:string -> (sourceview -> string array -> unit) -> unit
register_com ~prefix name args ?more f
creates and register a command with
name prefix_name
, arguments names args
and command body f
.
more
: can be used to describe the remaining parameters of the command.
f
: takes the active sourceview and the regular command arguments.
val switch_to_buffer : sourceview -> string -> unit
val candidate_buffers : unit -> string list
val switch_buffer_history : Ed_minibuffer.minibuffer_history
val switch_buffer : sourceview -> string array -> unit
val destroy_buffer : sourceview -> 'a -> unit
val prev_search : string option Pervasives.ref
type
search_buffer_function = ?wrapped:bool ->
bool ->
my_buffer ->
?start:GText.iter -> string -> bool * (GText.iter * GText.iter) option
val search_buffer : search_buffer_function
val re_search_buffer : search_buffer_function
val search : search_buffer_function ->
string ->
?changed:bool -> bool -> sourceview -> string array -> unit
val replace_history : Ed_minibuffer.minibuffer_history
val query_replace_gen : ?mes:string ->
string ->
search_buffer_function ->
(searched:string -> found:string -> repl:string -> string) ->
sourceview -> string array -> unit
query_replace_gen ?mes command_name fsearch_buffer freplace sourceview args
val query_replace : sourceview -> string array -> unit
val re_query_replace : sourceview -> string array -> unit
val paste : sourceview -> string array -> unit
val copy : sourceview -> string array -> unit
val cut : sourceview -> string array -> unit
val beginning_of_line : sourceview -> string array -> unit
val end_of_line : sourceview -> string array -> unit
val undo : sourceview -> string array -> unit
val redo : sourceview -> string array -> unit
val forward_word : sourceview -> string array -> unit
val backward_word : sourceview -> string array -> unit
val forward_line : sourceview -> string array -> unit
val backward_line : sourceview -> string array -> unit
val forward_char : sourceview -> string array -> unit
val backward_char : sourceview -> string array -> unit
val kill_line : sourceview -> string array -> unit
val kill_word : sourceview -> string array -> unit
val backward_kill_word : sourceview -> string array -> unit
val delete_char : sourceview -> string array -> unit
val backward_delete_char : sourceview -> string array -> unit
val transpose_chars : sourceview -> string array -> unit
val transpose_lines : sourceview -> string array -> unit
val transpose_words : sourceview -> string array -> unit
val yank_choose : sourceview -> string array -> unit
val insert : sourceview -> string array -> unit
val goto_history : Ed_minibuffer.minibuffer_history
val goto_line : sourceview -> string array -> unit
val goto_char : sourceview -> string array -> unit
val force_save : sourceview -> string array -> unit
val syntax_mode_history : Ed_minibuffer.minibuffer_history
val set_syntax_mode : sourceview -> string array -> unit
val popup_syntax_mode_choice : sourceview -> string array -> unit
val mode_history : Ed_minibuffer.minibuffer_history
val set_encoding : sourceview -> string array -> unit
val set_mode : sourceview -> string array -> unit
val popup_mode_choice : sourceview -> string array -> unit
val switch_line_numbers : sourceview -> string array -> unit
val switch_line_markers : sourceview -> string array -> unit
val set_wrap_mode : sourceview -> string array -> unit