Bram Moolenaar wrote:
Jonathan Smith wrote:
Conary [1] has a file format called a "recipe" [2] which is in many
ways similar in function to a spec file or an ebuild. rPath has been
maintaining a syntax highlighting file for this format, but it would
be nice if vim would accept a patch to include this in the standard
distribution. Attached is just such a patch.
Thanks for looking into this.
"recipe" is not a good filetype name. Is there anything against using
"conary"?
The syntax file must not start with "syntax clear". Look into a few
examples in the Vim 7 distribution how this is done properly.
I would very much prefer that the author of the file directly sends the
syntax file to me. At least for copyright issues.
Well, the files are called recipes. In the same way that you wouldn't call a
spec file "rpm", you wouldn't call a recipe "conary". Conary has other file
types which it uses, which vim should not be able to edit (changesets, the
equivalent of an RPM).
You'll notice that "rPath Inc" is listed as the author. I am a member of the
rPath distro team, and an employee of the same, so copyright shouldn't be an issue.
Thanks for the tips about "syntax clear". Taking an example from the spec.vim
file, I have modified the recipe.vim file to hopefully be acceptable. It is once
again attached to this email.
-smithj
--- vim63/runtime/filetype.vim.old 2005-07-29 18:16:25.000000000 -0400
+++ vim63/runtime/filetype.vim 2005-07-29 18:16:32.000000000 -0400
@@ -1216,6 +1216,9 @@
endif
endfun
+" Conary Recipe
+au BufNewFile,BufRead *.recipe setf recipe
+
" Remind
au BufNewFile,BufRead .reminders* setf remind
" Vim syntax file
" Language: Conary Recipe
" Maintainer: rPath Inc <http://www.rpath.com>
" Updated: 2007-04-18
"
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
runtime! syntax/python.vim
syn keyword conarySFunction mainDir addAction addSource addArchive addPatch
syn keyword conarySFunction addRedirect
syn keyword conaryGFunction add addAll addNewGroup addReference createGroup
syn keyword conaryGFunction addNewGroup startGroup remove removeComponents
syn keyword conaryGFunction replace setByDefault setDefaultGroup
syn keyword conaryGFunction setLabelPath addCopy setSearchPath
syn keyword conaryBFunction Run Automake Configure ManualConfigure
syn keyword conaryBFunction Make MakeParallelSubdir MakeInstall
syn keyword conaryBFunction MakePathsInstall CompilePython
syn keyword conaryBFunction Ldconfig Desktopfile Environment SetModes
syn keyword conaryBFunction Install Copy Move Symlink Link Remove Doc
syn keyword conaryBFunction Create MakeDirs disableParallelMake
syn keyword conaryBFunction ConsoleHelper Replace SGMLCatalogEntry
syn keyword conaryBFunction XInetdService XMLCatalogEntry TestSuite
syn keyword conaryBFunction PythonSetup
syn keyword conaryPFunction NonBinariesInBindirs FilesInMandir
syn keyword conaryPFunction ImproperlyShared CheckSonames CheckDestDir
syn keyword conaryPFunction ComponentSpec PackageSpec
syn keyword conaryPFunction Config InitScript GconfSchema SharedLibrary
syn keyword conaryPFunction ParseManifest MakeDevices DanglingSymlinks
syn keyword conaryPFunction AddModes WarnWriteable IgnoredSetuid
syn keyword conaryPFunction Ownership ExcludeDirectories
syn keyword conaryPFunction BadFilenames BadInterpreterPaths ByDefault
syn keyword conaryPFunction ComponentProvides ComponentRequires Flavor
syn keyword conaryPFunction EnforceConfigLogBuildRequirements Group
syn keyword conaryPFunction EnforceSonameBuildRequirements InitialContents
syn keyword conaryPFunction FilesForDirectories LinkCount
syn keyword conaryPFunction MakdeDevices NonMultilibComponent ObsoletePaths
syn keyword conaryPFunction NonMultilibDirectories NonUTF8Filenames TagSpec
syn keyword conaryPFunction Provides RequireChkconfig Requires TagHandler
syn keyword conaryPFunction TagDescription Transient User UtilizeGroup
syn keyword conaryPFunction WorldWritableExecutables UtilizeUser
syn keyword conaryPFunction WarnWritable Strip CheckDesktopFiles
" Most destdirPolicy aren't called from recipes, except for these
syn keyword conaryPFunction AutoDoc RemoveNonPackageFiles TestSuiteFiles
syn keyword conaryPFunction TestSuiteLinks
syn match conaryMacro "%(\w*)[sd]" contained
syn match conaryBadMacro "%(\w*)[^sd]" contained " no final marker
syn keyword conaryArches contained x86 x86_64
syn keyword conarySubArches contained sse2 3dnow 3dnowext cmov i486 i586
syn keyword conarySubArches contained i686 mmx mmxext nx sse sse2
syn keyword conaryBad RPM_BUILD_ROOT EtcConfig InstallBucket subDir
subdir
syn keyword conaryBad RPM_OPT_FLAGS
syn cluster conaryArchFlags contains=conaryArches,conarySubArches
syn match conaryArch "Arch\.[a-z0-9.]*"
contains=conaryArches,conarySubArches
syn match conaryArch "Arch\.[a-z0-9.]*"
contains=conaryArches,conarySubArches
syn keyword conaryKeywords name buildRequires version clearBuildReqs
syn keyword conaryUseFlag contained pcre tcpwrappers gcj gnat selinux pam
syn keyword conaryUseFlag contained bootstrap python perl
syn keyword conaryUseFlag contained readline gdbm emacs krb builddocs
syn keyword conaryUseFlag contained alternatives tcl tk X gtk gnome qt
syn keyword conaryUseFlag contained xfce gd ldap sasl pie desktop ssl kde
syn keyword conaryUseFlag contained slang netpbm nptl ipv6 buildtests
syn keyword conaryUseFlag contained ntpl xen dom0 domU
syn match conaryUse "Use\.[a-z0-9.]*" contains=conaryUseFlag
"syn match conaryR "r\.\w*" contains=conaryFunction
" strings
syn region pythonString matchgroup=Normal start=+[uU]\='+ end=+'+
skip=+\\\\\|\\'+ contains=pythonEscape,conaryMacro,conaryBadMacro
syn region pythonString matchgroup=Normal start=+[uU]\="+ end=+"+
skip=+\\\\\|\\"+ contains=pythonEscape,conaryMacro,conaryBadMacro
syn region pythonString matchgroup=Normal start=+[uU]\="""+ end=+"""+
contains=pythonEscape,conaryMacro,conaryBadMacro
syn region pythonString matchgroup=Normal start=+[uU]\='''+ end=+'''+
contains=pythonEscape,conaryMacro,conaryBadMacro
syn region pythonRawString matchgroup=Normal start=+[uU]\=[rR]'+ end=+'+
skip=+\\\\\|\\'+ contains=conaryMacro,conaryBadMacro
syn region pythonRawString matchgroup=Normal start=+[uU]\=[rR]"+ end=+"+
skip=+\\\\\|\\"+ contains=conaryMacro,conaryBadMacro
syn region pythonRawString matchgroup=Normal start=+[uU]\=[rR]"""+
end=+"""+ contains=conaryMacro,conaryBadMacro
syn region pythonRawString matchgroup=Normal start=+[uU]\=[rR]'''+
end=+'''+ contains=conaryMacro,conaryBadMacro
if version >= 508 || !exists("did_python_syn_inits")
if version <= 508
let did_python_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
" The default methods for highlighting. Can be overridden later
"HiLink pythonStatement Statement
"HiLink pythonFunction Function
"HiLink pythonConditional Conditional
"HiLink pythonRepeat Repeat
"HiLink pythonString String
"HiLink pythonRawString String
"HiLink pythonEscape Special
"HiLink pythonOperator Operator
"HiLink pythonPreCondit PreCondit
"HiLink pythonComment Comment
"HiLink pythonTodo Todo
HiLink conaryMacro Special
HiLink conaryBFunction Function
HiLink conaryGFunction Function
HiLink conarySFunction Operator
HiLink conaryPFunction Typedef
HiLink conaryFlags PreCondit
HiLink conaryArches Special
HiLink conarySubArches Special
HiLink conaryBad Error
HiLink conaryBadMacro Error
HiLink conaryKeywords Special
HiLink conaryUseFlag Typedef
"HiLink conaryR Typedef
delcommand HiLink
endif
let b:current_syntax = "recipe"
" vim: ts=8