Patch 7.4.833

71 views
Skip to first unread message

Bram Moolenaar

unread,
Aug 25, 2015, 9:40:36 AM8/25/15
to vim...@googlegroups.com

Patch 7.4.833
Problem: More side effects of ":set all&" are missing. (Björn Linse)
Solution: Call didset_options() and add didset_options2() to collect more
side effects to take care of. Still not everything...
Files: src/option.c


*** ../vim-7.4.832/src/option.c 2015-08-25 12:56:22.618312165 +0200
--- src/option.c 2015-08-25 15:29:31.402326593 +0200
***************
*** 3079,3084 ****
--- 3079,3085 ----
#endif
static char_u *option_expand __ARGS((int opt_idx, char_u *val));
static void didset_options __ARGS((void));
+ static void didset_options2 __ARGS((void));
static void check_string_option __ARGS((char_u **pp));
#if defined(FEAT_EVAL) || defined(PROTO)
static long_u *insecure_flag __ARGS((int opt_idx, int opt_flags));
***************
*** 3096,3101 ****
--- 3097,3103 ----
static char_u *check_clipboard_option __ARGS((void));
#endif
#ifdef FEAT_SPELL
+ static char_u *did_set_spell_option __ARGS((int is_spellfile));
static char_u *compile_cap_prog __ARGS((synblock_T *synblock));
#endif
#ifdef FEAT_EVAL
***************
*** 3376,3392 ****
didset_options();

#ifdef FEAT_SPELL
! /* Use the current chartab for the generic chartab. */
init_spell_chartab();
#endif

- #ifdef FEAT_LINEBREAK
- /*
- * initialize the table for 'breakat'.
- */
- fill_breakat_flags();
- #endif
-
/*
* Expand environment variables and things like "~" for the defaults.
* If option_expand() returns non-NULL the variable is expanded. This can
--- 3378,3388 ----
didset_options();

#ifdef FEAT_SPELL
! /* Use the current chartab for the generic chartab. This is not in
! * didset_options() because it only depends on 'encoding'. */
init_spell_chartab();
#endif

/*
* Expand environment variables and things like "~" for the defaults.
* If option_expand() returns non-NULL the variable is expanded. This can
***************
*** 3418,3431 ****
}
}

- /* Initialize the highlight_attr[] table. */
- highlight_changed();
-
save_file_ff(curbuf); /* Buffer is unchanged */

- /* Parse default for 'wildmode' */
- check_opt_wim();
-
#if defined(FEAT_ARABIC)
/* Detect use of mlterm.
* Mlterm is a terminal emulator akin to xterm that has some special
--- 3414,3421 ----
***************
*** 3437,3451 ****
set_option_value((char_u *)"tbidi", 1L, NULL, 0);
#endif

! #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
! /* Parse default for 'fillchars'. */
! (void)set_chars_option(&p_fcs);
! #endif
!
! #ifdef FEAT_CLIPBOARD
! /* Parse default for 'clipboard' */
! (void)check_clipboard_option();
! #endif

#ifdef FEAT_MBYTE
# if defined(WIN3264) && defined(FEAT_GETTEXT)
--- 3427,3433 ----
set_option_value((char_u *)"tbidi", 1L, NULL, 0);
#endif

! didset_options2();

#ifdef FEAT_MBYTE
# if defined(WIN3264) && defined(FEAT_GETTEXT)
***************
*** 3670,3676 ****

for (i = 0; !istermoption(&options[i]); i++)
if (!(options[i].flags & P_NODEFAULT)
! && (opt_flags == 0 || options[i].var != (char_u *)&p_enc))
set_option_default(i, opt_flags, p_cp);

#ifdef FEAT_WINDOWS
--- 3652,3661 ----

for (i = 0; !istermoption(&options[i]); i++)
if (!(options[i].flags & P_NODEFAULT)
! && (opt_flags == 0
! || (options[i].var != (char_u *)&p_enc
! && options[i].var != (char_u *)&p_cm
! && options[i].var != (char_u *)&p_key)))
set_option_default(i, opt_flags, p_cp);

