Jingcheng Zhang | 1 Nov 11:47
Picon

How to indent PHP and JavaScript correctly in the same file?


Hello,

  With the following options, how can I indent PHP and JavaScript
codes in the same file?

# tpl is a file type which contains both PHP and JavaScript codes
file.patterns.hypertext=*.tpl

# use hypertext lexer to hypertext files
lexer.$(file.patterns.hypertext)=hypertext

statement.indent.$(file.patterns.hypertext)=121 if else for while
statement.end.$(file.patterns.hypertext)=127 ;
statement.lookback.$(file.patterns.hypertext)= 20
block.start.$(file.patterns.hypertext)=127 {
block.end.$(file.patterns.hypertext)=127 }

The five lines above only follows style number predefined for PHP, not
JavaScript.
How can I define indent rules for JavaScript codes in the same file
while leaving
PHP indent rules working correctly? Do these options support multiple
values, both
for PHP and JavaScript? Thanks :)

Following is an example use case (test.tpl):

<a href="test.php">test</a>
<?php
(Continue reading)

Jingcheng Zhang | 1 Nov 15:33
Picon

Re: How to indent PHP and JavaScript correctly in the same file?


The main problem here is that each "language context" has its own
style number for this feature.
If these options support multiple "language context", or each option
supports multiple values, then
there are no problems.

Any solutions?

On Nov 1, 6:47 pm, Jingcheng Zhang <dio...@gmail.com> wrote:
> Hello,
>
>   With the following options, how can I indent PHP and JavaScript
> codes in the same file?
>
> # tpl is a file type which contains both PHP and JavaScript codes
> file.patterns.hypertext=*.tpl
>
> # use hypertext lexer to hypertext files
> lexer.$(file.patterns.hypertext)=hypertext
>
> statement.indent.$(file.patterns.hypertext)=121 if else for while
> statement.end.$(file.patterns.hypertext)=127 ;
> statement.lookback.$(file.patterns.hypertext)= 20
> block.start.$(file.patterns.hypertext)=127 {
> block.end.$(file.patterns.hypertext)=127 }
>
> The five lines above only follows style number predefined for PHP, not
> JavaScript.
> How can I define indent rules for JavaScript codes in the same file
(Continue reading)

instanton | 2 Nov 15:33
Favicon

Direct lua os.ececute output to output pane


Hello,

I wish to direct the output generated by a Lua script through the function os.execute to the output pane but I
don't have any clue how this can be done. Is this pissible in principle? Or, if not, is htere a substitute tot
he function os.execute which can be used to execute some external command inside a lua script?

Thanks for any feedbacks.  

  
instanton,soft_share <at> 126.com 
2008-11-02 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "scite-interest" group.
To post to this group, send email to scite-interest <at> googlegroups.com
To unsubscribe from this group, send email to scite-interest+unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/scite-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

mitchell | 2 Nov 16:17
Picon

Re: Direct lua os.ececute output to output pane


Hi,

> I wish to direct the output generated by a Lua script through the function os.execute to the output pane but
I don't have any clue how this can be done. Is this pissible in principle? Or, if not, is htere a substitute
tot he function os.execute which can be used to execute some external command inside a lua script?

You can either pipe os.execute() to a temporary file, read it in, and
print the contents to the output pane or use io.popen():read('*all')
and print that to the output pane.

-Mitchell;
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "scite-interest" group.
To post to this group, send email to scite-interest <at> googlegroups.com
To unsubscribe from this group, send email to scite-interest+unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/scite-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

mozers | 2 Nov 18:41
Picon

Re: Direct lua os.ececute output to output pane


Sunday, November 2, 2008, 5:33:19 PM, instanton wrote:

> I wish to direct the output generated by a Lua script through the
> function os.execute to the output pane

Try extended lua library Shell for SciTE
<http://scite-ru.googlecode.com/svn/trunk/pack/LuaLib/shell.dll>
You may like shell.exec :)
<http://scite-ru.googlecode.com/svn/trunk/pack/LuaLib/shell.html#exec>

