zsh-workers
 help / color / mirror / Atom feed
* [PATCH 0/2] _pandoc:  avoid use of cache, etc.
@ 2021-04-25 15:05 Jun. T
  2021-05-27 22:05 ` Oliver Kiddle
  0 siblings, 1 reply; 4+ messages in thread
From: Jun. T @ 2021-04-25 15:05 UTC (permalink / raw)
  To: zsh-workers

I've found _pandoc has _many_ problems.

(1/2) is the main part of the patch.
(2/2) is just a collection of simple fixes and updates.

I'm quite new to pandoc.
Feedbacks from experienced pandoc users are welcome.

PS
I'm not sure the 'fold markers' {{{ }}} for vim editor
need be kept or not.

-- 
Jun


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] _pandoc: avoid use of cache, etc.
  2021-04-25 15:05 [PATCH 0/2] _pandoc: avoid use of cache, etc Jun. T
@ 2021-05-27 22:05 ` Oliver Kiddle
  2021-05-27 22:37   ` Daniel Shahaf
  0 siblings, 1 reply; 4+ messages in thread
From: Oliver Kiddle @ 2021-05-27 22:05 UTC (permalink / raw)
  To: Jun. T; +Cc: zsh-workers

On 26 Apr, "Jun. T" wrote:
> I'm not sure the 'fold markers' {{{ }}} for vim editor
> need be kept or not.

I don't think so - they are editor specific and we only have them in a
couple of files rather than them being consistently applied across many.
Various editors, including vim, can parse a file to place folds where
they make sense syntactically. And I don't think we should have editor
specific markers for options either. That's what .editorconfig is for.

This patch removes vim markers in _pandoc and a couple of other
completion functions. They can also be found in files below Functions
but I've not touched those.

I'm open to other views if someone thinks this stuff would be useful.

Oliver

diff --git a/Completion/Unix/Command/_bpython b/Completion/Unix/Command/_bpython
index 233e032e6..2c2ea11b8 100644
--- a/Completion/Unix/Command/_bpython
+++ b/Completion/Unix/Command/_bpython
@@ -41,6 +41,3 @@ case "$service" in
       "$gtk_opts[@]"
   ;;
 esac
-
-
-# vim:autoindent expandtab shiftwidth=2 tabstop=2 softtabstop=2 filetype=zsh
diff --git a/Completion/Unix/Command/_cdrdao b/Completion/Unix/Command/_cdrdao
index ceb86267c..b634a2a28 100644
--- a/Completion/Unix/Command/_cdrdao
+++ b/Completion/Unix/Command/_cdrdao
@@ -2,7 +2,7 @@
 
 # TODO: Options must come before parameters.
 
-# Command completion and main loop {{{1
+# Command completion and main loop
 
 _cdrdao () {
   local ret=1
@@ -23,7 +23,7 @@ _cdrdao () {
   return ret
 }
 
-# Common arguments {{{1
+# Common arguments
 
 declare -ga _cdrdao_tmpfile_args
 _cdrdao_tmpfile_args=(
@@ -89,7 +89,7 @@ _cdrdao_common_read_args=(
   '--tao-source[indicate that source CD was written in TAO mode]'
   '--with-cddb[retrieve CD-TEXT data from a CDDB server]')
 
-# Sub-command completion {{{1
+# Sub-command completion
 
 _cdrdao-show-toc () {
   __cdrdao-show-toc-or-toc-info-or-toc-size
@@ -257,7 +257,7 @@ _cdrdao-copy () {
     $_cdrdao_paranoiamode_arg
 }
 
-# Type completion {{{1
+# Type completion
 
 __cdrdao-device () {
   # Use cdrdao scanbus and also check what OS we're running under and provide
@@ -280,6 +280,4 @@ __cdrdao-drivers () {
   fi
 }
 
-# }}}1
-
 _cdrdao
diff --git a/Completion/Unix/Command/_pandoc b/Completion/Unix/Command/_pandoc
index 2ff481e32..bdd261322 100644
--- a/Completion/Unix/Command/_pandoc
+++ b/Completion/Unix/Command/_pandoc
@@ -1,6 +1,6 @@
 #compdef pandoc
 
-# {{{ input or output formats with optional extensions
+# input or output formats with optional extensions
 # required option: -T (input|output)
 (( $+functions[_pandoc_format] )) ||
 _pandoc_format() {
@@ -16,8 +16,8 @@ _pandoc_format() {
     _wanted formats expl 'format' compadd -S '+' -r '-+ ' -a formats
   fi
 }
-# }}}
-# {{{ all supported formats
+
+# all supported formats
 (( $+functions[_pandoc_all_formats] )) ||
 _pandoc_all_formats(){
   local -a expl
@@ -25,16 +25,16 @@ _pandoc_all_formats(){
   formats=( $(pandoc --list-input-formats) $(pandoc --list-output-formats) )
   _wanted formats expl 'format' compadd -a formats
 }
-# }}}
-# {{{ pdf engine choice
+
+# pdf engine choice
 (( $+functions[_pandoc_pdf_engine] )) ||
 _pandoc_pdf_engine(){
   _alternative \
     'engines:engine:(pdflatex lualatex xelatex latexmk tectonic wkhtmltopdf weasyprint prince context pdfroff)' \
     'engine-executables:engine executable:_files -g "*(#q*)"'
 }
-# }}}
-# {{{ options to pass to --pdf-engine command
+
+# options to pass to --pdf-engine command
 (( $+functions[_pandoc_pdf_engine_opts] )) ||
 _pandoc_pdf_engine_opts(){
   local pdf_engine=${opt_args[--pdf-engine]}
@@ -47,8 +47,8 @@ _pandoc_pdf_engine_opts(){
       ;;
   esac
 }
-# }}}
-# {{{ data-dir specified by --data-dir option, or the default dir
+
+# data-dir specified by --data-dir option, or the default dir
 _pandoc_default_dir() {
   if (( $+opt_args[--data-dir] )); then
     echo ${opt_args[--data-dir]:a}
@@ -59,7 +59,8 @@ _pandoc_default_dir() {
     pandoc --version | sed -ne 's/.*[Uu]ser data directory: \([^ ]*\).*/\1/p'
   fi
 }
-# {{{ template file in $PWD or data-dir/templates/, or URL
+
+# template file in $PWD or data-dir/templates/, or URL
 (( $+functions[_pandoc_template] )) ||
 _pandoc_template(){
   # find output format from '-t format' or '-o xxx.format'
@@ -73,16 +74,16 @@ _pandoc_template(){
     "data-dir-templates:template in data-dir:_files -W $template_dir -g $pat" \
     'urls: :_urls'
 }
-# }}}
-# {{{ choose highlight-style
+
+# choose highlight-style
 (( $+functions[_pandoc_highlight_style] )) ||
 _pandoc_highlight_style(){
   _alternative \
     'styles:style:( $(pandoc --list-highlight-styles) )' \
     'style-files:style file:_files -g "*.theme"'
 }
-# }}}
-# {{{ filter file in $PWD, data-dir/filters/ or $PATH
+
+# filter file in $PWD, data-dir/filters/ or $PATH
 (( $+functions[_pandoc_filter] )) ||
 _pandoc_filter(){
   local filters_dir=$(_pandoc_default_dir)/filters
@@ -91,8 +92,8 @@ _pandoc_filter(){
     'data-dir-filters:filter in data-dir:_files -W filters_dir' \
     'commands: : _command_names -e'
 }
-# }}}
-# {{{ lua filter in $PWD or data-dir/filters/
+
+# lua filter in $PWD or data-dir/filters/
 (( $+functions[_pandoc_lua_filter] )) ||
 _pandoc_lua_filter(){
   local filters_dir=$(_pandoc_default_dir)/filters
@@ -100,8 +101,8 @@ _pandoc_lua_filter(){
     'local-filters:local filter:_files -g "*.lua"' \
     'data-dir-filters:filter in data-dir:_files -W filters_dir -g "*.lua"'
 }
-# }}}
-# {{{ default file in $PWD or data-dir/defaults/
+
+# default file in $PWD or data-dir/defaults/
 (( $+functions[_pandoc_defaults_file] )) ||
 _pandoc_defaults_file() {
   local defaults_dir=$(_pandoc_default_dir)/defaults
@@ -109,8 +110,8 @@ _pandoc_defaults_file() {
     'local-defaults:default file:_files -g "*.yaml"' \
     'data-dir-defaults:default in data-dir:_files -W defaults_dir -g "*.yaml"'
 }
-# }}}
-# {{{ choose reference location
+
+# choose reference location
 (( $+functions[_pandoc_reference_location] )) ||
 _pandoc_reference_location(){
   local -a policies
@@ -121,14 +122,14 @@ _pandoc_reference_location(){
   )
   _describe 'location' policies
 }
-# }}}
-# {{{ choose top level division
+
+# choose top level division
 (( $+functions[_pandoc_top_level_division] )) ||
 _pandoc_top_level_division(){
   _values 'top level division' default section chapter part
 }
-# }}}
-# {{{ choose email obfusication
+
+# choose email obfusication
 (( $+functions[_pandoc_email_obfusication] )) ||
 _pandoc_email_obfusication(){
   local -a policies
@@ -139,8 +140,8 @@ _pandoc_email_obfusication(){
   )
   _describe 'obfusication' policies
 }
-# }}}
-# {{{ choose wrapping policy
+
+# choose wrapping policy
 (( $+functions[_pandoc_wrap] )) ||
 _pandoc_wrap() {
   local -a policies
@@ -151,8 +152,8 @@ _pandoc_wrap() {
   )
   _describe 'policy' policies
 }
-# }}}
-# {{{ choose eol policy
+
+# choose eol policy
 (( $+functions[_pandoc_eol] )) ||
 _pandoc_eol() {
   local -a policies
@@ -163,8 +164,8 @@ _pandoc_eol() {
   )
   _describe 'policy' policies
 }
-# }}}
-# {{{ choose changes tracking policy
+
+# choose changes tracking policy
 (( $+functions[_pandoc_track_changes] )) ||
 _pandoc_track_changes() {
   local -a policies
@@ -175,7 +176,6 @@ _pandoc_track_changes() {
   )
   _describe 'policy' policies
 }
-# }}}
 
 # The real thing
 _arguments -s \


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] _pandoc: avoid use of cache, etc.
  2021-05-27 22:05 ` Oliver Kiddle
