Mercurial > vim
annotate runtime/ftplugin/rmd.vim @ 33404:9b35b4c6df4c v9.0.1960
patch 9.0.1960: Make CI checks more strict
Commit: https://github.com/vim/vim/commit/f7f746b1672909ae57d2eec97253d6627f6c0887
Author: Yee Cheng Chin <ychin.git@gmail.com>
Date: Sat Sep 30 12:28:50 2023 +0200
patch 9.0.1960: Make CI checks more strict
Problem: Make CI checks more strict
Solution: Add -Wstrict-prototypes -Wmissing-prototypes to CI,
fix uncovered problems
Add -Wstrict-prototypes -Wmissing-prototypes warnings check to CI
Add two new warnings to CI, silence some Perl related build-warnings:
- `strict-prototypes` helps prevent declaring a function with an empty
argument list, e.g. `int func()`. In C++, that's equivalent to `int
func(void)`, but in C, that means a function that can take any number
of arguments which is rarely what we want.
- `missing-prototypes` makes sure we use `static` for file-only internal
functions. Non-static functions should have been declared on a
prototype file.
- Add `no-compound-token-split-by-macro` to the perl cflags, since it
throws out a bunch of perl-related warnings that make the CI log
unnecessary verbose and hard to read. This seems to happen only with
clang 12 and above.
When applying those changes, it already uncovered a few warnings, so fix
up the code as well (fix prototypes, make the code static, remove
shadowed var declaration)
GTK header needs to have #pragma warning suppressiong because GTK2
headers will warn on `-Wstrict-prototypes`, and it's included by gui.h
and so we can't just turn off the warning in a couple files.
closes: #13223
closes: #13226
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 30 Sep 2023 12:45:05 +0200 |
parents | 033f22d4a52a |
children | 8ae680be2a51 |
rev | line source |
---|---|
6051 | 1 " Vim filetype plugin file |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8497
diff
changeset
|
2 " Language: R Markdown file |
6051 | 3 " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> |
8497
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
6051
diff
changeset
|
4 " Homepage: https://github.com/jalvesaq/R-Vim-runtime |
33368
033f22d4a52a
runtime(rmd) Update ftplugin and syntax files (#13193)
Christian Brabandt <cb@256bit.org>
parents:
32294
diff
changeset
|
5 " Last Change: Mon May 29, 2023 06:31AM |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8497
diff
changeset
|
6 " Original work by Alex Zvoleff (adjusted from R help for rmd by Michel Kuhlmann) |
6051 | 7 |
8 " Only do this when not yet done for this buffer | |
9 if exists("b:did_ftplugin") | |
10 finish | |
11 endif | |
12 | |
14637 | 13 if exists('g:rmd_include_html') && g:rmd_include_html |
14 runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim | |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8497
diff
changeset
|
15 endif |
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8497
diff
changeset
|
16 |
14637 | 17 setlocal comments=fb:*,fb:-,fb:+,n:> |
18 setlocal commentstring=#\ %s | |
6051 | 19 setlocal formatoptions+=tcqln |
20 setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+ | |
21 setlocal iskeyword=@,48-57,_,. | |
22 | |
23 let s:cpo_save = &cpo | |
24 set cpo&vim | |
25 | |
32294 | 26 function FormatRmd() |
14637 | 27 if search("^[ \t]*```[ ]*{r", "bncW") > search("^[ \t]*```$", "bncW") |
28 setlocal comments=:#',:###,:##,:# | |
29 else | |
30 setlocal comments=fb:*,fb:-,fb:+,n:> | |
31 endif | |
32 return 1 | |
33 endfunction | |
34 | |
33368
033f22d4a52a
runtime(rmd) Update ftplugin and syntax files (#13193)
Christian Brabandt <cb@256bit.org>
parents:
32294
diff
changeset
|
35 let s:last_line = 0 |
32294 | 36 function SetRmdCommentStr() |
33368
033f22d4a52a
runtime(rmd) Update ftplugin and syntax files (#13193)
Christian Brabandt <cb@256bit.org>
parents:
32294
diff
changeset
|
37 if line('.') == s:last_line |
033f22d4a52a
runtime(rmd) Update ftplugin and syntax files (#13193)
Christian Brabandt <cb@256bit.org>
parents:
32294
diff
changeset
|
38 return |
033f22d4a52a
runtime(rmd) Update ftplugin and syntax files (#13193)
Christian Brabandt <cb@256bit.org>
parents:
32294
diff
changeset
|
39 endif |
033f22d4a52a
runtime(rmd) Update ftplugin and syntax files (#13193)
Christian Brabandt <cb@256bit.org>
parents:
32294
diff
changeset
|
40 let s:last_line = line('.') |
033f22d4a52a
runtime(rmd) Update ftplugin and syntax files (#13193)
Christian Brabandt <cb@256bit.org>
parents:
32294
diff
changeset
|
41 |
033f22d4a52a
runtime(rmd) Update ftplugin and syntax files (#13193)
Christian Brabandt <cb@256bit.org>
parents:
32294
diff
changeset
|
42 if (search("^[ \t]*```[ ]*{r", "bncW") > search("^[ \t]*```$", "bncW")) || ((search('^---$', 'Wn') || search('^\.\.\.$', 'Wn')) && search('^---$', 'bnW')) |
033f22d4a52a
runtime(rmd) Update ftplugin and syntax files (#13193)
Christian Brabandt <cb@256bit.org>
parents:
32294
diff
changeset
|
43 set commentstring=#\ %s |
033f22d4a52a
runtime(rmd) Update ftplugin and syntax files (#13193)
Christian Brabandt <cb@256bit.org>
parents:
32294
diff
changeset
|
44 else |
033f22d4a52a
runtime(rmd) Update ftplugin and syntax files (#13193)
Christian Brabandt <cb@256bit.org>
parents:
32294
diff
changeset
|
45 set commentstring=<!--\ %s\ --> |
033f22d4a52a
runtime(rmd) Update ftplugin and syntax files (#13193)
Christian Brabandt <cb@256bit.org>
parents:
32294
diff
changeset
|
46 endif |
32061 | 47 endfunction |
48 | |
49 " If you do not want both 'comments' and 'commentstring' dynamically defined, | |
50 " put in your vimrc: let g:rmd_dynamic_comments = 0 | |
14637 | 51 if !exists("g:rmd_dynamic_comments") || (exists("g:rmd_dynamic_comments") && g:rmd_dynamic_comments == 1) |
52 setlocal formatexpr=FormatRmd() | |
32061 | 53 augroup RmdCStr |
54 autocmd! | |
55 autocmd CursorMoved <buffer> call SetRmdCommentStr() | |
56 augroup END | |
14637 | 57 endif |
58 | |
6051 | 59 " Enables pandoc if it is installed |
60 unlet! b:did_ftplugin | |
61 runtime ftplugin/pandoc.vim | |
62 | |
63 " Don't load another plugin for this buffer | |
64 let b:did_ftplugin = 1 | |
65 | |
24520 | 66 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") |
32061 | 67 let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" . |
6051 | 68 \ "All Files (*.*)\t*.*\n" |
69 endif | |
70 | |
71 if exists('b:undo_ftplugin') | |
72 let b:undo_ftplugin .= " | setl cms< com< fo< flp< isk< | unlet! b:browsefilter" | |
73 else | |
74 let b:undo_ftplugin = "setl cms< com< fo< flp< isk< | unlet! b:browsefilter" | |
75 endif | |
76 | |
77 let &cpo = s:cpo_save | |
78 unlet s:cpo_save | |
79 | |
80 " vim: sw=2 |