runtime(doc): clarify syntax vs matching mechanism

Commit: 
https://github.com/vim/vim/commit/fe1e2b5e2d65f05d820f17db935b15454a63be06
Author: Christian Brabandt <c...@256bit.org>
Date:   Fri Apr 26 18:42:59 2024 +0200

    runtime(doc): clarify syntax vs matching mechanism
    
    fixes: https://github.com/vim/vim/issues/14643
    
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index a426124a0..79f3cd7c6 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -9980,6 +9980,10 @@ synconcealed({lnum}, {col})                              
*synconcealed()*
                        synconcealed(lnum, 5)   [1, 'X', 2]
                        synconcealed(lnum, 6)   [0, '', 0]
 
+               Note: Doesn't consider |matchadd()| highlighting items,
+               since syntax and matching highlighting are two different
+               mechanisms |syntax-vs-match|.
+
 
 synstack({lnum}, {col})                                        *synstack()*
                Return a |List|, which is the stack of syntax items at the
diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt
index 2d1898de5..c23462c81 100644
--- a/runtime/doc/pattern.txt
+++ b/runtime/doc/pattern.txt
@@ -1,4 +1,4 @@
-*pattern.txt*   For Vim version 9.1.  Last change: 2023 Oct 23
+*pattern.txt*   For Vim version 9.1.  Last change: 2024 Apr 26
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1394,6 +1394,19 @@ Finally, these constructs are unique to Perl:
 ==============================================================================
 10. Highlighting matches                               *match-highlight*
 
+                                                       *syntax-vs-match*
+               Note that the match highlight mechanism is independent
+               of |syntax-highlighting|, which is (usually) a buffer-local
+               highlighting, while matching is window-local, both methods
+               can be freely mixed.  Match highlighting functions give you
+               a bit more flexibility in when and how to apply, but are
+               typically only used for temporary highlighting, without strict
+               rules.  Both methods can be used to conceal text.
+
+               Thus the matching functions like |matchadd()| won't consider
+               syntax rules and functions like |synconcealend()| and the
+               other way around.
+
                                                        *:mat* *:match*
 :mat[ch] {group} /{pattern}/
                Define a pattern to highlight in the current window.  It will
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index 7269e7d20..873315c82 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -1,4 +1,4 @@
-*syntax.txt*   For Vim version 9.1.  Last change: 2024 Apr 22
+*syntax.txt*   For Vim version 9.1.  Last change: 2024 Apr 26
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -4314,7 +4314,9 @@ Whether or not it is actually concealed depends on the 
value of the
 'conceallevel' option.  The 'concealcursor' option is used to decide whether
 concealable items in the current line are displayed unconcealed to be able to
 edit the line.
-Another way to conceal text is with |matchadd()|.
+
+Another way to conceal text is with |matchadd()|, but internally this works a
+bit differently |syntax-vs-match|.
 
 concealends                                            *:syn-concealends*
 
@@ -4322,7 +4324,9 @@ When the "concealends" argument is given, the start and 
end matches of
 the region, but not the contents of the region, are marked as concealable.
 Whether or not they are actually concealed depends on the setting on the
 'conceallevel' option. The ends of a region can only be concealed separately
-in this way when they have their own highlighting via "matchgroup"
+in this way when they have their own highlighting via "matchgroup".  The
+|synconcealed()| function can be used to retrieve information about conealed
+items.
 
 cchar                                                  *:syn-cchar*
                                                        *E844*
diff --git a/runtime/doc/tags b/runtime/doc/tags
index 6ad902259..dcd8db7e2 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -10186,6 +10186,7 @@ syntax-latex    syntax.txt      /*syntax-latex*
 syntax-loading syntax.txt      /*syntax-loading*
 syntax-printing        usr_06.txt      /*syntax-printing*
 syntax-tex     syntax.txt      /*syntax-tex*
+syntax-vs-match        pattern.txt     /*syntax-vs-match*
 syntax.txt     syntax.txt      /*syntax.txt*
 syntax_cmd     syntax.txt      /*syntax_cmd*
 sys-file-list  help.txt        /*sys-file-list*
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index 04a9afb1b..8e719481a 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -1,4 +1,4 @@
-*usr_41.txt*   For Vim version 9.1.  Last change: 2024 Feb 25
+*usr_41.txt*   For Vim version 9.1.  Last change: 2024 Apr 26
 
                     VIM USER MANUAL - by Bram Moolenaar
 
@@ -1096,7 +1096,7 @@ Syntax and highlighting:    *syntax-functions* 
*highlighting-functions*
        synIDattr()             get a specific attribute of a syntax ID
        synIDtrans()            get translated syntax ID
        synstack()              get list of syntax IDs at a specific position
-       synconcealed()          get info about concealing
+       synconcealed()          get info about (synax) concealing
        diff_hlID()             get highlight ID for diff mode at a position
        matchadd()              define a pattern to highlight (a "match")
        matchaddpos()           define a list of positions to highlight

-- 
-- 
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/E1s0Oh7-00GQhv-CX%40256bit.org.

Reply via email to