Use texinfo to generate docs

master
Yevgen Muntyan 2010-09-04 04:25:07 -07:00
parent 2099e58f92
commit e90c85292e
81 changed files with 3106 additions and 10272 deletions

View File

@ -1,43 +1,56 @@
if MOO_DEV_MODE
MOO_HELP_T2T_FILES = \
license.t2t \
prefs-file.t2t \
prefs.t2t \
user-tools.t2t \
regex.t2t \
medit.t2t
src_texinfo_files = \
medit.texi \
prefs.texi \
prefs-file.texi \
user-tools.texi \
regex.texi \
license.texi \
script.texi \
momscript.texi
man-medit.t2t: man-medit.t2t.in $(top_builddir)/config.status
cd $(top_builddir) && ./config.status --file=doc/man-medit.t2t
mv man-medit.t2t $(srcdir)/man-medit.t2t
# man-medit.t2t: man-medit.t2t.in $(top_builddir)/config.status
# cd $(top_builddir) && ./config.status --file=doc/man-medit.t2t
# mv man-medit.t2t $(srcdir)/man-medit.t2t
medit.1: man-medit.t2t
cd $(srcdir) && $(PYTHON) txt2tags/txt2tags.py --target=man --outfile=medit.1.tmp man-medit.t2t && \
mv medit.1.tmp medit.1
# medit.1: man-medit.t2t
# cd $(srcdir) && $(PYTHON) txt2tags/txt2tags.py --target=man --outfile=medit.1.tmp man-medit.t2t && \
# mv medit.1.tmp medit.1
medit.t2t: medit.t2t.in $(top_builddir)/config.status
cd $(top_builddir) && ./config.status --file=doc/medit.t2t
mv medit.t2t $(srcdir)/medit.t2t
medit.texi: medit.texi.in $(top_builddir)/config.status
cd $(top_builddir) && ./config.status --file=doc/medit.texi
mv medit.texi $(srcdir)/medit.texi
help.html: $(MOO_HELP_T2T_FILES)
cd $(srcdir) && $(PYTHON) txt2tags/txt2tags.py --outfile=help.html.tmp medit.t2t && \
mv help.html.tmp help.html
momscript.texi: $(top_srcdir)/moo/plugins/script/momscript-classes.h $(top_srcdir)/moo/plugins/script/gendoc.py
$(PYTHON) $(top_srcdir)/moo/plugins/script/gendoc.py $(top_srcdir)/moo/plugins/script/momscript-classes.h \
> momscript.texi.tmp && mv momscript.texi.tmp $(srcdir)/momscript.texi
help/index.html: help.html
# help.html: $(MOO_HELP_T2T_FILES)
# cd $(srcdir) && $(PYTHON) txt2tags/txt2tags.py --outfile=help.html.tmp medit.t2t && \
# mv help.html.tmp help.html
help/index.html: $(src_texinfo_files)
rm -f $(srcdir)/help/*.html
$(MKDIR_P) $(srcdir)/help
cd $(srcdir)/help && $(PERL) -I.. ../splity/splity.pl -index ../splity/index-template.html -page ../splity/page-template.html ../help.html
cd $(srcdir) && makeinfo --html medit.texi
help-sections.h: help.html genhelpsections.py
cd $(srcdir) && $(PYTHON) genhelpsections.py help.html > help-sections.h.tmp && mv help-sections.h.tmp help-sections.h
rm -f $(srcdir)/help-sections.h.tmp
help-sections.h: help/index.html $(srcdir)/gensections.py
$(PYTHON) $(srcdir)/gensections.py $(srcdir)/help/*.html > help-sections.h.tmp && \
mv help-sections.h.tmp $(srcdir)/help-sections.h
# help-sections.h: help.html genhelpsections.py
# cd $(srcdir) && $(PYTHON) genhelpsections.py help.html > help-sections.h.tmp && mv help-sections.h.tmp help-sections.h
# rm -f $(srcdir)/help-sections.h.tmp
all-am: doc
doc: medit.1 help/index.html help-sections.h
# doc: medit.1 help/index.html help-sections.h
doc: help/index.html help-sections.h
endif
EXTRA_DIST = medit.1 help.html help-sections.h help
# EXTRA_DIST = medit.1 help.html help-sections.h help
EXTRA_DIST = help help-sections.h
install-data-local:
$(MKDIR_P) $(DESTDIR)$(MOO_HELP_DIR)
@ -46,6 +59,6 @@ install-data-local:
uninstall-local:
rm -f $(DESTDIR)$(MOO_HELP_DIR)/*.html
if MOO_OS_UNIX
dist_man_MANS = medit.1
endif MOO_OS_UNIX
# if MOO_OS_UNIX
# dist_man_MANS = medit.1
# endif MOO_OS_UNIX

View File

@ -1,627 +0,0 @@
# -*- perl -*-
# Text::Template.pm
#
# Fill in `templates'
#
# Copyright 1996, 1997, 1999, 2001, 2002, 2003, 2008 M-J. Dominus.
# You may copy and distribute this program under the
# same terms as Perl iteself.
# If in doubt, write to mjd-perl-template+@plover.com for a license.
#
# Version 1.45
# DOCS HAVE BEEN REMOVED FROM THIS FILE
package Text::Template;
require 5.004;
use Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(fill_in_file fill_in_string TTerror);
use vars '$ERROR';
use strict;
$Text::Template::VERSION = '1.45';
my %GLOBAL_PREPEND = ('Text::Template' => '');
sub Version {
$Text::Template::VERSION;
}
sub _param {
my $kk;
my ($k, %h) = @_;
for $kk ($k, "\u$k", "\U$k", "-$k", "-\u$k", "-\U$k") {
return $h{$kk} if exists $h{$kk};
}
return;
}
sub always_prepend
{
my $pack = shift;
my $old = $GLOBAL_PREPEND{$pack};
$GLOBAL_PREPEND{$pack} = shift;
$old;
}
{
my %LEGAL_TYPE;
BEGIN {
%LEGAL_TYPE = map {$_=>1} qw(FILE FILEHANDLE STRING ARRAY);
}
sub new {
my $pack = shift;
my %a = @_;
my $stype = uc(_param('type', %a)) || 'FILE';
my $source = _param('source', %a);
my $untaint = _param('untaint', %a);
my $prepend = _param('prepend', %a);
my $alt_delim = _param('delimiters', %a);
my $broken = _param('broken', %a);
unless (defined $source) {
require Carp;
Carp::croak("Usage: $ {pack}::new(TYPE => ..., SOURCE => ...)");
}
unless ($LEGAL_TYPE{$stype}) {
require Carp;
Carp::croak("Illegal value `$stype' for TYPE parameter");
}
my $self = {TYPE => $stype,
PREPEND => $prepend,
UNTAINT => $untaint,
BROKEN => $broken,
(defined $alt_delim ? (DELIM => $alt_delim) : ()),
};
# Under 5.005_03, if any of $stype, $prepend, $untaint, or $broken
# are tainted, all the others become tainted too as a result of
# sharing the expression with them. We install $source separately
# to prevent it from acquiring a spurious taint.
$self->{SOURCE} = $source;
bless $self => $pack;
return unless $self->_acquire_data;
$self;
}
}
# Convert template objects of various types to type STRING,
# in which the template data is embedded in the object itself.
sub _acquire_data {
my ($self) = @_;
my $type = $self->{TYPE};
if ($type eq 'STRING') {
# nothing necessary
} elsif ($type eq 'FILE') {
my $data = _load_text($self->{SOURCE});
unless (defined $data) {
# _load_text already set $ERROR
return undef;
}
if ($self->{UNTAINT} && _is_clean($self->{SOURCE})) {
_unconditionally_untaint($data);
}
$self->{TYPE} = 'STRING';
$self->{FILENAME} = $self->{SOURCE};
$self->{SOURCE} = $data;
} elsif ($type eq 'ARRAY') {
$self->{TYPE} = 'STRING';
$self->{SOURCE} = join '', @{$self->{SOURCE}};
} elsif ($type eq 'FILEHANDLE') {
$self->{TYPE} = 'STRING';
local $/;
my $fh = $self->{SOURCE};
my $data = <$fh>; # Extra assignment avoids bug in Solaris perl5.00[45].
if ($self->{UNTAINT}) {
_unconditionally_untaint($data);
}
$self->{SOURCE} = $data;
} else {
# This should have been caught long ago, so it represents a
# drastic `can't-happen' sort of failure
my $pack = ref $self;
die "Can only acquire data for $pack objects of subtype STRING, but this is $type; aborting";
}
$self->{DATA_ACQUIRED} = 1;
}
sub source {
my ($self) = @_;
$self->_acquire_data unless $self->{DATA_ACQUIRED};
return $self->{SOURCE};
}
sub set_source_data {
my ($self, $newdata) = @_;
$self->{SOURCE} = $newdata;
$self->{DATA_ACQUIRED} = 1;
$self->{TYPE} = 'STRING';
1;
}
sub compile {
my $self = shift;
return 1 if $self->{TYPE} eq 'PREPARSED';
return undef unless $self->_acquire_data;
unless ($self->{TYPE} eq 'STRING') {
my $pack = ref $self;
# This should have been caught long ago, so it represents a
# drastic `can't-happen' sort of failure
die "Can only compile $pack objects of subtype STRING, but this is $self->{TYPE}; aborting";
}
my @tokens;
my $delim_pats = shift() || $self->{DELIM};
my ($t_open, $t_close) = ('{', '}');
my $DELIM; # Regex matches a delimiter if $delim_pats
if (defined $delim_pats) {
($t_open, $t_close) = @$delim_pats;
$DELIM = "(?:(?:\Q$t_open\E)|(?:\Q$t_close\E))";
@tokens = split /($DELIM|\n)/, $self->{SOURCE};
} else {
@tokens = split /(\\\\(?=\\*[{}])|\\[{}]|[{}\n])/, $self->{SOURCE};
}
my $state = 'TEXT';
my $depth = 0;
my $lineno = 1;
my @content;
my $cur_item = '';
my $prog_start;
while (@tokens) {
my $t = shift @tokens;
next if $t eq '';
if ($t eq $t_open) { # Brace or other opening delimiter
if ($depth == 0) {
push @content, [$state, $cur_item, $lineno] if $cur_item ne '';
$cur_item = '';
$state = 'PROG';
$prog_start = $lineno;
} else {
$cur_item .= $t;
}
$depth++;
} elsif ($t eq $t_close) { # Brace or other closing delimiter
$depth--;
if ($depth < 0) {
$ERROR = "Unmatched close brace at line $lineno";
return undef;
} elsif ($depth == 0) {
push @content, [$state, $cur_item, $prog_start] if $cur_item ne '';
$state = 'TEXT';
$cur_item = '';
} else {
$cur_item .= $t;
}
} elsif (!$delim_pats && $t eq '\\\\') { # precedes \\\..\\\{ or \\\..\\\}
$cur_item .= '\\';
} elsif (!$delim_pats && $t =~ /^\\([{}])$/) { # Escaped (literal) brace?
$cur_item .= $1;
} elsif ($t eq "\n") { # Newline
$lineno++;
$cur_item .= $t;
} else { # Anything else
$cur_item .= $t;
}
}
if ($state eq 'PROG') {
$ERROR = "End of data inside program text that began at line $prog_start";
return undef;
} elsif ($state eq 'TEXT') {
push @content, [$state, $cur_item, $lineno] if $cur_item ne '';
} else {
die "Can't happen error #1";
}
$self->{TYPE} = 'PREPARSED';
$self->{SOURCE} = \@content;
1;
}
sub prepend_text {
my ($self) = @_;
my $t = $self->{PREPEND};
unless (defined $t) {
$t = $GLOBAL_PREPEND{ref $self};
unless (defined $t) {
$t = $GLOBAL_PREPEND{'Text::Template'};
}
}
$self->{PREPEND} = $_[1] if $#_ >= 1;
return $t;
}
sub fill_in {
my $fi_self = shift;
my %fi_a = @_;
unless ($fi_self->{TYPE} eq 'PREPARSED') {
my $delims = _param('delimiters', %fi_a);
my @delim_arg = (defined $delims ? ($delims) : ());
$fi_self->compile(@delim_arg)
or return undef;
}
my $fi_varhash = _param('hash', %fi_a);
my $fi_package = _param('package', %fi_a) ;
my $fi_broken =
_param('broken', %fi_a) || $fi_self->{BROKEN} || \&_default_broken;
my $fi_broken_arg = _param('broken_arg', %fi_a) || [];
my $fi_safe = _param('safe', %fi_a);
my $fi_ofh = _param('output', %fi_a);
my $fi_eval_package;
my $fi_scrub_package = 0;
my $fi_filename = _param('filename') || $fi_self->{FILENAME} || 'template';
my $fi_prepend = _param('prepend', %fi_a);
unless (defined $fi_prepend) {
$fi_prepend = $fi_self->prepend_text;
}
if (defined $fi_safe) {
$fi_eval_package = 'main';
} elsif (defined $fi_package) {
$fi_eval_package = $fi_package;
} elsif (defined $fi_varhash) {
$fi_eval_package = _gensym();
$fi_scrub_package = 1;
} else {
$fi_eval_package = caller;
}
my $fi_install_package;
if (defined $fi_varhash) {
if (defined $fi_package) {
$fi_install_package = $fi_package;
} elsif (defined $fi_safe) {
$fi_install_package = $fi_safe->root;
} else {
$fi_install_package = $fi_eval_package; # The gensymmed one
}
_install_hash($fi_varhash => $fi_install_package);
}
if (defined $fi_package && defined $fi_safe) {
no strict 'refs';
# Big fat magic here: Fix it so that the user-specified package
# is the default one available in the safe compartment.
*{$fi_safe->root . '::'} = \%{$fi_package . '::'}; # LOD
}
my $fi_r = '';
my $fi_item;
foreach $fi_item (@{$fi_self->{SOURCE}}) {
my ($fi_type, $fi_text, $fi_lineno) = @$fi_item;
if ($fi_type eq 'TEXT') {
if ($fi_ofh) {
print $fi_ofh $fi_text;
} else {
$fi_r .= $fi_text;
}
} elsif ($fi_type eq 'PROG') {
no strict;
my $fi_lcomment = "#line $fi_lineno $fi_filename";
my $fi_progtext =
"package $fi_eval_package; $fi_prepend;\n$fi_lcomment\n$fi_text;";
my $fi_res;
my $fi_eval_err = '';
if ($fi_safe) {
$fi_safe->reval(q{undef $OUT});
$fi_res = $fi_safe->reval($fi_progtext);
$fi_eval_err = $@;
my $OUT = $fi_safe->reval('$OUT');
$fi_res = $OUT if defined $OUT;
} else {
my $OUT;
$fi_res = eval $fi_progtext;
$fi_eval_err = $@;
$fi_res = $OUT if defined $OUT;
}
# If the value of the filled-in text really was undef,
# change it to an explicit empty string to avoid undefined
# value warnings later.
$fi_res = '' unless defined $fi_res;
if ($fi_eval_err) {
$fi_res = $fi_broken->(text => $fi_text,
error => $fi_eval_err,
lineno => $fi_lineno,
arg => $fi_broken_arg,
);
if (defined $fi_res) {
if (defined $fi_ofh) {
print $fi_ofh $fi_res;
} else {
$fi_r .= $fi_res;
}
} else {
return $fi_res; # Undefined means abort processing
}
} else {
if (defined $fi_ofh) {
print $fi_ofh $fi_res;
} else {
$fi_r .= $fi_res;
}
}
} else {
die "Can't happen error #2";
}
}
_scrubpkg($fi_eval_package) if $fi_scrub_package;
defined $fi_ofh ? 1 : $fi_r;
}
sub fill_this_in {
my $pack = shift;
my $text = shift;
my $templ = $pack->new(TYPE => 'STRING', SOURCE => $text, @_)
or return undef;
$templ->compile or return undef;
my $result = $templ->fill_in(@_);
$result;
}
sub fill_in_string {
my $string = shift;
my $package = _param('package', @_);
push @_, 'package' => scalar(caller) unless defined $package;
Text::Template->fill_this_in($string, @_);
}
sub fill_in_file {
my $fn = shift;
my $templ = Text::Template->new(TYPE => 'FILE', SOURCE => $fn, @_)
or return undef;
$templ->compile or return undef;
my $text = $templ->fill_in(@_);
$text;
}
sub _default_broken {
my %a = @_;
my $prog_text = $a{text};
my $err = $a{error};
my $lineno = $a{lineno};
chomp $err;
# $err =~ s/\s+at .*//s;
"Program fragment delivered error ``$err''";
}
sub _load_text {
my $fn = shift;
local *F;
unless (open F, $fn) {
$ERROR = "Couldn't open file $fn: $!";
return undef;
}
local $/;
<F>;
}
sub _is_clean {
my $z;
eval { ($z = join('', @_)), eval '#' . substr($z,0,0); 1 } # LOD
}
sub _unconditionally_untaint {
for (@_) {
($_) = /(.*)/s;
}
}
{
my $seqno = 0;
sub _gensym {
__PACKAGE__ . '::GEN' . $seqno++;
}
sub _scrubpkg {
my $s = shift;
$s =~ s/^Text::Template:://;
no strict 'refs';
my $hash = $Text::Template::{$s."::"};
foreach my $key (keys %$hash) {
undef $hash->{$key};
}
}
}
# Given a hashful of variables (or a list of such hashes)
# install the variables into the specified package,
# overwriting whatever variables were there before.
sub _install_hash {
my $hashlist = shift;
my $dest = shift;
if (UNIVERSAL::isa($hashlist, 'HASH')) {
$hashlist = [$hashlist];
}
my $hash;
foreach $hash (@$hashlist) {
my $name;
foreach $name (keys %$hash) {
my $val = $hash->{$name};
no strict 'refs';
local *SYM = *{"$ {dest}::$name"};
if (! defined $val) {
delete ${"$ {dest}::"}{$name};
} elsif (ref $val) {
*SYM = $val;
} else {
*SYM = \$val;
}
}
}
}
sub TTerror { $ERROR }
1;
=head1 NAME
Text::Template - Expand template text with embedded Perl
=head1 VERSION
This file documents C<Text::Template> version B<1.45>
=head2 Author
Mark-Jason Dominus, Plover Systems
Please send questions and other remarks about this software to
C<mjd-perl-template+@plover.com>
You can join a very low-volume (E<lt>10 messages per year) mailing
list for announcements about this package. Send an empty note to
C<mjd-perl-template-request@plover.com> to join.
For updates, visit C<http://www.plover.com/~mjd/perl/Template/>.
=head2 Support?
This software is version 1.45. It may have bugs. Suggestions and bug
reports are always welcome. Send them to
C<mjd-perl-template+@plover.com>. (That is my address, not the address
of the mailing list. The mailing list address is a secret.)
=head1 LICENSE
Text::Template version 1.45
Copyright (C) 2008 Mark Jason Dominus
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. You may also can
redistribute it and/or modify it under the terms of the Perl
Artistic License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received copies of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
=head1 THANKS
Many thanks to the following people for offering support,
encouragement, advice, bug reports, and all the other good stuff.
David H. Adler /
Joel Appelbaum /
Klaus Arnhold /
AntE<oacute>nio AragE<atilde>o /
Kevin Atteson /
Chris.Brezil /
Mike Brodhead /
Tom Brown /
Dr. Frank Bucolo /
Tim Bunce /
Juan E. Camacho /
Itamar Almeida de Carvalho /
Joseph Cheek /
Gene Damon /
San Deng /
Bob Dougherty /
Marek Grac /
Dan Franklin /
gary at dls.net /
Todd A. Green /
Donald L. Greer Jr. /
Michelangelo Grigni /
Zac Hansen /
Tom Henry /
Jarko Hietaniemi /
Matt X. Hunter /
Robert M. Ioffe /
Daniel LaLiberte /
Reuven M. Lerner /
Trip Lilley /
Yannis Livassof /
Val Luck /
Kevin Madsen /
David Marshall /
James Mastros /
Joel Meulenberg /
Jason Moore /
Sergey Myasnikov /
Chris Nandor /
Bek Oberin /
Steve Palincsar /
Ron Pero /
Hans Persson /
Sean Roehnelt /
Jonathan Roy /
Shabbir J. Safdar /
Jennifer D. St Clair /
Uwe Schneider /
Randal L. Schwartz /
Michael G Schwern /
Yonat Sharon /
Brian C. Shensky /
Niklas Skoglund /
Tom Snee /
Fred Steinberg /
Hans Stoop /
Michael J. Suzio /
Dennis Taylor /
James H. Thompson /
Shad Todd /
Lieven Tomme /
Lorenzo Valdettaro /
Larry Virden /
Andy Wardley /
Archie Warnock /
Chris Wesley /
Matt Womer /
Andrew G Wood /
Daini Xie /
Michaely Yeung
Special thanks to:
=over 2
=item Jonathan Roy
for telling me how to do the C<Safe> support (I spent two years
worrying about it, and then Jonathan pointed out that it was trivial.)
=item Ranjit Bhatnagar
for demanding less verbose fragments like they have in ASP, for
helping me figure out the Right Thing, and, especially, for talking me
out of adding any new syntax. These discussions resulted in the
C<$OUT> feature.
=back
=head2 Bugs and Caveats
C<my> variables in C<fill_in> are still susceptible to being clobbered
by template evaluation. They all begin with C<fi_>, so avoid those
names in your templates.
The line number information will be wrong if the template's lines are
not terminated by C<"\n">. You should let me know if this is a
problem. If you do, I will fix it.
The C<$OUT> variable has a special meaning in templates, so you cannot
use it as if it were a regular variable.
There are not quite enough tests in the test suite.
=cut

View File

@ -1,144 +0,0 @@
package Text::Template::Preprocess;
use Text::Template;
@ISA = qw(Text::Template);
$Text::Template::Preprocess::VERSION = 1.45;
sub fill_in {
my $self = shift;
my (%args) = @_;
my $pp = $args{PREPROCESSOR} || $self->{PREPROCESSOR} ;
if ($pp) {
local $_ = $self->source();
# print "# fill_in: before <$_>\n";
&$pp;
# print "# fill_in: after <$_>\n";
$self->set_source_data($_);
}
$self->SUPER::fill_in(@_);
}
sub preprocessor {
my ($self, $pp) = @_;
my $old_pp = $self->{PREPROCESSOR};
$self->{PREPROCESSOR} = $pp if @_ > 1; # OK to pass $pp=undef
$old_pp;
}
1;
=head1 NAME
Text::Template::Preprocess - Expand template text with embedded Perl
=head1 VERSION
This file documents C<Text::Template::Preprocess> version B<1.45>
=head1 SYNOPSIS
use Text::Template::Preprocess;
my $t = Text::Template::Preprocess->new(...); # identical to Text::Template
# Fill in template, but preprocess each code fragment with pp().
my $result = $t->fill_in(..., PREPROCESSOR => \&pp);
my $old_pp = $t->preprocessor(\&new_pp);
=head1 DESCRIPTION
C<Text::Template::Preprocess> provides a new C<PREPROCESSOR> option to
C<fill_in>. If the C<PREPROCESSOR> option is supplied, it must be a
reference to a preprocessor subroutine. When filling out a template,
C<Text::Template::Preprocessor> will use this subroutine to preprocess
the program fragment prior to evaluating the code.
The preprocessor subroutine will be called repeatedly, once for each
program fragment. The program fragment will be in C<$_>. The
subroutine should modify the contents of C<$_> and return.
C<Text::Template::Preprocess> will then execute contents of C<$_> and
insert the result into the appropriate part of the template.
C<Text::Template::Preprocess> objects also support a utility method,
C<preprocessor()>, which sets a new preprocessor for the object. This
preprocessor is used for all subsequent calls to C<fill_in> except
where overridden by an explicit C<PREPROCESSOR> option.
C<preprocessor()> returns the previous default preprocessor function,
or undefined if there wasn't one. When invoked with no arguments,
C<preprocessor()> returns the object's current default preprocessor
function without changing it.
In all other respects, C<Text::Template::Preprocess> is identical to
C<Text::Template>.
=head1 WHY?
One possible purpose: If your files contain a lot of JavaScript, like
this:
Plain text here...
{ perl code }
<script language=JavaScript>
if (br== "n3") {
// etc.
}
</script>
{ more perl code }
More plain text...
You don't want C<Text::Template> to confuse the curly braces in the
JavaScript program with executable Perl code. One strategy:
sub quote_scripts {
s(<script(.*?)</script>)(q{$1})gsi;
}
Then use C<PREPROCESSOR =E<gt> \&quote_scripts>. This will transform
=head1 SEE ALSO
L<Text::Template>
=head1 AUTHOR
Mark-Jason Dominus, Plover Systems
Please send questions and other remarks about this software to
C<mjd-perl-template+@plover.com>
You can join a very low-volume (E<lt>10 messages per year) mailing
list for announcements about this package. Send an empty note to
C<mjd-perl-template-request@plover.com> to join.
For updates, visit C<http://www.plover.com/~mjd/perl/Template/>.
=head1 LICENSE
Text::Template::Preprocess version 1.45
Copyright (C) 2008 Mark Jason Dominus
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. You may also can
redistribute it and/or modify it under the terms of the Perl
Artistic License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received copies of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
=cut

View File

@ -1,20 +0,0 @@
# genhelpsections.py help.html
import sys
import re
print '#ifndef HELP_SECTIONS_H'
print '#define HELP_SECTIONS_H'
print ''
for line in open(sys.argv[1]):
m = re.search(r"##(.+)##", line)
if m:
section = m.group(1)
if section.startswith("fake-"):
section = section[5:]
section_cap = section.replace('-', '_').upper()
print '#define HELP_SECTION_%s "%s"' % (section_cap, section)
print ''
print '#endif /* HELP_SECTIONS_H */'

31
doc/gensections.py Normal file
View File

@ -0,0 +1,31 @@
import os
import sys
import re
re_section = re.compile('<!-- moo-help-section: (\S+) -->')
sections = [
[ 'PREFS_ACCELS', 'index.html' ],
[ 'PREFS_DIALOG', 'index.html' ],
[ 'PREFS_PLUGINS', 'index.html' ],
[ 'DIALOG_REPLACE', 'index.html' ],
[ 'DIALOG_FIND', 'index.html' ],
[ 'PREFS_FILE_SELECTOR', 'index.html' ],
[ 'FILE_SELECTOR', 'index.html' ],
[ 'DIALOG_FIND_FILE', 'index.html' ],
[ 'DIALOG_FIND_IN_FILES', 'index.html' ],
]
for f in sys.argv[1:]:
for line in open(f):
m = re_section.search(line)
if m:
sections.append([m.group(1), f])
break
print '#ifndef MOO_HELP_SECTIONS_H'
print '#define MOO_HELP_SECTIONS_H'
print ''
for sec, filename in sorted(sections):
print '#define HELP_SECTION_%s "%s"' % (sec, os.path.basename(filename))
print ''
print '#endif /* MOO_HELP_SECTIONS_H */'

View File

