Branch: refs/heads/master
Author: Skif-off <Skif-off(a)users.noreply.github.com>
Committer: GitHub <noreply(a)github.com>
Date: Tue, 09 Jan 2018 00:02:24 UTC
Commit: 23e563337611fb0087679c36fb0e91472e865bb5
https://github.com/geany/geany-plugins/commit/23e563337611fb0087679c36fb0e9…
Log Message:
-----------
GeanyLua: Fix right-trim.lua
Now script works with files with CRLF too
Modified Paths:
--------------
geanylua/examples/edit/right-trim.lua
Modified: geanylua/examples/edit/right-trim.lua
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -5,9 +5,9 @@
local s=geany.text()
-if (s and string.match(s, "[ \t]\n") )
+if (s and string.match(s, "[ \t][\r\n]") )
then
- geany.text(string.gsub(s,"[ \t]+\n", "\n"))
+ geany.text(string.gsub(s,"([ \t]+)([\r\n]+)", "%2"))
else
geany.message("Right trim:", "Match not found.")
end
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Skif-off <Skif-off(a)users.noreply.github.com>
Committer: Skif-off <Skif-off(a)users.noreply.github.com>
Date: Thu, 30 Nov 2017 07:07:48 UTC
Commit: 0b6b83f5a87dd63242cd414eabc45e48f5a907f5
https://github.com/geany/geany-plugins/commit/0b6b83f5a87dd63242cd414eabc45…
Log Message:
-----------
GeanyLua: Add filetype to set in geany.newfile()
Modified Paths:
--------------
geanylua/docs/geanylua-ref.html
geanylua/glspi_doc.c
Modified: geanylua/docs/geanylua-ref.html
24 lines changed, 18 insertions(+), 6 deletions(-)
===================================================================
@@ -136,7 +136,7 @@
</tr>
<tr class="odd">
- <td> function <a href="#newfile"><b>newfile</b></a> ( [filename] )<br></td>
+ <td> function <a href="#newfile"><b>newfile</b></a> ( [filename [, filetype] )<br></td>
<td class="desc">-- Create a new document.</td>
</tr>
@@ -756,11 +756,23 @@
<br><br>
-<a name="newfile"></a><hr><h3><tt>geany.newfile ( [filename] )</tt></h3><p>
-When called with one argument, creates a new document with the specified
-<tt>filename</tt>. </p><p>When called with no arguments, creates a new, untitled document.
-</p><br><br>
-
+<a name="newfile"></a><hr><h3><tt>geany.newfile ( [filename [, filetype] )</tt></h3><p>
+<p>When called with no arguments, creates a new, untitled document.</p>
+<p>When called with one argument, creates a new document with the specified
+<tt>filename</tt>.</p>
+<p>When called with two argument, creates a new document with the specified
+<tt>filename</tt> and <tt>filetype</tt> (a one-word description of the filetype,
+e.g. "C" or "Python".). If you want untitled document then set <tt>filename</tt> as <tt>""</tt>.</p>
+<p>So you can use it like this:</p>
+<pre>local s = geany.selection();
+
+if (s ~= "") and (s ~= nil) then
+ local t = geany.fileinfo();
+ geany.newfile("", t.type);
+ geany.selection(s);
+end</pre>
+<p>(create a new, untitled document, with selected text and auto set filetype).</p>
+<br><br>
<a name="open"></a><hr><h3><tt>geany.open ( [filename]|[index] )</tt></h3><p>
Modified: geanylua/glspi_doc.c
17 lines changed, 14 insertions(+), 3 deletions(-)
===================================================================
@@ -32,12 +32,23 @@ static gint glspi_filename(lua_State* L)
static gint glspi_newfile(lua_State* L)
{
const gchar *fn=NULL;
- if (lua_gettop(L)>0) {
+ GeanyFiletype *ft=NULL;
+ switch (lua_gettop(L)) {
+ case 0: break;
+ case 2:
+ if (!lua_isstring(L, 2)) { return FAIL_STRING_ARG(2); }
+ const gchar *tmp=lua_tostring(L, 2);
+ if ( '\0' == tmp[0] ) {
+ ft=NULL;
+ } else {
+ ft=filetypes_lookup_by_name(tmp);
+ }
+ default:
if (!lua_isstring(L, 1)) { return FAIL_STRING_ARG(1); }
fn=lua_tostring(L, 1);
- if ( '\0' == fn[0] ) { fn = NULL; }
+ if ( '\0' == fn[0] ) { fn=NULL; }
}
- document_new_file(fn, NULL, NULL);
+ document_new_file(fn, ft, NULL);
return 0;
}
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Skif-off <Skif-off(a)users.noreply.github.com>
Committer: GitHub <noreply(a)github.com>
Date: Thu, 30 Nov 2017 18:36:35 UTC
Commit: c91ae6f9254f61821fcaff10fece0b11ce8b560a
https://github.com/geany/geany-plugins/commit/c91ae6f9254f61821fcaff10fece0…
Log Message:
-----------
GeanyLua: trivial for Travis
Modified Paths:
--------------
geanylua/docs/geanylua-ref.html
Modified: geanylua/docs/geanylua-ref.html
3 lines changed, 1 insertions(+), 2 deletions(-)
===================================================================
@@ -758,8 +758,7 @@
<a name="newfile"></a><hr><h3><tt>geany.newfile ( [filename [, filetype] )</tt></h3><p>
<p>When called with no arguments, creates a new, untitled document.</p>
-<p>When called with one argument, creates a new document with the specified
-<tt>filename</tt>.</p>
+<p>When called with one argument, creates a new document with the specified <tt>filename</tt>.</p>
<p>When called with two argument, creates a new document with the specified
<tt>filename</tt> and <tt>filetype</tt> (a one-word description of the filetype,
e.g. "C" or "Python".). If you want untitled document then set <tt>filename</tt> as <tt>""</tt>.</p>
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).