diff --git a/.hgignore b/.hgignore index 7113d977..d232bd2e 100644 --- a/.hgignore +++ b/.hgignore @@ -42,8 +42,10 @@ moo/moolua/moo-lua-api.cpp moo/moolua/gtk-lua-api.cpp doc/help/* doc/man-medit.t2t -doc/medit.texi doc/medit.1 doc/script-lua.docbook doc/script-lua-gtk.docbook doc/script-python.docbook +doc/lgpl.no-fancy-chars +doc/medit-defines.ent +doc/moo-help-sections.h diff --git a/api/mpi/docbookwriter.py b/api/mpi/docbookwriter.py index 70c1fbd7..dd7dd2fd 100644 --- a/api/mpi/docbookwriter.py +++ b/api/mpi/docbookwriter.py @@ -5,6 +5,10 @@ from mpi.module import * tmpl_file_start = """\ + +%medit-defines; +]>
""" @@ -87,7 +91,8 @@ class Writer(object): text = re.sub(r'%FALSE\b', '%s' % self.constants['FALSE'], text) def repl_func(m): - return '' % (m.group(1), m.group(1)) + return '' % \ + dict(func_id=m.group(1), mode=self.mode) text = re.sub(r'([\w\d_.]+)\(\)', repl_func, text) assert not re.search(r'NULL|TRUE|FALSE', text) @@ -143,10 +148,11 @@ class Writer(object): oops(func_id) func_id = func.c_name + mode = self.mode self.out.write("""\ - -%(func_name)s() + +%(func_name)s() %(func_name)s(%(params_string)s) """ % locals()) diff --git a/autogen.sh b/autogen.sh index 77f359e2..3942198b 100755 --- a/autogen.sh +++ b/autogen.sh @@ -4,8 +4,8 @@ [ -z "$AUTOMAKE" ] && AUTOMAKE=automake workingdir=`pwd` -srcdir=`dirname "$0"` -srcdir=`cd "$srcdir" && pwd` +rel_srcdir=`dirname "$0"` +srcdir=`cd "$rel_srcdir" && pwd` cd "$srcdir" @@ -22,3 +22,9 @@ run_cmd $ACLOCAL --force -I m4 $ACLOCAL_FLAGS run_cmd $AUTOCONF --force run_cmd $AUTOHEADER --force run_cmd $AUTOMAKE --add-missing --copy --force-missing + +if [ "$1" ]; then + cd $workingdir && run_cmd $rel_srcdir/configure --enable-dev-mode "$@" +else + echo "Done. Run '$rel_srcdir/configure --enable-dev-mode' to configure" +fi diff --git a/doc/Makefile.am b/doc/Makefile.am index 4f7fa068..e3dfa25a 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -2,30 +2,9 @@ BUILT_SOURCES = if MOO_DEV_MODE -# docbook_files = \ -# medit.docbook \ -# prefs.docbook -# -# medit.docbook: medit.docbook.in $(top_builddir)/config.status -# $(AM_V_GEN)cd $(top_builddir) && ./config.status --silent --file=doc/medit.docbook -# $(AM_V_at)mv medit.docbook $(srcdir)/medit.docbook -# -# medit.html: $(docbook_files) -# $(AM_V_GEN)xsltproc /usr/share/xml/docbook/stylesheet/docbook-xsl/html/docbook.xsl $(srcdir)/medit.docbook > medit.html.tmp && \ -# mv medit.html.tmp $(srcdir)/medit.html - -src_texinfo_files = \ - medit.texi \ - prefs.texi \ - prefs-file.texi \ - user-tools.texi \ - regex.texi \ - license.texi \ - script.texi - -medit.texi: medit.texi.in $(top_builddir)/config.status - $(AM_V_GEN)cd $(top_builddir) && ./config.status --silent --file=doc/medit.texi - $(AM_V_at)mv medit.texi $(srcdir)/medit.texi +$(srcdir)/medit-defines.ent: medit-defines.ent.in $(top_builddir)/config.status + $(AM_V_GEN)cd $(top_builddir) && ./config.status --silent --file=doc/medit-defines.ent + $(AM_V_at)mv medit-defines.ent $(srcdir)/medit-defines.ent gendocbook_files = \ $(top_srcdir)/api/gendocbook.py \ @@ -33,60 +12,85 @@ gendocbook_files = \ $(top_srcdir)/api/mpi/module.py \ $(top_srcdir)/api/mpi/docbookwriter.py -script-python.docbook: $(gendocbook_files) $(top_srcdir)/api/moo.xml +$(srcdir)/script-python.docbook: $(gendocbook_files) $(top_srcdir)/api/moo.xml $(AM_V_GEN)$(PYTHON) $(top_srcdir)/api/gendocbook.py --python $(top_srcdir)/api/moo.xml \ > script-python.docbook.tmp && mv script-python.docbook.tmp $(srcdir)/script-python.docbook -script-lua.docbook: $(gendocbook_files) $(top_srcdir)/api/moo.xml +$(srcdir)/script-lua.docbook: $(gendocbook_files) $(top_srcdir)/api/moo.xml $(AM_V_GEN)$(PYTHON) $(top_srcdir)/api/gendocbook.py --lua $(top_srcdir)/api/moo.xml \ > script-lua.docbook.tmp && mv script-lua.docbook.tmp $(srcdir)/script-lua.docbook -script-lua-gtk.docbook: $(gendocbook_files) $(top_srcdir)/moo/moolua/gtk.xml +$(srcdir)/script-lua-gtk.docbook: $(gendocbook_files) $(top_srcdir)/moo/moolua/gtk.xml $(AM_V_GEN)$(PYTHON) $(top_srcdir)/api/gendocbook.py --lua $(top_srcdir)/moo/moolua/gtk.xml \ > script-lua-gtk.docbook.tmp && mv script-lua-gtk.docbook.tmp $(srcdir)/script-lua-gtk.docbook -help/script-python.html: script-python.docbook script.xsl help/index.html +$(srcdir)/help/script-python.html: script-python.docbook medit-defines.ent script.xsl + $(AM_V_at)$(MKDIR_P) $(srcdir)/help/ $(AM_V_GEN)xsltproc --output script-python.html.tmp \ $(srcdir)/script.xsl $(srcdir)/script-python.docbook \ && mv script-python.html.tmp $(srcdir)/help/script-python.html -help/script-lua.html: script-lua.docbook script.xsl help/index.html +$(srcdir)/help/script-lua.html: script-lua.docbook medit-defines.ent script.xsl + $(AM_V_at)$(MKDIR_P) $(srcdir)/help/ $(AM_V_GEN)xsltproc --output script-lua.html.tmp \ $(srcdir)/script.xsl $(srcdir)/script-lua.docbook \ && mv script-lua.html.tmp $(srcdir)/help/script-lua.html -help/script-lua-gtk.html: script-lua-gtk.docbook script.xsl help/index.html +$(srcdir)/help/script-lua-gtk.html: script-lua-gtk.docbook medit-defines.ent script.xsl + $(AM_V_at)$(MKDIR_P) $(srcdir)/help/ $(AM_V_GEN)xsltproc --output script-lua-gtk.html.tmp \ $(srcdir)/script.xsl $(srcdir)/script-lua-gtk.docbook \ && mv script-lua-gtk.html.tmp $(srcdir)/help/script-lua-gtk.html -help/script.css: script.css - $(AM_V_GEN)cp $(srcdir)/script.css $(srcdir)/help/ +$(srcdir)/help/medit.css: medit.css + $(AM_V_at)$(MKDIR_P) $(srcdir)/help/ + $(AM_V_GEN)cp $(srcdir)/medit.css $(srcdir)/help/ -help/index.html: $(src_texinfo_files) - $(AM_V_at)rm -f $(srcdir)/help/*.html - $(AM_V_at)$(MKDIR_P) $(srcdir)/help - $(AM_V_GEN)cd $(srcdir) && makeinfo --html medit.texi +$(srcdir)/lgpl.no-fancy-chars: $(top_srcdir)/COPYING + tr -d '\014' < $(top_srcdir)/COPYING > lgpl.no-fancy-chars.tmp && \ + mv lgpl.no-fancy-chars.tmp $(srcdir)/lgpl.no-fancy-chars -help/help.html: help/index.html - $(AM_V_GEN)cd $(srcdir) && makeinfo --html --no-split medit.texi && mv help.html help/ +docbook_files = \ + medit.docbook \ + prefs.docbook \ + regex.docbook \ + user-tools.docbook \ + license.docbook -help-sections.h.stamp: help/index.html $(srcdir)/gensections.py - $(AM_V_GEN)$(PYTHON) $(srcdir)/gensections.py $(srcdir)/help/*.html > help-sections.h.tmp && \ - (cmp -s help-sections.h.tmp $(srcdir)/help-sections.h || mv help-sections.h.tmp $(srcdir)/help-sections.h) - $(AM_V_at)rm -f help-sections.h.tmp - $(AM_V_at)echo stamp > help-sections.h.stamp +docbook_sources = \ + $(docbook_files) \ + lgpl.no-fancy-chars \ + medit-defines.ent + +$(srcdir)/help/index.html: $(docbook_sources) medit.xsl medit-common.xsl + $(AM_V_GEN)cd $(srcdir) && xsltproc --xinclude medit.xsl medit.docbook + +$(srcdir)/help/help.html: $(docbook_sources) medit-single.xsl medit-common.xsl + $(AM_V_at)$(MKDIR_P) $(srcdir)/help/ + $(AM_V_GEN)xsltproc --xinclude --output help.html.tmp $(srcdir)/medit-single.xsl $(srcdir)/medit.docbook && \ + mv help.html.tmp $(srcdir)/help/help.html + +toc.xml: $(docbook_sources) + $(AM_V_GEN)xsltproc --output toc.xml --xinclude \ + --stringparam chunk.first.sections 1 \ + http://docbook.sourceforge.net/release/xsl/current/html/maketoc.xsl $(srcdir)/medit.docbook + +moo-help-sections.h.stamp: $(docbook_files) toc.xml genhelpsectionsh.py + $(AM_V_GEN)$(PYTHON) $(srcdir)/genhelpsectionsh.py --toc=toc.xml --srcdir=$(srcdir) $(docbook_files) > moo-help-sections.h.tmp + $(AM_V_at)cmp -s moo-help-sections.h.tmp $(srcdir)/moo-help-sections.h || mv moo-help-sections.h.tmp $(srcdir)/moo-help-sections.h + $(AM_V_at)rm -f moo-help-sections.h.tmp + $(AM_V_at)echo stamp > moo-help-sections.h.stamp all-am: doc -doc: \ - help/index.html \ - help/help.html \ - help/script-lua.html \ - help/script-lua-gtk.html \ - help/script-python.html \ - help/script.css \ - help-sections.h.stamp \ - medit.1 +doc: \ + $(srcdir)/help/index.html \ + $(srcdir)/help/help.html \ + $(srcdir)/help/script-lua.html \ + $(srcdir)/help/script-lua-gtk.html \ + $(srcdir)/help/script-python.html \ + $(srcdir)/help/medit.css \ + $(srcdir)/medit.1 \ + moo-help-sections.h.stamp man-medit.t2t: man-medit.t2t.in $(top_builddir)/config.status $(AM_V_GEN)cd $(top_builddir) && ./config.status --silent --file=doc/man-medit.t2t @@ -98,7 +102,7 @@ medit.1: man-medit.t2t endif -EXTRA_DIST = help help-sections.h medit.1 +EXTRA_DIST = help moo-help-sections.h medit.1 install-data-local: $(MKDIR_P) $(DESTDIR)$(MOO_HELP_DIR) diff --git a/doc/genhelpsectionsh.py b/doc/genhelpsectionsh.py new file mode 100644 index 00000000..b0fca0ef --- /dev/null +++ b/doc/genhelpsectionsh.py @@ -0,0 +1,69 @@ +#! /usr/bin/env python + +import os +import re +import sys +import optparse + +op = optparse.OptionParser() +op.add_option("--toc", action="store") +op.add_option("--srcdir", action="store") +(opts, args) = op.parse_args() + +srcdir = opts.srcdir or '.' + +def resolve_filename(filename): + if os.path.exists(filename): + return filename + fullname = os.path.join(srcdir, filename) + if os.path.exists(fullname): + return fullname + raise RuntimeError('could not find file %s' % filename) + +def parse_toc(filename): + filename = resolve_filename(filename) + dic = {} + for line in open(filename): + m = re.search(r'<\?dbhtml filename="([\w\d_.-]+)"\?>', line) + if m: + dic[m.group(1)] = m.group(2) + return dic + +def parse_docbook(filename): + filename = resolve_filename(filename) + dic = {} + for line in open(filename): + m = re.search(r'id\s*=\s*"([\w\d_.-]+)"\s+moo.helpsection\s*=\s*"([\w\d_.-]+)"', line) + if m: + dic[m.group(2)] = m.group(1) + else: + m = re.search(r'moo.helpsection\s*=\s*"([\w\d_.-]+)"\s+id\s*=\s*"([\w\d_.-]+)"', line) + if m: + dic[m.group(1)] = m.group(2) + return dic + +map_id_to_html = parse_toc(opts.toc) +map_hsection_to_id = {} +for f in args: + map_hsection_to_id.update(parse_docbook(f)) + +map_hsection_to_html = { + 'PREFS_ACCELS': 'index.html', + 'PREFS_PLUGINS': 'index.html', + 'DIALOG_REPLACE': 'index.html', + 'DIALOG_FIND': 'index.html', + 'FILE_SELECTOR': 'index.html', + 'DIALOG_FIND_FILE': 'index.html', + 'DIALOG_FIND_IN_FILES': 'index.html', +} + +for section in map_hsection_to_id: + map_hsection_to_html[section] = os.path.basename(map_id_to_html[map_hsection_to_id[section]]) + +print '#ifndef MOO_HELP_SECTIONS_H' +print '#define MOO_HELP_SECTIONS_H' +print '' +for section in sorted(map_hsection_to_html.keys()): + print '#define HELP_SECTION_%s "%s"' % (section, map_hsection_to_html[section]) +print '' +print '#endif /* MOO_HELP_SECTIONS_H */' diff --git a/doc/gensections.py b/doc/gensections.py deleted file mode 100644 index 2d3d07b5..00000000 --- a/doc/gensections.py +++ /dev/null @@ -1,32 +0,0 @@ -import os -import sys -import re - -re_section = re.compile('') -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:]: - if not os.path.basename(f) in ['help.html', 'script-lua.html', 'script-lua-gtk.html', 'script-python.html']: - 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 */' diff --git a/doc/help-sections.h b/doc/help-sections.h index 4ee5fb1e..d209a2f4 100644 --- a/doc/help-sections.h +++ b/doc/help-sections.h @@ -1,31 +1,18 @@ #ifndef MOO_HELP_SECTIONS_H #define MOO_HELP_SECTIONS_H -#define HELP_SECTION_APP_LICENSE "License.html" +#define HELP_SECTION_APP_LICENSE "ch04.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_EDITING_OPTIONS "Options-for-editing-text.html" #define HELP_SECTION_FILE_SELECTOR "index.html" -#define HELP_SECTION_LICENSE_GPL "GNU-GPL.html" -#define HELP_SECTION_LICENSE_LFS "LuaFileSystem-License.html" -#define HELP_SECTION_LICENSE_LGPL "GNU-LGPL.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 "prefs_002exml.html" -#define HELP_SECTION_PREFS_FILE_FILTERS "File-filters-tab.html" -#define HELP_SECTION_PREFS_FILE_SELECTOR "index.html" -#define HELP_SECTION_PREFS_LANGS_AND_FILTERS "Preferences.html" -#define HELP_SECTION_PREFS_LANGS_OPTIONS "Language-options-tab.html" +#define HELP_SECTION_PREFS_DIALOG "ch01s01.html" +#define HELP_SECTION_PREFS_FILE_SELECTOR "ch01s04.html" +#define HELP_SECTION_PREFS_FILTERS "ch01s03.html" +#define HELP_SECTION_PREFS_LANGS "ch01s02.html" #define HELP_SECTION_PREFS_PLUGINS "index.html" -#define HELP_SECTION_REGEX "Regular-expressions.html" -#define HELP_SECTION_SCRIPT "Scripting.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" +#define HELP_SECTION_USER_TOOLS "ch03.html" #endif /* MOO_HELP_SECTIONS_H */ diff --git a/doc/license.texi b/doc/license.docbook similarity index 56% rename from doc/license.texi rename to doc/license.docbook index 5b9a07a5..07d3c58a 100644 --- a/doc/license.texi +++ b/doc/license.docbook @@ -1,40 +1,47 @@ -@node License -@unnumbered License -@helpsection{APP_LICENSE} + + +%medit-defines; +]> + +License -@medit{} 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 @medit{}, can be found in this section. +in &medit;, can be found in this section. + -@menu -* GNU GPL:: GNU General Public License -* GNU LGPL:: GNU Lesser General Public License -* Lua License:: Lua License -* LuaFileSystem License:: LuaFileSystem License -* xdg-utils License:: xdg-utils License -@end menu -@node GNU GPL -@section GNU General Public License -@helpsection{LICENSE_GPL} -@verbatiminclude ../COPYING.GPL + +GNU General Public License + + + + -@node GNU LGPL -@section GNU Lesser General Public License -@helpsection{LICENSE_LGPL} -@verbatiminclude ../COPYING -@node Lua License -@section Lua License -@helpsection{LICENSE_LUA} -@verbatiminclude ../moo/moolua/lua/COPYRIGHT + +GNU Lesser General Public License + + + + -@node LuaFileSystem License -@section LuaFileSystem License -@helpsection{LICENSE_LFS} -@verbatim + + +Lua License + + + + + + + +LuaFileSystem License + LuaFileSystem - File System Library for Lua Copyright 2003-2007 PUC-Rio http://www.keplerproject.org/luafilesystem @@ -44,14 +51,15 @@ 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 + + -@node xdg-utils License -@section xdg-utils License -@helpsection{LICENSE_XDG_UTILS} -@verbatim -Copyright 2006, Kevin Krammer -Copyright 2006, Jeremy White + + +xdg-utils License + +Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at> +Copyright 2006, Jeremy White <jwhite@codeweavers.com> LICENSE: @@ -72,4 +80,8 @@ 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 + + + + + diff --git a/doc/medit-common.xsl b/doc/medit-common.xsl new file mode 100644 index 00000000..f4a5eba3 --- /dev/null +++ b/doc/medit-common.xsl @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/doc/medit-defines.ent.in b/doc/medit-defines.ent.in new file mode 100644 index 00000000..051e2924 --- /dev/null +++ b/doc/medit-defines.ent.in @@ -0,0 +1,6 @@ + +medit"> + +$HOME/.local/share/medit-1/prefs.xml"> +$HOME/.local/share/medit-1/tools/"> +$HOME/.local/share/medit-1/"> diff --git a/doc/medit-single.xsl b/doc/medit-single.xsl new file mode 100644 index 00000000..5f19d505 --- /dev/null +++ b/doc/medit-single.xsl @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/doc/script.css b/doc/medit.css similarity index 100% rename from doc/script.css rename to doc/medit.css diff --git a/doc/medit.docbook b/doc/medit.docbook new file mode 100644 index 00000000..661344ea --- /dev/null +++ b/doc/medit.docbook @@ -0,0 +1,19 @@ + + +%medit-defines; +]> + + + +&medit; manual +12/26/2010 +&medit-version; + + + + + + + + diff --git a/doc/medit.texi.in b/doc/medit.texi.in deleted file mode 100644 index a1fee1a8..00000000 --- a/doc/medit.texi.in +++ /dev/null @@ -1,47 +0,0 @@ -\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 - -@end html -@end macro - -@titlepage -@title Sample Title -@end titlepage - -@contents - -@node Top -@top medit - -This manual is for medit version @MOO_DISPLAY_VERSION@. - -@menu -* Preferences:: Editor preferences. -* meditrc:: 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 diff --git a/doc/medit.xsl b/doc/medit.xsl new file mode 100644 index 00000000..452443af --- /dev/null +++ b/doc/medit.xsl @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/doc/prefs-file.texi b/doc/prefs-file.texi deleted file mode 100644 index caa179e2..00000000 --- a/doc/prefs-file.texi +++ /dev/null @@ -1,32 +0,0 @@ -@node prefs.xml -@chapter Preferences files -@helpsection{PREFS_FILE} - -@medit{} preferences are stored in @file{$HOME/.local/share/medit-1/prefs.xml} 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 diff --git a/doc/prefs.docbook b/doc/prefs.docbook new file mode 100644 index 00000000..8f912b17 --- /dev/null +++ b/doc/prefs.docbook @@ -0,0 +1,289 @@ + + +%medit-defines; +]> + +Preferences + + +Preferences dialog + +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 options tab + +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 + +Selected 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 tab section. + + + +Extensions + +Selected language will be used for files whose filenames match these patterns, +unless overridden in the File filters tab section. + + + +Options + +Default editing options to use in documents which use the given language. These +options can be overridden using File filters tab section, and options set +in the file text have a higher priority as well. See +for format of this entry content. + + + + + + + + +File filters tab + +File filters tab 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 (globs can also be +used, see below). 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. Alternatively it can be +a comma-separated list of globs prefixed with "globs:" or a list +of language ids prefixed with "langs:", e.g. "globs:*.c,*.h" or +"langs:c,c++". + + +Options field contains the options, in format described in +. + + + + + +<guilabel>File Selector</guilabel> tab + +File Selector tab in the Preferences +dialog allows to define custom commands which are available in +Open With submenu of context menu in File Selector. By default +this submenu contains single item Default Application +which opens selected file with default application as configured in the system. +Here you can add additional commands and set whether they should be available +only for given file patterns or syntax highlighting languages. + + +Use New button to create new command, Delete +button to delete selected command, and Up and Down +to change relative order of the commands, they will appear in the menu in the same order +as in this list. + + +The following entries set the command properties: + + + Name + Menu item label for this command. + + + Command + Shell command to execute when the menu item is activated. %f will + be replaced with full path of the selected file. Example: firefox %f + + + Extensions + Semicolon-separated list of file patterns to define for which files this command + is available, e.g. *.c;*.h. Leave it empty if the command should + be available for all files. + + + Mime types + Semicolon-separated list of mime types to define for which files this command + is available, e.g. application/docbook+xml;application/x-glade. Leave it empty + if the command should be available for all files. + + + + + + + +Options for editing text + +&medit; 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: + +-%- options -%- + +where options is the option string + +key: value; key: value; ... + +(the latter is the format used also in the Preferences dialog). + + +For example, the following might be the first line in a C file: + +/* -%- indent-width: 2; use-tabs: yes; strip: yes -%- */ + + + +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: +key=/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. Special value none will +turn off syntax highlighting 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. + + +indent-width +an integer specifying indentation offset used when the Tab key is pressed to indent text. + + +tab-width +displayed width of the Tab character. Note that this is not the same as +indent-width. + + +use-tabs +whether the Tab character should be used for indentation. + + + + +&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. + + + + + +Preferences files + +&medit; preferences are stored in &medit-prefs-xml; file. +It is an XML file which may be edited to set preferences which have not found +their place in the Preferences dialog. + + + +&medit; 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 +effect until you restart &medit;. + + + +The following "hidden" settings are available: + + + +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: + + + + +%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 a space, so that "%b%s" produces a nice string + + +%% +the percent character + + +Default value is "%a - %f%s" which produces something like "medit - /home/user/file [modified]". + + + +Editor/window_title_no_doc +same as Editor/window_title, used when no document is open. +Default value is "%a". + + + + + + diff --git a/doc/prefs.texi b/doc/prefs.texi deleted file mode 100644 index f26d6f8e..00000000 --- a/doc/prefs.texi +++ /dev/null @@ -1,120 +0,0 @@ -@node Preferences -@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 -* Language options tab:: Language-specific options. -* File filters tab:: Options based on file path. -* Options for editing text:: Options for editing text. -@end menu - -@node Language options tab -@section Language options tab -@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 tab} section. -@item @uilabel{Extensions} -The given language will be used for files whose filenames match these patterns, -unless overridden in the @uilabel{File filters tab} 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 tab} section, and options set -in the file text have a higher priority as well. See section @ref{Options for editing text} -for the format of this entry content. -@end table - - -@node File filters tab -@section File filters tab -@helpsection{PREFS_FILE_FILTERS} - -@uilabel{File filters tab} 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 (globs can also be -used, see below). 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. Alternatively it can be -a comma-separated list of globs prefixed with "@code{globs:}" or a list -of language ids prefixed with "@code{langs:}", e.g. "@code{globs:*.c,*.h}" or -"@code{langs:c,c++}". - -@uilabel{Options} field contains the options, in format described in -section @ref{Options for editing text}. - - -@node Options for editing text -@section Options for editing text -@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. diff --git a/doc/regex.docbook b/doc/regex.docbook new file mode 100644 index 00000000..4240cab5 --- /dev/null +++ b/doc/regex.docbook @@ -0,0 +1,23 @@ + + +%medit-defines; +]> + +Regular expressions + + +&medit; uses regular expressions functionality provided by Glib, which in turn uses +PCRE library. See +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 ".*" 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. + + + diff --git a/doc/regex.texi b/doc/regex.texi deleted file mode 100644 index 861e7f79..00000000 --- a/doc/regex.texi +++ /dev/null @@ -1,13 +0,0 @@ -@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. diff --git a/doc/script.texi b/doc/script.texi deleted file mode 100644 index 4c7abdf7..00000000 --- a/doc/script.texi +++ /dev/null @@ -1,18 +0,0 @@ -@node Scripting -@chapter Scripting -@helpsection{SCRIPT} - -@menu -* Lua:: Lua -* Python:: Python -@end menu - -@node Lua -@section Lua -@uref{script-lua.html, script-lua} - -@uref{script-lua-gtk.html, script-lua-gtk} - -@node Python -@section Python -@uref{script-python.html, script-python} diff --git a/doc/script.xsl b/doc/script.xsl index bf396413..19e49d6c 100644 --- a/doc/script.xsl +++ b/doc/script.xsl @@ -4,10 +4,8 @@ - - - + + diff --git a/doc/user-tools.docbook b/doc/user-tools.docbook new file mode 100644 index 00000000..ff26e664 --- /dev/null +++ b/doc/user-tools.docbook @@ -0,0 +1,331 @@ + + +%medit-defines; +]> + +User-defined tools + + +&medit; allows extending its functionality with user-defined +tools. It can be a Lua script or a Python script (if &medit; has been +built with Python support) which are 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. + + + + +Managing 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 discarded. + + + None, asynchronous + the command output will be discarded, and the command will be executed in background. + 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 + + +It is possible to create tools without using the Preferences dialog, +they can be stored in files in tools subfolder of the &medit; data +folders (or tools-context for tools which appear in the document context +menu). In particular, on Unix systems you can place files into &medit-user-tools-dir; 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; +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: + +!! key=value; key=value; ... !! + + + +key may be one of the following: + + + + position + it can be start or end, and it 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. + + + 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 + none, lines, selection, or doc. + + + output + none, async, pane, insert, or new-doc. + + + filter + output filter name. + + + + + + + + +Shell scripts + + +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 &medit; is as simple as 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: + + + DOC + document basename. + + + DOC_DIR + document directory. Full file path is + $DOC_DIR/$DOC. + + + DOC_BASE + basename without extension. + + + DOC_EXT + document filename extension including the period. Basename is always + $DOC_BASE$DOC_EXT. + + + LINE + the number of the line containing cursor. + + + DATA_DIR + user data directory (&medit-user-data-dir;). For example the tools are stored in + $DATA_DIR/menu.cfg file and in files in the + $DATA_DIR/tools/ directory. + + + + +Additionally, all shell commands which run inside &medit; will have +DATA_DIR/scripts +directories in $PATH, so you may place some &medit;-specific programs +or scripts into DATA_DIR/scripts/ to be used from shell script tools. + + + + + + +Lua scripts + + +Medit API for Lua scripts. + + +Gtk API for Lua scripts. + + + + + + +Python scripts + + +Medit API for Python scripts. + + + + + + diff --git a/doc/user-tools.texi b/doc/user-tools.texi deleted file mode 100644 index 632a264f..00000000 --- a/doc/user-tools.texi +++ /dev/null @@ -1,242 +0,0 @@ -@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 shell commands which run 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. diff --git a/moo/mooapp/mooappabout.c b/moo/mooapp/mooappabout.c index 4d7c2010..196e5c8c 100644 --- a/moo/mooapp/mooappabout.c +++ b/moo/mooapp/mooappabout.c @@ -25,7 +25,7 @@ #include "mooutils/mooi18n.h" #include "mooutils/moodialogs.h" #include "mooutils/moohelp.h" -#include "help-sections.h" +#include "moo-help-sections.h" #include "mooapp/mooappabout-dialog-gxml.h" #include "mooapp/mooappabout-license-gxml.h" #include "mooapp/mooappabout-credits-gxml.h" diff --git a/moo/mooedit/mooeditprefspage.c b/moo/mooedit/mooeditprefspage.c index 9e97e8ca..00c0dd78 100644 --- a/moo/mooedit/mooeditprefspage.c +++ b/moo/mooedit/mooeditprefspage.c @@ -33,7 +33,7 @@ #include "mooedit/mooeditprefs-general-gxml.h" #include "mooedit/mooeditprefs-langs-gxml.h" #include "mooedit/mooeditprefs-view-gxml.h" -#include "help-sections.h" +#include "moo-help-sections.h" #include @@ -215,6 +215,7 @@ page_filters_init (MooPrefsPage *page) { PrefsFiltersXml *gxml = g_object_get_data (G_OBJECT (page), "moo-edit-prefs-page-xml"); filter_treeview_init (gxml); + moo_help_set_id (GTK_WIDGET (page), HELP_SECTION_PREFS_FILTERS); } static void @@ -347,7 +348,7 @@ page_langs_init (MooPrefsPage *page) PrefsLangsXml *gxml = g_object_get_data (G_OBJECT (page), "moo-edit-prefs-page-xml"); MooTreeHelper *helper; - moo_help_set_id (GTK_WIDGET (page), HELP_SECTION_PREFS_LANGS_AND_FILTERS); + moo_help_set_id (GTK_WIDGET (page), HELP_SECTION_PREFS_LANGS); lang_combo_init (gxml->lang_combo, page, gxml); diff --git a/moo/mooedit/mooplugin.c b/moo/mooedit/mooplugin.c index d8e7e1b7..21f2b5b6 100644 --- a/moo/mooedit/mooplugin.c +++ b/moo/mooedit/mooplugin.c @@ -46,7 +46,7 @@ #include "mooutils/mooutils-debug.h" #include "mooutils/moohelp.h" #include "mooutils/mootype-macros.h" -#include "help-sections.h" +#include "moo-help-sections.h" #include #include #include diff --git a/moo/mooedit/mootextfind.c b/moo/mooedit/mootextfind.c index 24dc6bc2..4e955d9a 100644 --- a/moo/mooedit/mootextfind.c +++ b/moo/mooedit/mootextfind.c @@ -27,7 +27,7 @@ #include "mooutils/moocompat.h" #include "mooedit/mootextfind-gxml.h" #include "mooedit/mootextgotoline-gxml.h" -#include "help-sections.h" +#include "moo-help-sections.h" #include #include diff --git a/moo/mooutils/mooaccelprefs.c b/moo/mooutils/mooaccelprefs.c index e788170f..e1b0bd5c 100644 --- a/moo/mooutils/mooaccelprefs.c +++ b/moo/mooutils/mooaccelprefs.c @@ -27,7 +27,7 @@ #include "mooutils/moohelp.h" #include "mooutils/moocompat.h" #include "mooutils/mooaccelprefs-gxml.h" -#include "help-sections.h" +#include "moo-help-sections.h" #include #include #include diff --git a/moo/mooutils/mooprefsdialog.c b/moo/mooutils/mooprefsdialog.c index 7bec4a4c..ec2c92da 100644 --- a/moo/mooutils/mooprefsdialog.c +++ b/moo/mooutils/mooprefsdialog.c @@ -24,7 +24,7 @@ #include "mooutils/moohelp.h" #include "mooutils/mooutils-treeview.h" #include "mooutils/moocompat.h" -#include "help-sections.h" +#include "moo-help-sections.h" enum { diff --git a/moo/plugins/moofileselector-prefs.c b/moo/plugins/moofileselector-prefs.c index 7e5455f5..049e11ff 100644 --- a/moo/plugins/moofileselector-prefs.c +++ b/moo/plugins/moofileselector-prefs.c @@ -19,7 +19,7 @@ #include "mooutils/mooi18n.h" #include "mooutils/moostock.h" #include "mooutils/moohelp.h" -#include "help-sections.h" +#include "moo-help-sections.h" #include "plugins/moofileselector-prefs-gxml.h" #include #include diff --git a/moo/plugins/moofileselector.c b/moo/plugins/moofileselector.c index f8f265bb..56f1ad46 100644 --- a/moo/plugins/moofileselector.c +++ b/moo/plugins/moofileselector.c @@ -38,7 +38,7 @@ #include "plugins/moofileselector-gxml.h" #include "mooutils/moohelp.h" #include "mooutils/mooatom.h" -#include "help-sections.h" +#include "moo-help-sections.h" #include #include #include diff --git a/moo/plugins/moofind.c b/moo/plugins/moofind.c index 32404b5f..1466b699 100644 --- a/moo/plugins/moofind.c +++ b/moo/plugins/moofind.c @@ -31,7 +31,7 @@ #include "mooutils/mooutils-fs.h" #include "plugins/moofind-gxml.h" #include "plugins/moogrep-gxml.h" -#include "help-sections.h" +#include "moo-help-sections.h" #include #include #include diff --git a/moo/plugins/usertools/moousertools-prefs.c b/moo/plugins/usertools/moousertools-prefs.c index 2f8f910d..11e929a5 100644 --- a/moo/plugins/usertools/moousertools-prefs.c +++ b/moo/plugins/usertools/moousertools-prefs.c @@ -22,7 +22,7 @@ #include "mooutils/mooutils-treeview.h" #include "mooutils/moohelp.h" #include "plugins/usertools/moousertools-gxml.h" -#include "help-sections.h" +#include "moo-help-sections.h" #include enum {