@ -1,32 +1,36 @@
#ifndef HELP_SECTIONS_H
#define HELP_SECTIONS_H
#ifndef MOO_HELP_SECTIONS_H
#define MOO_HELP_SECTIONS_H
#define HELP_SECTION_PREFS_LANGS_AND_FILTERS "prefs-langs-and-filters"
#define HELP_SECTION_PREFS_LANG_OPTIONS "prefs-lang-options"
#define HELP_SECTION_PREFS_FILE_FILTERS "prefs-file-filters"
#define HELP_SECTION_EDITING_OPTIONS "editing-options"
#define HELP_SECTION_SECT_USER_TOOLS "sect-user-tools"
#define HELP_SECTION_PREFS_USER_TOOLS "prefs-user-tools"
#define HELP_SECTION_USER_TOOLS_FILES "user-tools-files"
#define HELP_SECTION_USER_TOOLS_LUA "user-tools-lua"
#define HELP_SECTION_USER_TOOLS_SHELL "user-tools-shell"
#define HELP_SECTION_PREFS_FILE "prefs-file"
#define HELP_SECTION_REGEX "regex"
#define HELP_SECTION_REGEX_SEARCH "regex-search"
#define HELP_SECTION_APP_LICENSE "app-license"
#define HELP_SECTION_GPL "gpl"
#define HELP_SECTION_LGPL "lgpl"
#define HELP_SECTION_LICENSE_LUA "license-lua"
#define HELP_SECTION_LICENSE_LUA_LFS "license-lua-lfs"
#define HELP_SECTION_LICENSE_XDG_UTILS "license-xdg-utils"
#define HELP_SECTION_DIALOG_REPLACE "dialog-replace"
#define HELP_SECTION_DIALOG_FIND "dialog-find"
#define HELP_SECTION_PREFS_DIALOG "prefs-dialog"
#define HELP_SECTION_PREFS_PLUGINS "prefs-plugins"
#define HELP_SECTION_PREFS_ACCELS "prefs-accels"
#define HELP_SECTION_PREFS_FILE_SELECTOR "prefs-file-selector"
#define HELP_SECTION_DIALOG_FIND_IN_FILES "dialog-find-in-files"
#define HELP_SECTION_DIALOG_FIND_FILE "dialog-find-file"
#define HELP_SECTION_FILE_SELECTOR "file-selector"
#define HELP_SECTION_APP_LICENSE "License.html"
#define HELP_SECTION_DIALOG_FIND "index.html"
#define HELP_SECTION_DIALOG_FIND_FILE "index.html"
#define HELP_SECTION_DIALOG_FIND_IN_FILES "index.html"
#define HELP_SECTION_DIALOG_REPLACE "index.html"
#define HELP_SECTION_DOCUMENT "Document-object.html"
#define HELP_SECTION_DOCUMENT_VIEW "DocumentView-object.html"
#define HELP_SECTION_EDITING_OPTIONS "editing_002doptions.html"
#define HELP_SECTION_FILE_SELECTOR "index.html"
#define HELP_SECTION_LICENSE_GPL "GNU-General-Public-License.html"
#define HELP_SECTION_LICENSE_LFS "LuaFileSystem-License.html"
#define HELP_SECTION_LICENSE_LGPL "GNU-Lesser-General-Public-License.html"
#define HELP_SECTION_LICENSE_LUA "Lua-License.html"
#define HELP_SECTION_LICENSE_XDG_UTILS "xdg_002dutils-License.html"
#define HELP_SECTION_PREFS_ACCELS "index.html"
#define HELP_SECTION_PREFS_DIALOG "index.html"
#define HELP_SECTION_PREFS_FILE "Preferences-files.html"
#define HELP_SECTION_PREFS_FILE_FILTERS "prefs_002dfile_002dfilters.html"
#define HELP_SECTION_PREFS_FILE_SELECTOR "index.html"
#define HELP_SECTION_PREFS_LANGS_AND_FILTERS "prefs_002dlangs_002dand_002dfilters.html"
#define HELP_SECTION_PREFS_LANGS_OPTIONS "prefs_002dlang_002doptions.html"
#define HELP_SECTION_PREFS_PLUGINS "index.html"
#define HELP_SECTION_REGEX "Regular-expressions.html"
#define HELP_SECTION_SCRIPT "Scripting.html"
#define HELP_SECTION_SCRIPT_APPLICATION "Application-object.html"
#define HELP_SECTION_SCRIPT_DOCUMENT_WINDOW "DocumentWindow-object.html"
#define HELP_SECTION_SCRIPT_EDITOR "Editor-object.html"
#define HELP_SECTION_USER_TOOLS "User_002ddefined-Tools.html"
#define HELP_SECTION_USER_TOOLS_FILES "Storing-tools-in-files.html"
#define HELP_SECTION_USER_TOOLS_MANAGING "Managing-tools.html"
#define HELP_SECTION_USER_TOOLS_SHELL_SCRIPTS "Shell-scripts.html"
#endif /* HELP_SECTIONS_H */
#endif /* MOO_HELP_SECTIONS_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,49 @@
<html lang="en">
<head>
<title>Application object - medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Scripting.html#Scripting" title="Scripting">
<link rel="next" href="Editor-object.html#Editor-object" title="Editor object">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Application-object"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Editor-object.html#Editor-object">Editor object</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Scripting.html#Scripting">Scripting</a>
<hr>
</div>
<h3 class="section">5.1 Application object</h3>
<p><!-- moo-help-section: SCRIPT_APPLICATION -->
<dl>
<dt><code>Application.editor()</code><dd>returns Editor object.
<br><dt><code>Application.active_view()</code><dd>returns current active document view or <code>null</code> if no documents are open.
<br><dt><code>Application.active_document()</code><dd>returns current active document or <code>null</code> if no documents are open.
<br><dt><code>Application.active_window()</code><dd>returns current active window.
<br><dt><code>Application.set_active_window(window)</code><dd>activates <var>window</var>.
<br><dt><code>Application.windows()</code><dd>returns a list of all editor windows.
<br><dt><code>Application.quit()</code><dd>quit medit.
</dl>
</body></html>

View File

@ -0,0 +1,138 @@
<html lang="en">
<head>
<title>Document object - medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Scripting.html#Scripting" title="Scripting">
<link rel="prev" href="DocumentView-object.html#DocumentView-object" title="DocumentView object">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Document-object"></a>
<p>
Previous:&nbsp;<a rel="previous" accesskey="p" href="DocumentView-object.html#DocumentView-object">DocumentView object</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Scripting.html#Scripting">Scripting</a>
<hr>
</div>
<h3 class="section">5.5 Document object</h3>
<p><!-- moo-help-section: DOCUMENT -->
<dl>
<dt><code>Document.views()</code><dd>returns list of views which display this document.
<br><dt><code>Document.active_view()</code><dd>returns active view of this document. If the document has a single
view, then that is returned; otherwise if the current active view
belongs to this document, then that view is returned; otherwise
a random view is picked.
<br><dt><code>Document.filename()</code><dd>returns full file path of the document or <code>null</code> if the document
has not been saved yet or if it can't be represented with a local
path (e.g. if it is in a remote location like a web site).
<ul>
<li>Untitled =&gt; <code>null</code>
<li><samp><span class="file">/home/user/example.txt</span></samp> =&gt; <code>"/home/user/example.txt"</code>
<li><samp><span class="file">http://example.com/index.html</span></samp> =&gt; <code>null</code>
</ul>
<br><dt><code>Document.uri()</code><dd>returns URI of the document or <code>null</code> if the document has not been
saved yet.
<br><dt><code>Document.basename()</code><dd>returns basename of the document, that is the full path minus directory
part. If the document has not been saved yet, then it returns the name
shown in the titlebar, e.g. "Untitled".
<br><dt><code>Document.encoding()</code><dd>returns character encoding of the document.
<br><dt><code>Document.set_encoding(encoding)</code><dd>set character encoding of the document, it will be used when the document
is saved.
<br><dt><code>Document.reload()</code><dd>reload the document.
<br><dt><code>Document.save()</code><dd>save the document.
<br><dt><code>Document.save_as(filename=null)</code><dd>save the document as <var>filename</var>. If <var>filename</var> is <code>null</code> then
<em>Save As</em> will be shown to choose new filename.
<br><dt><code>Document.can_undo()</code><dd>returns whether undo action is available.
<br><dt><code>Document.can_redo()</code><dd>returns whether redo action is available.
<br><dt><code>Document.undo()</code><dd>undo.
<br><dt><code>Document.redo()</code><dd>redo.
<br><dt><code>Document.begin_not_undoable_action()</code><dd>mark the beginning of a non-undoable operation. Undo stack will be erased
and undo will not be recorded until <code>end_not_undoable_action()</code> call.
<br><dt><code>Document.end_not_undoable_action()</code><dd>end the non-undoable operation started with <code>begin_not_undoable_action()</code>.
</dl>
<dl>
<dt><code>Document.start_pos()</code><dd>position at the beginning of the document (0 in Python, 1 in Lua, etc.)
<br><dt><code>Document.end_pos()</code><dd>position at the end of the document. This is the position past the last
character: it points to no character, but it is a valid position for
text insertion, cursor may be put there, etc.
<br><dt><code>Document.cursor_pos()</code><dd>position at the cursor.
<br><dt><code>Document.set_cursor_pos(pos)</code><dd>move cursor to position <var>pos</var>.
<br><dt><code>Document.selection()</code><dd>returns selection bounds as a list of two items, start and end. Returned
list is always sorted, use <code>cursor()</code> and <code>selection_bound()</code>
if you need to distinguish beginning and end of selection. If no text is
is selected, then it returns pair <code>[cursor, cursor]</code>.
<br><dt><code>Document.set_selection(bounds_as_list)</code><br><dt><code>Document.set_selection(start, end)</code><dd>select text.
<br><dt><code>Document.selection_bound()</code><dd>returns the selection bound other than cursor position. Selection is
either [cursor, selection_bound) or [selection_bound, cursor), depending
on direction user dragged the mouse (or on <code>set_selection</code>
arguments).
<br><dt><code>Document.has_selection()</code><dd>whether any text is selected.
<br><dt><code>Document.char_count()</code><dd>character count.
<br><dt><code>Document.line_count()</code><dd>line count.
<br><dt><code>Document.line_at_pos(pos)</code><dd>returns index of the line which contains position <var>pos</var>.
<br><dt><code>Document.pos_at_line(line)</code><dd>returns position at the beginning of line <var>line</var>.
<br><dt><code>Document.pos_at_line(line)</code><dd>returns position at the end of line <var>line</var>.
<br><dt><code>Document.char_at_pos(pos)</code><dd>returns character at position <var>pos</var> as string.
<br><dt><code>Document.text()</code><dd>returns whole document contents.
<br><dt><code>Document.text(start, end)</code><dd>returns text in the range [<var>start</var>, <var>end</var>), <var>end</var> not
included. Example: <code>doc.text(doc.start_pos(), doc.end_pos())</code> is
equivalent <code>to doc.text()</code>.
<br><dt><code>Document.insert_text(text)</code><br><dt><code>Document.insert_text(pos, text)</code><dd>insert text into the document. If <var>pos</var> is not given, insert at
cursor position.
<br><dt><code>Document.replace_text(start, end, text)</code><dd>replace text in the region [<var>start</var>, <var>end</var>). Equivalent to
<code>delete_text(start, end), insert_text(start, text)</code>.
<br><dt><code>Document.delete_text(start, end)</code><dd>delete text in the region [<var>start</var>, <var>end</var>). Example:
<code>doc.delete_text(doc.start(), doc.end())</code> will delete all text in
<code>doc</code>.
<br><dt><code>Document.append_text(text)</code><dd>append text. Equivalent to <code>doc.insert_text(doc.end(), text)</code>.
<br><dt><code>Document.clear()</code><dd>delete all text in the document.
<br><dt><code>Document.copy()</code><dd>copy selected text to clipboard. If no text is selected then nothing
will happen, same as Ctrl-C key combination.
<br><dt><code>Document.cut()</code><dd>cut selected text to clipboard. If no text is selected then nothing
will happen, same as Ctrl-X key combination.
<br><dt><code>Document.paste()</code><dd>paste text from clipboard. It has the same effect as Ctrl-V key combination:
nothing happens if clipboard is empty, and selected text is replaced with
clipboard contents otherwise.
<br><dt><code>Document.select_text(bounds_as_list)</code><br><dt><code>Document.select_text(start, end)</code><dd>select text, same as <code>set_selection()</code>.
<br><dt><code>Document.select_lines(line)</code><dd>select a line.
<br><dt><code>Document.select_lines(first, last)</code><dd>select lines from <var>first</var> to <var>last</var>, <em>including</em>
<var>last</var>.
<br><dt><code>Document.select_lines_at_pos(bounds_as_list)</code><br><dt><code>Document.select_lines_at_pos(start, end)</code><dd>select lines: similar to <code>select_text</code>, but select whole lines.
<br><dt><code>Document.select_all()</code><dd>select all.
<br><dt><code>Document.selected_text()</code><dd>returns selected text.
<br><dt><code>Document.selected_lines()</code><dd>returns selected lines as a list of strings, one string for each line,
line terminator characters not included. If nothing is selected, then
line at cursor is returned.
<br><dt><code>Document.delete_selected_text()</code><dd>delete selected text, equivalent to <code>doc.delete_text(doc.cursor(),
doc.selection_bound())</code>.
<br><dt><code>Document.delete_selected_lines()</code><dd>delete selected lines. Similar to <code>delete_selected_text()</code> but
selection is extended to include whole lines. If nothing is selected,
then line at cursor is deleted.
<br><dt><code>Document.replace_selected_text(text)</code><dd>replace selected text with <var>text</var>. If nothing is selected,
<var>text</var> is inserted at cursor.
<br><dt><code>Document.replace_selected_lines(text)</code><dd>replace selected lines with <var>text</var>. Similar to
<code>replace_selected_text()</code>, but selection is extended to include
whole lines. If nothing is selected, then line at cursor is replaced.
</dl>
</body></html>

View File

@ -0,0 +1,52 @@
<html lang="en">
<head>
<title>DocumentView object - medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Scripting.html#Scripting" title="Scripting">
<link rel="prev" href="DocumentWindow-object.html#DocumentWindow-object" title="DocumentWindow object">
<link rel="next" href="Document-object.html#Document-object" title="Document object">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="DocumentView-object"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Document-object.html#Document-object">Document object</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="DocumentWindow-object.html#DocumentWindow-object">DocumentWindow object</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Scripting.html#Scripting">Scripting</a>
<hr>
</div>
<h3 class="section">5.4 DocumentView object</h3>
<p><!-- moo-help-section: DOCUMENT_VIEW -->
<dl>
<dt><code>DocumentView.document()</code><dd>returns document to which this view belongs.
<br><dt><code>DocumentView.window()</code><dd>returns window which contains this view.
<br><dt><code>DocumentView.line_wrap_mode()</code><dd>returns whether line wrapping is enabled.
<br><dt><code>DocumentView.set_line_wrap_mode(enabled)</code><dd>enables or disables line wrapping.
<br><dt><code>DocumentView.overwrite_mode()</code><dd>returns whether overwrite mode is on.
<br><dt><code>DocumentView.set_overwrite_mode(enabled)</code><dd>enables or disables overwrite mode.
<br><dt><code>DocumentView.show_line_numbers()</code><dd>returns whether line numbers are displayed.
<br><dt><code>DocumentView.set_show_line_numbers(show)</code><dd>shows or hides line numbers.
</dl>
</body></html>

View File

@ -0,0 +1,55 @@
<html lang="en">
<head>
<title>DocumentWindow object - medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Scripting.html#Scripting" title="Scripting">
<link rel="prev" href="Editor-object.html#Editor-object" title="Editor object">
<link rel="next" href="DocumentView-object.html#DocumentView-object" title="DocumentView object">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="DocumentWindow-object"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="DocumentView-object.html#DocumentView-object">DocumentView object</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Editor-object.html#Editor-object">Editor object</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Scripting.html#Scripting">Scripting</a>
<hr>
</div>
<h3 class="section">5.3 DocumentWindow object</h3>
<p><!-- moo-help-section: SCRIPT_DOCUMENT_WINDOW -->
<dl>
<dt><code>DocumentWindow.editor()</code><dd>returns Editor object.
<br><dt><code>DocumentWindow.active_view()</code><dd>returns current active document view in this window.
<br><dt><code>DocumentWindow.set_active_view(view)</code><dd>makes <var>view</var> active, i.e. switches to its tab.
<br><dt><code>DocumentWindow.active_document()</code><dd>returns current active document in this window, that is the document
whose view is the active one.
<br><dt><code>DocumentWindow.set_active_document(doc)</code><dd>makes active a view of document <var>doc</var>. It picks arbitrary view
of <var>doc</var> if there are more than one in this window.
<br><dt><code>DocumentWindow.views()</code><dd>returns list of all document views in this window.
<br><dt><code>DocumentWindow.documents()</code><dd>returns list of all documents in this window.
<br><dt><code>DocumentWindow.is_active()</code><dd>returns whether this window is the active one.
<br><dt><code>DocumentWindow.set_active()</code><dd>makes this window active.
</dl>
</body></html>

View File

@ -0,0 +1,74 @@
<html lang="en">
<head>
<title>Editor object - medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Scripting.html#Scripting" title="Scripting">
<link rel="prev" href="Application-object.html#Application-object" title="Application object">
<link rel="next" href="DocumentWindow-object.html#DocumentWindow-object" title="DocumentWindow object">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Editor-object"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="DocumentWindow-object.html#DocumentWindow-object">DocumentWindow object</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Application-object.html#Application-object">Application object</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Scripting.html#Scripting">Scripting</a>
<hr>
</div>
<h3 class="section">5.2 Editor object</h3>
<p><!-- moo-help-section: SCRIPT_EDITOR -->
<dl>
<dt><code>Editor.active_document()</code><dd>returns current active document or <code>null</code> if there are no open documents
<br><dt><code>Editor.set_active_document(doc)</code><dd>makes <var>doc</var> active
<br><dt><code>Editor.active_window()</code><dd>returns current active window
<br><dt><code>Editor.set_active_window(window)</code><dd>makes <var>window</var> active
<br><dt><code>Editor.active_view()</code><dd>returns current active document view
<br><dt><code>Editor.set_active_view(view)</code><dd>makes <var>view</var> active
<br><dt><code>Editor.documents()</code><dd>returns list of all open documents
<br><dt><code>Editor.documents()</code><dd>returns list of all open document views
<br><dt><code>Editor.documents()</code><dd>returns list of all document windows
<br><dt><code>Editor.get_document_by_path(path)</code><dd>returns document with path <var>path</var> or <code>null</code>.
<br><dt><code>Editor.get_document_by_uri(path)</code><dd>returns document with uri <var>uri</var> or <code>null</code>.
<br><dt><code>Editor.new_file(file, encoding=null, window=null)</code><dd>open file if it exists on disk or create a new one. If <var>encoding</var> is
<code>null</code> or "auto" then pick character encoding automatically, otherwise use
<var>encoding</var>. If <var>window</var> is given then open file in that window,
otherwise in an existing window.
<br><dt><code>Editor.open_files(files, window=null)</code><dd>open files. If <var>window</var> is given then open files in that window,
otherwise in an existing window.
<br><dt><code>Editor.open_files(uris, window=null)</code><dd>open files. If <var>window</var> is given then open files in that window,
otherwise in an existing window.
<br><dt><code>Editor.open_file(file, encoding=null, window=null)</code><dd>open file. If <var>encoding</var> is <code>null</code> or "auto" then pick character
encoding automatically, otherwise use <var>encoding</var>. If <var>window</var>
is given then open files in that window, otherwise in an existing window.
<br><dt><code>Editor.open_uri(uri, encoding=null, window=null)</code><dd>open file. If <var>encoding</var> is <code>null</code> or "auto" then pick character
encoding automatically, otherwise use <var>encoding</var>. If <var>window</var>
is given then open files in that window, otherwise in an existing window.
<br><dt><code>Editor.reload(doc)</code><dd>reload document.
<br><dt><code>Editor.save(doc)</code><dd>save document.
<br><dt><code>Editor.save_as(doc, filename=null)</code><dd>save document as <var>filename</var>. If <var>filename</var> is not given then
first ask user for new filename.
<br><dt><code>Editor.close(doc)</code><dd>close document.
</dl>
</body></html>

View File

@ -1,27 +1,40 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title>GNU General Public License</title>
</HEAD>
<BODY>
<DIV CLASS="header" ID="header">
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="app-license.html">License</a></td>
<td width="33%" align="center">Up: <a href="app-license.html">License</a></td>
<td width="33%" align="right">Next: <a href="lgpl.html">GNU Lesser General Public License</a></td>
</tr></table>
<html lang="en">
<head>
<title>GNU General Public License - medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="License.html#License" title="License">
<link rel="next" href="GNU-Lesser-General-Public-License.html#GNU-Lesser-General-Public-License" title="GNU Lesser General Public License">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="GNU-General-Public-License"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="GNU-Lesser-General-Public-License.html#GNU-Lesser-General-Public-License">GNU Lesser General Public License</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="License.html#License">License</a>
<hr>
</div>
<H3>GNU General Public License</H3>
<h3 class="section">GNU General Public License</h3>
<!-- ##gpl## -->
<PRE>
GNU GENERAL PUBLIC LICENSE
<p><!-- moo-help-section: LICENSE_GPL -->
<pre class="verbatim"> GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
@ -313,8 +326,8 @@ to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
&lt;one line to give the program's name and a brief idea of what it does.&gt;
Copyright (C) &lt;year&gt; &lt;name of author&gt;
&lt;one line to give the program's name and a brief idea of what it does.>
Copyright (C) &lt;year> &lt;name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -352,7 +365,7 @@ necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
&lt;signature of Ty Coon&gt;, 1 April 1989
&lt;signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
@ -360,20 +373,7 @@ proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
</PRE>
</pre>
<ul>
</ul>
<hr>
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="app-license.html">License</a></td>
<td width="33%" align="center">Up: <a href="app-license.html">License</a></td>
<td width="33%" align="right">Next: <a href="lgpl.html">GNU Lesser General Public License</a></td>
</tr></table>
</BODY></HTML>
</body></html>

View File

@ -1,27 +1,42 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title>GNU Lesser General Public License</title>
</HEAD>
<BODY>
<DIV CLASS="header" ID="header">
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="gpl.html">GNU General Public License</a></td>
<td width="33%" align="center">Up: <a href="app-license.html">License</a></td>
<td width="33%" align="right">Next: <a href="license-lua.html">Lua License</a></td>
</tr></table>
<html lang="en">
<head>
<title>GNU Lesser General Public License - medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="License.html#License" title="License">
<link rel="prev" href="GNU-General-Public-License.html#GNU-General-Public-License" title="GNU General Public License">
<link rel="next" href="Lua-License.html#Lua-License" title="Lua License">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="GNU-Lesser-General-Public-License"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Lua-License.html#Lua-License">Lua License</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="GNU-General-Public-License.html#GNU-General-Public-License">GNU General Public License</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="License.html#License">License</a>
<hr>
</div>
<H3>GNU Lesser General Public License</H3>
<h3 class="section">GNU Lesser General Public License</h3>
<!-- ##lgpl## -->
<PRE>
GNU LESSER GENERAL PUBLIC LICENSE
<p><!-- moo-help-section: LICENSE_LGPL -->
<pre class="verbatim"> GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
@ -493,8 +508,8 @@ safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
&lt;one line to give the library's name and a brief idea of what it does.&gt;
Copyright (C) &lt;year&gt; &lt;name of author&gt;
&lt;one line to give the library's name and a brief idea of what it does.>
Copyright (C) &lt;year> &lt;name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -519,26 +534,13 @@ necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
&lt;signature of Ty Coon&gt;, 1 April 1990
&lt;signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
</PRE>
</pre>
<ul>
</ul>
<hr>
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="gpl.html">GNU General Public License</a></td>
<td width="33%" align="center">Up: <a href="app-license.html">License</a></td>
<td width="33%" align="right">Next: <a href="license-lua.html">Lua License</a></td>
</tr></table>
</BODY></HTML>
</body></html>

51
doc/help/License.html Normal file
View File

@ -0,0 +1,51 @@
<html lang="en">
<head>
<title>License - medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="Scripting.html#Scripting" title="Scripting">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="License"></a>
<p>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Scripting.html#Scripting">Scripting</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>
<h2 class="unnumbered">License</h2>
<p><!-- moo-help-section: APP_LICENSE -->
<p>medit as a whole is distributed under the terms of the GNU General
Public License, version 2, but most of its code is released under the
GNU Lesser General Public License. Full text of these licenses, as well
as licenses and acknowledgements for third-party software incorporated
in medit, can be found in this section.
<ul class="menu">
<li><a accesskey="1" href="GNU-General-Public-License.html#GNU-General-Public-License">GNU General Public License</a>: GNU General Public License
<li><a accesskey="2" href="GNU-Lesser-General-Public-License.html#GNU-Lesser-General-Public-License">GNU Lesser General Public License</a>: GNU Lesser General Public License
<li><a accesskey="3" href="Lua-License.html#Lua-License">Lua License</a>: Lua License
<li><a accesskey="4" href="LuaFileSystem-License.html#LuaFileSystem-License">LuaFileSystem License</a>: LuaFileSystem License
<li><a accesskey="5" href="xdg_002dutils-License.html#xdg_002dutils-License">xdg-utils License</a>: xdg-utils License
</ul>
</body></html>

76
doc/help/Lua-License.html Normal file
View File

@ -0,0 +1,76 @@
<html lang="en">
<head>
<title>Lua License - medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="License.html#License" title="License">
<link rel="prev" href="GNU-Lesser-General-Public-License.html#GNU-Lesser-General-Public-License" title="GNU Lesser General Public License">
<link rel="next" href="LuaFileSystem-License.html#LuaFileSystem-License" title="LuaFileSystem License">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Lua-License"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="LuaFileSystem-License.html#LuaFileSystem-License">LuaFileSystem License</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="GNU-Lesser-General-Public-License.html#GNU-Lesser-General-Public-License">GNU Lesser General Public License</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="License.html#License">License</a>
<hr>
</div>
<h3 class="section">Lua License</h3>
<p><!-- moo-help-section: LICENSE_LUA -->
<pre class="verbatim">Lua License
-----------
Lua is licensed under the terms of the MIT license reproduced below.
This means that Lua is free software and can be used for both academic
and commercial purposes at absolutely no cost.
For details and rationale, see http://www.lua.org/license.html .
===============================================================================
Copyright (C) 1994-2008 Lua.org, PUC-Rio.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
===============================================================================
(end of COPYRIGHT)
</pre>
</body></html>

View File

@ -0,0 +1,51 @@
<html lang="en">
<head>
<title>LuaFileSystem License - medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="License.html#License" title="License">
<link rel="prev" href="Lua-License.html#Lua-License" title="Lua License">
<link rel="next" href="xdg_002dutils-License.html#xdg_002dutils-License" title="xdg-utils License">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="LuaFileSystem-License"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="xdg_002dutils-License.html#xdg_002dutils-License">xdg-utils License</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Lua-License.html#Lua-License">Lua License</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="License.html#License">License</a>
<hr>
</div>
<h3 class="section">LuaFileSystem License</h3>
<p><!-- moo-help-section: LICENSE_LFS -->
<pre class="verbatim">LuaFileSystem - File System Library for Lua
Copyright 2003-2007 PUC-Rio
http://www.keplerproject.org/luafilesystem
LuaFileSystem is a Lua library developed to complement the set of functions
related to file systems offered by the standard Lua distribution. LuaFileSystem
offers a portable way to access the underlying directory structure and file
attributes. LuaFileSystem is free software and uses the same license as Lua 5.1
Current version is 1.2.1.
</pre>
</body></html>

View File

