]>
Commit | Line | Data |
---|---|---|
0a7814d6 AG |
1 | To: vim-dev@vim.org |
2 | Subject: patch 7.1.099 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.1.099 | |
11 | Problem: When the 'keymap' and 'paste' options have a non-default value, | |
12 | ":mkexrc" and ":mksession" do not correctly set the options. | |
13 | Solution: Set the options with side effects before other options. | |
14 | Files: src/option.c | |
15 | ||
16 | ||
17 | *** ../vim-7.1.098/src/option.c Thu Sep 6 13:32:53 2007 | |
18 | --- src/option.c Wed Sep 5 22:34:27 2007 | |
19 | *************** | |
20 | *** 427,432 **** | |
21 | --- 427,434 ---- | |
22 | #define P_NOGLOB 0x100000L/* do not use local value for global vimrc */ | |
23 | #define P_NFNAME 0x200000L/* only normal file name chars allowed */ | |
24 | #define P_INSECURE 0x400000L/* option was set from a modeline */ | |
25 | + #define P_PRI_MKRC 0x800000L/* priority for :mkvimrc (setting option has | |
26 | + side effects) */ | |
27 | ||
28 | #define ISK_LATIN1 (char_u *)"@,48-57,_,192-255" | |
29 | ||
30 | *************** | |
31 | *** 773,778 **** | |
32 | --- 775,782 ---- | |
33 | {(char_u *)0L, (char_u *)0L} | |
34 | #endif | |
35 | }, | |
36 | + /* P_PRI_MKRC isn't needed here, optval_default() | |
37 | + * always returns TRUE for 'compatible' */ | |
38 | {"compatible", "cp", P_BOOL|P_RALL, | |
39 | (char_u *)&p_cp, PV_NONE, | |
40 | {(char_u *)TRUE, (char_u *)FALSE}}, | |
41 | *************** | |
42 | *** 1515,1521 **** | |
43 | {(char_u *)0L, (char_u *)0L} | |
44 | #endif | |
45 | }, | |
46 | ! {"keymap", "kmp", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF|P_RSTAT|P_NFNAME, | |
47 | #ifdef FEAT_KEYMAP | |
48 | (char_u *)&p_keymap, PV_KMAP, | |
49 | {(char_u *)"", (char_u *)0L} | |
50 | --- 1519,1525 ---- | |
51 | {(char_u *)0L, (char_u *)0L} | |
52 | #endif | |
53 | }, | |
54 | ! {"keymap", "kmp", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF|P_RSTAT|P_NFNAME|P_PRI_MKRC, | |
55 | #ifdef FEAT_KEYMAP | |
56 | (char_u *)&p_keymap, PV_KMAP, | |
57 | {(char_u *)"", (char_u *)0L} | |
58 | *************** | |
59 | *** 1836,1842 **** | |
60 | {"paragraphs", "para", P_STRING|P_VI_DEF, | |
61 | (char_u *)&p_para, PV_NONE, | |
62 | {(char_u *)"IPLPPPQPP LIpplpipbp", (char_u *)0L}}, | |
63 | ! {"paste", NULL, P_BOOL|P_VI_DEF, | |
64 | (char_u *)&p_paste, PV_NONE, | |
65 | {(char_u *)FALSE, (char_u *)0L}}, | |
66 | {"pastetoggle", "pt", P_STRING|P_VI_DEF, | |
67 | --- 1840,1846 ---- | |
68 | {"paragraphs", "para", P_STRING|P_VI_DEF, | |
69 | (char_u *)&p_para, PV_NONE, | |
70 | {(char_u *)"IPLPPPQPP LIpplpipbp", (char_u *)0L}}, | |
71 | ! {"paste", NULL, P_BOOL|P_VI_DEF|P_PRI_MKRC, | |
72 | (char_u *)&p_paste, PV_NONE, | |
73 | {(char_u *)FALSE, (char_u *)0L}}, | |
74 | {"pastetoggle", "pt", P_STRING|P_VI_DEF, | |
75 | *************** | |
76 | *** 8535,8547 **** | |
77 | char_u *varp_local = NULL; /* fresh value */ | |
78 | char *cmd; | |
79 | int round; | |
80 | ||
81 | /* | |
82 | * The options that don't have a default (terminal name, columns, lines) | |
83 | * are never written. Terminal options are also not written. | |
84 | */ | |
85 | ! for (p = &options[0]; !istermoption(p); p++) | |
86 | ! if (!(p->flags & P_NO_MKRC) && !istermoption(p)) | |
87 | { | |
88 | /* skip global option when only doing locals */ | |
89 | if (p->indir == PV_NONE && !(opt_flags & OPT_GLOBAL)) | |
90 | --- 8539,8558 ---- | |
91 | char_u *varp_local = NULL; /* fresh value */ | |
92 | char *cmd; | |
93 | int round; | |
94 | + int pri; | |
95 | ||
96 | /* | |
97 | * The options that don't have a default (terminal name, columns, lines) | |
98 | * are never written. Terminal options are also not written. | |
99 | + * Do the loop over "options[]" twice: once for options with the | |
100 | + * P_PRI_MKRC flag and once without. | |
101 | */ | |
102 | ! for (pri = 1; pri >= 0; --pri) | |
103 | ! { | |
104 | ! for (p = &options[0]; !istermoption(p); p++) | |
105 | ! if (!(p->flags & P_NO_MKRC) | |
106 | ! && !istermoption(p) | |
107 | ! && ((pri == 1) == ((p->flags & P_PRI_MKRC) != 0))) | |
108 | { | |
109 | /* skip global option when only doing locals */ | |
110 | if (p->indir == PV_NONE && !(opt_flags & OPT_GLOBAL)) | |
111 | *************** | |
112 | *** 8637,8642 **** | |
113 | --- 8648,8654 ---- | |
114 | } | |
115 | } | |
116 | } | |
117 | + } | |
118 | return OK; | |
119 | } | |
120 | ||
121 | *** ../vim-7.1.098/src/version.c Thu Sep 6 14:25:50 2007 | |
122 | --- src/version.c Thu Sep 6 16:32:31 2007 | |
123 | *************** | |
124 | *** 668,669 **** | |
125 | --- 668,671 ---- | |
126 | { /* Add new patch number below this line */ | |
127 | + /**/ | |
128 | + 99, | |
129 | /**/ | |
130 | ||
131 | -- | |
132 | Not too long ago, a keyboard was something to make music with... | |
133 | ||
134 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
135 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
136 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
137 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |