runtime(pandoc): Update compiler plugin to use actual 'spelllang'

Commit: 
https://github.com/vim/vim/commit/d30ffdca495d116da359aaea806ad0da7b4b6c75
Author: Christian Brabandt <c...@256bit.org>
Date:   Mon Sep 9 20:26:28 2024 +0200

    runtime(pandoc): Update compiler plugin to use actual 'spelllang'
    
    Previously these would be cached in buffer-local variables and
    would not change on :compiler pandoc
    
    closes: #15642
    
    Signed-off-by: Konfekt <konf...@users.noreply.github.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/.github/MAINTAINERS b/.github/MAINTAINERS
index ed3143bb3..02efe9301 100644
--- a/.github/MAINTAINERS
+++ b/.github/MAINTAINERS
@@ -76,6 +76,7 @@ runtime/compiler/jshint.vim           @dkearns
 runtime/compiler/jsonlint.vim          @dkearns
 runtime/compiler/jq.vim                 @vito-c
 runtime/compiler/lazbuild.vim          @dkearns
+runtime/compiler/pandoc.vim            @Konfekt
 runtime/compiler/perl.vim              @petdance @heptite
 runtime/compiler/perlcritic.vim                @petdance @dkearns
 runtime/compiler/php.vim               @dkearns
diff --git a/runtime/compiler/pandoc.vim b/runtime/compiler/pandoc.vim
index ecc935a83..6c15e104c 100644
--- a/runtime/compiler/pandoc.vim
+++ b/runtime/compiler/pandoc.vim
@@ -1,10 +1,12 @@
 " Vim compiler file
 " Compiler:     Pandoc
 " Maintainer:   Konfekt
-" Last Change: 2024 Aug 20
+" Last Change: 2024 Sep 8
 "
 " Expects output file extension, say `:make html` or `:make pdf`.
 " Passes additional arguments to pandoc, say `:make html --self-contained`.
+" Adjust command-line flags by buffer-local/global variable
+" b/g:pandoc_compiler_args which defaults to empty.
 
 if exists("current_compiler")
   finish
@@ -40,18 +42,21 @@ silent! function s:PandocFiletype(filetype) abort
   endif
 endfunction
 
-let b:pandoc_compiler_from = get(b:, 'pandoc_compiler_from', 
s:PandocFiletype(&filetype))
-let b:pandoc_compiler_lang = get(b:, 'pandoc_compiler_lang', &spell ? 
matchstr(&spelllang, '^  ') : '')
+silent! function s:PandocLang()
+  let lang = get(b:, 'pandoc_compiler_lang',
+      \ &spell ? matchstr(&spelllang, '^  ') : '')
+  if lang ==# 'en' | let lang = '' | endif
+  return empty(lang) ? '' : '--metadata lang='..lang
+endfunction
 
 execute 'CompilerSet makeprg=pandoc'..escape(
-      \ ' --standalone' .
-      \ (b:pandoc_compiler_from ==# 'markdown' && (getline(1) =~# '^%\s\+\S\+' 
|| (search('^title:\s+\S+', 'cnw') > 0)) ?
-      \ '' : ' --metadata title=%:t:r:S') .
-      \ (empty(b:pandoc_compiler_lang) ?
-      \ '' : ' --metadata lang='..b:pandoc_compiler_lang) .
-      \ ' --from='..b:pandoc_compiler_from .
-      \ ' '..get(b:, 'pandoc_compiler_args', get(g:, 'pandoc_compiler_args', 
'')) .
-      \ ' --output %:r:S.$* -- %:S', ' ')
+    \ ' --standalone'..
+    \ (s:PandocFiletype(&filetype) ==# 'markdown' && (getline(1) =~# 
'^%\s\+\S\+' || (search('^title:\s+\S+', 'cnw') > 0)) ?
+    \ '' : ' --metadata title=%:t:r:S')..
+    \ ' '..s:PandocLang()..
+    \ ' --from='..s:PandocFiletype(&filetype)..
+    \ ' '..get(b:, 'pandoc_compiler_args', get(g:, 'pandoc_compiler_args', 
''))..
+    \ ' --output %:r:S.$* -- %:S', ' ')
 CompilerSet errorformat=\"%f\",\ line\ %l:\ %m
 
 let &cpo = s:keepcpo
diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt
index e7045c535..6942a584b 100644
--- a/runtime/doc/quickfix.txt
+++ b/runtime/doc/quickfix.txt
@@ -1359,8 +1359,7 @@ Additional arguments can be passed to pandoc:
 
 The `--from` argument is an educated guess using the buffer file type;
 it can be overridden by setting `b:pandoc_compiler_from`.
-Likewise the `--metadata lang` argument is set using `&spelllang`;
-it can be overridden by setting `b:pandoc_compiler_lang`.
+The `--metadata lang` argument is set using 'spelllang';
 If `--from=markdown` is assumed and no title set in a title header or
 YAML block, then the filename (without extension) is used as the title.
 

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1snjNm-005QOA-OM%40256bit.org.

Raspunde prin e-mail lui