@ 2021-05-27 22:37   ` Daniel Shahaf
  2021-05-27 23:12     ` Oliver Kiddle
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Shahaf @ 2021-05-27 22:37 UTC (permalink / raw)
  To: zsh-workers

Oliver Kiddle wrote on Thu, 27 May 2021 22:05 +00:00:
> I don't think so - they are editor specific and we only have them in a
> couple of files rather than them being consistently applied across many.
> Various editors, including vim, can parse a file to place folds where
> they make sense syntactically. And I don't think we should have editor
> specific markers for options either. That's what .editorconfig is for.
> 
> This patch removes vim markers in _pandoc and a couple of other
> completion functions. They can also be found in files below Functions

Where?  I don't see any {{{,}}} fold markers under Functions/.

> but I've not touched those.
> 
> I'm open to other views if someone thinks this stuff would be useful.

The diff hunks for _bpython and _pandoc look good, but I don't agree
with removing the fold markers from _cdrdao.  The fold markers in that
file can't be inferred from machine parsing, or even from naïve human
parsing; they were placed by a human familiar with the file.  Please
keep them.

If we do keep fold markers, then of course users of other editors are
welcome to add equivalent markings for their editors.  I don't think
that will grow unwieldy (and if it does, we can deal with it then).

If the fold markers interfere with "Jump to the matching curly brace"
functionality in editors that don't ignore matches in comments, the fold
markers could be changed to something other than curly braces.

