summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/context/lua/scite-ctx.lua218
-rw-r--r--scripts/context/perl/texexec.pl18
-rw-r--r--scripts/context/ruby/base/pdf.rb34
-rw-r--r--scripts/context/ruby/base/tex.rb4
-rw-r--r--scripts/context/ruby/ctxtools.rb4
5 files changed, 163 insertions, 115 deletions
diff --git a/scripts/context/lua/scite-ctx.lua b/scripts/context/lua/scite-ctx.lua
index fae9e0fb9..5836bcbfb 100644
--- a/scripts/context/lua/scite-ctx.lua
+++ b/scripts/context/lua/scite-ctx.lua
@@ -169,32 +169,32 @@ end
function string.replace(original,pattern,replacement)
local str = string.gsub(original,pattern,replacement)
---~ print(str) -- indirect, since else str + nofsubs
+-- print(str) -- indirect, since else str + nofsubs
return str -- indirect, since else str + nofsubs
end
-- support functions, maybe editor namespace
---~ function column_of_position(position)
---~ local line = editor:LineFromPosition(position)
---~ local oldposition = editor.CurrentPos
---~ local column = 0
---~ editor:GotoPos(position)
---~ while editor.CurrentPos ~= 0 and line == editor:LineFromPosition(editor.CurrentPos) do
---~ editor:CharLeft()
---~ column = column + 1
---~ end
---~ editor:GotoPos(oldposition)
---~ if line > 0 then
---~ return column -1
---~ else
---~ return column
---~ end
---~ end
-
---~ function line_of_position(position)
---~ return editor:LineFromPosition(position)
---~ end
+-- function column_of_position(position)
+-- local line = editor:LineFromPosition(position)
+-- local oldposition = editor.CurrentPos
+-- local column = 0
+-- editor:GotoPos(position)
+-- while editor.CurrentPos ~= 0 and line == editor:LineFromPosition(editor.CurrentPos) do
+-- editor:CharLeft()
+-- column = column + 1
+-- end
+-- editor:GotoPos(oldposition)
+-- if line > 0 then
+-- return column -1
+-- else
+-- return column
+-- end
+-- end
+
+-- function line_of_position(position)
+-- return editor:LineFromPosition(position)
+-- end
function extend_to_start()
local selectionstart = editor.SelectionStart
@@ -285,7 +285,7 @@ if props['ctx.helpinfo'] ~= '' then
print("")
print(string.replace(string.strip(props['ctx.helpinfo']),"%s*\|%s*","\n")) -- indirect, since else str + nofsubs
end
---~ print("") -- why not needed?
+print("")
print("- recognized first lines:")
print("")
print("xml <?xml version='1.0' language='nl'")
@@ -330,7 +330,7 @@ function wrap_text()
local endcolumn = props['SelectionEndColumn'] - 1
local indentation = string.rep(' ', startcolumn)
---~ local selection = string.gsub(editor:GetSelText(),"[\n\r][\n\r]+", ' ' .. magicstring .. ' ')
+-- local selection = string.gsub(editor:GetSelText(),"[\n\r][\n\r]+", ' ' .. magicstring .. ' ')
local selection = string.gsub(editor:GetSelText(),"[\n\r][\n\r]", "\n")
local selection = string.gsub(selection,"\n\n+", ' ' .. magicstring .. ' ')
local replacement = ''
@@ -520,21 +520,21 @@ local worddone = 0
-- we use wordlist as a hash so that we can add entries without the
-- need to sort and also use a fast (built in) search
---~ function kpsewhich_file(filename,filetype,progname)
---~ local progflag, typeflag = '', ''
---~ local tempname = os.tmpname()
---~ if progname then
---~ progflag = " --progname=" .. progname .. " "
---~ end
---~ if filetype then
---~ typeflag = " --format=" .. filetype .. " "
---~ end
---~ local command = "kpsewhich" .. progflag .. typeflag .. " " .. filename .. " > " .. tempname
---~ os.execute(command)
---~ for line in io.lines(tempname) do
---~ return string.gsub(line, "\s*$", '')
---~ end
---~ end
+-- function kpsewhich_file(filename,filetype,progname)
+-- local progflag, typeflag = '', ''
+-- local tempname = os.tmpname()
+-- if progname then
+-- progflag = " --progname=" .. progname .. " "
+-- end
+-- if filetype then
+-- typeflag = " --format=" .. filetype .. " "
+-- end
+-- local command = "kpsewhich" .. progflag .. typeflag .. " " .. filename .. " > " .. tempname
+-- os.execute(command)
+-- for line in io.lines(tempname) do
+-- return string.gsub(line, "\s*$", '')
+-- end
+-- end
function check_text()
@@ -721,72 +721,72 @@ menufunctions[12] = process_menu
local templatetrigger = 13
---~ local ctx_template_paths = { "./ctx-templates", "../ctx-templates", "../../ctx-templates" }
---~ local ctx_auto_templates = false
---~ local ctx_template_list = ""
---~ local ctx_dir_list = { }
---~ local ctx_dir_name = "./ctx-templates"
-
---~ local ctx_path_list = {}
---~ local ctx_path_done = {}
-
---~ function ctx_list_loaded()
---~ return ctx_dir_list and table.getn(ctx_dir_list) > 0
---~ end
-
---~ function insert_template(templatelist)
---~ if props["ctx.template.scan"] == "yes" then
---~ local current = props["FileDir"] .. "+" .. props["FileExt"] -- no name
---~ local rescan = props["ctx.template.rescan"] == "yes"
---~ local suffix = props["ctx.template.suffix."..props["FileExt"]] -- alas, no suffix expansion here
---~ if rescan then
---~ print("re-scanning enabled")
---~ end
---~ if current ~= ctx_file_path then
---~ rescan = true
---~ ctx_file_path = current
---~ ctx_file_done = false
---~ ctx_template_list = ""
---~ end
---~ if not ctx_file_done or rescan then
---~ local pattern = "*.*"
---~ for i, pathname in ipairs(ctx_template_paths) do
---~ print("scanning " .. pathname .. " for " .. pattern)
---~ ctx_dir_name = pathname
---~ ctx_dir_list = get_dir_list(pathname .. "/" .. pattern)
---~ if ctx_list_loaded() then
---~ break
---~ end
---~ end
---~ ctx_file_done = true
---~ end
---~ if ctx_list_loaded() then
---~ ctx_template_list = ""
---~ local pattern = "%." .. suffix .. "$"
---~ for j, filename in ipairs(ctx_dir_list) do
---~ if string.find(filename,pattern) then
---~ local menuname = string.gsub(filename,"%..-$","")
---~ if ctx_template_list ~= "" then
---~ ctx_template_list = ctx_template_list .. "|"
---~ end
---~ ctx_template_list = ctx_template_list .. menuname .. "=" .. ctx_dir_name .. "/" .. filename
---~ end
---~ end
---~ else
---~ print("no template files found")
---~ end
---~ if ctx_template_list == "" then
---~ ctx_auto_templates = false
---~ print("no file related templates found")
---~ else
---~ ctx_auto_templates = true
---~ templatelist = ctx_template_list
---~ end
---~ end
---~ if templatelist ~= "" then
---~ UserListShow(templatetrigger, templatelist)
---~ end
---~ end
+-- local ctx_template_paths = { "./ctx-templates", "../ctx-templates", "../../ctx-templates" }
+-- local ctx_auto_templates = false
+-- local ctx_template_list = ""
+-- local ctx_dir_list = { }
+-- local ctx_dir_name = "./ctx-templates"
+
+-- local ctx_path_list = {}
+-- local ctx_path_done = {}
+
+-- function ctx_list_loaded()
+-- return ctx_dir_list and table.getn(ctx_dir_list) > 0
+-- end
+
+-- function insert_template(templatelist)
+-- if props["ctx.template.scan"] == "yes" then
+-- local current = props["FileDir"] .. "+" .. props["FileExt"] -- no name
+-- local rescan = props["ctx.template.rescan"] == "yes"
+-- local suffix = props["ctx.template.suffix."..props["FileExt"]] -- alas, no suffix expansion here
+-- if rescan then
+-- print("re-scanning enabled")
+-- end
+-- if current ~= ctx_file_path then
+-- rescan = true
+-- ctx_file_path = current
+-- ctx_file_done = false
+-- ctx_template_list = ""
+-- end
+-- if not ctx_file_done or rescan then
+-- local pattern = "*.*"
+-- for i, pathname in ipairs(ctx_template_paths) do
+-- print("scanning " .. pathname .. " for " .. pattern)
+-- ctx_dir_name = pathname
+-- ctx_dir_list = get_dir_list(pathname .. "/" .. pattern)
+-- if ctx_list_loaded() then
+-- break
+-- end
+-- end
+-- ctx_file_done = true
+-- end
+-- if ctx_list_loaded() then
+-- ctx_template_list = ""
+-- local pattern = "%." .. suffix .. "$"
+-- for j, filename in ipairs(ctx_dir_list) do
+-- if string.find(filename,pattern) then
+-- local menuname = string.gsub(filename,"%..-$","")
+-- if ctx_template_list ~= "" then
+-- ctx_template_list = ctx_template_list .. "|"
+-- end
+-- ctx_template_list = ctx_template_list .. menuname .. "=" .. ctx_dir_name .. "/" .. filename
+-- end
+-- end
+-- else
+-- print("no template files found")
+-- end
+-- if ctx_template_list == "" then
+-- ctx_auto_templates = false
+-- print("no file related templates found")
+-- else
+-- ctx_auto_templates = true
+-- templatelist = ctx_template_list
+-- end
+-- end
+-- if templatelist ~= "" then
+-- UserListShow(templatetrigger, templatelist)
+-- end
+-- end
local ctx_template_paths = { "./ctx-templates", "../ctx-templates", "../../ctx-templates" }
local ctx_auto_templates = false
@@ -913,3 +913,13 @@ end
menufunctions[13] = process_template_one
menufunctions[14] = process_template_two
+-- command.name.26.*=Open Logfile
+-- command.subsystem.26.*=3
+-- command.26.*=open_log
+-- command.save.before.26.*=2
+-- command.groupundo.26.*=yes
+-- command.shortcut.26.*=Ctrl+E
+
+function open_log()
+ scite.Open(props['FileName'] .. ".log")
+end
diff --git a/scripts/context/perl/texexec.pl b/scripts/context/perl/texexec.pl
index e939df78e..7da7ff28b 100644
--- a/scripts/context/perl/texexec.pl
+++ b/scripts/context/perl/texexec.pl
@@ -151,6 +151,7 @@ my $PdfCombine = 0;
my $PdfOpen = 0;
my $PdfClose = 0;
my $AutoPdf = 0;
+my $UseXPdf = 0;
my $PrintFormat = 'standard';
my $ProducePdfT = 0;
my $ProducePdfM = 0;
@@ -312,6 +313,7 @@ my $MakeMpy = '';
"pdfclose" => \$PdfClose,
"pdfopen" => \$PdfOpen,
"autopdf" => \$AutoPdf,
+ "xpdf" => \$UseXPdf,
"modefile=s" => \$ModeFile, # additional modes file
"globalfile" => \$GlobalFile,
"nomapfiles" => \$NoMapFiles,
@@ -408,6 +410,16 @@ if ($AutoPdf) {
$PdfOpen = $PdfClose = 1 ;
}
+my $PdfOpenCall = "" ;
+
+if ($PdfOpen) {
+ $PdfOpenCall = "pdfopen --file" ;
+}
+
+if ($UseXPdf && !$dosish) {
+ $PdfOpenCall = "xpdfopen" ;
+}
+
# this is our hook into paranoid path extensions, assumes that
# these three vars are part of path specs in texmf.cnf
@@ -1953,11 +1965,11 @@ sub RunConTeXtFile {
{
unlink "$JobName.$JobSuffix";
}
- if ((!$Problems) && ($PdfOpen)) {
+ if ((!$Problems) && ($PdfOpen) && ($PdfOpenCall)) {
if ($Result ne '') {
- System("pdfopen --file $Result.pdf") if -f "$Result.pdf"
+ System("$PdfOpenCall $Result.pdf") if -f "$Result.pdf"
} else {
- System("pdfopen --file $JobName.pdf") if -f "$JobName.pdf"
+ System("$PdfOpenCall $JobName.pdf") if -f "$JobName.pdf"
}
}
}
diff --git a/scripts/context/ruby/base/pdf.rb b/scripts/context/ruby/base/pdf.rb
index d8cbf9e05..9f4e9a6c3 100644
--- a/scripts/context/ruby/base/pdf.rb
+++ b/scripts/context/ruby/base/pdf.rb
@@ -1,14 +1,34 @@
module PDFview
- @files = Hash.new
+ @files = Hash.new
+ @opencalls = Hash.new
+ @closecalls = Hash.new
+ @allcalls = Hash.new
+
+ @method = 'default' # 'xpdf'
+
+ @opencalls['default'] = "pdfopen --file"
+ @opencalls['xpdf'] = "xpdfopen"
+
+ @closecalls['default'] = "pdfclose --file"
+ @closecalls['xpdf'] = nil
+
+ @allcalls['default'] = "pdfclose --all"
+ @allcalls['xpdf'] = nil
+
+ def PDFview.setmethod(method)
+ @method = method
+ end
def PDFview.open(*list)
begin
[*list].flatten.each do |file|
filename = fullname(file)
if FileTest.file?(filename) then
- result = `pdfopen --file #{filename} 2>&1`
- @files[filename] = true
+ if @opencalls[@method] then
+ result = `#{@opencalls[@method]} #{filename} 2>&1`
+ @files[filename] = true
+ end
end
end
rescue
@@ -20,7 +40,9 @@ module PDFview
filename = fullname(file)
begin
if @files.key?(filename) then
- result = `pdfclose --file #{filename} 2>&1`
+ if @closecalls[@method] then
+ result = `#{@closecalls[@method]} #{filename} 2>&1`
+ end
else
closeall
return
@@ -33,7 +55,9 @@ module PDFview
def PDFview.closeall
begin
- result = `pdfclose --all 2>&1`
+ if @allcalls[@method] then
+ result = `#{@allcalls[@method]} 2>&1`
+ end
rescue
end
@files.clear
diff --git a/scripts/context/ruby/base/tex.rb b/scripts/context/ruby/base/tex.rb
index 25b10efa1..eb7ba657a 100644
--- a/scripts/context/ruby/base/tex.rb
+++ b/scripts/context/ruby/base/tex.rb
@@ -128,7 +128,7 @@ class TEX
'mpyforce', 'forcempy',
'forcetexutil', 'texutil',
'globalfile', 'autopath',
- 'purge', 'purgeall', 'autopdf', 'simplerun', 'verbose',
+ 'purge', 'purgeall', 'autopdf', 'xpdf', 'simplerun', 'verbose',
'nooptionfile'
]
@@stringvars = [
@@ -1195,6 +1195,8 @@ class TEX
setvariable('nomprun',true) if orisuffix == 'mpx' # else cylic run
+ PDFview.setmethod('xpdf') if getvariable('xpdf')
+
PDFview.closeall if getvariable('autopdf')
forcexml = jobsuffix.match(/^(xml|fo|fox|rlg|exa)$/io) # nil or match
diff --git a/scripts/context/ruby/ctxtools.rb b/scripts/context/ruby/ctxtools.rb
index 024bc4e18..a8fb4dde2 100644
--- a/scripts/context/ruby/ctxtools.rb
+++ b/scripts/context/ruby/ctxtools.rb
@@ -191,7 +191,7 @@ class Commands
interfaces = @commandline.arguments
if interfaces.empty? then
- interfaces = ['en', 'cz','de','it','nl','ro']
+ interfaces = ['en','cz','de','it','nl','ro','fr']
end
interfaces.each do |interface|
@@ -289,7 +289,7 @@ class Commands
interfaces = @commandline.arguments
if interfaces.empty? then
- interfaces = ['cz','de','it','nl','ro']
+ interfaces = ['cz','de','it','nl','ro','fr']
else
interfaces.delete('en')
end