patch: editor/vis: proper detection for shell scripts

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

patch: editor/vis: proper detection for shell scripts

Sebastien Marie-3
Hi,

For determining syntax used for a file, vis editor uses filename pattern or mime
detection using file(1).

For shell script, it expects "text/x-shellscript" mimetype output from file(1),
but file(1) returns "application/x-shellscript" on OpenBSD for such scripts.

The following diff makes vis editor to recognize "application/x-shellscript" as
shell script.

Thanks.
--
Sebastien Marie

Index: Makefile
===================================================================
RCS file: /cvs/ports/editors/vis/Makefile,v
retrieving revision 1.3
diff -u -p -r1.3 Makefile
--- Makefile 10 Apr 2018 22:51:28 -0000 1.3
+++ Makefile 22 Nov 2018 08:21:37 -0000
@@ -5,7 +5,7 @@ COMMENT = vi-like editor with sam-style
 V = 0.5
 DISTNAME = vis-v${V}
 PKGNAME = vis-${V}
-REVISION = 0
+REVISION = 1
 
 TEST_V = 0.3
 SUPDISTNAME = vis-test-${TEST_V}
Index: patches/patch-lua_plugins_filetype_lua
===================================================================
RCS file: patches/patch-lua_plugins_filetype_lua
diff -N patches/patch-lua_plugins_filetype_lua
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-lua_plugins_filetype_lua 22 Nov 2018 08:21:17 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+file(1) under OpenBSD return "application/x-shellscript" for shell-script
+Index: lua/plugins/filetype.lua
+--- lua/plugins/filetype.lua.orig
++++ lua/plugins/filetype.lua
+@@ -41,7 +41,7 @@ vis.ftdetect.filetypes = {
+ },
+ bash = {
+ ext = { "%.bash$", "%.csh$", "%.sh$", "%.zsh$" },
+- mime = { "text/x-shellscript" },
++ mime = { "application/x-shellscript" },
+ },
+ batch = {
+ ext = { "%.bat$", "%.cmd$" },