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

Skif-off notifications at xxxxx
Sat Nov 18 22:43:55 UTC 2017


@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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20171118/1b6c8571/attachment.html>


More information about the Github-comments mailing list