[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Auto-detect Guile in a text editor
From: |
Barry Fishman |
Subject: |
Re: Auto-detect Guile in a text editor |
Date: |
Tue, 13 Nov 2018 09:45:02 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
On 2018-10-23 13:07:33 +02, HiPhish wrote:
> Hello Schemers
>
> When I open a Scheme file (Neo)vim the file type is set to "scheme", but I
> would like to be able to detect that it is not just Scheme, but Guile Scheme.
> So far I have set up the editor to scan the first line for a shebang and if
> the word "guile" appears to set the file type to "scheme.guile":
>
> if getline(1) =~? '\v^#!.*[Gg]uile'
> let &filetype .= '.guile'
> endif
>
> If you are not familiar with Vim, the important part is the regex
> '^#!.*[Gg]uile'. This works OK, but is there a better way than adding a
> shebang or some other manual hing to the head of every script? How does Emacs
> do it?
Vim like Emacs recognizes modelines in the file. I start guile scripts
with:
#! /bin/sh
## -*- mode: scheme; coding: utf-8 -*-
## Time-stamp: <2018-09-14 08:43:42 barry>
exec ${GUILE:-guile} -e main -s $0 ${1+"$@"}
!#
--
Barry Fishman
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Auto-detect Guile in a text editor,
Barry Fishman <=