]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1924: 'commentstring' requires +folding feature v9.1.1924
authorDoug Kearns <dougkearns@gmail.com>
Thu, 20 Nov 2025 21:16:48 +0000 (21:16 +0000)
committerChristian Brabandt <cb@256bit.org>
Thu, 20 Nov 2025 21:16:48 +0000 (21:16 +0000)
Problem:  'commentstring' requires the +folding feature but is used in
  contexts other than folding.
Solution: Remove the +folding feature guards from 'commentstring' and
          make it available in all builds (Doug Kearns).

closes: #18731

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/doc/options.txt
runtime/doc/version9.txt
runtime/optwin.vim
src/buffer.c
src/errors.h
src/option.c
src/option.h
src/optiondefs.h
src/optionstr.c
src/structs.h
src/version.c

index e6bb6413e7e595e054a2e3ef0b472b6ae4510add..9b2169e332cd0b4e18a815678ee83f8d6b7f8af4 100644 (file)
@@ -1,4 +1,4 @@
-*options.txt*  For Vim version 9.1.  Last change: 2025 Nov 09
+*options.txt*  For Vim version 9.1.  Last change: 2025 Nov 20
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1991,8 +1991,6 @@ A jump table for the options with a short description can be found at |Q_op|.
                                        *'commentstring'* *'cms'* *E537*
 'commentstring' 'cms'  string  (default "/* %s */")
                        local to buffer
-                       {not available when compiled without the |+folding|
-                       feature}
        A template for a comment.  The "%s" in the value is replaced with the
        comment text, and should be padded with a space when possible.
        Currently used to add markers for folding, see |fold-marker|.  Also
index b8216dfb680a0c5e616efa7b63bd4f8d527ade77..78e6e3a211e363056229a03b0dd2d08031d2ad5b 100644 (file)
@@ -1,4 +1,4 @@
-*version9.txt* For Vim version 9.1.  Last change: 2025 Nov 09
+*version9.txt* For Vim version 9.1.  Last change: 2025 Nov 20
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -41692,6 +41692,8 @@ Completion: ~
 - 'smartcase' applies to completion filtering
 
 Options: ~
+- 'commentstring' is now available in all builds and no longer requires the
+  |+folding| feature
 - the default for 'commentstring' contains whitespace padding to have
   automatic comments look nicer |comment-install|
 - 'completeopt' is now a |global-local| option.
index 972c774713b2567788aded2da907550bc91cacee..1b982edca82d36c4223068a3af1d90724db9d279 100644 (file)
@@ -1,7 +1,7 @@
 " These commands create the option window.
 "
 " Maintainer:  The Vim Project <https://github.com/vim/vim>
-" Last Change: 2025 Oct 07
+" Last Change: 2025 Nov 20
 " Former Maintainer:   Bram Moolenaar <Bram@vim.org>
 
 " If there already is an option window, jump to that one.
@@ -860,6 +860,8 @@ call append("$", " \tset bs=" . &bs)
 call <SID>AddOption("comments", gettext("definition of what comment lines look like"))
 call append("$", "\t" .. s:local_to_buffer)
 call <SID>OptionL("com")
+call <SID>AddOption("commentstring", gettext("template for comments; used to put the marker in"))
+call <SID>OptionL("cms")
 call <SID>AddOption("formatoptions", gettext("list of flags that tell how automatic formatting works"))
 call append("$", "\t" .. s:local_to_buffer)
 call <SID>OptionL("fo")
@@ -1039,8 +1041,6 @@ if has("folding")
   call <SID>AddOption("foldminlines", gettext("minimum number of screen lines for a fold to be closed"))
   call append("$", "\t" .. s:local_to_window)
   call <SID>OptionL("fml")
-  call <SID>AddOption("commentstring", gettext("template for comments; used to put the marker in"))
-  call <SID>OptionL("cms")
   call <SID>AddOption("foldmethod", gettext("folding type: \"manual\", \"indent\", \"expr\", \"marker\",\n\"syntax\" or \"diff\""))
   call append("$", "\t" .. s:local_to_window)
   call <SID>OptionL("fdm")