--

-- 
mozers
<http://code.google.com/p/scite-ru/>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "scite-interest" group.
To post to this group, send email to scite-interest <at> googlegroups.com
To unsubscribe from this group, send email to scite-interest+unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/scite-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

jim_hill_au | 3 Nov 01:09
Picon

Re: ? Most Efficient Way To Search Across Files


> Dave Burstein, 24.10.2008 14:39:> I'm new to scite and enjoying it, but am hitting a problem I need help
> > with. I'm working on Joomla templates with about 8 files open, and I
> > often need to chase down a variable that could be in any of them.
> > What's the best way to search across all files?

On Oct 25, 2:44 am, Frank Wunderlich <frank.wunderl...@gmail.com>
wrote:
> have you tried the search/find in files option?

There's no "find in buffers" button in the find dialog.
(a buffer is an open file)
I sometimes wished there was, but it's not a big deal,
do it like this instead:

Hit shift-ctrl+F to get the "find in files" dialog.
If you enter multiple masks, separate them with a space,
semicolon doesn't work.
The path shown is that of the file in the active tab --
click the little button on the right to go up one level.

In the ouput pane, double-click a line,
and that file will be opened at that line,
in a new tab.

-- jim

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "scite-interest" group.
To post to this group, send email to scite-interest <at> googlegroups.com
(Continue reading)

instanton | 3 Nov 04:32
Favicon

Re: Direct lua os.ececute output to output pane

Thanks Mozers. shell.dll seems promising but I have some problem with it: shell.exec only accept double quoted string as its first argument, however what I have (originally for os.execute) is a single quoted string. When I pass this string into shell.exec, it simply tells me that the file or command was not found.
 
To be more specific, let me assume that I wish to set some file as a master file of a project, and tries to run compilation over the master file from any buffer. I use the following script to do so:
 
require 'shell'
compiler='my_compiler_name'
 
props['master_file.set'] = 0
props['master_filename']=nil
props['master_dir']=nil
 
GTK = scite_GetProp('PLAT_GTK')
if GTK then slash = '/' else slash = '\\' end
if GTK then cd_cmd = 'cd ' else cd_cmd = 'cd /D ' end
function toggle_masterfile()
 if tonumber(props['master_file.set'])==0 then
  props['master_file.set'] = 1
  props['master_filename']=props['FileNameExt']
  props['master_dir']=props['FileDir']
  output:append(props['master_dir']..slash..props['master_filename']..' set as master file.\n')
 else
  props['master_file.set'] = 0
  props['master_name']=nil
  props['master_dir']=nil
  output:append('Master file unset successfully.\n')
 end
end
 
function compile_masterfile()
 if tonumber(props['master_file.set'])==1 then
  output:append('Compiling master file '..props['master_filename']..'...please wait\n')
  cmd1=cd_cmd..props['master_dir']
  cmd2=compiler..props['master_filename']
  cmd=cmd1..' && '..cmd2
  os.execute(cmd)
--  print(shell.exec(cmd1,nil,true,true))
--  print(shell.exec(cmd2,nil,true,true))
  output:append('Compilation Finished')
 end
end
 
The problem of using os.execute lies in that it pops a black cmd window and prints all compilation messages in that window, so that when the compilation process exits, no message is left for inspection. The problem with shell.exec is simply that it cannot accept cmd1 and cmd2 as valid first argument. Wraping cmd1 and cmd2 with tostring doesn't help either. Any more help please?
 
 
2008-11-03
----- Original Message -----
From: mozers
Sent: 2008-11-03, 01:41:48
Subject: [scite] Re: Direct lua os.ececute output to output pane

Sunday, November 2, 2008, 5:33:19 PM, instanton wrote:

> I wish to direct the output generated by a Lua script through the
> function os.execute to the output pane

