Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-29 Thread Skif-off
@elextr 
>>> Its any name known to your system iconv, so its system specific, Geany has 
>>> some common names in its menus, but in fact even those are not guaranteed 
>>> to be available.

>> Thanks, here it is necessary to think.

> As far as we know there is no programmatic way of getting a list of the 
> available encodings at runtime, (the equivalent of the iconv --list command). 
> If you find one let us know.

Well, now I understand why I did not find examples of using this feature :))

> and probably the build scripts are very specific to the particular setup and 
> would not be useful even if they were published.

I don't think so and they are not much different from Debian repositories 
([geany](https://anonscm.debian.org/git/pkg-geany/packages/geany.git), 
[geany-plugins](https://anonscm.debian.org/git/pkg-geany/packages/geany-plugins.git))
 :) I use Debian-based OS and I wanted to see 
```geany-plugins-common.install``` (```libgeanypluginutils.so*```) only (I 
think that ```geany-plugin-workbench.install``` & 
```geany-plugin-keyrecord.install``` like all the others).
But now I think I understood how to do it, I will check it.
(I'm make deb files for myself because I'm using PR 
[#1017](https://github.com/geany/geany/pull/1017) for Geany.)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-348099123

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-29 Thread elextr
> > Its any name known to your system iconv, so its system specific, Geany has 
> > some common names in its menus, but in fact even those are not guaranteed 
> > to be available.

> Thanks, here it is necessary to think.

As far as we know there is no programmatic way of getting a list of the 
available encodings at runtime, (the equivalent of the `iconv --list` command). 
 If you find one let us know.

> I saw https://nightly.geany.org/ and thought that it's a part of the 
> development team :) 

Yes the nightlys are provided by one of the developers, but they are for 
checking the build on a number of configurations, the packages produced are 
intended only as an artifact, although they may work if your system matches the 
build one.  But the scripts are not published AFAIK and probably the build 
scripts are very specific to the particular setup and would not be useful even 
if they were published.

Packages for Debian are not built by the packagers any more IIUC, the packagers 
submit jobs to a Debian build farm that makes packages for all the platforms 
and systems Debian supports, so only authorised people can make packages for 
Debian.  Ubuntu is the same IIUC.  Other distros may vary :)  Packagers are of 
course individual contributors and their ability to immediately respond to a 
new Geany release may vary from time to time.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-348033303

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-29 Thread Skif-off
@elextr 
> Its any name known to your system iconv, so its system specific, Geany has 
> some common names in its menus, but in fact even those are not guaranteed to 
> be available.

Thanks, here it is necessary to think.
> The project does not package Geany for any distros, its done by external 
> packagers who are experts in the peculiarities of their distro. So the 
> project has no package building scripts.

I saw [https://nightly.geany.org/](https://nightly.geany.org/) and thought that 
it's a part of the development team :) Ok, I'll wait for the packages 1.32 in 
the repository.

@codebrainz 
> You should make separate pull requests for the above patches if you want to 
> get them merged.

Ok, I'll do it today-tomorrow.
> or if you volunteer to become the new maintainer :)

It's impossible :) I like Geany, I like GeanyLua (with ```lua-utf8``` :)), but 
I am not programmer: I know some script languages (AutoIt, Lua, 
JScript/VBScript) a little, I can understand a little bit С/FreePascal and I 
can do something (with help/examples), but maintainer... Sorry :(

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-347949013

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-28 Thread Matthew Brush
> P.S. geany.reloadconf (like geany.reload_configuration() from GeanyPy) may be 
> of interest...

You should make separate pull requests for the above patches if you want to get 
them merged. That plugin doesn't have a dedicated maintainer, so making it easy 
on committers will give you a better chance to get changes in ... or if you 
volunteer to become the new maintainer :)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-347713058

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-28 Thread elextr
> If I want to add forced_enc, then where I can to find list of them and how to 
> use? GEANY_ENCODING_* from encodings.h or strings from encodings.c? (I didn't 
> find examples.)

Its any name known to your system iconv, so its system specific, Geany has some 
common names in its menus, but in fact even those are not guaranteed to be 
available.

> Where I can find files for build deb-files from master-branch 

The project does not package Geany for any distros, its done by external 
packagers who are experts in the pecularities of their distro.  So the project 
has no package building scripts.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-347580241

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-28 Thread Skif-off
1. If I want to add 
[forced_enc](https://www.geany.org/manual/reference/document_8h.html#aaae9e8e045dbed0ee86751071c4eaa50),
 then where I can to find list of them and how to use? ```GEANY_ENCODING_*``` 
from [encodings.h](https://github.com/geany/geany/blob/master/src/encodings.h) 
or strings from 
[encodings.c](https://github.com/geany/geany/blob/master/src/encodings.c)? (I 
didn't find examples.)

2. Where I can find files for build deb-files from master-branch (or for 
nightly builds)? Or it's not public? I didn't find :) (Nofiles 
```geany_*.debian.tar.xz``` & ```geany-plugins_*.debian.tar.xz``` for 1.32 and 
I couldn't do it myself for Utils and Workbench.)

---
P.S.  ```geany.reloadconf``` (like ```geany.reload_configuration()``` from 
GeanyPy) may be of interest...
```diff
diff --git a/geanylua/glspi_app.c b/geanylua/glspi_app.c
index ed82d5eb..b59d6b9a 100644
--- a/geanylua/glspi_app.c
+++ b/geanylua/glspi_app.c
@@ -604,6 +604,12 @@ static gint glspi_keygrab(lua_State* L)
 }
 
 
+static gint glspi_reloadconf(lua_State* L)
+{
+   main_reload_configuration();
+   return 0;
+}
+
 
 static const struct luaL_reg glspi_app_funcs[] = {
{"pluginver", glspi_pluginver},
@@ -620,6 +626,7 @@ static const struct luaL_reg glspi_app_funcs[] = {
{"keycmd",glspi_keycmd},
{"launch",glspi_launch},
{"keygrab",   glspi_keygrab},
+   {"reloadconf", glspi_reloadconf},
{NULL,NULL}
 };
 
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-347559222

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-23 Thread Skif-off
@codebrainz maybe you'll make a PR? As part of the development team :)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-346721257

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-23 Thread Matthew Brush
Something like this:

```diff
diff --git a/configure.ac b/configure.ac
index 7fb7d402..fa3bf5a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,6 +9,7 @@ AC_CONFIG_SRCDIR([po/POTFILES.in])
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_MACRO_DIR([build/cache])
 
+AC_USE_SYSTEM_EXTENSIONS
 AC_PROG_CC
 AC_PROG_CC_C99
 AM_PROG_CC_C_O
diff --git a/geanylua/glspi_app.c b/geanylua/glspi_app.c
index 23818170..f6379f74 100644
--- a/geanylua/glspi_app.c
+++ b/geanylua/glspi_app.c
@@ -4,7 +4,10 @@
  * See the file "geanylua.c" for copyright information.
  */
 
-#define _BSD_SOURCE /* for stat() and lstat() */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include 
 #include 
 #include 
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-346607041

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-23 Thread Matthew Brush
@Skif-off yeah, I saw that warning, but it's just a deprecation warning.

Proper fix would be for GeanyLua to use build system to check for 
`stat()`/`lstat()` and let autotools handle defining such macros as needed for 
the proper versions, IMO.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-346602956

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-23 Thread Skif-off
@codebrainz 
Yes, both variant works fine. Only one warning:
```  CC   libgeanylua_la-glspi_app.lo
In file included from /usr/include/x86_64-linux-gnu/sys/stat.h:25:0,
 from glspi_app.c:8:
/usr/include/features.h:183:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE 
are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^~~
```
I added line ```#define _DEFAULT_SOURCE /* fix warning with glibc >= 2.20 */``` 
below.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-346602099

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-23 Thread Matthew Brush
This also works:

```diff
diff --git a/geanylua/glspi_app.c b/geanylua/glspi_app.c
index ed82d5eb..23818170 100644
--- a/geanylua/glspi_app.c
+++ b/geanylua/glspi_app.c
@@ -418,11 +418,11 @@ static gint glspi_launch(lua_State* L)
gchar **argv=NULL;
gboolean rv;
GError *err=NULL;
-   if (argc==0) { return FAIL_STRING_ARG(1); }
+   if (argc<=0) { return FAIL_STRING_ARG(1); }
for (i=1;i<=argc;i++) {
if (!lua_isstring(L,i)) { return FAIL_STRING_ARG(i); }
}
-   argv=g_malloc0(sizeof(gchar *)*argc+1);
+   argv=g_malloc0_n(argc+1, sizeof(gchar *));
for (i=0;i

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-23 Thread Matthew Brush
@Skif-off try this:

```c
argv=g_malloc0_n(argc + 1u, sizeof(gchar *));
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-346596722

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-23 Thread elextr
or set option `-Wno-alloc-size-larger-than`

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-346592130

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-23 Thread Skif-off
Maybe I'd better use gcc-6 (6.4.0) or gcc-5 (5.5.0)?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-346591446

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-23 Thread Skif-off
I tried ```argv = g_malloc0_n(argc+1, sizeof(gchar*));``` and I have:
```
glspi_app.c: In function ‘glspi_launch’:
glspi_app.c:425:7: warning: argument 1 range [18446744071562067969, 
18446744073709551615] exceeds maximum object size 9223372036854775807 
[-Walloc-size-larger-than=]
  argv = g_malloc0_n(argc+1, sizeof(gchar*));
  ~^
In file included from /usr/include/glib-2.0/glib/glist.h:32:0,
 from /usr/include/glib-2.0/glib/ghash.h:33,
 from /usr/include/glib-2.0/glib.h:50,
 from /usr/local/include/geany/tagmanager/tm_source_file.h:14,
 from /usr/local/include/geany/tagmanager/tm_tag.h:32,
 from /usr/local/include/geany/app.h:31,
 from /usr/local/include/geany/geanyplugin.h:36,
 from glspi.h:19,
 from glspi_app.c:15:
/usr/include/glib-2.0/glib/gmem.h:96:10: note: in a call to allocation function 
‘g_malloc0_n’ declared here
 gpointer g_malloc0_n  (gsize  n_blocks,
  ^~~
  CC   libgeanylua_la-glspi_dlg.lo
```

Xubuntu 17.10 x64,
```
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.2.0-8ubuntu3' 
--with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs 
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr 
--with-gcc-major-version-only --program-suffix=-7 
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id 
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix 
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu 
--enable-libstdcxx-debug --enable-libstdcxx-time=yes 
--with-default-libstdcxx-abi=new --enable-gnu-unique-object 
--disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie 
--with-system-zlib --with-target-system-zlib --enable-objc-gc=auto 
--enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic 
--enable-offload-targets=nvptx-none --without-cuda-driver 
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu 
--target=x86_64-linux-gnu
Thread model: posix
gcc version 7.2.0 (Ubuntu 7.2.0-8ubuntu3) 
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-346590176

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-21 Thread elextr
>  I believe it will allocate room for the needed pointers plus one byte.

@codebrainz good catch.

Luckily for any geanylua users the allocated memory is likely to round up to a 
multiple of a pointer anyway for alignment reasons.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-345987865

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-21 Thread Matthew Brush
> Thats why its a stupid warning (or at least stupid to enable by default) 
> because many system interfaces use int as a counter (like argc) and everybody 
> knows they are never negative

To be fair, it's not the _actual_ `argc`, it's a random value popped off the 
Lua stack, it could be anything and the code only guards against value `0`, not 
`< 0`.

Also, unrelated, that line looks wrong because of the order of operations and 
missing parenthesis, I believe it will allocate room for the needed pointers 
plus one byte. Presumably it's meant to be `sizeof(gchar*) * (argc+1)` to 
allocate storage for the number of pointers plus one extra pointer for the 
sentinel `NULL` as is customary with `argv`/`GStrv`.

To fix the warning and bug, it could probably be changed to:

```c
argv = g_malloc0_n(argc+1, sizeof(gchar*));
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-345984959

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-20 Thread elextr
For your own stuff sure.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-345944098

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-20 Thread Skif-off
Can I just ignore this warning? :)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-345943938

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-20 Thread Skif-off
@elextr 
```gchar **argv=NULL;``` >>> ```guchar **argv=NULL;```?
Is everything will be fine if I just ignore this warning?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-345940860

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-20 Thread elextr
You have items of mixed signedness in the expression.  This is IIRC a fairly 
new stupid warning.  To shut it up just cast argc to an unsigned type.  The 
nightly probably uses a compiler thats older than the stupid warning.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-345939759

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-19 Thread Skif-off
@frlan 
>But ... I prefer PR with an updated MAINTAINERS file too ;)

Sorry, it's too cool for me :) And I found a workaround:
```lua
  local t = geany.fileinfo();
  geany.newfile("UNTITLED" .. t.ext);
```
(but untitled document would be more convenient because it's obvious).


Well, I do not want to lose, maybe will useful :), patch (like 
```document.new_file``` in 
[GeanyPy](https://geanypy.readthedocs.io/en/latest/document.html#document.new_file),
 + fix two build warnings & upd ```geanylua-ref.html```):
```diff
diff -Naur 01/glspi_app.c 02/glspi_app.c
--- glspi_app.c
+++ glspi_app.c
@@ -5,6 +5,7 @@
  */
 
 #define _BSD_SOURCE /* for stat() and lstat() */
+#define _DEFAULT_SOURCE /* fix warning if glibc >= 2.20 */
 #include 
 #include 
 #include 
@@ -422,7 +423,7 @@
for (i=1;i<=argc;i++) {
if (!lua_isstring(L,i)) { return FAIL_STRING_ARG(i); }
}
-   argv=g_malloc0(sizeof(gchar *)*argc+1);
+   argv=g_malloc0(sizeof(gchar *)*(argc+1));
for (i=0;i0) {
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; }
+   tf=lua_tostring(L, 2);
+   if ( '\0' == tf[0] ) {
+   ft=NULL;
+   } else {
+   ft=filetypes_lookup_by_name(tf);
+   }
}
-   document_new_file(fn, NULL, NULL);
+   document_new_file(fn, ft, NULL);
return 0;
 }
 
diff -Naur 01/docs/geanylua-ref.html 02/docs/geanylua-ref.html
--- docs/geanylua-ref.html
+++ docs/geanylua-ref.html
@@ -756,11 +756,23 @@
 
 
 
-geany.newfile ( [filename] )
-When called with one argument, creates a new document with the specified
-filename. When called with no arguments, creates a new, 
untitled document.
-
+geany.newfile ( [filename [, filetype] 
)
+When called with no arguments, creates a new, untitled document.
+When called with one argument, creates a new document with the specified
+filename.
+When called with two argument, creates a new document with the specified
+filename and filetype (a one-word description of the 
filetype,
+e.g. "C" or "Python".). If you want untitled document then set 
filename as "".
+So you can use it like this:
+local s = geany.selection();
 
+if (s ~= "") and (s ~= nil) then
+  local t = geany.fileinfo();
+  geany.newfile("", t.type);
+  geany.selection(s);
+end
+(create a new, untitled document, with selected text and autoset 
filetype).
+
 
 
 geany.open ( [filename]|[index] )

```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-345538243

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-19 Thread Frank Lanitz
@elextr  @Skif-off  Why not? But not before 1.32 and I prefer PR with an 
updated MAINTAINERS file too ;) 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-345507308

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-19 Thread Skif-off
Hmm, seems to work work fine and I think I fixed two warnings... Make PR?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-345503683

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-18 Thread elextr
Ok, you can do it if you extend your own Geanylua.  And since its unowned, why 
not :)

You C cod is passing a string as the filetype, it should be a pointer to the 
filetype structure, use 
[`filetypes_lookup_by_name()`](https://www.geany.org/manual/reference/filetypes_8h.html#aa2a53fa0c2f4362d9a5e6eb01839c5a5)
 to get it from the string. 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-345489659

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-18 Thread Skif-off
I tried to use ```glspi_newfile``` 
[mod](https://github.com/geany/geany-plugins/issues/646#issuecomment-345476945),
 but Geany crash with error
>(geany:3157): Geany-CRITICAL **: filetypes_load_config: assertion 'ft_id < 
>filetypes_array->len' failed

Need to think.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-345487039

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-18 Thread elextr
> > a normal plugin would use document_set_filetype() but I don't know if its 
> > available in the restricted Geanylua API.
> "normal" plugin? :)

By a "normal" plugin I mean one that uses the standard Geany plugin API, C, 
C++, Cython, anything else that accesses C and compiles to a `.so` for eg Rust, 
and Python via Geanypy that mapped almost all of the Geany API to Python and 
@kugel-s Peasy that uses GI to make all the Geany API available to Python and 
some other languages I believe.  

But IIRC Geanylua provided only a customised and limited subset of that API.  
If the functionality is not available then I don't think you will be able to do 
whatever you are trying to do.

To explain further, there are several reasons to use the Geany filetype, not 
set the lexer directly:

1. Geany expects its in control of the lexer, it will set it or reset it at any 
time it feels the need to, overwriting your selection.

2. To make highlighting work you need more than the lexer, you need to map the 
style results to the styles set by the filetype/colour scheme, and thats hard 
coded in Geany based on what Geany expects the lexer to be from the filetype, 
not whats set in Scintilla.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-345483522

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-18 Thread Skif-off
@elextr 
>a normal plugin would use document_set_filetype() but I don't know if its 
>available in the restricted Geanylua API.

"normal" plugin? :)
I use local 
[geanylua-ref.html](https://github.com/geany/geany-plugins/blob/master/geanylua/docs/geanylua-ref.html).
 Also I tried to find ```document_set_filetype()``` in source files of 
Geanylua, but without success.

Maybe try something like
```diff
--- "geanylua/glspi_doc.c"
+++ "geanylua/glspi_doc.c"
@@ -36,8 +36,10 @@
if (!lua_isstring(L, 1)){ return FAIL_STRING_ARG(1); }
fn=lua_tostring(L, 1);
if ( '\0' == fn[0] ) { fn = NULL; }
+   ft=lua_tostring(L, 2);
+   if ( '\0' == fn[0] ) { fn = NULL; }
}
-   document_new_file(fn, NULL, NULL);
+   document_new_file(fn, ft, NULL);
return 0;
 }
 ```
? 
Function ```glspi_newfile```, i.e. minimal effort (?). And use like
```lua
local t = geany.fileinfo();
geany.newfile("", t.type);
```
for untitled document/new tab.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-345476945

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-18 Thread Frank Lanitz
Unlikely if no more adopt it.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-345449239

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-18 Thread elextr
Since the Geanylua documentation seems to be absent on the web I can't really 
help you, a normal plugin would use 
[`document_set_filetype()`](https://www.geany.org/manual/reference/document_8h.html#a7a2f2bfa1c9fe7d9472466e895c251f6)
 but I don't know if its available in the restricted Geanylua API.

Geanylua being orphaned and unmaintained I'm not sure if the missing 
documentation problem will get fixed.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-345448735

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-18 Thread Skif-off
How can I do this? I found ```geany.fileinfo()``` with fields ```type``` & 
```desc``` and nothing more.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-345446095

Re: [Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-17 Thread elextr
You should not set the lexer directly, set the Geany filetype instead.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646#issuecomment-345417127

[Github-comments] [geany/geany-plugins] [geanylua] geany.scintilla() does not work with SCI_SETLEXER (#646)

2017-11-17 Thread Skif-off
I added small script:
```lua
--[[
  Copy selected text to new tab
  2017.11.18
--]]

local s = geany.selection();

if (s == "") then
  geany.message("No text is selected!");
elseif (s == nil) then
  geany.message("There is no open document!");
else
  --SCI_GETLEXER
  local l = geany.scintilla(4002);
  geany.newfile();
  geany.selection(s);
  --SCI_SETLEXER
  geany.scintilla(4001, l);
  geany.status("Lua-script: Copy selected text to new tab.");
end
```
```SCI_GETLEXER```works fine, all values (```SCLEX_*```) were correctly 
received, but ```SCI_SETLEXER``` is not working.
Why? It's bug or not implemented?

Xubuntu 17.10 x64, Geany 1.31, I also checked current Git versions.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/646