From e3298c63208ff86cfc7f9d3441f120d2edcc4e56 Mon Sep 17 00:00:00 2001 From: Tim Allen Date: Thu, 3 Sep 2020 15:06:24 +1000 Subject: [PATCH] Address code-review comments - some wording changes in included documentation - find supports multiple starting paths, we don't need to launch it 3 times - Change the regex that trims the file extension to only trim the last extension Some additional things I noticed: - find should use -L to see through symlinks like the autoload processing does. - find should check the user's autoload directory first, so users can override Kakoune's built-in documentation. --- rc/tools/doc.asciidoc | 4 ++-- rc/tools/doc.kak | 33 ++++++++++++++++++--------------- rc/tools/lint.asciidoc | 13 ++++++------- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/rc/tools/doc.asciidoc b/rc/tools/doc.asciidoc index ff1fbae9..14ea2920 100644 --- a/rc/tools/doc.asciidoc +++ b/rc/tools/doc.asciidoc @@ -10,6 +10,6 @@ == Options *docsclient* (str):: - If set, the `:doc` command (and other commands that display documentation) - will try to display documentation in the Kakoune client with this name. + If set, the `:doc` command will try to display documentation in the Kakoune + client with this name. See <> diff --git a/rc/tools/doc.kak b/rc/tools/doc.kak index b68f9363..d88dcda2 100644 --- a/rc/tools/doc.kak +++ b/rc/tools/doc.kak @@ -137,18 +137,20 @@ define-command -params 1 -hidden doc-render %{ define-command -params 1..2 \ -shell-script-candidates %{ if [ "$kak_token_to_complete" -eq 0 ]; then - ( - find "${kak_runtime}/doc/" -type f -name "*.asciidoc" - find "${kak_runtime}/rc/" -type f -name "*.asciidoc" - find "${kak_config}/autoload/" -type f -name "*.asciidoc" - ) | sed 's,.*/,,; s/\.[^/]*$//' + find -L \ + "${kak_config}/autoload/" \ + "${kak_runtime}/doc/" \ + "${kak_runtime}/rc/" \ + -type f -name "*.asciidoc" | + sed 's,.*/,,; s/\.[^.]*$//' elif [ "$kak_token_to_complete" -eq 1 ]; then page=$( - ( - find "${kak_runtime}/doc/" -type f -name "$1.asciidoc" - find "${kak_runtime}/rc/" -type f -name "$1.asciidoc" - find "${kak_config}/autoload/" -type f -name "$1.asciidoc" - ) | head -1 + find -L \ + "${kak_config}/autoload/" \ + "${kak_runtime}/doc/" \ + "${kak_runtime}/rc/" \ + -type f -name "$1.asciidoc" | + head -1 ) if [ -f "${page}" ]; then awk ' @@ -164,11 +166,12 @@ define-command -params 1..2 \ } %{ evaluate-commands %sh{ page=$( - ( - find "${kak_runtime}/doc/" -type f -name "$1.asciidoc" - find "${kak_runtime}/rc/" -type f -name "$1.asciidoc" - find "${kak_config}/autoload/" -type f -name "$1.asciidoc" - ) | head -1 + find -L \ + "${kak_config}/autoload/" \ + "${kak_runtime}/doc/" \ + "${kak_runtime}/rc/" \ + -type f -name "$1.asciidoc" | + head -1 ) if [ -f "${page}" ]; then jump_cmd="" diff --git a/rc/tools/lint.asciidoc b/rc/tools/lint.asciidoc index 3590eb7e..da7213bf 100644 --- a/rc/tools/lint.asciidoc +++ b/rc/tools/lint.asciidoc @@ -1,8 +1,8 @@ = Integrate with tools that check files for problems. Many file-formats have "lint" tools that check for common problems and point out -where they occur. Most of these tools produce output in the the traditional -message format: +where they occur. Most of these tools produce output in the traditional message +format: ---- {filename}:{line}:{column}: {kind}: {message} @@ -15,7 +15,7 @@ This plugin can run such tools and collect the resulting messages. The complete output is collected in the `*lint-output*` buffer, and any lines in the current file with messages will have a marker displayed next to them in the left margin. When the cursor moves onto a line with the problem, the associated messages will -be displayed in a tool tip.. +be displayed in a tool tip. == Commands @@ -46,12 +46,11 @@ be displayed in a tool tip.. The shell command used by lint-buffer and lint-selections. + It will be given the path to a file containing the text to be - linted, and must produce output in the format: + linted, and must produce output in the format described above. *toolsclient* (str):: - If set, the `:lint` command (and other commands that point out files and - line-numbers) will try to display its results in the Kakoune client with - this name. + If set, the `:lint` command will try to display its results in the Kakoune + client with this name. See <>