[arch-projects] [devtools] Help text editors out a bit
This pair of patches helps text editor programs when editing the files. For non-executable bash files, a phony shebang "#!/hint/bash" provides a hint to text editors that the shell dialect for that file is Bash; and is general that basically every text editor will understand it, unlike most other editor hints; without misleading a user into thinking that maybe the file is executable, like "#!/bin/bash" would. `commitpkg` had a line with a bunch of complex quoting and backslashes; it was confusing Emacs, and caused the rest of the file to be a string, wcrwing up syntax highlighting, but more importantly, auto-indentation. -- Happy hacking, ~ Luke Shumaker
From: Luke Shumaker <lukeshu@lukeshu.com> This provides a cross-editor hint that the syntax of the file is Bash. --- bash_completion.in | 2 ++ lib/archroot.sh | 2 ++ lib/common.sh | 2 ++ lib/valid-tags.sh | 2 ++ 4 files changed, 8 insertions(+) diff --git a/bash_completion.in b/bash_completion.in index dd140fc..10dad36 100644 --- a/bash_completion.in +++ b/bash_completion.in @@ -1,3 +1,5 @@ +#!/hint/bash + _devtools_compgen() { local i r COMPREPLY=($(compgen -W '$*' -- "$cur")) diff --git a/lib/archroot.sh b/lib/archroot.sh index 989f1e1..d8d4a2e 100644 --- a/lib/archroot.sh +++ b/lib/archroot.sh @@ -1,3 +1,5 @@ +#!/hint/bash + CHROOT_VERSION='v4' ## diff --git a/lib/common.sh b/lib/common.sh index 5ef9f97..e64553b 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -1,3 +1,5 @@ +#!/hint/bash + # Avoid any encoding problems export LANG=C diff --git a/lib/valid-tags.sh b/lib/valid-tags.sh index 36918fe..9491b0a 100644 --- a/lib/valid-tags.sh +++ b/lib/valid-tags.sh @@ -1,3 +1,5 @@ +#!/hint/bash + _arch=( i686 x86_64 -- 2.12.0
It was confusing Emacs and screwing up the syntax highlighting and auto-indentation for the rest of the file. --- commitpkg.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commitpkg.in b/commitpkg.in index 3b3246b..707a81c 100644 --- a/commitpkg.in +++ b/commitpkg.in @@ -47,7 +47,7 @@ done for i in 'changelog' 'install'; do while read -r file; do # evaluate any bash variables used - eval file=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$file")\" + eval file=\"$(sed "s/^\(['\"]\)\(.*\)\1\$/\2/" <<< "$file")\" needsversioning+=("$file") done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD) done -- 2.12.0
participants (1)
-
Luke Shumaker