diff options
author | Bart Schaefer <schaefer@zsh.org> | 2013-10-13 10:59:52 -0700 |
---|---|---|
committer | Bart Schaefer <schaefer@zsh.org> | 2013-10-13 10:59:52 -0700 |
commit | 332924513bade9bae205bd8ffd5d0e3f8e8e1d62 (patch) | |
tree | da57173ab6013d0f85e9760447c18a34c3633f93 /Src | |
parent | 5faab39a7e87d180e52bb6ebb9bf101f176cc40b (diff) | |
parent | d5ba3ed24579bb12df958c09224367e16e70bad2 (diff) | |
download | zsh-332924513bade9bae205bd8ffd5d0e3f8e8e1d62.tar.gz zsh-332924513bade9bae205bd8ffd5d0e3f8e8e1d62.tar.xz zsh-332924513bade9bae205bd8ffd5d0e3f8e8e1d62.zip |
Merge branch 'master' of git://git.code.sf.net/p/zsh/code
Diffstat (limited to 'Src')
-rw-r--r-- | Src/Modules/parameter.c | 40 | ||||
-rw-r--r-- | Src/Modules/parameter.mdd | 2 | ||||
-rw-r--r-- | Src/hist.c | 17 | ||||
-rw-r--r-- | Src/pattern.c | 3 |
4 files changed, 58 insertions, 4 deletions
diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c index a029c9cb4..22148f991 100644 --- a/Src/Modules/parameter.c +++ b/Src/Modules/parameter.c @@ -759,6 +759,38 @@ disreswordsgetfn(UNUSED(Param pm)) return getreswords(DISABLED); } +/* Functions for the patchars special parameter. */ + +/**/ +static char ** +getpatchars(int dis) +{ + int i; + char **ret, **p; + + p = ret = (char **) zhalloc(ZPC_COUNT * sizeof(char *)); + + for (i = 0; i < ZPC_COUNT; i++) + if (zpc_strings[i] && !dis == !zpc_disables[i]) + *p++ = dupstring(zpc_strings[i]); + + *p = NULL; + + return ret; +} + +static char ** +patcharsgetfn(UNUSED(Param pm)) +{ + return getpatchars(0); +} + +static char ** +dispatcharsgetfn(UNUSED(Param pm)) +{ + return getpatchars(1); +} + /* Functions for the options special parameter. */ /**/ @@ -2018,6 +2050,10 @@ static const struct gsu_array reswords_gsu = { reswordsgetfn, arrsetfn, stdunsetfn }; static const struct gsu_array disreswords_gsu = { disreswordsgetfn, arrsetfn, stdunsetfn }; +static const struct gsu_array patchars_gsu = +{ patcharsgetfn, arrsetfn, stdunsetfn }; +static const struct gsu_array dispatchars_gsu = +{ dispatcharsgetfn, arrsetfn, stdunsetfn }; static const struct gsu_array dirs_gsu = { dirsgetfn, dirssetfn, stdunsetfn }; static const struct gsu_array historywords_gsu = @@ -2038,6 +2074,8 @@ static struct paramdef partab[] = { &pmdisfunctions_gsu, getpmdisfunction, scanpmdisfunctions), SPECIALPMDEF("dis_galiases", 0, &pmdisgaliases_gsu, getpmdisgalias, scanpmdisgaliases), + SPECIALPMDEF("dis_patchars", PM_ARRAY|PM_READONLY, + &dispatchars_gsu, NULL, NULL), SPECIALPMDEF("dis_reswords", PM_ARRAY|PM_READONLY, &disreswords_gsu, NULL, NULL), SPECIALPMDEF("dis_saliases", 0, @@ -2072,6 +2110,8 @@ static struct paramdef partab[] = { &pmoptions_gsu, getpmoption, scanpmoptions), SPECIALPMDEF("parameters", PM_READONLY, NULL, getpmparameter, scanpmparameters), + SPECIALPMDEF("patchars", PM_ARRAY|PM_READONLY, + &patchars_gsu, NULL, NULL), SPECIALPMDEF("reswords", PM_ARRAY|PM_READONLY, &reswords_gsu, NULL, NULL), SPECIALPMDEF("saliases", 0, diff --git a/Src/Modules/parameter.mdd b/Src/Modules/parameter.mdd index eb48d5f2a..a91a5dc09 100644 --- a/Src/Modules/parameter.mdd +++ b/Src/Modules/parameter.mdd @@ -2,6 +2,6 @@ name=zsh/parameter link=either load=yes -autofeatures="p:parameters p:commands p:functions p:dis_functions p:funcfiletrace p:funcsourcetrace p:funcstack p:functrace p:builtins p:dis_builtins p:reswords p:dis_reswords p:options p:modules p:dirstack p:history p:historywords p:jobtexts p:jobdirs p:jobstates p:nameddirs p:userdirs p:aliases p:dis_aliases p:galiases p:dis_galiases p:saliases p:dis_saliases" +autofeatures="p:parameters p:commands p:functions p:dis_functions p:funcfiletrace p:funcsourcetrace p:funcstack p:functrace p:builtins p:dis_builtins p:reswords p:dis_reswords p:patchars p:dis_patchars p:options p:modules p:dirstack p:history p:historywords p:jobtexts p:jobdirs p:jobstates p:nameddirs p:userdirs p:aliases p:dis_aliases p:galiases p:dis_galiases p:saliases p:dis_saliases" objects="parameter.o" diff --git a/Src/hist.c b/Src/hist.c index bd650e81e..ed9560952 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -937,12 +937,21 @@ hbegin(int dohist) /* * For INCAPPENDHISTORY, when interactive, save the history here * as it gives a better estimate of the times of commands. + * * If SHAREHISTORY is also set continue to do so in the * standard place, because that's safer about reading and * rewriting history atomically. + * + * The histsave_stack_pos test won't usually fail here. + * We need to test the opposite for the hend() case because we + * need to save in the history file we've switched to, but then + * we pop immediately after that so the variable becomes zero. + * We will already have saved the line and restored the history + * so that (correctly) nothing happens here. But it shows + * I thought about it. */ if (isset(INCAPPENDHISTORY) && !isset(SHAREHISTORY) && - !(histactive & HA_NOINC) && !strin) + !(histactive & HA_NOINC) && !strin && histsave_stack_pos == 0) savehistfile(hf, 0, HFILE_USE_OPTIONS | HFILE_FAST); } @@ -1348,7 +1357,11 @@ hend(Eprog prog) chline = hptr = NULL; chwords = NULL; histactive = 0; - if (isset(SHAREHISTORY) && histfileIsLocked()) + /* + * For normal INCAPPENDHISTORY case and reasoning, see hbegin(). + */ + if (isset(SHAREHISTORY) ? histfileIsLocked() : + (isset(INCAPPENDHISTORY) && histsave_stack_pos != 0)) savehistfile(hf, 0, HFILE_USE_OPTIONS | HFILE_FAST); unlockhistfile(hf); /* It's OK to call this even if we aren't locked */ /* diff --git a/Src/pattern.c b/Src/pattern.c index 4f0166bfa..609a9e372 100644 --- a/Src/pattern.c +++ b/Src/pattern.c @@ -236,7 +236,8 @@ static const char zpc_chars[ZPC_COUNT] = { * Corresponding strings used in enable/disable -p. * NULL means no way of turning this on or off. */ -static const char *zpc_strings[ZPC_COUNT] = { +/**/ +const char *zpc_strings[ZPC_COUNT] = { NULL, NULL, "|", NULL, "~", "(", "?", "*", "[", "<", "^", "#", NULL, "?(", "*(", "+(", "!(", "@(" }; |