index 6e4990abdfc7561d671e39326e351fa6a127721d..94c6356f889fb45154280096c9f21b99b724d384 100644 (file)
@@ -2476,9 +2476,7 @@ free_buf_options(
     ga_clear(&buf->b_kmap_ga);
 #endif
     clear_string_option(&buf->b_p_com);
-#ifdef FEAT_FOLDING
     clear_string_option(&buf->b_p_cms);
-#endif
     clear_string_option(&buf->b_p_nf);
 #ifdef FEAT_SYN_HL
     clear_string_option(&buf->b_p_syn);
index 0b66402f7b94ea03e4aff29a5489cf6fb39375f5..0f5441a4ae4ad3cf2bebf1d0e3a07428d175d12b 100644 (file)
@@ -1364,9 +1364,9 @@ EXTERN char e_illegal_character_after_chr[]
 #ifdef FEAT_FOLDING
 EXTERN char e_comma_required[]
        INIT(= N_("E536: Comma required"));
+#endif
 EXTERN char e_commentstring_must_be_empty_or_contain_str[]
        INIT(= N_("E537: 'commentstring' must be empty or contain %s"));
-#endif
 EXTERN char e_pattern_found_in_every_line_str[]
        INIT(= N_("E538: Pattern found in every line: %s"));
 EXTERN char e_illegal_character_str[]
index dafd8341e9c1974a12c07cab8678ffacfd4b701a..88b0769c71d52e29e857a47f3f7ef594f9a110c6 100644 (file)
@@ -6866,9 +6866,7 @@ get_varp(struct vimoption *p)
        case PV_CINSD:  return (char_u *)&(curbuf->b_p_cinsd);
        case PV_CINW:   return (char_u *)&(curbuf->b_p_cinw);
        case PV_COM:    return (char_u *)&(curbuf->b_p_com);
-#ifdef FEAT_FOLDING
        case PV_CMS:    return (char_u *)&(curbuf->b_p_cms);
-#endif
        case PV_CPT:    return (char_u *)&(curbuf->b_p_cpt);
 #ifdef BACKSLASH_IN_FILENAME
        case PV_CSL:    return (char_u *)&(curbuf->b_p_csl);
@@ -7457,10 +7455,8 @@ buf_copy_options(buf_T *buf, int flags)
            COPY_OPT_SCTX(buf, BV_SN);
            buf->b_p_com = vim_strsave(p_com);
            COPY_OPT_SCTX(buf, BV_COM);
-#ifdef FEAT_FOLDING
            buf->b_p_cms = vim_strsave(p_cms);
            COPY_OPT_SCTX(buf, BV_CMS);
-#endif
            buf->b_p_fo = vim_strsave(p_fo);
            COPY_OPT_SCTX(buf, BV_FO);
            buf->b_p_flp = vim_strsave(p_flp);
index ac9dca9e2a375bc113b8084c3a06678e31106e28..dc67566d6d72d9339569e8bbdf211f86aecf72e1 100644 (file)
@@ -510,9 +510,7 @@ EXTERN char_u       *p_cb;          // 'clipboard'
 EXTERN char_u  *p_cpm;         // 'clipmethod'
 #endif
 EXTERN long    p_ch;           // 'cmdheight'
-#ifdef FEAT_FOLDING
 EXTERN char_u  *p_cms;         // 'commentstring'
-#endif
 EXTERN char_u  *p_cpt;         // 'complete'
 EXTERN long    p_cto;          // 'completetimeout'
 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
@@ -1191,9 +1189,7 @@ enum
     , BV_CINSD
     , BV_CINW
     , BV_CM
-#ifdef FEAT_FOLDING
     , BV_CMS
-#endif
     , BV_COM
     , BV_COT
     , BV_CPT
index 7f893d89da481f5e65546488d6793aef3a009ff8..fda69853593eb218d8a2d23271e9ff5157c600de 100644 (file)
@@ -48,9 +48,7 @@
 #define PV_CINSD       OPT_BUF(BV_CINSD)
 #define PV_CINW                OPT_BUF(BV_CINW)
 #define PV_CM          OPT_BOTH(OPT_BUF(BV_CM))
-#ifdef FEAT_FOLDING
-# define PV_CMS                OPT_BUF(BV_CMS)
-#endif
+#define PV_CMS         OPT_BUF(BV_CMS)
 #define PV_COM         OPT_BUF(BV_COM)
 #define PV_COT         OPT_BOTH(OPT_BUF(BV_COT))
 #define PV_CPT         OPT_BUF(BV_CPT)
@@ -671,13 +669,8 @@ static struct vimoption options[] =
                                (char_u *)0L}
                            SCTX_INIT},
     {"commentstring", "cms", P_STRING|P_ALLOCED|P_VI_DEF,
-#ifdef FEAT_FOLDING
                            (char_u *)&p_cms, PV_CMS, did_set_commentstring, NULL,
                            {(char_u *)"/* %s */", (char_u *)0L}
-#else
-                           (char_u *)NULL, PV_NONE, NULL, NULL,
-                           {(char_u *)0L, (char_u *)0L}
-#endif
                            SCTX_INIT},
                            // P_PRI_MKRC isn't needed here, optval_default()
                            // always returns TRUE for 'compatible'
index b4bfe742dfdd6dd84cfb571e4a2ddf051f0ac3ff..8df27ffbdaf74725973659bca1703d6b4c5c820a 100644 (file)
@@ -307,9 +307,7 @@ check_buf_options(buf_T *buf)
     check_string_option(&buf->b_p_flp);
     check_string_option(&buf->b_p_isk);
     check_string_option(&buf->b_p_com);
-#ifdef FEAT_FOLDING
     check_string_option(&buf->b_p_cms);
-#endif
     check_string_option(&buf->b_p_nf);
     check_string_option(&buf->b_p_qe);
 #ifdef FEAT_SYN_HL
@@ -1581,7 +1579,6 @@ did_set_comments(optset_T *args)
     return errmsg;
 }
 
-#if defined(FEAT_FOLDING)
 /*
  * The 'commentstring' option is changed.
  */
@@ -1595,7 +1592,6 @@ did_set_commentstring(optset_T *args)
 
     return NULL;
 }
-#endif
 
 /*
  * Check if value for 'complete' is valid when 'complete' option is changed.
index c64ca825487576fdea4576be4212274c40d830f7..907d4216559d5ebf82997fe7dc3c7f3edcb77bcc 100644 (file)
@@ -3312,9 +3312,7 @@ struct file_buffer
     char_u     *b_p_cinsd;     // 'cinscopedecls'
     char_u     *b_p_cinw;      // 'cinwords'
     char_u     *b_p_com;       // 'comments'
-#ifdef FEAT_FOLDING
     char_u     *b_p_cms;       // 'commentstring'
-#endif
     char_u     *b_p_cot;       // 'completeopt' local value
     unsigned   b_cot_flags;    // flags for 'completeopt'
     char_u     *b_p_cpt;       // 'complete'
index d038dfdaac9434e1123ba1d0945905a13d3a4afa..65e2f58f80de9ca8d213212f000fad3dc3ca69ec 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1924,
 /**/
     1923,
 /**/