#ifdef FEAT_WINDOWS
***************
*** 4206,4211 ****
--- 4191,4198 ----
++arg;
/* Only for :set command set global value of local options. */
set_options_default(OPT_FREE | opt_flags);
+ didset_options();
+ didset_options2();
redraw_all_later(CLEAR);
}
else
***************
*** 5348,5353 ****
--- 5335,5341 ----
(void)spell_check_msm();
(void)spell_check_sps();
(void)compile_cap_prog(curwin->w_s);
+ (void)did_set_spell_option(TRUE);
#endif
#if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
(void)opt_strings_flags(p_toolbar, p_toolbar_values, &toolbar_flags, TRUE);
***************
*** 5362,5367 ****
--- 5350,5384 ----
#ifdef FEAT_LINEBREAK
briopt_check(curwin);
#endif
+ #ifdef FEAT_LINEBREAK
+ /* initialize the table for 'breakat'. */
+ fill_breakat_flags();
+ #endif
+
+ }
+
+ /*
+ * More side effects of setting options.
+ */
+ static void
+ didset_options2()
+ {
+ /* Initialize the highlight_attr[] table. */
+ (void)highlight_changed();
+
+ /* Parse default for 'wildmode' */
+ check_opt_wim();
+
+ (void)set_chars_option(&p_lcs);
+ #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
+ /* Parse default for 'fillchars'. */
+ (void)set_chars_option(&p_fcs);
+ #endif
+
+ #ifdef FEAT_CLIPBOARD
+ /* Parse default for 'clipboard' */
+ (void)check_clipboard_option();
+ #endif
}

/*
***************
*** 6794,6821 ****
else if (varp == &(curwin->w_s->b_p_spl)
|| varp == &(curwin->w_s->b_p_spf))
{
! win_T *wp;
! int l;
!
! if (varp == &(curwin->w_s->b_p_spf))
! {
! l = (int)STRLEN(curwin->w_s->b_p_spf);
! if (l > 0 && (l < 4 || STRCMP(curwin->w_s->b_p_spf + l - 4,
! ".add") != 0))
! errmsg = e_invarg;
! }
!
! if (errmsg == NULL)
! {
! FOR_ALL_WINDOWS(wp)
! if (wp->w_buffer == curbuf && wp->w_p_spell)
! {
! errmsg = did_set_spelllang(wp);
! # ifdef FEAT_WINDOWS
! break;
! # endif
! }
! }
}
/* When 'spellcapcheck' is set compile the regexp program. */
else if (varp == &(curwin->w_s->b_p_spc))
--- 6811,6817 ----
else if (varp == &(curwin->w_s->b_p_spl)
|| varp == &(curwin->w_s->b_p_spf))
{
! errmsg = did_set_spell_option(varp == &(curwin->w_s->b_p_spf));
}
/* When 'spellcapcheck' is set compile the regexp program. */
else if (varp == &(curwin->w_s->b_p_spc))
***************
*** 7687,7692 ****
--- 7683,7718 ----
#endif

#ifdef FEAT_SPELL
+ static char_u *
+ did_set_spell_option(is_spellfile)
+ int is_spellfile;
+ {
+ char_u *errmsg = NULL;
+ win_T *wp;
+ int l;
+
+ if (is_spellfile)
+ {
+ l = (int)STRLEN(curwin->w_s->b_p_spf);
+ if (l > 0 && (l < 4
+ || STRCMP(curwin->w_s->b_p_spf + l - 4, ".add") != 0))
+ errmsg = e_invarg;
+ }
+
+ if (errmsg == NULL)
+ {
+ FOR_ALL_WINDOWS(wp)
+ if (wp->w_buffer == curbuf && wp->w_p_spell)
+ {
+ errmsg = did_set_spelllang(wp);
+ # ifdef FEAT_WINDOWS
+ break;
+ # endif
+ }
+ }
+ return errmsg;
+ }
+
/*
* Set curbuf->b_cap_prog to the regexp program for 'spellcapcheck'.
* Return error message when failed, NULL when OK.
***************
*** 11741,11746 ****
--- 11767,11773 ----
if (!(options[opt_idx].flags & (P_WAS_SET|P_VI_DEF)))
set_option_default(opt_idx, OPT_FREE, FALSE);
didset_options();
+ didset_options2();
}

if (fname != NULL)
***************
*** 11829,11834 ****
--- 11856,11862 ----
|| (!(options[opt_idx].flags & P_VI_DEF) && !p_cp))
set_option_default(opt_idx, OPT_FREE, p_cp);
didset_options();
+ didset_options2();
}

#ifdef FEAT_LINEBREAK
*** ../vim-7.4.832/src/version.c 2015-08-25 14:21:14.013470670 +0200
--- src/version.c 2015-08-25 14:47:04.281087542 +0200
***************
*** 743,744 ****
--- 743,746 ----
{ /* Add new patch number below this line */
+ /**/
+ 833,
/**/

--
You can be stopped by the police for biking over 65 miles per hour.
You are not allowed to walk across a street on your hands.
[real standing laws in Connecticut, United States of America]

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

John Marriott

unread,
Aug 25, 2015, 2:39:47 PM8/25/15
to vim...@googlegroups.com