@ -0,0 +1,101 @@
<html lang="en">
<head>
<title>Managing tools - medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="User_002ddefined-Tools.html#User_002ddefined-Tools" title="User-defined Tools">
<link rel="next" href="Storing-tools-in-files.html#Storing-tools-in-files" title="Storing tools in files">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Managing-tools"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Storing-tools-in-files.html#Storing-tools-in-files">Storing tools in files</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="User_002ddefined-Tools.html#User_002ddefined-Tools">User-defined Tools</a>
<hr>
</div>
<h3 class="section">4.1 Managing tools</h3>
<p><!-- moo-help-section: USER_TOOLS_MANAGING -->
<p>To create a new tool or to modify existing ones, open
<em>Preferences</em> dialog and select <em>Tools</em> in the list on the left.
<p>Select the tool in the list or click the <em>New</em>
button to create a new one. To modify the order in which the tools
appear in the <em>Tools</em> menu (or in the document
context menu), use <em>Up</em> and <em>Down</em> buttons. To rename a tool,
click its name in the list to select it and then click again to
edit the name. Use the <em>Delete</em> button to delete a tool.
<p>The following controls are available to modify the tools behavior:
<dl>
<dt><em>Files</em><dd>Specifies for which files the tool is going to be available.
<br><dt><em>Options</em><dd>Specifies under which conditions the tool should be enabled.
<br><dt><em>Command type</em><dd>The type of the tool: a Python script, a Lua script, or a shell script.
<br><dt><em>Code</em> text field<dd>Here you enter the actual script text.
</dl>
<p><em>Options</em> entry content is a comma-separated list of the following:
<dl>
<dt><var>need-doc</var><dd>the tool needs an open document.
<br><dt><var>need-file</var><dd>the tool will not work in new unsaved documents.
<br><dt><var>need-save</var><dd>the document will be saved before the command is executed.
<br><dt><var>need-save-all</var><dd>all open documents will be saved before the command is executed.
</dl>
<p><em>Files</em> entry content can be the following:
<ul>
<li>a comma-separated list of file patterns, e.g. "<code>*.c,*.h</code>";
<li>a comma-separated list of languages prefixed with "<code>langs:</code>", e.g. "<code>langs: c, c++, objc</code>";
<li>a regular expression matching document filename prefixed with "<code>regex:</code>", e.g. the above
pattern list may be written as "<code>regex:\.[ch]$</code>".
</ul>
<p>Empty entry means that the tool will be available for all documents.
<p>Shell script tools also have the following controls available:
<p><em>Input</em> entry specifies what text from the document should be passed to the command via its standard input:
<dl>
<dt><em>None</em><dd>no input text.
<br><dt><em>Selected lines</em><dd>the lines containing selection or the line containing the cursor in case when no text is selected.
<br><dt><em>Selection</em><dd>exact selected text. This will be different from "Selected lines" if selection does not span whole lines of the document, for instance if it is a single word.
<br><dt><em>Whole document</em><dd>whole document contents.
</dl>
<p><em>Output</em> entry specifies how the standard output of the command should be redirected.
<dl>
<dt><em>None</em><dd>the command output will be discarded.
<br><dt><em>None, asynchronous</em><dd>the command output will be discarded, and the command will be executed in background.
For instance, you should use this if you need to launch some external program like a web browser.
<br><dt><em>Output pane</em><dd>the command output will be displayed in an output pane. This is useful for running programs
like compilers, where you want to see the output.
<br><dt><em>Insert into the document</em><dd>output will be inserted into the current document at the cursor position. It will replace the
text used as an input, if any.
<br><dt><em>New document</em><dd>new document will be created and the command output will be inserted into it.
</dl>
<p><em>Filter</em> combo. If the output pane is used, then it can be passed through a <dfn>filter</dfn>:
the filter can match filenames and line numbers, so when you click the text in the
output pane it will open the corresponding file. This is used for compilers and similar
commands, which output locations of errors in processed files.
</body></html>

View File

@ -0,0 +1,66 @@
<html lang="en">
<head>
<title>Preferences files - medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="prefs_002dlangs_002dand_002dfilters.html#prefs_002dlangs_002dand_002dfilters" title="prefs-langs-and-filters">
<link rel="next" href="Regular-expressions.html#Regular-expressions" title="Regular expressions">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Preferences-files"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Regular-expressions.html#Regular-expressions">Regular expressions</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="prefs_002dlangs_002dand_002dfilters.html#prefs_002dlangs_002dand_002dfilters">prefs-langs-and-filters</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>
<h2 class="chapter">2 Preferences files</h2>
<p><!-- moo-help-section: PREFS_FILE -->
<p>medit preferences are stored in <samp><span class="file">$HOME/.config/meditrc</span></samp> file.
It is an XML file which may be edited to set preferences which have not found
their place in the <em>Preferences</em> dialog.
<p>NOTE: medit reads the preferences file on startup and writes it whenever <em>OK</em>
or <em>Apply</em> button is clicked in the <em>Preferences</em> dialog. Therefore, if you
modify the preferences file, your changes may be overwritten, and they not take
effect until you restart medit.
<p>The following "hidden" settings are available:
<ul>
<li><var>Editor/window_title</var>: Format of the window title. It is a string which may
contain format sequences, which are percent sign followed by a character:
<ul>
<li><code>%a</code>: application name;
<li><code>%b</code>: current document basename;
<li><code>%f</code>: full path of the current document;
<li><code>%u</code>: URI of the current document;
<li><code>%s</code>: the status of the current document, e.g. "<code> [modified]</code>". It is prefixed
with a space, so that "<code>%b%s</code>" produces a nice string;
<li><code>%%</code>: the percent character.
</ul>
Default value is "<code>%a - %f%s</code>" which produces something like "<code>medit - /home/user/file [modified]</code>".
<li><var>Editor/window_title_no_doc</var>: same as <code>Editor/window_title</code>, used when no document is open.
Default value is "<code>%a</code>".
</ul>
</body></html>

View File

@ -0,0 +1,49 @@
<html lang="en">
<head>
<title>Regular expressions - medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="Preferences-files.html#Preferences-files" title="Preferences files">
<link rel="next" href="User_002ddefined-Tools.html#User_002ddefined-Tools" title="User-defined Tools">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Regular-expressions"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="User_002ddefined-Tools.html#User_002ddefined-Tools">User-defined Tools</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Preferences-files.html#Preferences-files">Preferences files</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>
<h2 class="chapter">3 Regular expressions</h2>
<p><!-- moo-help-section: REGEX -->
<p>medit uses regular expressions functionality provided by Glib, which in turn uses
<a href="http://pcre.org/">PCRE</a> library. See
<a href="http://library.gnome.org/devel/glib/stable/glib-regex-syntax.html">Glib manual</a>
for complete description of regular expression syntax.
<p>Regular expression searches in a document text are limited to single lines, unless the
search pattern includes newline character. For example, pattern "<code>.*</code>" will match every
line in the document, pattern "<code>.*\n.*</code>" will match pairs of consecutive lines. This means
that it is mostly impossible to perform searches for text which spawns multiple lines.
</body></html>

47
doc/help/Scripting.html Normal file
View File

@ -0,0 +1,47 @@
<html lang="en">
<head>
<title>Scripting - medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="User_002ddefined-Tools.html#User_002ddefined-Tools" title="User-defined Tools">
<link rel="next" href="License.html#License" title="License">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Scripting"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="License.html#License">License</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="User_002ddefined-Tools.html#User_002ddefined-Tools">User-defined Tools</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>
<h2 class="chapter">5 Scripting</h2>
<p><!-- moo-help-section: SCRIPT -->
<ul class="menu">
<li><a accesskey="1" href="Application-object.html#Application-object">Application object</a>: Application object
<li><a accesskey="2" href="Editor-object.html#Editor-object">Editor object</a>: Editor object
<li><a accesskey="3" href="DocumentWindow-object.html#DocumentWindow-object">DocumentWindow object</a>: DocumentWindow object
<li><a accesskey="4" href="DocumentView-object.html#DocumentView-object">DocumentView object</a>: DocumentView object
<li><a accesskey="5" href="Document-object.html#Document-object">Document object</a>: Document object
</ul>
</body></html>

View File

@ -0,0 +1,57 @@
<html lang="en">
<head>
<title>Shell scripts - medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="User_002ddefined-Tools.html#User_002ddefined-Tools" title="User-defined Tools">
<link rel="prev" href="Storing-tools-in-files.html#Storing-tools-in-files" title="Storing tools in files">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Shell-scripts"></a>
<p>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Storing-tools-in-files.html#Storing-tools-in-files">Storing tools in files</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="User_002ddefined-Tools.html#User_002ddefined-Tools">User-defined Tools</a>
<hr>
</div>
<h3 class="section">4.3 Shell scripts</h3>
<p><!-- moo-help-section: USER_TOOLS_SHELL_SCRIPTS -->
<p>In addition to the document text passed via standard input,
shell scripts have a number of environment variables set. <samp><span class="env">APP_PID</span></samp>
variable is set to the current process process id, so that opening a file in the
same instance of medit is as simple as <code>medit filename</code> (on the other
hand, you will have to use command line options if you need to run a new medit instance).
The following environment variables are set when scripts are executed:
<dl>
<dt><samp><span class="env">DOC</span></samp><dd>the document basename.
<br><dt><samp><span class="env">DOC_DIR</span></samp><dd>the document file directory. The full file path is <samp><span class="file">$DOC_DIR/$DOC</span></samp>.
<br><dt><samp><span class="env">DOC_BASE</span></samp><dd>the basename without extension.
<br><dt><samp><span class="env">DOC_EXT</span></samp><dd>the document filename extension including the period. The basename is always <samp><span class="file">$DOC_BASE$DOC_EXT</span></samp>.
<br><dt><samp><span class="env">LINE</span></samp><dd>the number of the line containing cursor.
<br><dt><samp><span class="env">DATA_DIR</span></samp><dd>the user data directory. For example the tools are stored in <samp><span class="file">$DATA_DIR/menu.cfg</span></samp> file and in files in the <samp><span class="file">$DATA_DIR/tools/</span></samp> directory.
</dl>
<p>Additionally, all processes ran from inside medit will have <samp><span class="file">DATADIR/scripts</span></samp>
directories in <code>$PATH</code>, so you may place some medit-specific programs
or scripts into <samp><span class="file">USERDATADIR/scripts/</span></samp> to be used from shell script tools.
</body></html>

View File

@ -0,0 +1,122 @@
<html lang="en">
<head>
<title>Storing tools in files - medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="User_002ddefined-Tools.html#User_002ddefined-Tools" title="User-defined Tools">
<link rel="prev" href="Managing-tools.html#Managing-tools" title="Managing tools">
<link rel="next" href="Shell-scripts.html#Shell-scripts" title="Shell scripts">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Storing-tools-in-files"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Shell-scripts.html#Shell-scripts">Shell scripts</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Managing-tools.html#Managing-tools">Managing tools</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="User_002ddefined-Tools.html#User_002ddefined-Tools">User-defined Tools</a>
<hr>
</div>
<h3 class="section">4.2 Storing tools in files</h3>
<p><!-- moo-help-section: USER_TOOLS_FILES -->
<p>It is possible to create tools without using the <em>Preferences</em> dialog,
they can be stored in files in <samp><span class="file">tools</span></samp> subfolder of the medit data
folders (or <samp><span class="file">tools-context</span></samp> for tools which appear in the document context
menu). In particular, on Unix systems you can place files into
<samp><span class="file">$HOME/.local/share/medit/tools/</span></samp> folder.
<p>Names of the files in the <samp><span class="file">tools</span></samp> folder are used as their menu item
labels, after stripping first three characters, so you can use trhee-character
prefix to affect the order of the menu items, e.g. you can have <samp><span class="file">00-Do Something</span></samp>,
<samp><span class="file">01-Another tool</span></samp> files to have them in that order in the menu. The files
may be of three types: files with extension "<samp><span class="file">.py</span></samp>", they will be used
as Python scripts; files with extension "<samp><span class="file">.lua</span></samp>", they will be used
as Lua scripts; and executable files, they will be executed in the same way
as shell commands.
<p>To set parameters for a tool, place them on the first or the second line of the file in
the following format:
<pre class="example"> !! <var>key</var>=<var>value</var>; <var>key</var>=<var>value</var>; ... !!
</pre>
<p><var>key</var> may be one of the following:
<dl>
<dt><var>position</var><dd>it can be &ldquo;start&ldquo; or &ldquo;end&ldquo;, and defines whether the menu item will be located at the start or at the end of the menu.
<br><dt><var>id</var><dd>the tool identificator.
<br><dt><var>name</var><dd>the tool name, i.e. the label used in the menu item. Overrides the file name.
<br><dt><var>accel</var><dd>default keyboard accelerator used to invoke this tool.
<br><dt><var>menu</var><dd>the menu to place this tool into. By default the tools are located in the Tools menu, but they can be as well put into any other menu.
<br><dt><var>langs</var><dd>comma-separated list of languages for which this tool will be enabled.
<br><dt><var>file-filter</var><dd>defines for which files this tool will be enabled. The value has the same format as in the <em>Preferences</em> dialog.
<br><dt><var>options</var><dd>same as the <em>Options</em> entry content in the <em>Preferences</em> dialog.
</dl>
<p>In addition to these, you can set input and output options for executable files:
<dl>
<dt><var>input</var><dd>can be <code>none</code>, <code>lines</code>, <code>selection</code>, or <code>doc</code>.
<br><dt><var>output</var><dd>can be <code>none</code>, <code>async</code>, <code>pane</code>, <code>insert</code>, or <code>new-doc</code>.
<br><dt><var>filter</var><dd>the output filter name.
</dl>
<!-- @node Lua scripts -->
<!-- @section Lua scripts -->
<!-- Lua scripts can use the standard Lua library, ``lfs`` library, and ``medit`` package -->
<!-- which provides some text editor API. Lua scripts have the following variables and functions available. -->
<!-- ``doc``: a table with the following fields: -->
<!-- | ``file`` | the document file path. | -->
<!-- | ``name`` | the document file basename. -->
<!-- | ``dir`` | the document file directory. -->
<!-- | ``ext`` | the document filename extension including the period. -->
<!-- | ``base`` | the document filename without the extension: the basename is always ``base..ext``. -->
<!-- ``Cut()``, ``Copy()``, ``Paste()``: clipboard operations. -->
<!-- ``Backspace()``, ``Delete()``: corresponding key actions. -->
<!-- ``Up()``, ``Down()``, ``Left()``, ``Right()``: move cursor as the arrow keys do. -->
<!-- ``Selection()``: returns selected text as a string. Returns ``nil`` when no text is selected. -->
<!-- ``Select(n)``: selects ``n`` characters to the right if ``n`` is positive, and ``-n`` characters to the left if it is negative. -->
<!-- ``Insert(...)``: inserts text at cursor. Namely, it converts each argument to a string and inserts the result into the document. -->
<!-- ``NewLine()``: inserts new line character. -->
<!-- The following functions are provided for more advanced text manipulation. Position in the -->
<!-- document is denoted by the character offset from the beginning of the document, starting -->
<!-- from 1, so the first character is at position 1. Functions which take or return ranges use pairs of -->
<!-- offsets, a pair ``start``, ``end`` denotes range of text from -->
<!-- ``start`` to ``end``, **not** including the character at offset ``end``. For instance, the -->
<!-- single-character range consisting of the first character in the document corresponds to the -->
<!-- pair ``1, 2``. Non-positive offset denotes the end of the document. -->
<!-- ``InsertText(pos, ...)``: inserts text at the position ``pos``. -->
<!-- ``DeleteText(start, end)``: deletes text in the range ``[start..end)``. -->
<!-- ``GetInsert()``: returns position of the cursor in the document. -->
<!-- ``GetSelectionBounds()``: returns positions of the selection start and end. If no text is -->
<!-- selected, returns pair ``pos, pos`` where ``pos`` is the cursor position. -->
<!-- ``GetLine([pos])``: returns line number of the character at the position ``pos``. If ``pos`` -->
<!-- is not specified, it defaults to the cursor position. -->
<!-- ``GetPosAtLine(n)``: returns position at the beginning of the ``n``-th line. -->
<!-- ``LineStart([pos])``: returns the position of the beginning of the line which contains character at ``pos``. -->
<!-- If ``pos`` is not specified, it defaults to the cursor position. -->
<!-- ``LineEnd([pos])``: returns the position of the end of the line which contains character at ``pos``. -->
<!-- If ``pos`` is not specified, it defaults to the cursor position. -->
<!-- ``ForwardLine([pos, [n]])``: returns the position of the beginning of the next line (or -->
<!-- ``n``-th line if ``n`` is specified). ``pos`` defaults to the cursor position if not -->
<!-- specified. -->
<!-- ``BackwardLine([pos, [n]])``: returns the position of the beginning of the previous line -->
<!-- (or ``n``-th line backwards if ``n`` is specified). ``pos`` defaults to the cursor position -->
<!-- if not specified. -->
<!-- ``GetText(start, end)``: returns the text in the ``[start..end)``. If ``start == end``, it -->
<!-- returns an empty string, not ``nil``. -->
</body></html>

View File

@ -0,0 +1,56 @@
<html lang="en">
<head>
<title>User-defined Tools - medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="Regular-expressions.html#Regular-expressions" title="Regular expressions">
<link rel="next" href="Scripting.html#Scripting" title="Scripting">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="User-defined-Tools"></a>
<a name="User_002ddefined-Tools"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Scripting.html#Scripting">Scripting</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Regular-expressions.html#Regular-expressions">Regular expressions</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>
<h2 class="chapter">4 User-defined Tools</h2>
<p><!-- moo-help-section: USER_TOOLS -->
<p>medit allows extending its functionality with user-defined
<dfn>tools</dfn>. It can be a Lua or Python (provided medit has been
built with Python support) script which is executed inside medit,
or a shell script which can use the text of the open document as
its input and/or output.
<p>There are some predefined tools which you can use as
an example or to modify to suit your needs.
<ul class="menu">
<li><a accesskey="1" href="Managing-tools.html#Managing-tools">Managing tools</a>: Managing tools.
<li><a accesskey="2" href="Storing-tools-in-files.html#Storing-tools-in-files">Storing tools in files</a>: Storing tools in files.
<!-- * Lua scripts:: Lua scripts. -->
<li><a accesskey="3" href="Shell-scripts.html#Shell-scripts">Shell scripts</a>: Shell scripts.
</ul>
</body></html>

View File

@ -1,49 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title>License</title>
</HEAD>
<BODY>
<DIV CLASS="header" ID="header">
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="regex-search.html">Search</a></td>
<td width="33%" align="center">Up: <a href="index.html">medit 0.99.0-unstable Manual</a></td>
<td width="33%" align="right">Next: <a href="gpl.html">GNU General Public License</a></td>
</tr></table>
<hr>
<H2>License</H2>
<!-- ##app-license## -->
<P>
medit as a whole is distributed under the terms of the GNU General
Public License, version 2, but most of its code is released under the
GNU Lesser General Public License. Full text of these licenses, as well
as licenses and acknowledgements for third-party software incorporated
in medit, can be found in this section.
</P>
<ul>
<li><a href="gpl.html">GNU General Public License</a></li>
<li><a href="lgpl.html">GNU Lesser General Public License</a></li>
<li><a href="license-lua.html">Lua License</a></li>
<li><a href="license-lua-lfs.html">LuaFileSystem License</a></li>
<li><a href="license-xdg-utils.html">xdg-utils License</a></li>
</ul>
<hr>
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="regex-search.html">Search</a></td>
<td width="33%" align="center">Up: <a href="index.html">medit 0.99.0-unstable Manual</a></td>
<td width="33%" align="right">Next: <a href="gpl.html">GNU General Public License</a></td>
</tr></table>
</BODY></HTML>

View File

@ -1,104 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title>Editing options</title>
</HEAD>
<BODY>
<DIV CLASS="header" ID="header">
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="prefs-file-filters.html">File filters</a></td>
<td width="33%" align="center">Up: <a href="prefs-langs-and-filters.html">Selecting editing options and languages</a></td>
<td width="33%" align="right">Next: <a href="sect-user-tools.html">User-defined Tools</a></td>
</tr></table>
<hr>
<H3>Editing options</H3>
<!-- ##editing-options## -->
<P>
medit has some editing options which can be set in the document text,
or in the <I>Preferences</I> dialog for sets of files or for given syntax
highlighting language.
</P>
<P>
To set the options in the document text, place the following on the first,
second or the last line of the document:
</P>
<PRE>
-%- <em>options</em> -%-
</PRE>
<P>
where <I>options</I> is the option string
</P>
<PRE>
<em>key</em>: <em>value</em>; <em>key</em>: <em>value</em>; ...
</PRE>
<P>
(the latter is the format used also in the <I>Preferences</I> dialog).
</P>
<P>
Values can be strings, integers, or booleans.
</P>
<P>
Booleans are <CODE>yes</CODE>, <CODE>no</CODE>, <CODE>true</CODE>, <CODE>false</CODE>, <CODE>1</CODE>, <CODE>0</CODE>.
</P>
<P>
If a string value contains <CODE>:</CODE> character, then the following syntax may be used: <CODE><em>key</em>=/<em>value</em>/</CODE>.
Any character may be used instead of slash (and it must not occur in the <I>value</I>).
Example: <CODE>word-chars=@-/:@</CODE>
</P>
<P>
The following options are available:
</P>
<TABLE BORDER="1">
<TR>
<TD><CODE>lang</CODE></TD>
<TD>syntax highlighting language to use in this document.</TD>
</TR>
<TR>
<TD><CODE>strip</CODE></TD>
<TD>a boolean value, whether trailing whitespace should be removed from the document on save.</TD>
</TR>
<TR>
<TD><CODE>add-newline</CODE></TD>
<TD>a boolean value, whether the editor should ensure that saved files have a trailing new line character.</TD>
</TR>
<TR>
<TD><CODE>tab-width</CODE></TD>
<TD>displayed width of the Tab character. NOTE: This is not an indentation offset, this is the visual width of a Tab character.</TD>
</TR>
<TR>
<TD><CODE>use-tabs</CODE></TD>
<TD>whether the Tab character should be used for indentation.</TD>
</TR>
<TR>
<TD><CODE>indent-width</CODE></TD>
<TD>an integer specifying indentation offset used when the Tab key is pressed to indent text.</TD>
</TR>
</TABLE>
<P>
medit tries to understand modelines of Vim, Emacs, and Kate text editors, so chances are it will correctly
pick up the conventional settings from source files.
</P>
<ul>
</ul>
<hr>
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="prefs-file-filters.html">File filters</a></td>
<td width="33%" align="center">Up: <a href="prefs-langs-and-filters.html">Selecting editing options and languages</a></td>
<td width="33%" align="right">Next: <a href="sect-user-tools.html">User-defined Tools</a></td>
</tr></table>
</BODY></HTML>

View File

@ -0,0 +1,73 @@
<html lang="en">
<head>
<title>editing-options - medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="prefs_002dlangs_002dand_002dfilters.html#prefs_002dlangs_002dand_002dfilters" title="prefs-langs-and-filters">
<link rel="prev" href="prefs_002dfile_002dfilters.html#prefs_002dfile_002dfilters" title="prefs-file-filters">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="editing-options"></a>
<a name="editing_002doptions"></a>
<p>
Previous:&nbsp;<a rel="previous" accesskey="p" href="prefs_002dfile_002dfilters.html#prefs_002dfile_002dfilters">prefs-file-filters</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="prefs_002dlangs_002dand_002dfilters.html#prefs_002dlangs_002dand_002dfilters">prefs-langs-and-filters</a>
<hr>
</div>
<h3 class="section">1.3 Editing options</h3>
<p><!-- moo-help-section: EDITING_OPTIONS -->
<p>medit has some editing options which can be set in the document text,
or in the <em>Preferences</em> dialog for sets of files or for given syntax
highlighting language.
<p>To set the options in the document text, place the following on the first,
second or the last line of the document:
<pre class="example"> -%- <var>options</var> -%-
</pre>
<p>where <var>options</var> is the option string
<pre class="example"> <var>key</var>: <var>value</var>; <var>key</var>: <var>value</var>; ...
</pre>
<p>(the latter is the format used also in the <em>Preferences</em> dialog).
<p>Values can be strings, integers, or booleans.
<p>Booleans are &lsquo;<samp><span class="samp">yes</span></samp>&rsquo;, &lsquo;<samp><span class="samp">no</span></samp>&rsquo;, &lsquo;<samp><span class="samp">true</span></samp>&rsquo;, &lsquo;<samp><span class="samp">false</span></samp>&rsquo;, &lsquo;<samp><span class="samp">1</span></samp>&rsquo;, &lsquo;<samp><span class="samp">0</span></samp>&rsquo;.
<p>If a string value contains <code>:</code> character, then the following syntax may be used:
<var>key</var><code>=/</code><var>value</var><code>/</code>. Any character may be used instead of slash (and it
must not occur in the <var>value</var>). Example: &lsquo;<samp><span class="samp">word-chars=@-/:@</span></samp>&rsquo;
<p>The following options are available:
<dl>
<dt><var>lang</var><dd>syntax highlighting language to use in this document.
<br><dt><var>strip</var><dd>a boolean value, whether trailing whitespace should be removed from the document on save.
<br><dt><var>add-newline</var><dd>a boolean value, whether the editor should ensure that saved files have a trailing new line character.
<br><dt><var>tab-width</var><dd>displayed width of the Tab character. NOTE: This is not an indentation offset, this is the visual width of a Tab character.
<br><dt><var>use-tabs</var><dd>whether the Tab character should be used for indentation.
<br><dt><var>indent-width</var><dd>an integer specifying indentation offset used when the Tab key is pressed to indent text.
</dl>
<p>medit tries to understand modelines of Vim, Emacs, and Kate text editors, so chances are it will correctly
pick up the conventional settings from source files.
</body></html>

View File

@ -1,47 +1,85 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>medit 0.99.0-unstable Manual</TITLE>
</HEAD>
<BODY>
<DIV CLASS="header" ID="header">
<!--<br><sup>(all sections in one long page)</sup></div>-->
<H1>medit 0.99.0-unstable Manual</H1>
</DIV>
<DIV CLASS="body" ID="body">
<P>
medit 0.99.0-unstable Manual
</P>
<hr>
<h2 style="margin:0;">Contents:</h2>
<html lang="en">
<head>
<title>medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="#Top">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<h1 class="settitle">medit 0.99.0-unstable manual</h1>
<div class="contents">
<h2>Table of Contents</h2>
<ul>
<li><a href="prefs-langs-and-filters.html">Selecting editing options and languages</a><ul><li><a href="prefs-lang-options.html">Language-specific options</a></li>
<li><a href="prefs-file-filters.html">File filters</a></li>
<li><a href="editing-options.html">Editing options</a></li></ul></li>
<li><a href="sect-user-tools.html">User-defined Tools</a><ul><li><a href="prefs-user-tools.html">Managing tools</a></li>
<li><a href="user-tools-files.html">Storing tools in files</a></li>
<li><a href="user-tools-lua.html">Lua scripts</a></li>
<li><a href="user-tools-shell.html">Shell scripts</a></li></ul></li>
<li><a href="prefs-file.html">Preferences files</a></li>
<li><a href="regex.html">Regular expressions</a><ul><li><a href="regex-search.html">Search</a></li></ul></li>
<li><a href="app-license.html">License</a><ul><li><a href="gpl.html">GNU General Public License</a></li>
<li><a href="lgpl.html">GNU Lesser General Public License</a></li>
<li><a href="license-lua.html">Lua License</a></li>
<li><a href="license-lua-lfs.html">LuaFileSystem License</a></li>
<li><a href="license-xdg-utils.html">xdg-utils License</a></li></ul></li>
<li><a name="toc_Top" href="index.html#Top">medit</a>
<li><a name="toc_prefs_002dlangs_002dand_002dfilters" href="prefs_002dlangs_002dand_002dfilters.html#prefs_002dlangs_002dand_002dfilters">1 Selecting editing options and languages</a>
<ul>
<li><a href="prefs_002dlang_002doptions.html#prefs_002dlang_002doptions">1.1 Language-specific options</a>
<li><a href="prefs_002dfile_002dfilters.html#prefs_002dfile_002dfilters">1.2 File filters</a>
<li><a href="editing_002doptions.html#editing_002doptions">1.3 Editing options</a>
</li></ul>
<li><a name="toc_Preferences-files" href="Preferences-files.html#Preferences-files">2 Preferences files</a>
<li><a name="toc_Regular-expressions" href="Regular-expressions.html#Regular-expressions">3 Regular expressions</a>
<li><a name="toc_User_002ddefined-Tools" href="User_002ddefined-Tools.html#User_002ddefined-Tools">4 User-defined Tools</a>
<ul>
<li><a href="Managing-tools.html#Managing-tools">4.1 Managing tools</a>
<li><a href="Storing-tools-in-files.html#Storing-tools-in-files">4.2 Storing tools in files</a>
<li><a href="Shell-scripts.html#Shell-scripts">4.3 Shell scripts</a>
</li></ul>
<li><a name="toc_Scripting" href="Scripting.html#Scripting">5 Scripting</a>
<ul>
<li><a href="Application-object.html#Application-object">5.1 Application object</a>
<li><a href="Editor-object.html#Editor-object">5.2 Editor object</a>
<li><a href="DocumentWindow-object.html#DocumentWindow-object">5.3 DocumentWindow object</a>
<li><a href="DocumentView-object.html#DocumentView-object">5.4 DocumentView object</a>
<li><a href="Document-object.html#Document-object">5.5 Document object</a>
</li></ul>
<li><a name="toc_License" href="License.html#License">License</a>
<ul>
<li><a href="GNU-General-Public-License.html#GNU-General-Public-License">GNU General Public License</a>
<li><a href="GNU-Lesser-General-Public-License.html#GNU-Lesser-General-Public-License">GNU Lesser General Public License</a>
<li><a href="Lua-License.html#Lua-License">Lua License</a>
<li><a href="LuaFileSystem-License.html#LuaFileSystem-License">LuaFileSystem License</a>
<li><a href="xdg_002dutils-License.html#xdg_002dutils-License">xdg-utils License</a>
</li></ul>
</li></ul>
</div>
<div class="node">
<a name="Top"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="prefs_002dlangs_002dand_002dfilters.html#prefs_002dlangs_002dand_002dfilters">prefs-langs-and-filters</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="../index.html#dir">(dir)</a>
<hr>
</div>
<h2 class="unnumbered">medit</h2>
<p>This manual is for medit version 0.99.0-unstable, a text editor.
<ul class="menu">
<li><a accesskey="1" href="prefs_002dlangs_002dand_002dfilters.html#prefs_002dlangs_002dand_002dfilters">prefs-langs-and-filters</a>: Selecting editing options and languages.
<li><a accesskey="2" href="Preferences-files.html#Preferences-files">Preferences files</a>: Preferences files.
<li><a accesskey="3" href="Regular-expressions.html#Regular-expressions">Regular expressions</a>: Regular expressions.
<li><a accesskey="4" href="User_002ddefined-Tools.html#User_002ddefined-Tools">User-defined Tools</a>: User-defined Tools.
<li><a accesskey="5" href="Scripting.html#Scripting">Scripting</a>: Scripting.
<li><a accesskey="6" href="License.html#License">License</a>: License.
</ul>
</BODY></HTML>
</body></html>

