[ovs-dev] [PATCH] ovs-lib: Ensure Emacs identifies the file type properly.

Aaron Conole aconole at redhat.com
Mon Apr 2 19:05:31 UTC 2018


Ben Pfaff <blp at ovn.org> writes:

> This makes Emacs identify the file as a shell script, so that it does
> the right kind of syntax coloring and indentation.
>
> Signed-off-by: Ben Pfaff <blp at ovn.org>
> ---

It is better than typing M-x shell-mode each time.

>  utilities/ovs-lib.in | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
> index cf6b6d296eb5..7889409c75a8 100644
> --- a/utilities/ovs-lib.in
> +++ b/utilities/ovs-lib.in
> @@ -1,3 +1,4 @@
> +# -*- sh -*-
>  # This is a shell function library sourced by some Open vSwitch scripts.
>  # It is not intended to be invoked on its own.

Acked-by: Aaron Conole <aconole at redhat.com>

I might also suggest folding in the following (for our vim brethren).

NB: I at first thought vim was correctly detecting the file type on the
same hint - but turns out it just syntax highlights what it thinks are
comments and quotes.  Adding the syntax line is what works for vim (and
neither appears to be a universal solution).

diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
index 7889409c7..4b08f0f53 100644
--- a/utilities/ovs-lib.in
+++ b/utilities/ovs-lib.in
@@ -1,4 +1,5 @@
 # -*- sh -*-
+# vi:syntax=sh
 # This is a shell function library sourced by some Open vSwitch scripts.
 # It is not intended to be invoked on its own.


More information about the dev mailing list