On 25-Aug-2015 11:40 PM, Bram Moolenaar wrote:
>
> Patch 7.4.833
> Problem: More side effects of ":set all&" are missing. (Björn Linse)
> Solution: Call didset_options() and add didset_options2() to
collect more
> side effects to take care of. Still not everything...
> Files: src/option.c
>
>
This patch fails to compile on Win64 (both gui and not) with FEAT_CRYPT
undefined, like so:
gcc -c -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603
-DHAVE_PATHDEF -DFEAT_BIG -DFEAT_GUI_W32 -DFEAT_CLIPBOARD -
DFEAT_MBYTE -pipe -w -march=native -Wall -O3 -fomit-frame-pointer
-freg-struct-return -s gui_w32.c -o gobjnative/gui_w32
.o
option.c: In function 'set_options_default':
option.c:3657:36: error: 'p_cm' undeclared (first use in this function)
&& options[i].var != (char_u *)&p_cm
^
option.c:3657:36: note: each undeclared identifier is reported only once
for each function it appears in
option.c:3658:36: error: 'p_key' undeclared (first use in this function)
&& options[i].var != (char_u *)&p_key)))
^
Make_cyg_ming.mak:781: recipe for target 'gobjnative/option.o' failed
make: *** [gobjnative/option.o] Error 1
make: *** Waiting for unfinished jobs....

Bram Moolenaar

unread,
Aug 25, 2015, 3:27:54 PM8/25/15
to John Marriott, vim...@googlegroups.com
Sorry, I'll add an #ifdef

--
Kisses may last for as much as, but no more than, five minutes.
[real standing law in Iowa, United States of America]

John Marriott

unread,
Aug 26, 2015, 2:43:35 PM8/26/15
to vim...@googlegroups.com
On 26-Aug-2015 5:27 AM, Bram Moolenaar wrote:
> John Marriott wrote:
>
>> On 25-Aug-2015 11:40 PM, Bram Moolenaar wrote:
>> >
>> > Patch 7.4.833
>> > Problem: More side effects of ":set all&" are missing. (Björn Linse)
>> > Solution: Call didset_options() and add didset_options2() to collect more
>> > side effects to take care of. Still not everything...
>> > Files: src/option.c
>> >
>> >
>> This patch fails to compile on Win64 (both gui and not) with FEAT_CRYPT
>> undefined, like so:
>> gcc -c -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603
>> -DHAVE_PATHDEF -DFEAT_BIG -DFEAT_GUI_W32 -DFEAT_CLIPBOARD -
>> DFEAT_MBYTE -pipe -w -march=native -Wall -O3 -fomit-frame-pointer
>> -freg-struct-return -s gui_w32.c -o gobjnative/gui_w32
>> .o
>> option.c: In function 'set_options_default':
>> option.c:3657:36: error: 'p_cm' undeclared (first use in this function)
>> && options[i].var != (char_u *)&p_cm
>> ^
>> option.c:3657:36: note: each undeclared identifier is reported only once
>> for each function it appears in
>> option.c:3658:36: error: 'p_key' undeclared (first use in this function)
>> && options[i].var != (char_u *)&p_key)))
>> ^
>> Make_cyg_ming.mak:781: recipe for target 'gobjnative/option.o' failed
>> make: *** [gobjnative/option.o] Error 1
>> make: *** Waiting for unfinished jobs....
> Sorry, I'll add an #ifdef
>
Hey Bram,

After 7.4.838, I can compile without crypt. Thanks.

But after 7.4.830, 7.4.833 and 7.4.838, the compile fails if FEAT_MBYTE
is undefined, like so (non-gui under HP-UX):
Starting make in the src directory.
If there are problems, cd to the src directory and run make there
cd src && make first
cc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -o objects/buffer.o buffer.c
cc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -o objects/eval.o eval.c
cc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -o objects/ex_cmds.o ex_cmds.c
cc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -o objects/ex_cmds2.o ex_cmds2.c
cc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -o objects/hardcopy.o hardcopy.c
cc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -o objects/if_xcmdsrv.o
if_xcmdsrv.c
cc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -o objects/misc1.o misc1.c
cc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -o objects/misc2.o misc2.c
cc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -o objects/option.o option.c
cc: "option.c", line 3656: error 1588: "p_enc" undefined.
cc: "option.c", line 3656: error 1527: Incompatible types in cast: Must
cast from scalar to scalar or to void type.
*** Error exit code 1

Stop.
*** Error exit code 1

Stop.

Bram Moolenaar

unread,
Aug 26, 2015, 5:24:38 PM8/26/15
to John Marriott, vim...@googlegroups.com
Ah yes, p_enc is also an optional feature. I'll make a patch.

--
A parent can be arrested if his child cannot hold back a burp during a church
service.
[real standing law in Nebraska, United States of America]
Reply all
Reply to author
Forward
0 new messages