View File

@ -1,50 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title>LuaFileSystem License</title>
</HEAD>
<BODY>
<DIV CLASS="header" ID="header">
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="license-lua.html">Lua License</a></td>
<td width="33%" align="center">Up: <a href="app-license.html">License</a></td>
<td width="33%" align="right">Next: <a href="license-xdg-utils.html">xdg-utils License</a></td>
</tr></table>
<hr>
<H3>LuaFileSystem License</H3>
<!-- ##license-lua-lfs## -->
<PRE>
LuaFileSystem - File System Library for Lua
Copyright 2003-2007 PUC-Rio
http://www.keplerproject.org/luafilesystem
LuaFileSystem is a Lua library developed to complement the set of functions
related to file systems offered by the standard Lua distribution. LuaFileSystem
offers a portable way to access the underlying directory structure and file
attributes. LuaFileSystem is free software and uses the same license as Lua 5.1
Current version is 1.2.1.
</PRE>
<P></P>
<ul>
</ul>
<hr>
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="license-lua.html">Lua License</a></td>
<td width="33%" align="center">Up: <a href="app-license.html">License</a></td>
<td width="33%" align="right">Next: <a href="license-xdg-utils.html">xdg-utils License</a></td>
</tr></table>
</BODY></HTML>

View File

@ -1,74 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title>Lua License</title>
</HEAD>
<BODY>
<DIV CLASS="header" ID="header">
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="lgpl.html">GNU Lesser General Public License</a></td>
<td width="33%" align="center">Up: <a href="app-license.html">License</a></td>
<td width="33%" align="right">Next: <a href="license-lua-lfs.html">LuaFileSystem License</a></td>
</tr></table>
<hr>
<H3>Lua License</H3>
<!-- ##license-lua## -->
<PRE>
Lua License
-----------
Lua is licensed under the terms of the MIT license reproduced below.
This means that Lua is free software and can be used for both academic
and commercial purposes at absolutely no cost.
For details and rationale, see http://www.lua.org/license.html .
===============================================================================
Copyright (C) 1994-2008 Lua.org, PUC-Rio.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
===============================================================================
(end of COPYRIGHT)
</PRE>
<ul>
</ul>
<hr>
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="lgpl.html">GNU Lesser General Public License</a></td>
<td width="33%" align="center">Up: <a href="app-license.html">License</a></td>
<td width="33%" align="right">Next: <a href="license-lua-lfs.html">LuaFileSystem License</a></td>
</tr></table>
</BODY></HTML>

View File

