aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2021-12-18 17:22:09 +0100
committerGitHub <noreply@github.com>2021-12-18 17:22:09 +0100
commitff1b0f632a8d3aed0ba861057e7bd8ade4540277 (patch)
treed57073bfe906ab82e5df55a091b9d565f42b0de3 /runtime
parent34d88edaec33bc75a60618fd62e570aa235c03ea (diff)
downloadrneovim-ff1b0f632a8d3aed0ba861057e7bd8ade4540277.tar.gz
rneovim-ff1b0f632a8d3aed0ba861057e7bd8ade4540277.tar.bz2
rneovim-ff1b0f632a8d3aed0ba861057e7bd8ade4540277.zip
vim-patch:8.2.3843: dep3patch files are not recognized (#16700)
Problem: Dep3patch files are not recognized. Solution: Recognize dep3patch files by their location and content. (James McCoy, closes vim/vim#9367) https://github.com/vim/vim/commit/647ab4cede4dbf412d24748f8e0a64d1cb9239f4
Diffstat (limited to 'runtime')
-rw-r--r--runtime/autoload/dist/ft.vim17
-rw-r--r--runtime/filetype.vim3
2 files changed, 20 insertions, 0 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index a3db4ae87a..366d7b009d 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -811,6 +811,23 @@ func dist#ft#Redif()
endwhile
endfunc
+" This function is called for all files under */debian/patches/*, make sure not
+" to non-dep3patch files, such as README and other text files.
+func dist#ft#Dep3patch()
+ if expand('%:t') ==# 'series'
+ return
+ endif
+
+ for ln in getline(1, 100)
+ if ln =~# '^\%(Description\|Subject\|Origin\|Bug\|Forwarded\|Author\|From\|Reviewed-by\|Acked-by\|Last-Updated\|Applied-Upstream\):'
+ setf dep3patch
+ return
+ elseif ln =~# '^---'
+ " end of headers found. stop processing
+ return
+ endif
+ endfor
+endfunc
" Restore 'cpoptions'
let &cpo = s:cpo_save
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 6dfdbeb275..57aaeab766 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -486,6 +486,9 @@ au BufNewFile,BufRead dict.conf,.dictrc setf dictconf
" Dictd config
au BufNewFile,BufRead dictd*.conf setf dictdconf
+" DEP3 formatted patch files
+au BufNewFile,BufRead */debian/patches/* call dist#ft#Dep3patch()
+
" Diff files
au BufNewFile,BufRead *.diff,*.rej setf diff
au BufNewFile,BufRead *.patch