Cheers,

Daniel

> +++ b/Completion/Unix/Command/_cdrdao
> @@ -2,7 +2,7 @@
>  
>  # TODO: Options must come before parameters.
>  
> -# Command completion and main loop {{{1
> +# Command completion and main loop
>  
>  _cdrdao () {
>    local ret=1
> @@ -23,7 +23,7 @@ _cdrdao () {
>    return ret
>  }
>  
> -# Common arguments {{{1
> +# Common arguments
^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] _pandoc: avoid use of cache, etc.
  2021-05-27 22:37   ` Daniel Shahaf
@ 2021-05-27 23:12     ` Oliver Kiddle
  0 siblings, 0 replies; 4+ messages in thread
From: Oliver Kiddle @ 2021-05-27 23:12 UTC (permalink / raw)
  To: Daniel Shahaf; +Cc: zsh-workers

"Daniel Shahaf" wrote:
> Oliver Kiddle wrote on Thu, 27 May 2021 22:05 +00:00:
> > And I don't think we should have editor
> > specific markers for options either. That's what .editorconfig is for.
> > 
> > This patch removes vim markers in _pandoc and a couple of other
> > completion functions. They can also be found in files below Functions
>
> Where?  I don't see any {{{,}}} fold markers under Functions/.

In that case, they are vim markers for options. E.g Misc/ztodo contains
    # vim: set ft=zsh et sw=2 sts=2:

Oliver


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-27 23:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-25 15:05 [PATCH 0/2] _pandoc: avoid use of cache, etc Jun. T
2021-05-27 22:05 ` Oliver Kiddle
2021-05-27 22:37   ` Daniel Shahaf
2021-05-27 23:12     ` Oliver Kiddle

zsh-workers

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/zsh-workers

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 zsh-workers zsh-workers/ http://inbox.vuxu.org/zsh-workers \
		zsh-workers@zsh.org
	public-inbox-index zsh-workers

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


code repositories for the project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git