@ -1,76 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title>xdg-utils License</title>
</HEAD>
<BODY>
<DIV CLASS="header" ID="header">
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="license-lua-lfs.html">LuaFileSystem License</a></td>
<td width="33%" align="center">Up: <a href="app-license.html">License</a></td>
<td width="33%" align="right">Next: <a href="index.html">medit 0.99.0-unstable Manual</a></td>
</tr></table>
<hr>
<H3>xdg-utils License</H3>
<!-- ##license-xdg-utils## -->
<PRE>
Copyright 2006, Kevin Krammer &lt;kevin.krammer@gmx.at&gt;
Copyright 2006, Jeremy White &lt;jwhite@codeweavers.com&gt;
LICENSE:
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
</PRE>
<P></P>
<P>
<!-- ##fake-dialog-replace## -->
<!-- ##fake-dialog-find## -->
<!-- ##fake-prefs-dialog## -->
<!-- ##fake-prefs-plugins## -->
<!-- ##fake-prefs-accels## -->
<!-- ##fake-prefs-file-selector## -->
<!-- ##fake-dialog-find-in-files## -->
<!-- ##fake-dialog-find-file## -->
<!-- ##fake-file-selector## -->
</P>
</DIV>
<!-- html code generated by txt2tags 2.5 (http://txt2tags.sf.net) -->
<ul>
</ul>
<hr>
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="license-lua-lfs.html">LuaFileSystem License</a></td>
<td width="33%" align="center">Up: <a href="app-license.html">License</a></td>
<td width="33%" align="right">Next: <a href="index.html">medit 0.99.0-unstable Manual</a></td>
</tr></table>
</BODY></HTML>

View File

@ -1,70 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title>File filters</title>
</HEAD>
<BODY>
<DIV CLASS="header" ID="header">
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="prefs-lang-options.html">Language-specific options</a></td>
<td width="33%" align="center">Up: <a href="prefs-langs-and-filters.html">Selecting editing options and languages</a></td>
<td width="33%" align="right">Next: <a href="editing-options.html">Editing options</a></td>
</tr></table>
<hr>
<H3>File filters</H3>
<!-- ##prefs-file-filters## -->
<P>
<I>File filters</I> section allows to customize editing options,
as well as syntax highlighting language, on per-document basis using regular expressions
which are matched against the document filename. Full file paths are used, so one can
have per-directory settings.
</P>
<P>
Use dollar if you need to match ends of filenames, e.g. "<CODE>\.doc$</CODE>" will work as "<CODE>*.doc</CODE>"
pattern.
</P>
<P>
The filters are applied in the order they appear in the list, one by one. All filters
are applied to every file, so several filters may affect options in the same file. In this
way one can set some options for a set of files or a directory, then set or modify some
additional options for certain files in that set, etc.
</P>
<P>
To add a filter, use <I>New</I> button. Click the filter in the list to
select it, then click the <I>Filter</I> or <I>Options</I>
part of it to edit. Use <I>Delete</I> button to delete a filter,
and <I>Up</I> and <I>Down</I> buttons to change the order in
which they are applied.
</P>
<P>
<I>Filter</I> field contains a regular expression matched agains the
document filename. If it is found in the filename, then the options from the
<I>Options</I> field are applied to the document.
</P>
<P>
<I>Options</I> field contains the options, in format described in the
<A href="editing-options.html">Editing options</A> section.
</P>
<ul>
</ul>
<hr>
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="prefs-lang-options.html">Language-specific options</a></td>
<td width="33%" align="center">Up: <a href="prefs-langs-and-filters.html">Selecting editing options and languages</a></td>
<td width="33%" align="right">Next: <a href="editing-options.html">Editing options</a></td>
</tr></table>
</BODY></HTML>

View File

@ -1,71 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title>Preferences files</title>
</HEAD>
<BODY>
<DIV CLASS="header" ID="header">
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="user-tools-shell.html">Shell scripts</a></td>
<td width="33%" align="center">Up: <a href="index.html">medit 0.99.0-unstable Manual</a></td>
<td width="33%" align="right">Next: <a href="regex.html">Regular expressions</a></td>
</tr></table>
<hr>
<H2>Preferences files</H2>
<!-- ##prefs-file## -->
<P>
medit preferences are stored in <CODE>$HOME/.config/meditrc</CODE> file.
It is an XML file which may be edited to set preferences which have not found
their place in the &lt;interface&gt;Preferences&lt;/interface&gt; dialog.
</P>
<P>
NOTE: medit reads the preferences file on startup and writes it whenever <I>OK</I>
or <I>Apply</I> button is clicked in the <I>Preferences</I> dialog. Therefore, if you
modify the preferences file, your changes may be overwritten, and they not take
the effect until you restart medit.
</P>
<P>
The following "hidden" settings are available.
</P>
<UL>
<LI><CODE>Editor/window_title</CODE>: Format of the window title. It is a string which may
contain format sequences: percent sign followed by a character:
<UL>
<LI><CODE>%a</CODE>: application name;
<LI><CODE>%b</CODE>: current document basename;
<LI><CODE>%f</CODE>: full path of the current document;
<LI><CODE>%u</CODE>: URI of the current document;
<LI><CODE>%s</CODE>: the status of the current document, e.g. "`` [modified]``". It is prefixed
with space, so that "<CODE>%b%s</CODE>" will produce a nice string;
<LI><CODE>%%</CODE>: the percent character.
<P></P>
Default value is "<CODE>%a - %f%s</CODE>" which produces something like "<CODE>medit - /home/user/file [modified]</CODE>".
<P></P>
</UL>
<LI><CODE>Editor/window_title_no_doc</CODE>: Same as <CODE>Editor/window_title</CODE>, used when no document is open. Default value is "<CODE>%a</CODE>".
<LI><CODE>Editor/tab_width</CODE>: Visual width of the Tab character, 8 by default.
</UL>
<ul>
</ul>
<hr>
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="user-tools-shell.html">Shell scripts</a></td>
<td width="33%" align="center">Up: <a href="index.html">medit 0.99.0-unstable Manual</a></td>
<td width="33%" align="right">Next: <a href="regex.html">Regular expressions</a></td>
</tr></table>
</BODY></HTML>

View File

@ -1,61 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title>Language-specific options</title>
</HEAD>
<BODY>
<DIV CLASS="header" ID="header">
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="prefs-langs-and-filters.html">Selecting editing options and languages</a></td>
<td width="33%" align="center">Up: <a href="prefs-langs-and-filters.html">Selecting editing options and languages</a></td>
<td width="33%" align="right">Next: <a href="prefs-file-filters.html">File filters</a></td>
</tr></table>
<hr>
<H3>Language-specific options</H3>
<!-- ##prefs-lang-options## -->
<P>
Here you can set editing options on per-language basis, as well as define
for which file patterns and mime types given language should be used.
</P>
<TABLE BORDER="1">
<TR>
<TD><I>Language</I> combo box</TD>
<TD>Choose the language you want to customize. Settings for <CODE>None</CODE> will apply to documents for which no syntax highlighting language was chosen.</TD>
</TR>
<TR>
<TD><I>Mime types</I></TD>
<TD>The given language will be used for files with these mime types, unless the language is chosen based on the filename or overridden in the <I>File filters</I> section.</TD>
</TR>
<TR>
<TD><I>Extensions</I></TD>
<TD>The given language will be used for files whose filenames match these patterns, unless overridden in the <I>File filters</I> section.</TD>
</TR>
<TR>
<TD><I>Options</I></TD>
<TD>Default editing options to use in documents which use the given language. These options can be overridden using <I>File filters</I> section, and options set in the file text have a higher priority as well. See the <A href="editing-options.html">Editing options</A> section for the format of this entry content.</TD>
</TR>
</TABLE>
<ul>
</ul>
<hr>
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="prefs-langs-and-filters.html">Selecting editing options and languages</a></td>
<td width="33%" align="center">Up: <a href="prefs-langs-and-filters.html">Selecting editing options and languages</a></td>
<td width="33%" align="right">Next: <a href="prefs-file-filters.html">File filters</a></td>
</tr></table>
</BODY></HTML>

View File

@ -1,48 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title>Selecting editing options and languages</title>
</HEAD>
<BODY>
<DIV CLASS="header" ID="header">
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="index.html">medit 0.99.0-unstable Manual</a></td>
<td width="33%" align="center">Up: <a href="index.html">medit 0.99.0-unstable Manual</a></td>
<td width="33%" align="right">Next: <a href="prefs-lang-options.html">Language-specific options</a></td>
</tr></table>
<hr>
<H2>Selecting editing options and languages</H2>
<!-- ##prefs-langs-and-filters## -->
<P>
<I>Languages and files</I> tab in the <I>Editor</I>
section of the <I>Preferences</I> dialog allows customizing
how syntax highlighting language and editing options are chosen
depending on the document filename, as well as setting editing options for
all documents which use given language and choosing file patterns and mime types
for which the given language should be used.
</P>
<ul>
<li><a href="prefs-lang-options.html">Language-specific options</a></li>
<li><a href="prefs-file-filters.html">File filters</a></li>
<li><a href="editing-options.html">Editing options</a></li>
</ul>
<hr>
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="index.html">medit 0.99.0-unstable Manual</a></td>
<td width="33%" align="center">Up: <a href="index.html">medit 0.99.0-unstable Manual</a></td>
<td width="33%" align="right">Next: <a href="prefs-lang-options.html">Language-specific options</a></td>
</tr></table>
</BODY></HTML>

View File

@ -1,164 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title>Managing tools</title>
</HEAD>
<BODY>
<DIV CLASS="header" ID="header">
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="sect-user-tools.html">User-defined Tools</a></td>
<td width="33%" align="center">Up: <a href="sect-user-tools.html">User-defined Tools</a></td>
<td width="33%" align="right">Next: <a href="user-tools-files.html">Storing tools in files</a></td>
</tr></table>
<hr>
<H3>Managing tools</H3>
<!-- ##prefs-user-tools## -->
<P>
To create a new tool or to modify existing ones, open
<I>Preferences</I> dialog and select <I>Tools</I> in the list on the left.
</P>
<P>
Select the tool in the list or click the <I>New</I>
button to create a new one. To modify the order in which the tools
appear in the <I>Tools</I> menu (or in the document
context menu), use <I>Up</I> and <I>Down</I> buttons. To rename a tool,
click its name in the list to select it and then click again to
edit the name. Use the <I>Delete</I> button to delete a tool.
</P>
<P>
The following controls are available to modify the tools behavior:
</P>
<TABLE BORDER="1">
<TR>
<TD><I>Files</I></TD>
<TD>Specifies for which files the tool is going to be available.</TD>
</TR>
<TR>
<TD><I>Options</I></TD>
<TD>Specifies under which conditions the tool should be enabled.</TD>
</TR>
<TR>
<TD><I>Command type</I></TD>
<TD>The type of the tool: a Python script, a Lua script, or a shell script.</TD>
</TR>
<TR>
<TD><I>Code text field</I></TD>
<TD>Here you enter the actual script text.</TD>
</TR>
</TABLE>
<P>
<I>Options</I> entry content is a comma-separated list of the following:
</P>
<TABLE BORDER="1">
<TR>
<TD><CODE>need-doc</CODE></TD>
<TD>the tool needs an open document</TD>
</TR>
<TR>
<TD><CODE>need-file</CODE></TD>
<TD>the tool will not work in new unsaved documents.</TD>
</TR>
<TR>
<TD><CODE>need-save</CODE></TD>
<TD>the document will be saved before the command is executed.</TD>
</TR>
<TR>
<TD><CODE>need-save-all</CODE></TD>
<TD>all open documents will be saved before the command is executed.</TD>
</TR>
</TABLE>
<P>
<I>Files</I> entry content can be the following:
</P>
<UL>
<LI>a comma-separated list of file patterns, e.g. "<CODE>*.c,*.h</CODE>";
<LI>a comma-separated list of languages prefixed with "<CODE>langs:</CODE>", e.g. "<CODE>langs: c, c++, objc</CODE>";
<LI>a regular expression matching document filename prefixed with "<CODE>regex:</CODE>", e.g. the above
pattern list may be written as "<CODE>regex:\.[ch]$</CODE>".
</UL>
<P>
Empty entry means that the tool will be available for all documents.
</P>
<P>
Shell script tools also have the following controls available:
</P>
<P>
<I>Input</I> entry specifies what text from the document should be passed to the command via its standard input:
</P>
<TABLE BORDER="1">
<TR>
<TD><CODE>None</CODE></TD>
<TD>no input text.</TD>
</TR>
<TR>
<TD><CODE>Selected lines</CODE></TD>
<TD>the lines containing selection or the line containing the cursor in case when no text is selected.</TD>
</TR>
<TR>
<TD><CODE>Selection</CODE></TD>
<TD>exact selected text. This will be different from "Selected lines" if selection does not span whole lines of the document, for instance if it is a single word.</TD>
</TR>
<TR>
<TD><CODE>Whole document</CODE></TD>
<TD>whole document contents.</TD>
</TR>
</TABLE>
<P>
<I>Output</I> entry specifies how the standard output of the command should be redirected.
</P>
<TABLE BORDER="1">
<TR>
<TD><CODE>None</CODE></TD>
<TD>the command output will be suppressed.</TD>
</TR>
<TR>
<TD><CODE>None, asynchronous</CODE></TD>
<TD>the command output will be suppressed, and the command will be executed in background. For instance, you should use this if you need to launch some external program like a web browser.</TD>
</TR>
<TR>
<TD><CODE>Output pane</CODE></TD>
<TD>the command output will be displayed in an output pane. This is useful for running programs like compilers, where you want to see the output.</TD>
</TR>
<TR>
<TD><CODE>Insert into the document</CODE></TD>
<TD>output will be inserted into the current document at the cursor position. It will replace the text used as an input, if any.</TD>
</TR>
<TR>
<TD><CODE>New document</CODE></TD>
<TD>new document will be created and the command output will be inserted into it.</TD>
</TR>
</TABLE>
<P>
<I>Filter</I> combo. If the output pane is used, then it can be passed through a <I>filter</I>:
the filter can match filenames and line numbers, so when you click the text in the
output pane it will open the corresponding file. This is used for compilers and similar
commands, which output locations of errors in processed files.
</P>
<ul>
</ul>
<hr>
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="sect-user-tools.html">User-defined Tools</a></td>
<td width="33%" align="center">Up: <a href="sect-user-tools.html">User-defined Tools</a></td>
<td width="33%" align="right">Next: <a href="user-tools-files.html">Storing tools in files</a></td>
</tr></table>
</BODY></HTML>

View File

@ -0,0 +1,67 @@
<html lang="en">
<head>
<title>prefs-file-filters - medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="prefs_002dlangs_002dand_002dfilters.html#prefs_002dlangs_002dand_002dfilters" title="prefs-langs-and-filters">
<link rel="prev" href="prefs_002dlang_002doptions.html#prefs_002dlang_002doptions" title="prefs-lang-options">
<link rel="next" href="editing_002doptions.html#editing_002doptions" title="editing-options">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="prefs-file-filters"></a>
<a name="prefs_002dfile_002dfilters"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="editing_002doptions.html#editing_002doptions">editing-options</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="prefs_002dlang_002doptions.html#prefs_002dlang_002doptions">prefs-lang-options</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="prefs_002dlangs_002dand_002dfilters.html#prefs_002dlangs_002dand_002dfilters">prefs-langs-and-filters</a>
<hr>
</div>
<h3 class="section">1.2 File filters</h3>
<p><!-- moo-help-section: PREFS_FILE_FILTERS -->
<p><em>File filters</em> section allows to customize editing options,
as well as syntax highlighting language, on per-document basis using regular
expressions which are matched against the document filename. Full file paths are used,
so one can have per-directory settings.
<p>Use dollar if you need to match ends of filenames, e.g. "<code>\.doc$</code>" will work as
"<code>*.doc</code>" pattern.
<p>The filters are applied in the order they appear in the list, one by one. All filters
are applied to every file, so several filters may affect options in the same file. In
this way one can set some options for a set of files or a directory, then set or modify
some additional options for certain files in that set, etc.
<p>To add a filter, use <em>New</em> button. Click the filter in the list to
select it, then click the <em>Filter</em> or <em>Options</em>
part of it to edit. Use <em>Delete</em> button to delete a filter,
and <em>Up</em> and <em>Down</em> buttons to change the order in
which they are applied.
<p><em>Filter</em> field contains a regular expression matched agains the
document filename. If it is found in the filename, then the options from the
<em>Options</em> field are applied to the document.
<p><em>Options</em> field contains the options, in format described in
section <a href="editing_002doptions.html#editing_002doptions">editing-options</a>.
</body></html>

View File

@ -0,0 +1,54 @@
<html lang="en">
<head>
<title>prefs-lang-options - medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="prefs_002dlangs_002dand_002dfilters.html#prefs_002dlangs_002dand_002dfilters" title="prefs-langs-and-filters">
<link rel="next" href="prefs_002dfile_002dfilters.html#prefs_002dfile_002dfilters" title="prefs-file-filters">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="prefs-lang-options"></a>
<a name="prefs_002dlang_002doptions"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="prefs_002dfile_002dfilters.html#prefs_002dfile_002dfilters">prefs-file-filters</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="prefs_002dlangs_002dand_002dfilters.html#prefs_002dlangs_002dand_002dfilters">prefs-langs-and-filters</a>
<hr>
</div>
<h3 class="section">1.1 Language-specific options</h3>
<p><!-- moo-help-section: PREFS_LANGS_OPTIONS -->
<p>Here you can set editing options on per-language basis, as well as define
for which file patterns and mime types given language should be used.
<dl>
<dt><em>Language</em> combo box<dd>Choose the language you want to customize. Settings for <code>None</code> will apply to
documents for which no syntax highlighting language was chosen.
<br><dt><em>Mime types</em><dd>The given language will be used for files with these mime types, unless the language
is chosen based on the filename or overridden in the <em>File filters</em> section.
<br><dt><em>Extensions</em><dd>The given language will be used for files whose filenames match these patterns,
unless overridden in the <em>File filters</em> section.
<br><dt><em>Options</em><dd>Default editing options to use in documents which use the given language. These
options can be overridden using <em>File filters</em> section, and options set
in the file text have a higher priority as well. See section <a href="editing_002doptions.html#editing_002doptions">editing-options</a>
for the format of this entry content.
</dl>
</body></html>

View File

@ -0,0 +1,53 @@
<html lang="en">
<head>
<title>prefs-langs-and-filters - medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="index.html#Top" title="Top">
<link rel="next" href="Preferences-files.html#Preferences-files" title="Preferences files">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="prefs-langs-and-filters"></a>
<a name="prefs_002dlangs_002dand_002dfilters"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Preferences-files.html#Preferences-files">Preferences files</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="index.html#Top">Top</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>
<h2 class="chapter">1 Selecting editing options and languages</h2>
<p><!-- moo-help-section: PREFS_LANGS_AND_FILTERS -->
<p><em>Languages and files</em> tab in the <em>Editor</em>
section of the <em>Preferences</em> dialog allows customizing
how syntax highlighting language and editing options are chosen
depending on the document filename, as well as setting editing options for
all documents which use given language and choosing file patterns and mime types
for which the given language should be used.
<ul class="menu">
<li><a accesskey="1" href="prefs_002dlang_002doptions.html#prefs_002dlang_002doptions">prefs-lang-options</a>: Language-specific options.
<li><a accesskey="2" href="prefs_002dfile_002dfilters.html#prefs_002dfile_002dfilters">prefs-file-filters</a>: File filters.
<li><a accesskey="3" href="editing_002doptions.html#editing_002doptions">editing-options</a>: Editing options.
</ul>
</body></html>

View File

@ -1,44 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title>Search</title>
</HEAD>
<BODY>
<DIV CLASS="header" ID="header">
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="regex.html">Regular expressions</a></td>
<td width="33%" align="center">Up: <a href="regex.html">Regular expressions</a></td>
<td width="33%" align="right">Next: <a href="app-license.html">License</a></td>
</tr></table>
<hr>
<H3>Search</H3>
<!-- ##regex-search## -->
<P>
Regular expression searches in a document text are limited to single lines, unless the
search pattern includes newline. For example, pattern ".*" will match every line in the
document, pattern ".*\n.*" will match pairs of consecutive lines. This means that it is
mostly impossible to perform searches for text which spawns multiple lines.
</P>
<ul>
</ul>
<hr>
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="regex.html">Regular expressions</a></td>
<td width="33%" align="center">Up: <a href="regex.html">Regular expressions</a></td>
<td width="33%" align="right">Next: <a href="app-license.html">License</a></td>
</tr></table>
</BODY></HTML>

View File

@ -1,43 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title>Regular expressions</title>
</HEAD>
<BODY>
<DIV CLASS="header" ID="header">
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="prefs-file.html">Preferences files</a></td>
<td width="33%" align="center">Up: <a href="index.html">medit 0.99.0-unstable Manual</a></td>
<td width="33%" align="right">Next: <a href="regex-search.html">Search</a></td>
</tr></table>
<hr>
<H2>Regular expressions</H2>
<!-- ##regex## -->
<P>
Medit uses regular expressions functionality provided by Glib, which in turn uses
<A HREF="http://pcre.org/">PCRE</A> library. See <A HREF="http://library.gnome.org/devel/glib/stable/glib-regex-syntax.html">Glib manual</A>
for complete description of regular expressions syntax.
</P>
<ul>
<li><a href="regex-search.html">Search</a></li>
</ul>
<hr>
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="prefs-file.html">Preferences files</a></td>
<td width="33%" align="center">Up: <a href="index.html">medit 0.99.0-unstable Manual</a></td>
<td width="33%" align="right">Next: <a href="regex-search.html">Search</a></td>
</tr></table>
</BODY></HTML>

View File

@ -1,52 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title>User-defined Tools</title>
</HEAD>
<BODY>
<DIV CLASS="header" ID="header">
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="editing-options.html">Editing options</a></td>
<td width="33%" align="center">Up: <a href="index.html">medit 0.99.0-unstable Manual</a></td>
<td width="33%" align="right">Next: <a href="prefs-user-tools.html">Managing tools</a></td>
</tr></table>
<hr>
<H2>User-defined Tools</H2>
<!-- ##sect-user-tools## -->
<P>
medit allows extending its functionality with user-defined
<I>tools</I>. It can be a Lua or Python (provided medit has been
built with Python support) script which is executed inside medit,
or a shell script which can use the text of the open document as
its input and/or output.
</P>
<P>
There are some predefined tools which you can use as
an example or to modify to suit your needs.
</P>
<ul>
<li><a href="prefs-user-tools.html">Managing tools</a></li>
<li><a href="user-tools-files.html">Storing tools in files</a></li>
<li><a href="user-tools-lua.html">Lua scripts</a></li>
<li><a href="user-tools-shell.html">Shell scripts</a></li>
</ul>
<hr>
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="editing-options.html">Editing options</a></td>
<td width="33%" align="center">Up: <a href="index.html">medit 0.99.0-unstable Manual</a></td>
<td width="33%" align="right">Next: <a href="prefs-user-tools.html">Managing tools</a></td>
</tr></table>
</BODY></HTML>

View File

@ -1,123 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title>Storing tools in files</title>
</HEAD>
<BODY>
<DIV CLASS="header" ID="header">
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="prefs-user-tools.html">Managing tools</a></td>
<td width="33%" align="center">Up: <a href="sect-user-tools.html">User-defined Tools</a></td>
<td width="33%" align="right">Next: <a href="user-tools-lua.html">Lua scripts</a></td>
</tr></table>
<hr>
<H3>Storing tools in files</H3>
<!-- ##user-tools-files## -->
<P>
It is possible to create tools without using the <I>Preferences</I> dialog,
they can be stored in files in <CODE>tools</CODE> subfolder of the medit data
folders (or <CODE>tools-context</CODE> for tools which appear in the document context
menu). In particular, on Unix systems you can place files into
<CODE>$HOME/.local/share/medit/tools/</CODE> folder.
</P>
<P>
Names of the files in the <CODE>tools</CODE> folder are used as their menu item
labels, after stripping first three characters, so you can use trhee-character
prefix to affect the order of the menu items, e.g. you can have <CODE>00-Do Something</CODE>,
<CODE>01-Another tool</CODE> files to have them in that order in the menu. The files
may be of three types: files with extension "<CODE>.py</CODE>", they will be used
as Python scripts; files with extension "<CODE>.lua</CODE>", they will be used
as Lua scripts; and executable files, they will be executed in the same way
as shell commands.
</P>
<P>
To set parameters for a tool, place them on the first or the second line of the file in
the following format:
</P>
<PRE>
!! <em>key</em>=<em>value</em>; <em>key</em>=<em>value</em>; ... !!
</PRE>
<P></P>
<P>
<I>key</I> may be one of the following:
</P>
<TABLE BORDER="1">
<TR>
<TD><CODE>position</CODE></TD>
<TD>it can be <CODE>start</CODE> or <CODE>end</CODE>, and defines whether the menu item will be located at the start or at the end of the menu.</TD>
</TR>
<TR>
<TD><CODE>id</CODE></TD>
<TD>the tool identificator.</TD>
</TR>
<TR>
<TD><CODE>name</CODE></TD>
<TD>the tool name, i.e. the label used in the menu item. Overrides the file name.</TD>
</TR>
<TR>
<TD><CODE>os</CODE></TD>
<TD><CODE>windows</CODE> or <CODE>unix</CODE>. If specified, then the tool will not be used when medit is running on a different operating system.</TD>
</TR>
<TR>
<TD><CODE>accel</CODE></TD>
<TD>default keyboard accelerator used to invoke this tool.</TD>
</TR>
<TR>
<TD><CODE>menu</CODE></TD>
<TD>the menu to place this tool into. By default the tools are located in the Tools menu, but they can be as well put into any other menu.</TD>
</TR>
<TR>
<TD><CODE>langs</CODE></TD>
<TD>comma-separated list of languages for which this tool will be enabled.</TD>
</TR>
<TR>
<TD><CODE>file-filter</CODE></TD>
<TD>defines for which files this tool will be enabled. The value has the same format as in the <I>Preferences</I> dialog.</TD>
</TR>
<TR>
<TD><CODE>options</CODE></TD>
<TD>same as the <I>Options</I> entry content in the <I>Preferences</I> dialog.</TD>
</TR>
</TABLE>
<P>
In addition to these, you can set input and output options for executable files:
</P>
<TABLE BORDER="1">
<TR>
<TD><CODE>input</CODE></TD>
<TD>can be <CODE>none</CODE>, <CODE>lines</CODE>, <CODE>selection</CODE>, or <CODE>doc</CODE>.</TD>
</TR>
<TR>
<TD><CODE>output</CODE></TD>
<TD>can be <CODE>none</CODE>, <CODE>async</CODE>, <CODE>pane</CODE>, <CODE>insert</CODE>, or <CODE>new-doc</CODE>.</TD>
</TR>
<TR>
<TD><CODE>filter</CODE></TD>
<TD>the output filter name.</TD>
</TR>
</TABLE>
<ul>
</ul>
<hr>
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="prefs-user-tools.html">Managing tools</a></td>
<td width="33%" align="center">Up: <a href="sect-user-tools.html">User-defined Tools</a></td>
<td width="33%" align="right">Next: <a href="user-tools-lua.html">Lua scripts</a></td>
</tr></table>
</BODY></HTML>

View File

@ -1,108 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title>Lua scripts</title>
</HEAD>
<BODY>
<DIV CLASS="header" ID="header">
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="user-tools-files.html">Storing tools in files</a></td>
<td width="33%" align="center">Up: <a href="sect-user-tools.html">User-defined Tools</a></td>
<td width="33%" align="right">Next: <a href="user-tools-shell.html">Shell scripts</a></td>
</tr></table>
<hr>
<H3>Lua scripts</H3>
<!-- ##user-tools-lua## -->
<P>
Lua scripts can use the standard Lua library, <CODE>lfs</CODE> library, and <CODE>medit</CODE> package
which provides some text editor API. Lua scripts have the following variables and functions available.
</P>
<UL>
<LI><CODE>doc</CODE>: a table with the following fields:
</UL>
<TABLE ALIGN="center" BORDER="1">
<TR>
<TD><CODE>file</CODE></TD>
<TD>the document file path.</TD>
</TR>
<TR>
<TD><CODE>name</CODE></TD>
<TD>the document file basename.</TD>
</TR>
<TR>
<TD><CODE>dir</CODE></TD>
<TD>the document file directory.</TD>
</TR>
<TR>
<TD><CODE>ext</CODE></TD>
<TD>the document filename extension including the period.</TD>
</TR>
<TR>
<TD><CODE>base</CODE></TD>
<TD>the document filename without the extension: the basename is always <CODE>base..ext</CODE>.</TD>
</TR>
</TABLE>
<UL>
<LI><CODE>Cut()</CODE>, <CODE>Copy()</CODE>, <CODE>Paste()</CODE>: clipboard operations.
<LI><CODE>Backspace()</CODE>, <CODE>Delete()</CODE>: corresponding key actions.
<LI><CODE>Up()</CODE>, <CODE>Down()</CODE>, <CODE>Left()</CODE>, <CODE>Right()</CODE>: move cursor as the arrow keys do.
<LI><CODE>Selection()</CODE>: returns selected text as a string. Returns <CODE>nil</CODE> when no text is selected.
<LI><CODE>Select(n)</CODE>: selects <CODE>n</CODE> characters to the right if <CODE>n</CODE> is positive, and <CODE>-n</CODE> characters to the left if it is negative.
<LI><CODE>Insert(...)</CODE>: inserts text at cursor. Namely, it converts each argument to a string and inserts the result into the document.
<LI><CODE>NewLine()</CODE>: inserts new line character.
<P></P>
The following functions are provided for more advanced text manipulation. Position in the
document is denoted by the character offset from the beginning of the document, starting
from 1, so the first character is at position 1. Functions which take or return ranges use pairs of
offsets, a pair <CODE>start</CODE>, <CODE>end</CODE> denotes range of text from
<CODE>start</CODE> to <CODE>end</CODE>, <B>not</B> including the character at offset <CODE>end</CODE>. For instance, the
single-character range consisting of the first character in the document corresponds to the
pair <CODE>1, 2</CODE>. Non-positive offset denotes the end of the document.
<P></P>
<LI><CODE>InsertText(pos, ...)</CODE>: inserts text at the position <CODE>pos</CODE>.
<LI><CODE>DeleteText(start, end)</CODE>: deletes text in the range <CODE>[start..end)</CODE>.
<LI><CODE>GetInsert()</CODE>: returns position of the cursor in the document.
<LI><CODE>GetSelectionBounds()</CODE>: returns positions of the selection start and end. If no text is
selected, returns pair <CODE>pos, pos</CODE> where <CODE>pos</CODE> is the cursor position.
<LI><CODE>GetLine([pos])</CODE>: returns line number of the character at the position <CODE>pos</CODE>. If <CODE>pos</CODE>
is not specified, it defaults to the cursor position.
<LI><CODE>GetPosAtLine(n)</CODE>: returns position at the beginning of the <CODE>n</CODE>-th line.
<LI><CODE>LineStart([pos])</CODE>: returns the position of the beginning of the line which contains character at <CODE>pos</CODE>.
If <CODE>pos</CODE> is not specified, it defaults to the cursor position.
<LI><CODE>LineEnd([pos])</CODE>: returns the position of the end of the line which contains character at <CODE>pos</CODE>.
If <CODE>pos</CODE> is not specified, it defaults to the cursor position.
<LI><CODE>ForwardLine([pos, [n]])</CODE>: returns the position of the beginning of the next line (or
<CODE>n</CODE>-th line if <CODE>n</CODE> is specified). <CODE>pos</CODE> defaults to the cursor position if not
specified.
<LI><CODE>BackwardLine([pos, [n]])</CODE>: returns the position of the beginning of the previous line
(or <CODE>n</CODE>-th line backwards if <CODE>n</CODE> is specified). <CODE>pos</CODE> defaults to the cursor position
if not specified.
<LI><CODE>GetText(start, end)</CODE>: returns the text in the <CODE>[start..end)</CODE>. If <CODE>start == end</CODE>, it
returns an empty string, not <CODE>nil</CODE>.
</UL>
<ul>
</ul>
<hr>
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="user-tools-files.html">Storing tools in files</a></td>
<td width="33%" align="center">Up: <a href="sect-user-tools.html">User-defined Tools</a></td>
<td width="33%" align="right">Next: <a href="user-tools-shell.html">Shell scripts</a></td>
</tr></table>
</BODY></HTML>

View File

@ -1,78 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title>Shell scripts</title>
</HEAD>
<BODY>
<DIV CLASS="header" ID="header">
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="user-tools-lua.html">Lua scripts</a></td>
<td width="33%" align="center">Up: <a href="sect-user-tools.html">User-defined Tools</a></td>
<td width="33%" align="right">Next: <a href="prefs-file.html">Preferences files</a></td>
</tr></table>
<hr>
<H3>Shell scripts</H3>
<!-- ##user-tools-shell## -->
<P>
In addition to the document text passed via standard input,
shell scripts have a number of environment variables set. <CODE>$APP_PID</CODE>
variable is set to the current process process id, so that opening a file in the
same instance of medit is as simple as <CODE>medit filename</CODE> (on the other
hand, you will have to use command line options if you need to run a new medit instance).
The following environment variables are set when scripts are executed:
</P>
<TABLE BORDER="1">
<TR>
<TD><CODE>DOC</CODE></TD>
<TD>the document basename.</TD>
</TR>
<TR>
<TD><CODE>DOC_DIR</CODE></TD>
<TD>the document file directory. The full file path is <CODE>$DOC_DIR/$DOC</CODE>.</TD>
</TR>
<TR>
<TD><CODE>DOC_BASE</CODE></TD>
<TD>the basename without extension.</TD>
</TR>
<TR>
<TD><CODE>DOC_EXT</CODE></TD>
<TD>the document filename extension including the period. The basename is always <CODE>$DOC_BASE$DOC_EXT</CODE>.</TD>
</TR>
<TR>
<TD><CODE>LINE</CODE></TD>
<TD>the number of the line containing cursor.</TD>
</TR>
<TR>
<TD><CODE>DATA_DIR</CODE></TD>
<TD>the user data directory. For example the tools are stored in <CODE>$DATA_DIR/menu.cfg</CODE> file and in files in the <CODE>$DATA_DIR/tools/</CODE> directory.</TD>
</TR>
</TABLE>
<P>
Additionally, all processes ran from inside medit will have <CODE>DATADIR/scripts</CODE>
directories in <CODE>$PATH</CODE>, so you may place some medit-specific programs
or scripts into <CODE>USERDATADIR/scripts/</CODE> to be used from shell script tools.
</P>
<ul>
</ul>
<hr>
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="user-tools-lua.html">Lua scripts</a></td>
<td width="33%" align="center">Up: <a href="sect-user-tools.html">User-defined Tools</a></td>
<td width="33%" align="right">Next: <a href="prefs-file.html">Preferences files</a></td>
</tr></table>
</BODY></HTML>

View File

@ -0,0 +1,63 @@
<html lang="en">
<head>
<title>xdg-utils License - medit 0.99.0-unstable manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="medit 0.99.0-unstable manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="License.html#License" title="License">
<link rel="prev" href="LuaFileSystem-License.html#LuaFileSystem-License" title="LuaFileSystem License">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="xdg-utils-License"></a>
<a name="xdg_002dutils-License"></a>
<p>
Previous:&nbsp;<a rel="previous" accesskey="p" href="LuaFileSystem-License.html#LuaFileSystem-License">LuaFileSystem License</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="License.html#License">License</a>
<hr>
</div>
<h3 class="section">xdg-utils License</h3>
<p><!-- moo-help-section: LICENSE_XDG_UTILS -->
<pre class="verbatim">Copyright 2006, Kevin Krammer &lt;kevin.krammer@gmx.at>
Copyright 2006, Jeremy White &lt;jwhite@codeweavers.com>
LICENSE:
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
</pre>
</body></html>

View File

@ -1,23 +1,40 @@
@node License
@unnumbered License
@helpsection{APP_LICENSE}
== License ==[app-license]
APPNAME as a whole is distributed under the terms of the GNU General
@medit{} as a whole is distributed under the terms of the GNU General
Public License, version 2, but most of its code is released under the
GNU Lesser General Public License. Full text of these licenses, as well
as licenses and acknowledgements for third-party software incorporated
in APPNAME, can be found in this section.
in @medit{}, can be found in this section.
=== GNU General Public License ===[gpl]
%!include: ``../COPYING.GPL``
@menu
* GNU General Public License:: GNU General Public License
* GNU Lesser General Public License:: GNU Lesser General Public License
* Lua License:: Lua License
* LuaFileSystem License:: LuaFileSystem License
* xdg-utils License:: xdg-utils License
@end menu
=== GNU Lesser General Public License ===[lgpl]
%!include: ``../COPYING``
@node GNU General Public License
@section GNU General Public License
@helpsection{LICENSE_GPL}
@verbatiminclude ../COPYING.GPL
=== Lua License ===[license-lua]
%!include: ``../moo/moolua/COPYRIGHT``
@node GNU Lesser General Public License
@section GNU Lesser General Public License
@helpsection{LICENSE_LGPL}
@verbatiminclude ../COPYING
=== LuaFileSystem License ===[license-lua-lfs]
```
@node Lua License
@section Lua License
@helpsection{LICENSE_LUA}
@verbatiminclude ../moo/moolua/COPYRIGHT
@node LuaFileSystem License
@section LuaFileSystem License
@helpsection{LICENSE_LFS}
@verbatim
LuaFileSystem - File System Library for Lua
Copyright 2003-2007 PUC-Rio
http://www.keplerproject.org/luafilesystem
@ -27,10 +44,12 @@ related to file systems offered by the standard Lua distribution. LuaFileSystem
offers a portable way to access the underlying directory structure and file
attributes. LuaFileSystem is free software and uses the same license as Lua 5.1
Current version is 1.2.1.
```
@end verbatim
=== xdg-utils License ===[license-xdg-utils]
```
@node xdg-utils License
@section xdg-utils License
@helpsection{LICENSE_XDG_UTILS}
@verbatim
Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at>
Copyright 2006, Jeremy White <jwhite@codeweavers.com>
@ -53,5 +72,4 @@ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
```
@end verbatim

View File

@ -1,107 +0,0 @@
MEDIT
August 2010
%!encoding: UTF-8
= NAME =
medit - text editor
= SYNOPSIS =
**medit** [//OPTION//]... [//FILES//]
= DESCRIPTION =
**medit** is a text editor.
= OPTIONS =
: **-n**, **--new-app**
run new instance of **medit**. By default **medit** opens //FILES//
(or creates a new document if none are given) in an existing instance
of application
: **-s**, **--use-session**[=//yes|no//]
load and save session. By default **medit** does it when **-n** is not used.
If this option is not given on command line then medit uses the corresponding
preferences setting.
: **--pid** //PID//
use existing instance with process id //PID//.
: **--app-name** //NAME//
use instance name //NAME//. If an instance with this name is already running,
then it will send files given on the command line to that instance and exit.
: **-e**, **--encoding** //ENCODING//
use provided character encoding to open the file
: **-l**, **--line** //LINE//
open file and position cursor on line //LINE//. Alternatively
line number may be specified with filename, e.g.
medit foo.txt:12
: **-r**, **--reload**
automatically reload opened file if it was modified on disk by another program.
: **-w**, **--new-window**
open file in a new window.
: **-t**, **--new-tab**
open file in a new tab.
: **--log-file** //FILE//
write debug output into //FILE//. This option is only useful on Windows.
: **--log-window**
show debug output in a log window. This option is only useful on Windows.
: **--debug** //DOMAINS//
enable debug output for //DOMAINS// (if **medit** was compiled with
--enable-debug option).
: **--exec** //STRING//
execute python code in //STRING// in an existing instance.
: **--exec-file** //FILE//
execute python file //FILE// in an existing instance.
: **-h**, **--help**
show summary of options.
: **-v**, **--version**
show program version.
: //FILES//
list of files to open. Filenames may include line numbers after colon,
e.g. /tmp/file.txt:200. Trailing colon is ignored.
= ENVIRONMENT VARIABLES =
: MEDIT_PID
if set, it is used as --pid argument. When medit spawns a process (e.g. a DVI viewer) it sets
MEDIT_PID to its own process id, so the child process may in turn simply use 'medit filename'
to open a file (e.g. for inverse DVI search).
= CONTACT =
http://mooedit.sourceforge.net/contact.html
= AUTHOR =
Written and maintained by Yevgen Muntyan <emuntyan@sourceforge.net>
% = COPYRIGHT =
%
% 2004-2010 Yevgen Muntyan <emuntyan@sourceforge.net>
%
% medit is a free software.

View File

@ -1,107 +0,0 @@
MEDIT
August 2010
%!encoding: UTF-8
= NAME =
medit - text editor
= SYNOPSIS =
**medit** [//OPTION//]... [//FILES//]
= DESCRIPTION =
**medit** is a text editor.
= OPTIONS =
: **-n**, **--new-app**
run new instance of **medit**. By default **medit** opens //FILES//
(or creates a new document if none are given) in an existing instance
of application
: **-s**, **--use-session**[=//yes|no//]
load and save session. By default **medit** does it when **-n** is not used.
If this option is not given on command line then medit uses the corresponding
preferences setting.
: **--pid** //PID//
use existing instance with process id //PID//.
: **--app-name** //NAME//
use instance name //NAME//. If an instance with this name is already running,
then it will send files given on the command line to that instance and exit.
: **-e**, **--encoding** //ENCODING//
use provided character encoding to open the file
: **-l**, **--line** //LINE//
open file and position cursor on line //LINE//. Alternatively
line number may be specified with filename, e.g.
medit foo.txt:12
: **-r**, **--reload**
automatically reload opened file if it was modified on disk by another program.
: **-w**, **--new-window**
open file in a new window.
: **-t**, **--new-tab**
open file in a new tab.
: **--log-file** //FILE//
write debug output into //FILE//. This option is only useful on Windows.
: **--log-window**
show debug output in a log window. This option is only useful on Windows.
: **--debug** //DOMAINS//
enable debug output for //DOMAINS// (if **medit** was compiled with
--enable-debug option).
: **--exec** //STRING//
execute python code in //STRING// in an existing instance.
: **--exec-file** //FILE//
execute python file //FILE// in an existing instance.
: **-h**, **--help**
show summary of options.
: **-v**, **--version**
show program version.
: //FILES//
list of files to open. Filenames may include line numbers after colon,
e.g. /tmp/file.txt:200. Trailing colon is ignored.
= ENVIRONMENT VARIABLES =
: MEDIT_PID
if set, it is used as --pid argument. When medit spawns a process (e.g. a DVI viewer) it sets
MEDIT_PID to its own process id, so the child process may in turn simply use 'medit filename'
to open a file (e.g. for inverse DVI search).
= CONTACT =
http://mooedit.sourceforge.net/contact.html
= AUTHOR =
Written and maintained by Yevgen Muntyan <@MOO_EMAIL@>
% = COPYRIGHT =
%
% @MOO_COPYRIGHT@
%
% medit is a free software.

View File

@ -1,110 +0,0 @@
.TH "MEDIT" 1 "August 2010" ""
.SH NAME
.P
medit \- text editor
.SH SYNOPSIS
.P
\fBmedit\fR [\fIOPTION\fR]... [\fIFILES\fR]
.SH DESCRIPTION
.P
\fBmedit\fR is a text editor.
.SH OPTIONS
.TP
\fB\-n\fR, \fB\-\-new\-app\fR
run new instance of \fBmedit\fR. By default \fBmedit\fR opens \fIFILES\fR
(or creates a new document if none are given) in an existing instance
of application
.TP
\fB\-s\fR, \fB\-\-use\-session\fR[=\fIyes|no\fR]
load and save session. By default \fBmedit\fR does it when \fB\-n\fR is not used.
If this option is not given on command line then medit uses the corresponding
preferences setting.
.TP
\fB\-\-pid\fR \fIPID\fR
use existing instance with process id \fIPID\fR.
.TP
\fB\-\-app\-name\fR \fINAME\fR
use instance name \fINAME\fR. If an instance with this name is already running,
then it will send files given on the command line to that instance and exit.
.TP
\fB\-e\fR, \fB\-\-encoding\fR \fIENCODING\fR
use provided character encoding to open the file
.TP
\fB\-l\fR, \fB\-\-line\fR \fILINE\fR
open file and position cursor on line \fILINE\fR. Alternatively
line number may be specified with filename, e.g.
medit foo.txt:12
.TP
\fB\-r\fR, \fB\-\-reload\fR
automatically reload opened file if it was modified on disk by another program.
.TP
\fB\-w\fR, \fB\-\-new\-window\fR
open file in a new window.
.TP
\fB\-t\fR, \fB\-\-new\-tab\fR
open file in a new tab.
.TP
\fB\-\-log\-file\fR \fIFILE\fR
write debug output into \fIFILE\fR. This option is only useful on Windows.
.TP
\fB\-\-log\-window\fR
show debug output in a log window. This option is only useful on Windows.
.TP
\fB\-\-debug\fR \fIDOMAINS\fR
enable debug output for \fIDOMAINS\fR (if \fBmedit\fR was compiled with
\-\-enable\-debug option).
.TP
\fB\-\-exec\fR \fISTRING\fR
execute python code in \fISTRING\fR in an existing instance.
.TP
\fB\-\-exec\-file\fR \fIFILE\fR
execute python file \fIFILE\fR in an existing instance.
.TP
\fB\-h\fR, \fB\-\-help\fR
show summary of options.
.TP
\fB\-v\fR, \fB\-\-version\fR
show program version.
.TP
\fIFILES\fR
list of files to open. Filenames may include line numbers after colon,
e.g. /tmp/file.txt:200. Trailing colon is ignored.
.SH ENVIRONMENT VARIABLES
.TP
MEDIT_PID
if set, it is used as \-\-pid argument. When medit spawns a process (e.g. a DVI viewer) it sets
MEDIT_PID to its own process id, so the child process may in turn simply use 'medit filename'
to open a file (e.g. for inverse DVI search).
.SH CONTACT
.P
http://mooedit.sourceforge.net/contact.html
.SH AUTHOR
.P
Written and maintained by Yevgen Muntyan <emuntyan@sourceforge.net>
.\" man code generated by txt2tags 2.5 (http://txt2tags.sf.net)

BIN
doc/medit.info Normal file

Binary file not shown.

View File

@ -1,50 +0,0 @@
APPNAME APPVERSION Manual
%! Target : html
%! Encoding : UTF-8
%! Options : --css-sugar
%! Options(html): --mask-email
%% 'entities'
%! Postproc: APPNAME medit
%! Postproc: APPVERSION 0.99.0-unstable
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% Sections stuff
%%
%% Convert '== Title ==[anchor]' to '== !!ANCHOR!!anchor!!Title!! ==[anchor]'
%! Preproc : '^(=+)\s*(.*)\s+\1\[(.*)\]' '\1 !!ANCHOR!!\3!!\2!! \1[\3]'
%% Remove t2t-generated '<A NAME="anchor"></A>'
%! Postproc: '<A NAME=".*"></A>' ''
%% Convert '<H1>!!ANCHOR!!anchor!!Title!!</H1>' to '<H1><a name="anchor">Title</a></H1><!-- ##anchor## -->',
%% ##anchor## is needed for makedocs to generate help-sections.h
%! Postproc: '<(H\d)>!!ANCHOR!!(.*)!!(.*)!!</\1>' '<\1><a name="\2">\3</a></\1><!-- ##\2## -->'
%% Convert remaining '!!ANCHOR!!anchor!!Title!!' to 'Title'
%! Postproc: '!!ANCHOR!!(.*)!!(.*)!!' '\2'
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%! Postproc: '@em\{(.*?)\}' '<em>\1</em>'
%! Postproc: '@comment\{(.*?)\}' '<!-- \1 -->'
APPNAME APPVERSION Manual
%!include: prefs.t2t
%!include: user-tools.t2t
%!include: prefs-file.t2t
%!include: regex.t2t
%!include: license.t2t
%% Fake help sections
@comment{##fake-dialog-replace##}
@comment{##fake-dialog-find##}
@comment{##fake-prefs-dialog##}
@comment{##fake-prefs-plugins##}
@comment{##fake-prefs-accels##}
@comment{##fake-prefs-file-selector##}
@comment{##fake-dialog-find-in-files##}
@comment{##fake-dialog-find-file##}
@comment{##fake-file-selector##}

View File

@ -1,50 +0,0 @@
APPNAME APPVERSION Manual
%! Target : html
%! Encoding : UTF-8
%! Options : --css-sugar
%! Options(html): --mask-email
%% 'entities'
%! Postproc: APPNAME medit
%! Postproc: APPVERSION @MOO_DISPLAY_VERSION@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% Sections stuff
%%
%% Convert '== Title ==[anchor]' to '== !!ANCHOR!!anchor!!Title!! ==[anchor]'
%! Preproc : '^(=+)\s*(.*)\s+\1\[(.*)\]' '\1 !!ANCHOR!!\3!!\2!! \1[\3]'
%% Remove t2t-generated '<A NAME="anchor"></A>'
%! Postproc: '<A NAME=".*"></A>' ''
%% Convert '<H1>!!ANCHOR!!anchor!!Title!!</H1>' to '<H1><a name="anchor">Title</a></H1><!-- ##anchor## -->',
%% ##anchor## is needed for makedocs to generate help-sections.h
%! Postproc: '<(H\d)>!!ANCHOR!!(.*)!!(.*)!!</\1>' '<\1><a name="\2">\3</a></\1><!-- ##\2## -->'
%% Convert remaining '!!ANCHOR!!anchor!!Title!!' to 'Title'
%! Postproc: '!!ANCHOR!!(.*)!!(.*)!!' '\2'
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%! Postproc: '@em\{(.*?)\}' '<em>\1</em>'
%! Postproc: '@comment\{(.*?)\}' '<!-- \1 -->'
APPNAME APPVERSION Manual
%!include: prefs.t2t
%!include: user-tools.t2t
%!include: prefs-file.t2t
%!include: regex.t2t
%!include: license.t2t
%% Fake help sections
@comment{##fake-dialog-replace##}
@comment{##fake-dialog-find##}
@comment{##fake-prefs-dialog##}
@comment{##fake-prefs-plugins##}
@comment{##fake-prefs-accels##}
@comment{##fake-prefs-file-selector##}
@comment{##fake-dialog-find-in-files##}
@comment{##fake-dialog-find-file##}
@comment{##fake-file-selector##}

47
doc/medit.texi Normal file
View File

@ -0,0 +1,47 @@
\input texinfo @c -*-texinfo-*-
@setfilename help.info
@settitle medit 0.99.0-unstable manual
@c %**end of header
@macro medit
medit
@end macro
@macro uilabel{text}
@emph{\text\}
@end macro
@macro helpsection{id}
@html
<!-- moo-help-section: \id\ -->
@end html
@end macro
@titlepage
@title Sample Title
@end titlepage
@contents
@node Top
@top medit
This manual is for medit version 0.99.0-unstable, a text editor.
@menu
* prefs-langs-and-filters:: Selecting editing options and languages.
* Preferences files:: Preferences files.
* Regular expressions:: Regular expressions.
* User-defined Tools:: User-defined Tools.
* Scripting:: Scripting.
* License:: License.
@end menu
@include prefs.texi
@include prefs-file.texi
@include regex.texi
@include user-tools.texi
@include script.texi
@include license.texi
@bye

47
doc/medit.texi.in Normal file
View File

@ -0,0 +1,47 @@
\input texinfo @c -*-texinfo-*-
@setfilename help.info
@settitle medit @MOO_DISPLAY_VERSION@ manual
@c %**end of header
@macro medit
medit
@end macro
@macro uilabel{text}
@emph{\text\}
@end macro
@macro helpsection{id}
@html
<!-- moo-help-section: \id\ -->
@end html
@end macro
@titlepage
@title Sample Title
@end titlepage
@contents
@node Top
@top medit
This manual is for medit version @MOO_DISPLAY_VERSION@, a text editor.
@menu
* prefs-langs-and-filters:: Selecting editing options and languages.
* Preferences files:: Preferences files.
* Regular expressions:: Regular expressions.
* User-defined Tools:: User-defined Tools.
* Scripting:: Scripting.
* License:: License.
@end menu
@include prefs.texi
@include prefs-file.texi
@include regex.texi
@include user-tools.texi
@include script.texi
@include license.texi
@bye

296
doc/momscript.texi Normal file
View File

@ -0,0 +1,296 @@
@node Application object
@section Application object
@helpsection{SCRIPT_APPLICATION}
@table @method
@item Application.editor()
returns Editor object.
@item Application.active_view()
returns current active document view or @null{} if no documents are open.
@item Application.active_document()
returns current active document or @null{} if no documents are open.
@item Application.active_window()
returns current active window.
@item Application.set_active_window(window)
activates @param{window}.
@item Application.windows()
returns a list of all editor windows.
@item Application.quit()
quit @medit{}.
@end table
@node Editor object
@section Editor object
@helpsection{SCRIPT_EDITOR}
@table @method
@item Editor.active_document()
returns current active document or @null{} if there are no open documents
@item Editor.set_active_document(doc)
makes @param{doc} active
@item Editor.active_window()
returns current active window
@item Editor.set_active_window(window)
makes @param{window} active
@item Editor.active_view()
returns current active document view
@item Editor.set_active_view(view)
makes @param{view} active
@item Editor.documents()
returns list of all open documents
@item Editor.documents()
returns list of all open document views
@item Editor.documents()
returns list of all document windows
@item Editor.get_document_by_path(path)
returns document with path @param{path} or @null{}.
@item Editor.get_document_by_uri(path)
returns document with uri @param{uri} or @null{}.
@item Editor.new_file(file, encoding=null, window=null)
open file if it exists on disk or create a new one. If @param{encoding} is
@null{} or "auto" then pick character encoding automatically, otherwise use
@param{encoding}. If @param{window} is given then open file in that window,
otherwise in an existing window.
@item Editor.open_files(files, window=null)
open files. If @param{window} is given then open files in that window,
otherwise in an existing window.
@item Editor.open_files(uris, window=null)
open files. If @param{window} is given then open files in that window,
otherwise in an existing window.
@item Editor.open_file(file, encoding=null, window=null)
open file. If @param{encoding} is @null{} or "auto" then pick character
encoding automatically, otherwise use @param{encoding}. If @param{window}
is given then open files in that window, otherwise in an existing window.
@item Editor.open_uri(uri, encoding=null, window=null)
open file. If @param{encoding} is @null{} or "auto" then pick character
encoding automatically, otherwise use @param{encoding}. If @param{window}
is given then open files in that window, otherwise in an existing window.
@item Editor.reload(doc)
reload document.
@item Editor.save(doc)
save document.
@item Editor.save_as(doc, filename=null)
save document as @param{filename}. If @param{filename} is not given then
first ask user for new filename.
@item Editor.close(doc)
close document.
@end table
@node DocumentWindow object
@section DocumentWindow object
@helpsection{SCRIPT_DOCUMENT_WINDOW}
@table @method
@item DocumentWindow.editor()
returns Editor object.
@item DocumentWindow.active_view()
returns current active document view in this window.
@item DocumentWindow.set_active_view(view)
makes @param{view} active, i.e. switches to its tab.
@item DocumentWindow.active_document()
returns current active document in this window, that is the document
whose view is the active one.
@item DocumentWindow.set_active_document(doc)
makes active a view of document @param{doc}. It picks arbitrary view
of @param{doc} if there are more than one in this window.
@item DocumentWindow.views()
returns list of all document views in this window.
@item DocumentWindow.documents()
returns list of all documents in this window.
@item DocumentWindow.is_active()
returns whether this window is the active one.
@item DocumentWindow.set_active()
makes this window active.
@end table
@node DocumentView object
@section DocumentView object
@helpsection{DOCUMENT_VIEW}
@table @method
@item DocumentView.document()
returns document to which this view belongs.
@item DocumentView.window()
returns window which contains this view.
@item DocumentView.line_wrap_mode()
returns whether line wrapping is enabled.
@item DocumentView.set_line_wrap_mode(enabled)
enables or disables line wrapping.
@item DocumentView.overwrite_mode()
returns whether overwrite mode is on.
@item DocumentView.set_overwrite_mode(enabled)
enables or disables overwrite mode.
@item DocumentView.show_line_numbers()
returns whether line numbers are displayed.
@item DocumentView.set_show_line_numbers(show)
shows or hides line numbers.
@end table
@node Document object
@section Document object
@helpsection{DOCUMENT}
@table @method
@item Document.views()
returns list of views which display this document.
@item Document.active_view()
returns active view of this document. If the document has a single
view, then that is returned; otherwise if the current active view
belongs to this document, then that view is returned; otherwise
a random view is picked.
@item Document.filename()
returns full file path of the document or @null{} if the document
has not been saved yet or if it can't be represented with a local
path (e.g. if it is in a remote location like a web site).
@itemize @minus
@item Untitled => @null{}
@item @file{/home/user/example.txt} => @code{"/home/user/example.txt"}
@item @file{http://example.com/index.html} => @null{}
@end itemize
@item Document.uri()
returns URI of the document or @null{} if the document has not been
saved yet.
@item Document.basename()
returns basename of the document, that is the full path minus directory
part. If the document has not been saved yet, then it returns the name
shown in the titlebar, e.g. "Untitled".
@item Document.encoding()
returns character encoding of the document.
@item Document.set_encoding(encoding)
set character encoding of the document, it will be used when the document
is saved.
@item Document.reload()
reload the document.
@item Document.save()
save the document.
@item Document.save_as(filename=null)
save the document as @param{filename}. If @param{filename} is @null{} then
@uilabel{Save As} will be shown to choose new filename.
@item Document.can_undo()
returns whether undo action is available.
@item Document.can_redo()
returns whether redo action is available.
@item Document.undo()
undo.
@item Document.redo()
redo.
@item Document.begin_not_undoable_action()
mark the beginning of a non-undoable operation. Undo stack will be erased
and undo will not be recorded until @method{end_not_undoable_action()} call.
@item Document.end_not_undoable_action()
end the non-undoable operation started with @method{begin_not_undoable_action()}.
@end table
@table @method
@item Document.start_pos()
position at the beginning of the document (0 in Python, 1 in Lua, etc.)
@item Document.end_pos()
position at the end of the document. This is the position past the last
character: it points to no character, but it is a valid position for
text insertion, cursor may be put there, etc.
@item Document.cursor_pos()
position at the cursor.
@item Document.set_cursor_pos(pos)
move cursor to position @param{pos}.
@item Document.selection()
returns selection bounds as a list of two items, start and end. Returned
list is always sorted, use @method{cursor()} and @method{selection_bound()}
if you need to distinguish beginning and end of selection. If no text is
is selected, then it returns pair @code{[cursor, cursor]}.
@item Document.set_selection(bounds_as_list)
@item Document.set_selection(start, end)
select text.
@item Document.selection_bound()
returns the selection bound other than cursor position. Selection is
either [cursor, selection_bound) or [selection_bound, cursor), depending
on direction user dragged the mouse (or on @method{set_selection}
arguments).
@item Document.has_selection()
whether any text is selected.
@item Document.char_count()
character count.
@item Document.line_count()
line count.
@item Document.line_at_pos(pos)
returns index of the line which contains position @param{pos}.
@item Document.pos_at_line(line)
returns position at the beginning of line @param{line}.
@item Document.pos_at_line(line)
returns position at the end of line @param{line}.
@item Document.char_at_pos(pos)
returns character at position @param{pos} as string.
@item Document.text()
returns whole document contents.
@item Document.text(start, end)
returns text in the range [@param{start}, @param{end}), @param{end} not
included. Example: @code{doc.text(doc.start_pos(), doc.end_pos())} is
equivalent @code{to doc.text()}.
@item Document.insert_text(text)
@item Document.insert_text(pos, text)
insert text into the document. If @param{pos} is not given, insert at
cursor position.
@item Document.replace_text(start, end, text)
replace text in the region [@param{start}, @param{end}). Equivalent to
@code{delete_text(start, end), insert_text(start, text)}.
@item Document.delete_text(start, end)
delete text in the region [@param{start}, @param{end}). Example:
@code{doc.delete_text(doc.start(), doc.end())} will delete all text in
@code{doc}.
@item Document.append_text(text)
append text. Equivalent to @code{doc.insert_text(doc.end(), text)}.
@item Document.clear()
delete all text in the document.
@item Document.copy()
copy selected text to clipboard. If no text is selected then nothing
will happen, same as Ctrl-C key combination.
@item Document.cut()
cut selected text to clipboard. If no text is selected then nothing
will happen, same as Ctrl-X key combination.
@item Document.paste()
paste text from clipboard. It has the same effect as Ctrl-V key combination:
nothing happens if clipboard is empty, and selected text is replaced with
clipboard contents otherwise.
@item Document.select_text(bounds_as_list)
@item Document.select_text(start, end)
select text, same as @method{set_selection()}.
@item Document.select_lines(line)
select a line.
@item Document.select_lines(first, last)
select lines from @param{first} to @param{last}, @emph{including}
@param{last}.
@item Document.select_lines_at_pos(bounds_as_list)
@item Document.select_lines_at_pos(start, end)
select lines: similar to @method{select_text}, but select whole lines.
@item Document.select_all()
select all.
@item Document.selected_text()
returns selected text.
@item Document.selected_lines()
returns selected lines as a list of strings, one string for each line,
line terminator characters not included. If nothing is selected, then
line at cursor is returned.
@item Document.delete_selected_text()
delete selected text, equivalent to @code{doc.delete_text(doc.cursor(),
doc.selection_bound())}.
@item Document.delete_selected_lines()
delete selected lines. Similar to @method{delete_selected_text()} but
selection is extended to include whole lines. If nothing is selected,
then line at cursor is deleted.
@item Document.replace_selected_text(text)
replace selected text with @param{text}. If nothing is selected,
@param{text} is inserted at cursor.
@item Document.replace_selected_lines(text)
replace selected lines with @param{text}. Similar to
@method{replace_selected_text()}, but selection is extended to include
whole lines. If nothing is selected, then line at cursor is replaced.
@end table

View File

@ -1,30 +0,0 @@
== Preferences files ==[prefs-file]
APPNAME preferences are stored in ``$HOME/.config/APPNAMErc`` file.
It is an XML file which may be edited to set preferences which have not found
their place in the <interface>Preferences</interface> dialog.
NOTE: APPNAME reads the preferences file on startup and writes it whenever //OK//
or //Apply// button is clicked in the //Preferences// dialog. Therefore, if you
modify the preferences file, your changes may be overwritten, and they not take
the effect until you restart APPNAME.
The following "hidden" settings are available.
- ``Editor/window_title``: Format of the window title. It is a string which may
contain format sequences: percent sign followed by a character:
- ``%a``: application name;
- ``%b``: current document basename;
- ``%f``: full path of the current document;
- ``%u``: URI of the current document;
- ``%s``: the status of the current document, e.g. "`` [modified]``". It is prefixed
with space, so that "``%b%s``" will produce a nice string;
- ``%%``: the percent character.
Default value is "``%a - %f%s``" which produces something like "``APPNAME - /home/user/file [modified]``".
- ``Editor/window_title_no_doc``: Same as ``Editor/window_title``, used when no document is open. Default value is "``%a``".
- ``Editor/tab_width``: Visual width of the Tab character, 8 by default.

32
doc/prefs-file.texi Normal file
View File

@ -0,0 +1,32 @@
@node Preferences files
@chapter Preferences files
@helpsection{PREFS_FILE}
@medit{} preferences are stored in @file{$HOME/.config/@medit{}rc} file.
It is an XML file which may be edited to set preferences which have not found
their place in the @uilabel{Preferences} dialog.
NOTE: @medit{} reads the preferences file on startup and writes it whenever @uilabel{OK}
or @uilabel{Apply} button is clicked in the @uilabel{Preferences} dialog. Therefore, if you
modify the preferences file, your changes may be overwritten, and they not take
effect until you restart @medit{}.
The following "hidden" settings are available:
@itemize @bullet
@item
@var{Editor/window_title}: Format of the window title. It is a string which may
contain format sequences, which are percent sign followed by a character:
@itemize @minus
@item @code{%a}: application name;
@item @code{%b}: current document basename;
@item @code{%f}: full path of the current document;
@item @code{%u}: URI of the current document;
@item @code{%s}: the status of the current document, e.g. "@code{ [modified]}". It is prefixed
with a space, so that "@code{%b%s}" produces a nice string;
@item @code{%%}: the percent character.
@end itemize
Default value is "@code{%a - %f%s}" which produces something like "@code{@medit{} - /home/user/file [modified]}".
@item
@var{Editor/window_title_no_doc}: same as @code{Editor/window_title}, used when no document is open.
Default value is "@code{%a}".
@end itemize

View File

@ -1,87 +0,0 @@
== Selecting editing options and languages ==[prefs-langs-and-filters]
//Languages and files// tab in the //Editor//
section of the //Preferences// dialog allows customizing
how syntax highlighting language and editing options are chosen
depending on the document filename, as well as setting editing options for
all documents which use given language and choosing file patterns and mime types
for which the given language should be used.
=== Language-specific options ===[prefs-lang-options]
Here you can set editing options on per-language basis, as well as define
for which file patterns and mime types given language should be used.
| //Language// combo box | Choose the language you want to customize. Settings for ``None`` will apply to documents for which no syntax highlighting language was chosen. |
| //Mime types// | The given language will be used for files with these mime types, unless the language is chosen based on the filename or overridden in the //File filters// section.
| //Extensions// | The given language will be used for files whose filenames match these patterns, unless overridden in the //File filters// section.
| //Options// | Default editing options to use in documents which use the given language. These options can be overridden using //File filters// section, and options set in the file text have a higher priority as well. See the [Editing options #editing-options] section for the format of this entry content.
=== File filters ===[prefs-file-filters]
//File filters// section allows to customize editing options,
as well as syntax highlighting language, on per-document basis using regular expressions
which are matched against the document filename. Full file paths are used, so one can
have per-directory settings.
Use dollar if you need to match ends of filenames, e.g. "``\.doc$``" will work as "``*.doc``"
pattern.
The filters are applied in the order they appear in the list, one by one. All filters
are applied to every file, so several filters may affect options in the same file. In this
way one can set some options for a set of files or a directory, then set or modify some
additional options for certain files in that set, etc.
To add a filter, use //New// button. Click the filter in the list to
select it, then click the //Filter// or //Options//
part of it to edit. Use //Delete// button to delete a filter,
and //Up// and //Down// buttons to change the order in
which they are applied.
//Filter// field contains a regular expression matched agains the
document filename. If it is found in the filename, then the options from the
//Options// field are applied to the document.
//Options// field contains the options, in format described in the
[Editing options #editing-options] section.
=== Editing options ===[editing-options]
APPNAME has some editing options which can be set in the document text,
or in the //Preferences// dialog for sets of files or for given syntax
highlighting language.
To set the options in the document text, place the following on the first,
second or the last line of the document:
```
-%- @em{options} -%-
```
where //options// is the option string
```
@em{key}: @em{value}; @em{key}: @em{value}; ...
```
(the latter is the format used also in the //Preferences// dialog).
Values can be strings, integers, or booleans.
Booleans are ``yes``, ``no``, ``true``, ``false``, ``1``, ``0``.
If a string value contains ``:`` character, then the following syntax may be used: ``@em{key}=/@em{value}/``.
Any character may be used instead of slash (and it must not occur in the //value//).
Example: ``word-chars=@-/:@``
The following options are available:
| ``lang`` | syntax highlighting language to use in this document. |
| ``strip`` | a boolean value, whether trailing whitespace should be removed from the document on save.
| ``add-newline`` | a boolean value, whether the editor should ensure that saved files have a trailing new line character.
| ``tab-width`` | displayed width of the Tab character. NOTE: This is not an indentation offset, this is the visual width of a Tab character.
| ``use-tabs`` | whether the Tab character should be used for indentation.
| ``indent-width`` | an integer specifying indentation offset used when the Tab key is pressed to indent text.
APPNAME tries to understand modelines of Vim, Emacs, and Kate text editors, so chances are it will correctly
pick up the conventional settings from source files.

117
doc/prefs.texi Normal file
View File

@ -0,0 +1,117 @@
@node prefs-langs-and-filters
@chapter Selecting editing options and languages
@helpsection{PREFS_LANGS_AND_FILTERS}
@uilabel{Languages and files} tab in the @uilabel{Editor}
section of the @uilabel{Preferences} dialog allows customizing
how syntax highlighting language and editing options are chosen
depending on the document filename, as well as setting editing options for
all documents which use given language and choosing file patterns and mime types
for which the given language should be used.
@menu
* prefs-lang-options:: Language-specific options.
* prefs-file-filters:: File filters.
* editing-options:: Editing options.
@end menu
@node prefs-lang-options
@section Language-specific options
@helpsection{PREFS_LANGS_OPTIONS}
Here you can set editing options on per-language basis, as well as define
for which file patterns and mime types given language should be used.
@table @asis
@item @uilabel{Language} combo box
Choose the language you want to customize. Settings for @code{None} will apply to
documents for which no syntax highlighting language was chosen.
@item @uilabel{Mime types}
The given language will be used for files with these mime types, unless the language
is chosen based on the filename or overridden in the @uilabel{File filters} section.
@item @uilabel{Extensions}
The given language will be used for files whose filenames match these patterns,
unless overridden in the @uilabel{File filters} section.
@item @uilabel{Options}
Default editing options to use in documents which use the given language. These
options can be overridden using @uilabel{File filters} section, and options set
in the file text have a higher priority as well. See section @ref{editing-options}
for the format of this entry content.
@end table
@node prefs-file-filters
@section File filters
@helpsection{PREFS_FILE_FILTERS}
@uilabel{File filters} section allows to customize editing options,
as well as syntax highlighting language, on per-document basis using regular
expressions which are matched against the document filename. Full file paths are used,
so one can have per-directory settings.
Use dollar if you need to match ends of filenames, e.g. "@code{\.doc$}" will work as
"@code{*.doc}" pattern.
The filters are applied in the order they appear in the list, one by one. All filters
are applied to every file, so several filters may affect options in the same file. In
this way one can set some options for a set of files or a directory, then set or modify
some additional options for certain files in that set, etc.
To add a filter, use @uilabel{New} button. Click the filter in the list to
select it, then click the @uilabel{Filter} or @uilabel{Options}
part of it to edit. Use @uilabel{Delete} button to delete a filter,
and @uilabel{Up} and @uilabel{Down} buttons to change the order in
which they are applied.
@uilabel{Filter} field contains a regular expression matched agains the
document filename. If it is found in the filename, then the options from the
@uilabel{Options} field are applied to the document.
@uilabel{Options} field contains the options, in format described in
section @ref{editing-options}.
@node editing-options
@section Editing options
@helpsection{EDITING_OPTIONS}
@medit{} has some editing options which can be set in the document text,
or in the @uilabel{Preferences} dialog for sets of files or for given syntax
highlighting language.
To set the options in the document text, place the following on the first,
second or the last line of the document:
@example
-%- @var{options} -%-
@end example
where @var{options} is the option string
@example
@var{key}: @var{value}; @var{key}: @var{value}; ...
@end example
(the latter is the format used also in the @uilabel{Preferences} dialog).
Values can be strings, integers, or booleans.
Booleans are @samp{yes}, @samp{no}, @samp{true}, @samp{false}, @samp{1}, @samp{0}.
If a string value contains @code{:} character, then the following syntax may be used:
@code{@var{key}=/@var{value}/}. Any character may be used instead of slash (and it
must not occur in the @var{value}). Example: @samp{word-chars=@@-/:@@}
The following options are available:
@table @var
@item lang
syntax highlighting language to use in this document.
@item strip
a boolean value, whether trailing whitespace should be removed from the document on save.
@item add-newline
a boolean value, whether the editor should ensure that saved files have a trailing new line character.
@item tab-width
displayed width of the Tab character. NOTE: This is not an indentation offset, this is the visual width of a Tab character.
@item use-tabs
whether the Tab character should be used for indentation.
@item indent-width
an integer specifying indentation offset used when the Tab key is pressed to indent text.
@end table
@medit{} tries to understand modelines of Vim, Emacs, and Kate text editors, so chances are it will correctly
pick up the conventional settings from source files.

View File

@ -1,16 +0,0 @@
== Regular expressions ==[regex]
Medit uses regular expressions functionality provided by Glib, which in turn uses
[PCRE http://pcre.org/] library. See [Glib manual http://library.gnome.org/devel/glib/stable/glib-regex-syntax.html]
for complete description of regular expressions syntax.
=== Search ===[regex-search]
Regular expression searches in a document text are limited to single lines, unless the
search pattern includes newline. For example, pattern ".*" will match every line in the
document, pattern ".*\n.*" will match pairs of consecutive lines. This means that it is
mostly impossible to perform searches for text which spawns multiple lines.

13
doc/regex.texi Normal file
View File

@ -0,0 +1,13 @@
@node Regular expressions
@chapter Regular expressions
@helpsection{REGEX}
@medit{} uses regular expressions functionality provided by Glib, which in turn uses
@uref{http://pcre.org/, PCRE} library. See
@uref{http://library.gnome.org/devel/glib/stable/glib-regex-syntax.html, Glib manual}
for complete description of regular expression syntax.
Regular expression searches in a document text are limited to single lines, unless the
search pattern includes newline character. For example, pattern "@code{.*}" will match every
line in the document, pattern "@code{.*\n.*}" will match pairs of consecutive lines. This means
that it is mostly impossible to perform searches for text which spawns multiple lines.

25
doc/script.texi Normal file
View File

@ -0,0 +1,25 @@
@node Scripting
@chapter Scripting
@helpsection{SCRIPT}
@macro method{text}
@code{\text\}
@end macro
@macro param{text}
@var{\text\}
@end macro
@macro null{}
@code{null}
@end macro
@menu
* Application object:: Application object
* Editor object:: Editor object
* DocumentWindow object:: DocumentWindow object
* DocumentView object:: DocumentView object
* Document object:: Document object
@end menu
@include momscript.texi

View File

@ -1,15 +0,0 @@
{$opening}
<!--<br><sup>(all sections in one long page)</sup></div>-->
<{$title_tag}>{$title}</{main::end_tag($title_tag)}>
{$content}
<hr>
<h2 style="margin:0;">Contents:</h2>
<ul>
{main::sub_list(\@sub, 0, 0, 'li', 'ul')}
</ul>
{$closing}

View File

@ -1,29 +0,0 @@
{
%next = %top unless (%next);
$opening =~ s!<title>.*</title>!'<title>'.main::strip_tags($title).'</title>'!eis;
$opening;
}
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="{$prev{'name'}}.html">{main::strip_tags($prev{'title'})}</a></td>
<td width="33%" align="center">Up: <a href="{$up{'name'}}.html">{main::strip_tags($up{'title'})}</a></td>
<td width="33%" align="right">Next: <a href="{$next{'name'}}.html">{main::strip_tags($next{'title'})}</a></td>
</tr></table>
<hr>
<{$title_tag}>{$title}</{main::end_tag($title_tag)}>
{$content}
<ul>
{main::sub_list(\@sub, 0, 0, 'li', 'ul')}
</ul>
<hr>
<table width="100%"><tr valign="top">
<td width="33%" align="left">Previous: <a href="{$prev{'name'}}.html">{main::strip_tags($prev{'title'})}</a></td>
<td width="33%" align="center">Up: <a href="{$up{'name'}}.html">{main::strip_tags($up{'title'})}</a></td>
<td width="33%" align="right">Next: <a href="{$next{'name'}}.html">{main::strip_tags($next{'title'})}</a></td>
</tr></table>
{$closing}

View File

@ -1,234 +0,0 @@
#!/usr/bin/perl
# (C) 2002 Yonat Sharon
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
use strict;
use Text::Template;
# documentation:
sub usage {
print <<END;
splity.pl - Split a long HTML file to smaller HTML files
according to sections with <hN> headings.
Usage:
split.pl [-h N] [-index <file>] [-page <file>] <html-file>
<html-file> source HTML file to split
-h N split on <h1> to <hN> (default is 3)
-index <file> template file to use for the index page
(default is index-template.html)
-page <file> template file to use for the section pages
(default is page-template.html)
See splity.html for details on the format of the source HTML
file and the template files.
END
exit;
}
return 1 if ($0 =~ /splity.t$/);
usage() unless (@ARGV);
# init parameters:
my $source = pop; # TODO: default to 'all.html'
my %param = @ARGV;
my $max_h_level = $param{'-h'} || 3;
my $index_template = $param{'-index'} || 'index-template.html';
my $page_template = $param{'-page'} || 'page-template.html';
# extract data:
my $s = slurp_file($source);
my ($opening, $closing, @sections) = split_sections($s, $max_h_level);
my $doc_vars = {'opening' => $opening, 'closing' => $closing, 'source' => $source};
my @pages;
foreach my $section (@sections) {
push(@pages, extract_page_data($section));
}
create_structure(\@pages);
# fill-in empty names and titles:
for (my $i = 0; $i < scalar(@pages); ++$i) {
$pages[$i]->{'name'} ||= $i || 'index'; # TODO: should be according to parent, like 1.4.2
$pages[$i]->{'title'} ||= $pages[$i]->{'name'};
}
# create index
my $index_page = shift @pages;
my $tt = new Text::Template(SOURCE => $index_template)
or die "Can't construct template $index_template: $Text::Template::ERROR";
output_page($tt, $index_page, $doc_vars);
# create pages
$tt = new Text::Template(SOURCE => $page_template)
or die "Can't construct template $page_template: $Text::Template::ERROR";
foreach my $page (@pages) {
output_page($tt, $page, $doc_vars);
}
################################################################################
### output_page($template, $page) # Create output file for $page using $template.
sub output_page {
my ($template, $page, $doc_vars) = @_;
open(F, "> $page->{'name'}.html")
or die "Can't open $page->{'name'}.html for writing: $!";
$template->fill_in(HASH => [$page, $doc_vars], OUTPUT => \*F)
or die "Can't fill_in template for $page->{'name'}: $Text::Template::ERROR";
close F;
}
### $s = slurp_file($filename) # Read the whole file into a string. ############
sub slurp_file {
local $/;
open(F, $_[0]) or die "Can't open $_[0]: $!";
my $s = <F>;
close(F);
return $s;
}
### ($opening, $closing, @sections) = split_sections($html, $max_h_level) ######
### Split HTML file to sections according to headings 1-$max_h_level.
sub split_sections { # split to @sections, and common $opening and $closing
my $level = qr/[1-$_[1]]/i;
my @sections = split(/(?=<h$level\W)/i, $_[0]);
# cut $closing from last section
my $closing;
my $closing_tag = qr/<h\d[^>]+style="[^"]*display\s*:\s*none\s*;/is;
if ($sections[$#sections] =~ /^$closing_tag/) {
$closing = pop @sections;
} else {
$sections[$#sections] =~ s!($closing_tag.*)!!is;
$sections[$#sections] =~ s!(</body.*)!!is unless ($1);
$closing = $1;
}
return (shift @sections, $closing, @sections);
}
### $hash_ref = extract_page_data($html_section) ###############################
### Extract the following fields from an HTML page section:
### title - heading text
### level - heading level
### name - <a name> in heading
### title_tag - complete heading tag
### content - everything but the heading
### excerpt - content of <excerpt></excerpt> tag (if exists)
sub extract_page_data {
local $_ = $_[0];
my $page;
my $title;
# extract <hN>title</hN>
s!<(h(\d)[^>]*)>(.*?)</h\2>!!is;
$page->{'title_tag'} = $1;
$page->{'level'} = $2;
$title = $3;
# extract <a name="name">
$page->{'name'} = $1 if
$title =~ s!<a[^>]+name="(.*?)"[^>]*>(.*?)</a>!$2!is; # TODO: quotes should not be required
$title =~ s!\s*\n! !g;
$page->{'title'} = $title;
# extract <excerpt>excerpt</excerpt>
$page->{'excerpt'} = $1 if s!<excerpt>([^<]*)</excerpt>!$1!i;
# redirect internal links
s!\bhref="#(.*?)"!href="$1.html"!gi; # TODO: only inside A tags!
$page->{'content'} = $_;
return $page;
}
### create_structure(\@array_of_hash_refs) #####################################
### Create linking fields between @array elements, based on their 'level' field:
### top - first element
### prev - previous element
### next - next element
### up - parent element
### sub - array of child elements (direct children only)
sub create_structure {
my $array = shift;
my $top = $array->[0];
my $level = $top->{'level'};
my $last;
foreach my $curr (@$array) {
$curr->{'top'} = $top;
if ($last) {
$curr->{'prev'} = $last;
$last->{'next'} = $curr;
# find parent:
my $curr_level = $curr->{'level'};
my $last_level = $last->{'level'};
if ($last_level == $curr_level) { # same level
$curr->{'up'} = $last->{'up'};
} elsif ($last_level < $curr_level) { # sub-section
$curr->{'up'} = $last;
} else { # up-section
my $up = $last->{'up'};
while ($up->{'level'} >= $curr_level) {
$up = $up->{'up'};
}
$curr->{'up'} = $up;
}
push(@{$curr->{'up'}->{'sub'}}, $curr);
}
$last = $curr;
}
}
### $html = sub_list(\@sub, $depth, $show_excerpts, $item_tag, $sub_list_tag) ##
### Return HTML multi-level list of descendants.
### \@sub - direct children
### $depth - show descendants up to $depth level (0 means show all)
### $excerpt_format - format string for excerpt, with '$1' as fill-in place.
### e.g., '<span class="excerpt">&quot;$1 ...&quot;</span>'
### $item_tag - wrap each descendant with this tag (eg 'li')
### $sub_list_tag - wrap descendants' sub-lists with this tag (eg 'ul')
sub sub_list {
my $sub = shift;
join("\n" , map {sub_list_item($_, @_)} @$sub);
}
sub sub_list_item {
my ($page, $depth, $excerpt_format, $item_tag, $sub_list_tag) = @_;
my $html = qq(<a href="$page->{'name'}.html">$page->{'title'}</a>);
if ($excerpt_format and $page->{'excerpt'}) {
$excerpt_format =~ s/\$1/$page->{'excerpt'}/;
$html .= $excerpt_format;
}
if ($depth != 1 and $page->{'sub'}) {
--$depth if ($depth > 0);
$html .= "<$sub_list_tag>";
$html .= sub_list($page->{'sub'}, $depth, $excerpt_format, $item_tag, $sub_list_tag);
$html .= '</' . end_tag($sub_list_tag) . '>';
}
return "<$item_tag>$html</" . end_tag($item_tag) . '>';
}
### $closing_tag = end_tag($tag_with_attributes) ###############################
sub end_tag {
my $tag = $_[0];
$tag =~ s/\W.*//s;
return $tag;
}
### $text = strip_tags($html) # Strip tags out of $html. #######################
sub strip_tags {
local $_ = $_[0];
s/<.*?>//gs;
s/^\s*//s;
s/\s*$//s;
return $_;
}

View File

@ -1,340 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@ -1,78 +0,0 @@
Txt2tags README file
---------------------
http://txt2tags.sf.net
Txt2tags is a document generator. It reads a text file with
minimal markup as **bold** and //italic// and converts it
to the following formats:
- HTML
- XHTML
- SGML
- LaTeX
- Lout
- Man page
- Wikipedia
- Google Code Wiki
- DokuWiki
- MoinMoin
- MagicPoint
- PageMaker
- Plain text
You can use it as a Web component (PHP), as a GUI application
(windows and buttons) or as a command line program.
For more information, please visit the program website at
http://txt2tags.sf.net
-------------------------------------------------------------
Quick sample for the command line usage:
1. Write a text file like this (leave 1st line blank):
= Hello =
I'm a robot. You're my **master**!
[smile.jpg]
2. Run this command:
txt2tags --target html --no-headers file.t2t
3. The result is:
<H1>Hello</H1>
<P>
I'm a robot. You're my <B>master</B>!
<IMG ALIGN="middle" SRC="smile.jpg" BORDER="0" ALT="">
</P>
-------------------------------------------------------------
Txt2tags package structure:
ChangeLog Changes from previous versions
COPYING The GPL License contents
README This file
TODO Things to do in future versions
txt2tags The program itself
(the only required file to run)
doc/ Documentation
extras/ Syntax files and utilities
po/ Program translation files
samples/ Sample file converted to all targets
samples/img "Powered by" button and other images
samples/css Sample CSS files for HTML and XHTML
samples/module Examples: txt2tags as a Python module
test/ The txt2tags test suite
-------------------------------------------------------------
Author: Aurelio Jargas - http://aurelio.net

File diff suppressed because it is too large Load Diff

View File

@ -1,204 +0,0 @@
== User-defined Tools ==[sect-user-tools]
APPNAME allows extending its functionality with user-defined
//tools//. It can be a Lua or Python (provided APPNAME has been
built with Python support) script which is executed inside APPNAME,
or a shell script which can use the text of the open document as
its input and/or output.
There are some predefined tools which you can use as
an example or to modify to suit your needs.
=== Managing tools ===[prefs-user-tools]
To create a new tool or to modify existing ones, open
//Preferences// dialog and select //Tools// in the list on the left.
Select the tool in the list or click the //New//
button to create a new one. To modify the order in which the tools
appear in the //Tools// menu (or in the document
context menu), use //Up// and //Down// buttons. To rename a tool,
click its name in the list to select it and then click again to
edit the name. Use the //Delete// button to delete a tool.
The following controls are available to modify the tools behavior:
| //Files// | Specifies for which files the tool is going to be available. |
| //Options// | Specifies under which conditions the tool should be enabled.
| //Command type// | The type of the tool: a Python script, a Lua script, or a shell script.
| //Code text field// | Here you enter the actual script text.
//Options// entry content is a comma-separated list of the following:
| ``need-doc`` | the tool needs an open document |
| ``need-file`` | the tool will not work in new unsaved documents.
| ``need-save`` | the document will be saved before the command is executed.
| ``need-save-all`` | all open documents will be saved before the command is executed.
//Files// entry content can be the following:
- a comma-separated list of file patterns, e.g. "``*.c,*.h``";
- a comma-separated list of languages prefixed with "``langs:``", e.g. "``langs: c, c++, objc``";
- a regular expression matching document filename prefixed with "``regex:``", e.g. the above
pattern list may be written as "``regex:\.[ch]$``".
Empty entry means that the tool will be available for all documents.
Shell script tools also have the following controls available:
//Input// entry specifies what text from the document should be passed to the command via its standard input:
| ``None`` | no input text. |
| ``Selected lines`` | the lines containing selection or the line containing the cursor in case when no text is selected.
| ``Selection`` | exact selected text. This will be different from "Selected lines" if selection does not span whole lines of the document, for instance if it is a single word.
| ``Whole document`` | whole document contents.
//Output// entry specifies how the standard output of the command should be redirected.
| ``None`` | the command output will be suppressed. |
| ``None, asynchronous`` | the command output will be suppressed, and the command will be executed in background. For instance, you should use this if you need to launch some external program like a web browser.
| ``Output pane`` | the command output will be displayed in an output pane. This is useful for running programs like compilers, where you want to see the output.
| ``Insert into the document`` | output will be inserted into the current document at the cursor position. It will replace the text used as an input, if any.
| ``New document`` | new document will be created and the command output will be inserted into it.
//Filter// combo. If the output pane is used, then it can be passed through a //filter//:
the filter can match filenames and line numbers, so when you click the text in the
output pane it will open the corresponding file. This is used for compilers and similar
commands, which output locations of errors in processed files.
=== Storing tools in files ===[user-tools-files]
It is possible to create tools without using the //Preferences// dialog,
they can be stored in files in ``tools`` subfolder of the APPNAME data
folders (or ``tools-context`` for tools which appear in the document context
menu). In particular, on Unix systems you can place files into
``$HOME/.local/share/APPNAME/tools/`` folder.
Names of the files in the ``tools`` folder are used as their menu item
labels, after stripping first three characters, so you can use trhee-character
prefix to affect the order of the menu items, e.g. you can have ``00-Do Something``,
``01-Another tool`` files to have them in that order in the menu. The files
may be of three types: files with extension "``.py``", they will be used
as Python scripts; files with extension "``.lua``", they will be used
as Lua scripts; and executable files, they will be executed in the same way
as shell commands.
To set parameters for a tool, place them on the first or the second line of the file in
the following format:
```
!! @em{key}=@em{value}; @em{key}=@em{value}; ... !!
```
//key// may be one of the following:
| ``position`` | it can be ``start`` or ``end``, and defines whether the menu item will be located at the start or at the end of the menu. |
| ``id`` | the tool identificator.
| ``name`` | the tool name, i.e. the label used in the menu item. Overrides the file name.
| ``os`` | ``windows`` or ``unix``. If specified, then the tool will not be used when APPNAME is running on a different operating system.
| ``accel`` | default keyboard accelerator used to invoke this tool.
| ``menu`` | the menu to place this tool into. By default the tools are located in the Tools menu, but they can be as well put into any other menu.
| ``langs`` | comma-separated list of languages for which this tool will be enabled.
| ``file-filter`` | defines for which files this tool will be enabled. The value has the same format as in the //Preferences// dialog.
| ``options`` | same as the //Options// entry content in the //Preferences// dialog.
In addition to these, you can set input and output options for executable files:
| ``input`` | can be ``none``, ``lines``, ``selection``, or ``doc``. |
| ``output`` | can be ``none``, ``async``, ``pane``, ``insert``, or ``new-doc``.
| ``filter`` | the output filter name.
% === Python scripts ===[user-tools-python]
%
% If APPNAME is built with Python support, then Python scripts have full access to the program
% internals via builtin ``moo`` module. APPNAME classes extend classes from ``pygtk``,
% in particular the ``moo.edit.Edit`` class representing documents extends the
% ``gtk.TextView`` class, and all editing operations can be implemented using
% ``pygtk`` API.
%
% Python scripts executed from inside APPNAME have ``LIBDIR/plugins/lib``
% and ``USERDATADIR/plugins/lib`` directories added to ``sys.path``,
% you can place there APPNAME-specific modules to be used from python tools.
%
% Python scripts have the following variables predefined:
%
% | ``doc`` | the current document object. |
% | ``window`` | the current editor window.
% | ``buffer`` | the text buffer (a ``moo.edit.TextBuffer`` instance) of the current document.
% | ``editor`` | the ``moo.edit.Editor`` object representing the text editor. Use its methods to open/close files, switch between documents and windows, etc.
% | ``moo`` | the ``moo`` module, already imported so you can omit ``import moo`` statement in scripts.
=== Lua scripts ===[user-tools-lua]
Lua scripts can use the standard Lua library, ``lfs`` library, and ``medit`` package
which provides some text editor API. Lua scripts have the following variables and functions available.
- ``doc``: a table with the following fields:
| ``file`` | the document file path. |
| ``name`` | the document file basename.
| ``dir`` | the document file directory.
| ``ext`` | the document filename extension including the period.
| ``base`` | the document filename without the extension: the basename is always ``base..ext``.
- ``Cut()``, ``Copy()``, ``Paste()``: clipboard operations.
- ``Backspace()``, ``Delete()``: corresponding key actions.
- ``Up()``, ``Down()``, ``Left()``, ``Right()``: move cursor as the arrow keys do.
- ``Selection()``: returns selected text as a string. Returns ``nil`` when no text is selected.
- ``Select(n)``: selects ``n`` characters to the right if ``n`` is positive, and ``-n`` characters to the left if it is negative.
- ``Insert(...)``: inserts text at cursor. Namely, it converts each argument to a string and inserts the result into the document.
- ``NewLine()``: inserts new line character.
The following functions are provided for more advanced text manipulation. Position in the
document is denoted by the character offset from the beginning of the document, starting
from 1, so the first character is at position 1. Functions which take or return ranges use pairs of
offsets, a pair ``start``, ``end`` denotes range of text from
``start`` to ``end``, **not** including the character at offset ``end``. For instance, the
single-character range consisting of the first character in the document corresponds to the
pair ``1, 2``. Non-positive offset denotes the end of the document.
- ``InsertText(pos, ...)``: inserts text at the position ``pos``.
- ``DeleteText(start, end)``: deletes text in the range ``[start..end)``.
- ``GetInsert()``: returns position of the cursor in the document.
- ``GetSelectionBounds()``: returns positions of the selection start and end. If no text is
selected, returns pair ``pos, pos`` where ``pos`` is the cursor position.
- ``GetLine([pos])``: returns line number of the character at the position ``pos``. If ``pos``
is not specified, it defaults to the cursor position.
- ``GetPosAtLine(n)``: returns position at the beginning of the ``n``-th line.
- ``LineStart([pos])``: returns the position of the beginning of the line which contains character at ``pos``.
If ``pos`` is not specified, it defaults to the cursor position.
- ``LineEnd([pos])``: returns the position of the end of the line which contains character at ``pos``.
If ``pos`` is not specified, it defaults to the cursor position.
- ``ForwardLine([pos, [n]])``: returns the position of the beginning of the next line (or
``n``-th line if ``n`` is specified). ``pos`` defaults to the cursor position if not
specified.
- ``BackwardLine([pos, [n]])``: returns the position of the beginning of the previous line
(or ``n``-th line backwards if ``n`` is specified). ``pos`` defaults to the cursor position
if not specified.
- ``GetText(start, end)``: returns the text in the ``[start..end)``. If ``start == end``, it
returns an empty string, not ``nil``.
=== Shell scripts ===[user-tools-shell]
In addition to the document text passed via standard input,
shell scripts have a number of environment variables set. ``$APP_PID``
variable is set to the current process process id, so that opening a file in the
same instance of APPNAME is as simple as ``APPNAME filename`` (on the other
hand, you will have to use command line options if you need to run a new APPNAME instance).
The following environment variables are set when scripts are executed:
| ``DOC`` | the document basename. |
| ``DOC_DIR`` | the document file directory. The full file path is ``$DOC_DIR/$DOC``.
| ``DOC_BASE`` | the basename without extension.
| ``DOC_EXT`` | the document filename extension including the period. The basename is always ``$DOC_BASE$DOC_EXT``.
| ``LINE`` | the number of the line containing cursor.
| ``DATA_DIR`` | the user data directory. For example the tools are stored in ``$DATA_DIR/menu.cfg`` file and in files in the ``$DATA_DIR/tools/`` directory.
Additionally, all processes ran from inside APPNAME will have ``DATADIR/scripts``
directories in ``$PATH``, so you may place some APPNAME-specific programs
or scripts into ``USERDATADIR/scripts/`` to be used from shell script tools.

242
doc/user-tools.texi Normal file
View File

@ -0,0 +1,242 @@
@node User-defined Tools
@chapter User-defined Tools
@helpsection{USER_TOOLS}
@medit{} allows extending its functionality with user-defined
@dfn{tools}. It can be a Lua or Python (provided @medit{} has been
built with Python support) script which is executed inside @medit{},
or a shell script which can use the text of the open document as
its input and/or output.
There are some predefined tools which you can use as
an example or to modify to suit your needs.
@menu
* Managing tools:: Managing tools.
* Storing tools in files:: Storing tools in files.
@c * Lua scripts:: Lua scripts.
* Shell scripts:: Shell scripts.
@end menu
@node Managing tools
@section Managing tools
@helpsection{USER_TOOLS_MANAGING}
To create a new tool or to modify existing ones, open
@uilabel{Preferences} dialog and select @uilabel{Tools} in the list on the left.
Select the tool in the list or click the @uilabel{New}
button to create a new one. To modify the order in which the tools
appear in the @uilabel{Tools} menu (or in the document
context menu), use @uilabel{Up} and @uilabel{Down} buttons. To rename a tool,
click its name in the list to select it and then click again to
edit the name. Use the @uilabel{Delete} button to delete a tool.
The following controls are available to modify the tools behavior:
@table @asis
@item @uilabel{Files}
Specifies for which files the tool is going to be available.
@item @uilabel{Options}
Specifies under which conditions the tool should be enabled.
@item @uilabel{Command type}
The type of the tool: a Python script, a Lua script, or a shell script.
@item @uilabel{Code} text field
Here you enter the actual script text.
@end table
@uilabel{Options} entry content is a comma-separated list of the following:
@table @var
@item need-doc
the tool needs an open document.
@item need-file
the tool will not work in new unsaved documents.
@item need-save
the document will be saved before the command is executed.
@item need-save-all
all open documents will be saved before the command is executed.
@end table
@uilabel{Files} entry content can be the following:
@itemize @bullet
@item
a comma-separated list of file patterns, e.g. "@code{*.c,*.h}";
@item
a comma-separated list of languages prefixed with "@code{langs:}", e.g. "@code{langs: c, c++, objc}";
@item
a regular expression matching document filename prefixed with "@code{regex:}", e.g. the above
pattern list may be written as "@code{regex:\.[ch]$}".
@end itemize
Empty entry means that the tool will be available for all documents.
Shell script tools also have the following controls available:
@uilabel{Input} entry specifies what text from the document should be passed to the command via its standard input:
@table @uilabel
@item None
no input text.
@item Selected lines
the lines containing selection or the line containing the cursor in case when no text is selected.
@item Selection
exact selected text. This will be different from "Selected lines" if selection does not span whole lines of the document, for instance if it is a single word.
@item Whole document
whole document contents.
@end table
@uilabel{Output} entry specifies how the standard output of the command should be redirected.
@table @uilabel
@item None
the command output will be discarded.
@item None, asynchronous
the command output will be discarded, and the command will be executed in background.
For instance, you should use this if you need to launch some external program like a web browser.
@item Output pane
the command output will be displayed in an output pane. This is useful for running programs
like compilers, where you want to see the output.
@item Insert into the document
output will be inserted into the current document at the cursor position. It will replace the
text used as an input, if any.
@item New document
new document will be created and the command output will be inserted into it.
@end table
@uilabel{Filter} combo. If the output pane is used, then it can be passed through a @dfn{filter}:
the filter can match filenames and line numbers, so when you click the text in the
output pane it will open the corresponding file. This is used for compilers and similar
commands, which output locations of errors in processed files.
@node Storing tools in files
@section Storing tools in files
@helpsection{USER_TOOLS_FILES}
It is possible to create tools without using the @uilabel{Preferences} dialog,
they can be stored in files in @file{tools} subfolder of the @medit{} data
folders (or @file{tools-context} for tools which appear in the document context
menu). In particular, on Unix systems you can place files into
@file{$HOME/.local/share/@medit{}/tools/} folder.
Names of the files in the @file{tools} folder are used as their menu item
labels, after stripping first three characters, so you can use trhee-character
prefix to affect the order of the menu items, e.g. you can have @file{00-Do Something},
@file{01-Another tool} files to have them in that order in the menu. The files
may be of three types: files with extension "@file{.py}", they will be used
as Python scripts; files with extension "@file{.lua}", they will be used
as Lua scripts; and executable files, they will be executed in the same way
as shell commands.
To set parameters for a tool, place them on the first or the second line of the file in
the following format:
@example
!! @var{key}=@var{value}; @var{key}=@var{value}; ... !!
@end example
@var{key} may be one of the following:
@table @var
@item position
it can be ``start`` or ``end``, and defines whether the menu item will be located at the start or at the end of the menu.
@item id
the tool identificator.
@item name
the tool name, i.e. the label used in the menu item. Overrides the file name.
@item accel
default keyboard accelerator used to invoke this tool.
@item menu
the menu to place this tool into. By default the tools are located in the Tools menu, but they can be as well put into any other menu.
@item langs
comma-separated list of languages for which this tool will be enabled.
@item file-filter
defines for which files this tool will be enabled. The value has the same format as in the @uilabel{Preferences} dialog.
@item options
same as the @uilabel{Options} entry content in the @uilabel{Preferences} dialog.
@end table
In addition to these, you can set input and output options for executable files:
@table @var
@item input
can be @code{none}, @code{lines}, @code{selection}, or @code{doc}.
@item output
can be @code{none}, @code{async}, @code{pane}, @code{insert}, or @code{new-doc}.
@item filter
the output filter name.
@end table
@c @node Lua scripts
@c @section Lua scripts
@c
@c Lua scripts can use the standard Lua library, ``lfs`` library, and ``medit`` package
@c which provides some text editor API. Lua scripts have the following variables and functions available.
@c
@c - ``doc``: a table with the following fields:
@c | ``file`` | the document file path. |
@c | ``name`` | the document file basename.
@c | ``dir`` | the document file directory.
@c | ``ext`` | the document filename extension including the period.
@c | ``base`` | the document filename without the extension: the basename is always ``base..ext``.
@c - ``Cut()``, ``Copy()``, ``Paste()``: clipboard operations.
@c - ``Backspace()``, ``Delete()``: corresponding key actions.
@c - ``Up()``, ``Down()``, ``Left()``, ``Right()``: move cursor as the arrow keys do.
@c - ``Selection()``: returns selected text as a string. Returns ``nil`` when no text is selected.
@c - ``Select(n)``: selects ``n`` characters to the right if ``n`` is positive, and ``-n`` characters to the left if it is negative.
@c - ``Insert(...)``: inserts text at cursor. Namely, it converts each argument to a string and inserts the result into the document.
@c - ``NewLine()``: inserts new line character.
@c
@c The following functions are provided for more advanced text manipulation. Position in the
@c document is denoted by the character offset from the beginning of the document, starting
@c from 1, so the first character is at position 1. Functions which take or return ranges use pairs of
@c offsets, a pair ``start``, ``end`` denotes range of text from
@c ``start`` to ``end``, **not** including the character at offset ``end``. For instance, the
@c single-character range consisting of the first character in the document corresponds to the
@c pair ``1, 2``. Non-positive offset denotes the end of the document.
@c
@c - ``InsertText(pos, ...)``: inserts text at the position ``pos``.
@c - ``DeleteText(start, end)``: deletes text in the range ``[start..end)``.
@c - ``GetInsert()``: returns position of the cursor in the document.
@c - ``GetSelectionBounds()``: returns positions of the selection start and end. If no text is
@c selected, returns pair ``pos, pos`` where ``pos`` is the cursor position.
@c - ``GetLine([pos])``: returns line number of the character at the position ``pos``. If ``pos``
@c is not specified, it defaults to the cursor position.
@c - ``GetPosAtLine(n)``: returns position at the beginning of the ``n``-th line.
@c - ``LineStart([pos])``: returns the position of the beginning of the line which contains character at ``pos``.
@c If ``pos`` is not specified, it defaults to the cursor position.
@c - ``LineEnd([pos])``: returns the position of the end of the line which contains character at ``pos``.
@c If ``pos`` is not specified, it defaults to the cursor position.
@c - ``ForwardLine([pos, [n]])``: returns the position of the beginning of the next line (or
@c ``n``-th line if ``n`` is specified). ``pos`` defaults to the cursor position if not
@c specified.
@c - ``BackwardLine([pos, [n]])``: returns the position of the beginning of the previous line
@c (or ``n``-th line backwards if ``n`` is specified). ``pos`` defaults to the cursor position
@c if not specified.
@c - ``GetText(start, end)``: returns the text in the ``[start..end)``. If ``start == end``, it
@c returns an empty string, not ``nil``.
@node Shell scripts
@section Shell scripts
@helpsection{USER_TOOLS_SHELL_SCRIPTS}
In addition to the document text passed via standard input,
shell scripts have a number of environment variables set. @env{APP_PID}
variable is set to the current process process id, so that opening a file in the
same instance of @medit{} is as simple as @code{@medit{} filename} (on the other
hand, you will have to use command line options if you need to run a new @medit{} instance).
The following environment variables are set when scripts are executed:
@table @env
@item DOC
the document basename.
@item DOC_DIR
the document file directory. The full file path is @file{$DOC_DIR/$DOC}.
@item DOC_BASE
the basename without extension.
@item DOC_EXT
the document filename extension including the period. The basename is always @file{$DOC_BASE$DOC_EXT}.
@item LINE
the number of the line containing cursor.
@item DATA_DIR
the user data directory. For example the tools are stored in @file{$DATA_DIR/menu.cfg} file and in files in the @file{$DATA_DIR/tools/} directory.
@end table
Additionally, all processes ran from inside @medit{} will have @file{DATADIR/scripts}
directories in @code{$PATH}, so you may place some @medit{}-specific programs
or scripts into @file{USERDATADIR/scripts/} to be used from shell script tools.

View File

@ -205,7 +205,10 @@ MooLineEndType
moo_edit_get_line_end_type (MooEdit *edit)
{
moo_return_val_if_fail (MOO_IS_EDIT (edit), MOO_LE_DEFAULT);
return edit->priv->line_end_type;
if (edit->priv->line_end_type == MOO_LE_NONE)
return MOO_LE_DEFAULT;
else
return edit->priv->line_end_type;
}
static void

View File

@ -1224,6 +1224,15 @@ moo_edit_filename_changed (MooEdit *edit,
}
void
moo_edit_reload (MooEdit *edit,
const char *encoding,
GError **error)
{
_moo_editor_reload (edit->priv->editor, edit, encoding, error);
}
gboolean
moo_edit_close (MooEdit *edit,
gboolean ask_confirm)

View File

@ -106,6 +106,9 @@ MooEditStatus moo_edit_get_status (MooEdit *edit);
void moo_edit_status_changed (MooEdit *edit);
MooEditState moo_edit_get_state (MooEdit *edit);
void moo_edit_reload (MooEdit *edit,
const char *encoding,
GError **error);
gboolean moo_edit_close (MooEdit *edit,
gboolean ask_confirm);
gboolean moo_edit_save (MooEdit *edit,

View File

@ -1258,8 +1258,6 @@ update_doc_line_end_item (MooEditWindow *window)
g_return_if_fail (action != NULL);
le = moo_edit_get_line_end_type (doc);
if (le == MOO_LE_NONE)
le = MOO_LE_DEFAULT;
g_return_if_fail (le > 0 && le < G_N_ELEMENTS(line_end_menu_items));
moo_menu_mgr_set_active (moo_menu_action_get_mgr (MOO_MENU_ACTION (action)),

View File

@ -286,7 +286,8 @@ open_file_by_id (const char *id,
GtkWidget *parent)
{
const char *dir;
char *filename, *basename;
const char *basename;
char *filename;
g_return_if_fail (id != NULL);
@ -296,10 +297,14 @@ open_file_by_id (const char *id,
return;
}
if (!strcmp (id, MOO_HELP_ID_CONTENTS))
if (strcmp (id, MOO_HELP_ID_CONTENTS) == 0)
id = MOO_HELP_ID_INDEX;
basename = g_strdup_printf ("%s.html", id);
if (strcmp (id, MOO_HELP_ID_INDEX) == 0 || id[0] == 0)
basename = "index.html";
else
basename = id;
filename = g_build_filename (dir, basename, NULL);
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
@ -310,7 +315,6 @@ open_file_by_id (const char *id,
warn_no_help_file (basename, parent);
g_free (filename);
g_free (basename);
}
void

View File

@ -14,7 +14,3 @@ EXTRA_DIST += plugins/script/genmeta.py
momscript-classes-meta.h: plugins/script/momscript-classes.h plugins/script/genmeta.py
$(PYTHON) $(srcdir)/plugins/script/genmeta.py $(srcdir)/plugins/script/momscript-classes.h > momscript-classes-meta.h.tmp && \
mv momscript-classes-meta.h.tmp momscript-classes-meta.h
plugins/script/momscript.t2t: plugins/script/momscript-classes.h plugins/script/momscript-classes.cpp plugins/script/gendoc.py
$(PYTHON) $(srcdir)/plugins/script/gendoc.py $(srcdir)/plugins/script/momscript-classes.h $(srcdir)/plugins/script/momscript-classes.cpp \
> $(srcdir)/plugins/script/momscript.t2t.tmp && mv $(srcdir)/plugins/script/momscript.t2t.tmp $(srcdir)/plugins/script/momscript.t2t

View File

@ -49,14 +49,28 @@ static bool get_bool(const Variant &val)
return val.value<VtBool>();
}
static String get_string(const Variant &val)
static String get_string(const Variant &val, bool null_ok = false)
{
if (null_ok && val.vt() == VtVoid)
return String();
if (val.vt() != VtString)
Error::raise("string expected");
return val.value<VtString>();
}
static moo::Vector<String> get_string_list(const Variant &val)
{
if (val.vt() != VtArray)
Error::raise("list expected");
const VariantArray &ar = val.value<VtArray>();
moo::Vector<String> ret;
for (int i = 0, c = ar.size(); i < c; ++i)
ret.append(get_string(ar[i]));
return ret;
}
template<typename GClass, typename Class>
static Variant wrap_gslist(GSList *list)
{
@ -231,8 +245,168 @@ Variant Editor::windows(const VariantArray &args)
return wrap_gslist<MooEditWindow, DocumentWindow>(windows);
}
// METHOD(get_document_by_path);
// METHOD(get_document_by_uri);
Variant Editor::get_document_by_path(const VariantArray &args)
{
check_1_arg(args);
String path = get_string(args[0]);
MooEdit *doc = moo_editor_get_doc(moo_editor_instance(), path);
return doc ? HObject(Document::wrap(doc)) : HObject();
}
Variant Editor::get_document_by_uri(const VariantArray &args)
{
check_1_arg(args);
String uri = get_string(args[0]);
MooEdit *doc = moo_editor_get_doc_for_uri(moo_editor_instance(), uri);
return doc ? HObject(Document::wrap(doc)) : HObject();
}
static GSList *get_file_info_list(const Variant &val, bool uri)
{
moo::Vector<String> filenames = get_string_list(val);
if (filenames.empty())
return NULL;
GSList *files = NULL;
for (int i = 0, c = filenames.size(); i < c; ++i)
{
MooEditFileInfo *fi = uri ?
moo_edit_file_info_new_uri(filenames[i], NULL) :
moo_edit_file_info_new_path(filenames[i], NULL);
if (!fi)
goto error;
files = g_slist_prepend(files, fi);
}
return g_slist_reverse(files);
error:
g_slist_foreach(files, (GFunc) moo_edit_file_info_free, NULL);
g_slist_free(files);
Error::raise("error");
}
static Variant open_files_or_uris(const VariantArray &args, bool uri)
{
if (args.size() == 0 || args.size() > 2)
Error::raise("expected one or two arguments");
moo::SharedPtr<DocumentWindow> window;
if (args.size() >= 2)
window = get_object<DocumentWindow>(args[1], true);
GSList *files = get_file_info_list(args[0], uri);
moo_editor_open(moo_editor_instance(), window ? window->gobj() : NULL, NULL, files);
g_slist_foreach(files, (GFunc) moo_edit_file_info_free, NULL);
g_slist_free(files);
return Variant();
}
Variant Editor::open_files(const VariantArray &args)
{
return open_files_or_uris(args, false);
}
Variant Editor::open_uris(const VariantArray &args)
{
return open_files_or_uris(args, true);
}
static Variant open_file_or_uri(const VariantArray &args, bool uri, bool new_file)
{
if (args.size() == 0)
Error::raise("at least one argument expected");
String file = get_string(args[0]);
String encoding;
if (args.size() > 1)
encoding = get_string(args[1], true);
moo::SharedPtr<DocumentWindow> window;
if (args.size() > 2)
window = get_object<DocumentWindow>(args[2], true);
MooEdit *doc = NULL;
if (new_file)
{
if (uri)
{
moo_assert_not_reached();
Error::raise("error");
}
else
{
doc = moo_editor_new_file(moo_editor_instance(), window ? window->gobj() : NULL, NULL, file, encoding);
}
}
else
{
if (uri)
doc = moo_editor_open_uri(moo_editor_instance(), window ? window->gobj() : NULL, NULL, file, encoding);
else
doc = moo_editor_open_file(moo_editor_instance(), window ? window->gobj() : NULL, NULL, file, encoding);
}
return doc ? HObject(Document::wrap(doc)) : HObject();
}
Variant Editor::open_file(const VariantArray &args)
{
return open_file_or_uri(args, false, false);
}
Variant Editor::open_uri(const VariantArray &args)
{
return open_file_or_uri(args, true, false);
}
Variant Editor::new_file(const VariantArray &args)
{
return open_file_or_uri(args, false, true);
}
Variant Editor::reload(const VariantArray &args)
{
check_1_arg(args);
moo::SharedPtr<Document> doc = get_object<Document>(args[0]);
moo_edit_reload(doc->gobj(), NULL, NULL);
return Variant();
}
Variant Editor::save(const VariantArray &args)
{
check_1_arg(args);
moo::SharedPtr<Document> doc = get_object<Document>(args[0]);
return bool(moo_edit_save(doc->gobj(), NULL));
}
Variant Editor::save_as(const VariantArray &args)
{
if (args.size() == 0)
Error::raise("at least one argument expected");
moo::SharedPtr<Document> doc = get_object<Document>(args[0]);
String filename;
if (args.size() > 0)
filename = get_string(args[1], true);
return bool(moo_edit_save_as(doc->gobj(),
filename.empty() ? NULL : (const char*) filename,
NULL,
NULL));
}
Variant Editor::close(const VariantArray &args)
{
check_1_arg(args);
return bool(moo_edit_close(get_object<Document>(args[0])->gobj(), TRUE));
}
///////////////////////////////////////////////////////////////////////////////
@ -404,53 +578,90 @@ Variant Document::basename(const VariantArray &args)
return String(moo_edit_get_display_basename(gobj()));
}
// Variant Document::reload(const VariantArray &args)
// {
// VariantArray editor_args;
// editor_args.append(HObject(*this));
// editor_args.append(args);
// return Editor::get_instance().reload(editor_args);
// }
//
// Variant Document::save(const VariantArray &args)
// {
// VariantArray editor_args;
// editor_args.append(HObject(*this));
// editor_args.append(args);
// return Editor::get_instance().save(editor_args);
// }
//
// Variant Document::save_as(const VariantArray &args)
// {
// VariantArray editor_args;
// editor_args.append(HObject(*this));
// editor_args.append(args);
// return Editor::get_instance().save_as(editor_args);
// }
//
// Variant Document::save_as_uri(const VariantArray &args)
// {
// VariantArray editor_args;
// editor_args.append(HObject(*this));
// editor_args.append(args);
// return Editor::get_instance().save_as_uri(editor_args);
// }
Variant Document::reload(const VariantArray &args)
{
VariantArray editor_args;
editor_args.append(HObject(*this));
editor_args.append(args);
return Editor::get_instance().reload(editor_args);
}
// Variant Document::encoding(const VariantArray &args)
// {
// }
//
// Variant Document::set_encoding(const VariantArray &args)
// {
// }
//
// Variant Document::line_endings(const VariantArray &args)
// {
// }
//
// Variant Document::set_line_endings(const VariantArray &args)
// {
// }
Variant Document::save(const VariantArray &args)
{
VariantArray editor_args;
editor_args.append(HObject(*this));
editor_args.append(args);
return Editor::get_instance().save(editor_args);
}
Variant Document::save_as(const VariantArray &args)
{
VariantArray editor_args;
editor_args.append(HObject(*this));
editor_args.append(args);
return Editor::get_instance().save_as(editor_args);
}
Variant Document::encoding(const VariantArray &args)
{
check_no_args(args);
return String(moo_edit_get_encoding(gobj()));
}
Variant Document::set_encoding(const VariantArray &args)
{
check_1_arg(args);
String enc = get_string(args);
moo_edit_set_encoding(gobj(), enc);
return Variant();
}
Variant Document::line_endings(const VariantArray &args)
{
check_no_args(args);
switch (moo_edit_get_line_end_type(gobj()))
{
case MOO_LE_UNIX:
return String("unix");
case MOO_LE_WIN32:
return String("win32");
case MOO_LE_MAC:
return String("mac");
case MOO_LE_MIX:
return String("mix");
case MOO_LE_NONE:
return String("none");
}
moo_assert_not_reached();
Error::raise("error");
}
Variant Document::set_line_endings(const VariantArray &args)
{
check_1_arg(args);
MooLineEndType le = MOO_LE_NONE;
String str_le = get_string(args[0]);
if (str_le == "unix")
le = MOO_LE_UNIX;
else if (str_le == "win32")
le = MOO_LE_WIN32;
else if (str_le == "mac")
le = MOO_LE_MAC;
else if (str_le == "mix")
le = MOO_LE_MIX;
else if (str_le == "none")
le = MOO_LE_NONE;
else
Error::raise("invalid line ending type");
moo_edit_set_line_end_type(gobj(), le);
return Variant();
}
Variant Document::can_undo(const VariantArray &args)
{

View File

@ -65,90 +65,135 @@ private: \
MOM_OBJECT_DEFN(Class) \
template<> Class *_Singleton<Class>::s_instance = 0;
///
/// @node Application object
/// @section Application object
/// @helpsection{SCRIPT_APPLICATION}
/// @table @method
///
SINGLETON_CLASS(Application)
{
public:
/// @item Application.editor()
/// returns Editor object.
METHOD(editor);
/// @item Application.active_view()
/// returns current active document view or @null{} if no documents are open.
METHOD(active_view);
/// @item Application.active_document()
/// returns current active document or @null{} if no documents are open.
METHOD(active_document);
/// @item Application.active_window()
/// returns current active window.
METHOD(active_window);
/// @item Application.set_active_window(window)
/// activates @param{window}.
METHOD(set_active_window);
/// @item Application.windows()
/// returns a list of all editor windows.
METHOD(windows);
/// @item Application.quit()
/// quit @medit{}.
METHOD(quit);
private:
MOM_SINGLETON_DECL(Application)
};
///////////////////////////////////////////////////////////////////////////////
///
/// ==== Editor ====[mom-script-editor]
/// @end table
///
///
/// @node Editor object
/// @section Editor object
/// @helpsection{SCRIPT_EDITOR}
/// @table @method
///
SINGLETON_CLASS(Editor)
{
public:
/// - ``Editor.active_document()``: returns current active document or null
/// if there are no open documents
/// @item Editor.active_document()
/// returns current active document or @null{} if there are no open documents
METHOD(active_document);
/// - ``Editor.set_active_document(doc)``: makes ``doc`` active
/// @item Editor.set_active_document(doc)
/// makes @param{doc} active
METHOD(set_active_document);
/// - ``Editor.active_window()``: returns current active window
/// @item Editor.active_window()
/// returns current active window
METHOD(active_window);
/// - ``Editor.set_active_window(window)``: makes ``window`` active
/// @item Editor.set_active_window(window)
/// makes @param{window} active
METHOD(set_active_window);
/// - ``Editor.active_view()``: returns current active document view
/// @item Editor.active_view()
/// returns current active document view
METHOD(active_view);
/// - ``Editor.set_active_view(view)``: makes ``view`` active
/// @item Editor.set_active_view(view)
/// makes @param{view} active
METHOD(set_active_view);
/// - ``Editor.documents()``: returns list of all open documents
/// @item Editor.documents()
/// returns list of all open documents
METHOD(documents);
/// - ``Editor.documents()``: returns list of all open document views
/// @item Editor.documents()
/// returns list of all open document views
METHOD(views);
/// - ``Editor.documents()``: returns list of all document windows
/// @item Editor.documents()
/// returns list of all document windows
METHOD(windows);
// /// - ``Editor.get_document_by_path(path)``: returns document with path
// /// ``path`` or null.
// METHOD(get_document_by_path);
// /// - ``Editor.get_document_by_uri(path)``: returns document with uri
// /// ``uri`` or null.
// METHOD(get_document_by_uri);
//
// /// - ``Editor.open_files(files, window=null)``: open files. If ``window`` is
// /// given then open files in that window, otherwise in an existing window.
// METHOD(open_files);
// /// - ``Editor.open_files(uris, window=null)``: open files. If ``window`` is
// /// given then open files in that window, otherwise in an existing window.
// METHOD(open_uris);
// /// - ``Editor.open_file(file, encoding=null, window=null)``: open file.
// /// If ``encoding`` is null or "auto" then pick character encoding automatically,
// /// otherwise use ``encoding``.
// /// If ``window`` is given then open files in that window, otherwise in an existing window.
// METHOD(open_file);
// /// - ``Editor.open_uri(uri, encoding=null, window=null)``: open file.
// /// If ``encoding`` is null or "auto" then pick character encoding automatically,
// /// otherwise use ``encoding``.
// /// If ``window`` is given then open files in that window, otherwise in an existing window.
// METHOD(open_uri);
// /// - ``Editor.reload(doc)``: reload document.
// METHOD(reload);
// /// - ``Editor.save(doc)``: save document.
// METHOD(save);
// /// - ``Editor.save_as(doc, new_filename=null)``: save document as ``new_filename``.
// /// If ``new_filename`` is not given then first ask user for new filename.
// METHOD(save_as);
// /// - ``Editor.save_as_uri(doc, new_uri=null)``: save document as ``new_uri``.
// /// If ``new_uri`` is not given then first ask user for new filename.
// METHOD(save_as_uri);
// /// ``Editor.close(doc)``: close document.
// METHOD(close);
/// @item Editor.get_document_by_path(path)
/// returns document with path @param{path} or @null{}.
METHOD(get_document_by_path);
/// @item Editor.get_document_by_uri(path)
/// returns document with uri @param{uri} or @null{}.
METHOD(get_document_by_uri);
/// @item Editor.new_file(file, encoding=null, window=null)
/// open file if it exists on disk or create a new one. If @param{encoding} is
/// @null{} or "auto" then pick character encoding automatically, otherwise use
/// @param{encoding}. If @param{window} is given then open file in that window,
/// otherwise in an existing window.
METHOD(new_file);
/// @item Editor.open_files(files, window=null)
/// open files. If @param{window} is given then open files in that window,
/// otherwise in an existing window.
METHOD(open_files);
/// @item Editor.open_files(uris, window=null)
/// open files. If @param{window} is given then open files in that window,
/// otherwise in an existing window.
METHOD(open_uris);
/// @item Editor.open_file(file, encoding=null, window=null)
/// open file. If @param{encoding} is @null{} or "auto" then pick character
/// encoding automatically, otherwise use @param{encoding}. If @param{window}
/// is given then open files in that window, otherwise in an existing window.
METHOD(open_file);
/// @item Editor.open_uri(uri, encoding=null, window=null)
/// open file. If @param{encoding} is @null{} or "auto" then pick character
/// encoding automatically, otherwise use @param{encoding}. If @param{window}
/// is given then open files in that window, otherwise in an existing window.
METHOD(open_uri);
/// @item Editor.reload(doc)
/// reload document.
METHOD(reload);
/// @item Editor.save(doc)
/// save document.
METHOD(save);
/// @item Editor.save_as(doc, filename=null)
/// save document as @param{filename}. If @param{filename} is not given then
/// first ask user for new filename.
METHOD(save_as);
/// @item Editor.close(doc)
/// close document.
METHOD(close);
private:
MOM_SINGLETON_DECL(Editor)
};
///
/// @end table
///
template<typename T, typename GT>
class _GObjectWrapper : public Object
@ -218,114 +263,332 @@ protected: \
#define MOM_GOBJECT_DEFN(Class) \
MOM_OBJECT_DEFN(Class)
///
/// @node DocumentWindow object
/// @section DocumentWindow object
/// @helpsection{SCRIPT_DOCUMENT_WINDOW}
/// @table @method
///
GOBJECT_CLASS(DocumentWindow, MooEditWindow)
{
public:
/// @item DocumentWindow.editor()
/// returns Editor object.
METHOD(editor);
/// @item DocumentWindow.active_view()
/// returns current active document view in this window.
METHOD(active_view);
/// @item DocumentWindow.set_active_view(view)
/// makes @param{view} active, i.e. switches to its tab.
METHOD(set_active_view);
/// @item DocumentWindow.active_document()
/// returns current active document in this window, that is the document
/// whose view is the active one.
METHOD(active_document);
/// @item DocumentWindow.set_active_document(doc)
/// makes active a view of document @param{doc}. It picks arbitrary view
/// of @param{doc} if there are more than one in this window.
METHOD(set_active_document);
/// @item DocumentWindow.views()
/// returns list of all document views in this window.
METHOD(views);
/// @item DocumentWindow.documents()
/// returns list of all documents in this window.
METHOD(documents);
/// @item DocumentWindow.is_active()
/// returns whether this window is the active one.
METHOD(is_active);
/// @item DocumentWindow.set_active()
/// makes this window active.
METHOD(set_active);
private:
MOM_GOBJECT_DECL(DocumentWindow, MooEditWindow)
};
///
/// @end table
///
///
/// @node DocumentView object
/// @section DocumentView object
/// @helpsection{DOCUMENT_VIEW}
/// @table @method
///
GOBJECT_CLASS(DocumentView, MooEdit)
{
public:
/// @item DocumentView.document()
/// returns document to which this view belongs.
METHOD(document);
/// @item DocumentView.window()
/// returns window which contains this view.
METHOD(window);
/// @item DocumentView.line_wrap_mode()
/// returns whether line wrapping is enabled.
METHOD(line_wrap_mode);
/// @item DocumentView.set_line_wrap_mode(enabled)
/// enables or disables line wrapping.
METHOD(set_line_wrap_mode);
/// @item DocumentView.overwrite_mode()
/// returns whether overwrite mode is on.
METHOD(overwrite_mode);
/// @item DocumentView.set_overwrite_mode(enabled)
/// enables or disables overwrite mode.
METHOD(set_overwrite_mode);
/// @item DocumentView.show_line_numbers()
/// returns whether line numbers are displayed.
METHOD(show_line_numbers);
/// @item DocumentView.set_show_line_numbers(show)
/// shows or hides line numbers.
METHOD(set_show_line_numbers);
private:
MOM_GOBJECT_DECL(DocumentView, MooEdit)
};
///
/// @end table
///
///
/// @node Document object
/// @section Document object
/// @helpsection{DOCUMENT}
///
GOBJECT_CLASS(Document, MooEdit)
{
public:
/// @table @method
/// @item Document.views()
/// returns list of views which display this document.
METHOD(views);
/// @item Document.active_view()
/// returns active view of this document. If the document has a single
/// view, then that is returned; otherwise if the current active view
/// belongs to this document, then that view is returned; otherwise
/// a random view is picked.
METHOD(active_view);
/// @item Document.filename()
/// returns full file path of the document or @null{} if the document
/// has not been saved yet or if it can't be represented with a local
/// path (e.g. if it is in a remote location like a web site).
/// @itemize @minus
/// @item Untitled => @null{}
/// @item @file{/home/user/example.txt} => @code{"/home/user/example.txt"}
/// @item @file{http://example.com/index.html} => @null{}
/// @end itemize
METHOD(filename);
/// @item Document.uri()
/// returns URI of the document or @null{} if the document has not been
/// saved yet.
METHOD(uri);
/// @item Document.basename()
/// returns basename of the document, that is the full path minus directory
/// part. If the document has not been saved yet, then it returns the name
/// shown in the titlebar, e.g. "Untitled".
METHOD(basename);
// METHOD(encoding);
// METHOD(set_encoding);
// METHOD(line_endings);
// METHOD(set_line_endings);
/// @item Document.encoding()
/// returns character encoding of the document.
METHOD(encoding);
/// @item Document.set_encoding(encoding)
/// set character encoding of the document, it will be used when the document
/// is saved.
METHOD(set_encoding);
// METHOD(reload);
// METHOD(save);
// METHOD(save_as);
// METHOD(save_as_uri);
METHOD(line_endings);
METHOD(set_line_endings);
/// @item Document.reload()
/// reload the document.
METHOD(reload);
/// @item Document.save()
/// save the document.
METHOD(save);
/// @item Document.save_as(filename=null)
/// save the document as @param{filename}. If @param{filename} is @null{} then
/// @uilabel{Save As} will be shown to choose new filename.
METHOD(save_as);
/// @item Document.can_undo()
/// returns whether undo action is available.
METHOD(can_undo);
/// @item Document.can_redo()
/// returns whether redo action is available.
METHOD(can_redo);
/// @item Document.undo()
/// undo.
METHOD(undo);
/// @item Document.redo()
/// redo.
METHOD(redo);
/// @item Document.begin_not_undoable_action()
/// mark the beginning of a non-undoable operation. Undo stack will be erased
/// and undo will not be recorded until @method{end_not_undoable_action()} call.
METHOD(begin_not_undoable_action);
/// @item Document.end_not_undoable_action()
/// end the non-undoable operation started with @method{begin_not_undoable_action()}.
METHOD(end_not_undoable_action);
/// @end table
/// @table @method
/// @item Document.start_pos()
/// position at the beginning of the document (0 in Python, 1 in Lua, etc.)
METHOD(start_pos);
/// @item Document.end_pos()
/// position at the end of the document. This is the position past the last
/// character: it points to no character, but it is a valid position for
/// text insertion, cursor may be put there, etc.
METHOD(end_pos);
/// @item Document.cursor_pos()
/// position at the cursor.
METHOD(cursor_pos);
/// @item Document.set_cursor_pos(pos)
/// move cursor to position @param{pos}.
METHOD(set_cursor_pos);
/// @item Document.selection()
/// returns selection bounds as a list of two items, start and end. Returned
/// list is always sorted, use @method{cursor()} and @method{selection_bound()}
/// if you need to distinguish beginning and end of selection. If no text is
/// is selected, then it returns pair @code{[cursor, cursor]}.
METHOD(selection);
/// @item Document.set_selection(bounds_as_list)
/// @item Document.set_selection(start, end)
/// select text.
METHOD(set_selection);
/// @item Document.selection_bound()
/// returns the selection bound other than cursor position. Selection is
/// either [cursor, selection_bound) or [selection_bound, cursor), depending
/// on direction user dragged the mouse (or on @method{set_selection}
/// arguments).
METHOD(selection_bound);
/// @item Document.has_selection()
/// whether any text is selected.
METHOD(has_selection);
/// @item Document.char_count()
/// character count.
METHOD(char_count);
/// @item Document.line_count()
/// line count.
METHOD(line_count);
/// @item Document.line_at_pos(pos)
/// returns index of the line which contains position @param{pos}.
METHOD(line_at_pos);
/// @item Document.pos_at_line(line)
/// returns position at the beginning of line @param{line}.
METHOD(pos_at_line);
/// @item Document.pos_at_line(line)
/// returns position at the end of line @param{line}.
METHOD(pos_at_line_end);
/// @item Document.char_at_pos(pos)
/// returns character at position @param{pos} as string.
METHOD(char_at_pos);
/// @item Document.text()
/// returns whole document contents.
/// @item Document.text(start, end)
/// returns text in the range [@param{start}, @param{end}), @param{end} not
/// included. Example: @code{doc.text(doc.start_pos(), doc.end_pos())} is
/// equivalent @code{to doc.text()}.
METHOD(text);
/// @item Document.insert_text(text)
/// @item Document.insert_text(pos, text)
/// insert text into the document. If @param{pos} is not given, insert at
/// cursor position.
METHOD(insert_text);
/// @item Document.replace_text(start, end, text)
/// replace text in the region [@param{start}, @param{end}). Equivalent to
/// @code{delete_text(start, end), insert_text(start, text)}.
METHOD(replace_text);
/// @item Document.delete_text(start, end)
/// delete text in the region [@param{start}, @param{end}). Example:
/// @code{doc.delete_text(doc.start(), doc.end())} will delete all text in
/// @code{doc}.
METHOD(delete_text);
/// @item Document.append_text(text)
/// append text. Equivalent to @code{doc.insert_text(doc.end(), text)}.
METHOD(append_text);
/// @item Document.clear()
/// delete all text in the document.
METHOD(clear);
/// @item Document.copy()
/// copy selected text to clipboard. If no text is selected then nothing
/// will happen, same as Ctrl-C key combination.
METHOD(copy);
/// @item Document.cut()
/// cut selected text to clipboard. If no text is selected then nothing
/// will happen, same as Ctrl-X key combination.
METHOD(cut);
/// @item Document.paste()
/// paste text from clipboard. It has the same effect as Ctrl-V key combination:
/// nothing happens if clipboard is empty, and selected text is replaced with
/// clipboard contents otherwise.
METHOD(paste);
/// @item Document.select_text(bounds_as_list)
/// @item Document.select_text(start, end)
/// select text, same as @method{set_selection()}.
METHOD(select_text);
/// @item Document.select_lines(line)
/// select a line.
/// @item Document.select_lines(first, last)
/// select lines from @param{first} to @param{last}, @emph{including}
/// @param{last}.
METHOD(select_lines);
/// @item Document.select_lines_at_pos(bounds_as_list)
/// @item Document.select_lines_at_pos(start, end)
/// select lines: similar to @method{select_text}, but select whole lines.
METHOD(select_lines_at_pos);
/// @item Document.select_all()
/// select all.
METHOD(select_all);
/// @item Document.selected_text()
/// returns selected text.
METHOD(selected_text);
/// @item Document.selected_lines()
/// returns selected lines as a list of strings, one string for each line,
/// line terminator characters not included. If nothing is selected, then
/// line at cursor is returned.
METHOD(selected_lines);
/// @item Document.delete_selected_text()
/// delete selected text, equivalent to @code{doc.delete_text(doc.cursor(),
/// doc.selection_bound())}.
METHOD(delete_selected_text);
/// @item Document.delete_selected_lines()
/// delete selected lines. Similar to @method{delete_selected_text()} but
/// selection is extended to include whole lines. If nothing is selected,
/// then line at cursor is deleted.
METHOD(delete_selected_lines);
/// @item Document.replace_selected_text(text)
/// replace selected text with @param{text}. If nothing is selected,
/// @param{text} is inserted at cursor.
METHOD(replace_selected_text);
/// @item Document.replace_selected_lines(text)
/// replace selected lines with @param{text}. Similar to
/// @method{replace_selected_text()}, but selection is extended to include
/// whole lines. If nothing is selected, then line at cursor is replaced.
METHOD(replace_selected_lines);
/// @end table
public:
GtkTextBuffer *buffer() { return gtk_text_view_get_buffer(GTK_TEXT_VIEW(gobj())); }
private:
MOM_GOBJECT_DECL(Document, MooEdit)
};
///
///
#undef PROPERTY
#undef METHOD

View File

@ -11,6 +11,28 @@ if there are no open documents
- ``Editor.documents()``: returns list of all open documents
- ``Editor.documents()``: returns list of all open document views
- ``Editor.documents()``: returns list of all document windows
- ``Editor.get_document(name)``: returns document with name ``name`` or
null. ``name`` is interpreted as full file path, as file URI, as file
basename (file path minus directory path), in that order.
- ``Editor.get_document_by_path(path)``: returns document with path
``path`` or null.
- ``Editor.get_document_by_uri(path)``: returns document with uri
``uri`` or null.
- ``Editor.new_file(file, encoding=null, window=null)``: open file if it exists
on disk or create a new one. If ``encoding`` is null or "auto" then pick character
encoding automatically, otherwise use ``encoding``. If ``window`` is given then
open file in that window, otherwise in an existing window.
- ``Editor.open_files(files, window=null)``: open files. If ``window`` is
given then open files in that window, otherwise in an existing window.
- ``Editor.open_files(uris, window=null)``: open files. If ``window`` is
given then open files in that window, otherwise in an existing window.
- ``Editor.open_file(file, encoding=null, window=null)``: open file.
If ``encoding`` is null or "auto" then pick character encoding automatically,
otherwise use ``encoding``.
If ``window`` is given then open files in that window, otherwise in an existing window.
- ``Editor.open_uri(uri, encoding=null, window=null)``: open file.
If ``encoding`` is null or "auto" then pick character encoding automatically,
otherwise use ``encoding``.
If ``window`` is given then open files in that window, otherwise in an existing window.
- ``Editor.reload(doc)``: reload document.
- ``Editor.save(doc)``: save document.
- ``Editor.save_as(doc, new_filename=null)``: save document as ``new_filename``.
If ``new_filename`` is not given then first ask user for new filename.
``Editor.close(doc)``: close document.

View File

@ -410,7 +410,7 @@ moo_user_tools_prefs_page_new (void)
g_signal_connect_swapped (page, "init", G_CALLBACK (main_page_init), gxml);
g_signal_connect_swapped (page, "apply", G_CALLBACK (main_page_apply), gxml);
moo_help_set_id (page, HELP_SECTION_PREFS_USER_TOOLS);
moo_help_set_id (page, HELP_SECTION_USER_TOOLS);
cxml = command_xml_new_with_root (GTK_WIDGET (gxml->page_menu));
g_object_set_data (G_OBJECT (gxml->page_menu), "moo-user-tools-prefs-xml", cxml);