Try extended lua library Shell for SciTE
<http://scite-ru.googlecode.com/svn/trunk/pack/LuaLib/shell.dll>
You may like shell.exec :)
<http://scite-ru.googlecode.com/svn/trunk/pack/LuaLib/shell.html#exec>

--
mozers
<http://code.google.com/p/scite-ru/>


Information from ESET NOD32 Antivirus, version of virus signature database 3576 (20081102) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "scite-interest" group.
To post to this group, send email to scite-interest <at> googlegroups.com
To unsubscribe from this group, send email to scite-interest+unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/scite-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

mozers | 3 Nov 08:42
Picon

Re: Direct lua os.ececute output to output pane


Monday, November 3, 2008, 6:32:04 AM, instanton wrote:
> When I pass this string into shell.exec, it
> simply tells me that the file or command was not found.

1. I am not sure what shell.dll will work in gtk.
Use the decision which was suggested by Mitchell.

2. The command "CD mypath" will not work without the instruction a command processor.
It is necessary to write "CMD.EXE/C CD mypath".
Any command will not be executed if it is not found in the current path or in system environment PATH.
It is necessary to use a full path to an executed file.

--

-- 
mozers
<http://code.google.com/p/scite-ru/>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "scite-interest" group.
To post to this group, send email to scite-interest <at> googlegroups.com
To unsubscribe from this group, send email to scite-interest+unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/scite-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

SteveD | 3 Nov 10:05
Picon

Re: Direct lua os.ececute output to output pane


On Nov 3, 5:32 am, "instanton"<soft_sh...@126.com> wrote:
> The problem of using os.execute lies in that it pops a black cmd window and prints all compilation messages
in that window, so that when the compilation process exits, no message is left for inspection. The problem
with shell.exec is simply that it cannot accept cmd1 and cmd2 as valid first argument. Wraping cmd1 and
cmd2 with tostring doesn't help either. Any more help please?

Another solution that involves an extension library is this:

http://groups.google.com/group/scite-interest/web/spawner.dll

As with any extension, you will have to put 'require "spawner"' in
your startup lua script.

I orginally wrote this library to spawn debugger processes, since
SciTE's existing process control is limited and os.execute is clumsy
and cannot be interactive.

Here is an example:

p = spawner.new('dir *.*')
p:use_shell()
p:set_output 'trace'
p:run()

The use_shell() method simply ensures that 'cmd.exe /c ' is placed
before your command, otherwise it is optional.  The set_output()
method is passed a _global function_ that should receive the output of
the command, in this case just the builtin trace() function that
writes directly to the output pane.  And run() starts the process.

There is also a method set_result() which specifies a function which
will be called when the process finishes, e.g:

p:set_result 'print'

This function will be called with the result code as a string. This is
particularly useful if you do need the result code of the command, say
when running a compiler.

This DLL also provides a reliable implementation of popen (os.popen
does not work properly for Windows GUI applications):

f = spawner.popen 'dir /w'
print(f:read())  -- first line of output, etc

Note: I do not _entirely_ trust uploads to the files section of this
group, so be suspicious of any alternations to it that do not come
from me!

steve d.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "scite-interest" group.
To post to this group, send email to scite-interest <at> googlegroups.com
To unsubscribe from this group, send email to scite-interest+unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/scite-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Philippe Lhoste | 3 Nov 11:19
Picon

Re: Direct lua os.ececute output to output pane


On 03/11/2008 04:32, instanton wrote:
> The problem of using os.execute lies in that it pops a black cmd window 
> and prints all compilation messages in that window, so that when the 
> compilation process exits, no message is left for inspection.

You can either use the solution given by Mitchell (popen) or, on Windows, prefix the 
command with "cmd /k".
Thus the cd will work and the cmd box will remain on screen after running the command.
(untested...)

--

-- 
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "scite-interest" group.
To post to this group, send email to scite-interest <at> googlegroups.com
To unsubscribe from this group, send email to scite-interest+unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/scite-interest?hl=en
-~----------~----~----~----~------~----~------~--~---


Gmane