Mercurial > vim
comparison src/ex_cmds2.c @ 13553:04019fc3de93 v8.0.1650
patch 8.0.1650: too many #ifdefs
commit https://github.com/vim/vim/commit/0c72fe4ed8430db41f43c5878e6ee60265dc49e9
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Mar 29 16:04:08 2018 +0200
patch 8.0.1650: too many #ifdefs
Problem: Too many #ifdefs.
Solution: Graduate FEAT_LISTCMDS, no reason to leave out buffer commands.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 29 Mar 2018 16:15:07 +0200 |
parents | 1fd0f8392946 |
children | 5ef1e6170589 |
comparison
equal
deleted
inserted
replaced
13552:5417164ac275 | 13553:04019fc3de93 |
---|---|
2438 | 2438 |
2439 static char_u *do_one_arg(char_u *str); | 2439 static char_u *do_one_arg(char_u *str); |
2440 static int do_arglist(char_u *str, int what, int after); | 2440 static int do_arglist(char_u *str, int what, int after); |
2441 static void alist_check_arg_idx(void); | 2441 static void alist_check_arg_idx(void); |
2442 static int editing_arg_idx(win_T *win); | 2442 static int editing_arg_idx(win_T *win); |
2443 #ifdef FEAT_LISTCMDS | |
2444 static int alist_add_list(int count, char_u **files, int after); | 2443 static int alist_add_list(int count, char_u **files, int after); |
2445 #endif | |
2446 #define AL_SET 1 | 2444 #define AL_SET 1 |
2447 #define AL_ADD 2 | 2445 #define AL_ADD 2 |
2448 #define AL_DEL 3 | 2446 #define AL_DEL 3 |
2449 | 2447 |
2450 /* | 2448 /* |
2565 { | 2563 { |
2566 garray_T new_ga; | 2564 garray_T new_ga; |
2567 int exp_count; | 2565 int exp_count; |
2568 char_u **exp_files; | 2566 char_u **exp_files; |
2569 int i; | 2567 int i; |
2570 #ifdef FEAT_LISTCMDS | |
2571 char_u *p; | 2568 char_u *p; |
2572 int match; | 2569 int match; |
2573 #endif | |
2574 int arg_escaped = TRUE; | 2570 int arg_escaped = TRUE; |
2575 | 2571 |
2576 /* | 2572 /* |
2577 * Set default argument for ":argadd" command. | 2573 * Set default argument for ":argadd" command. |
2578 */ | 2574 */ |
2588 * Collect all file name arguments in "new_ga". | 2584 * Collect all file name arguments in "new_ga". |
2589 */ | 2585 */ |
2590 if (get_arglist(&new_ga, str, arg_escaped) == FAIL) | 2586 if (get_arglist(&new_ga, str, arg_escaped) == FAIL) |
2591 return FAIL; | 2587 return FAIL; |
2592 | 2588 |
2593 #ifdef FEAT_LISTCMDS | |
2594 if (what == AL_DEL) | 2589 if (what == AL_DEL) |
2595 { | 2590 { |
2596 regmatch_T regmatch; | 2591 regmatch_T regmatch; |
2597 int didone; | 2592 int didone; |
2598 | 2593 |
2635 EMSG2(_(e_nomatch2), ((char_u **)new_ga.ga_data)[i]); | 2630 EMSG2(_(e_nomatch2), ((char_u **)new_ga.ga_data)[i]); |
2636 } | 2631 } |
2637 ga_clear(&new_ga); | 2632 ga_clear(&new_ga); |
2638 } | 2633 } |
2639 else | 2634 else |
2640 #endif | |
2641 { | 2635 { |
2642 i = expand_wildcards(new_ga.ga_len, (char_u **)new_ga.ga_data, | 2636 i = expand_wildcards(new_ga.ga_len, (char_u **)new_ga.ga_data, |
2643 &exp_count, &exp_files, EW_DIR|EW_FILE|EW_ADDSLASH|EW_NOTFOUND); | 2637 &exp_count, &exp_files, EW_DIR|EW_FILE|EW_ADDSLASH|EW_NOTFOUND); |
2644 ga_clear(&new_ga); | 2638 ga_clear(&new_ga); |
2645 if (i == FAIL || exp_count == 0) | 2639 if (i == FAIL || exp_count == 0) |
2646 { | 2640 { |
2647 EMSG(_(e_nomatch)); | 2641 EMSG(_(e_nomatch)); |
2648 return FAIL; | 2642 return FAIL; |
2649 } | 2643 } |
2650 | 2644 |
2651 #ifdef FEAT_LISTCMDS | |
2652 if (what == AL_ADD) | 2645 if (what == AL_ADD) |
2653 { | 2646 { |
2654 (void)alist_add_list(exp_count, exp_files, after); | 2647 (void)alist_add_list(exp_count, exp_files, after); |
2655 vim_free(exp_files); | 2648 vim_free(exp_files); |
2656 } | 2649 } |
2657 else /* what == AL_SET */ | 2650 else /* what == AL_SET */ |
2658 #endif | |
2659 alist_set(ALIST(curwin), exp_count, exp_files, FALSE, NULL, 0); | 2651 alist_set(ALIST(curwin), exp_count, exp_files, FALSE, NULL, 0); |
2660 } | 2652 } |
2661 | 2653 |
2662 alist_check_arg_idx(); | 2654 alist_check_arg_idx(); |
2663 | 2655 |
2735 { | 2727 { |
2736 int i; | 2728 int i; |
2737 | 2729 |
2738 if (eap->cmdidx != CMD_args) | 2730 if (eap->cmdidx != CMD_args) |
2739 { | 2731 { |
2740 #if defined(FEAT_LISTCMDS) | |
2741 alist_unlink(ALIST(curwin)); | 2732 alist_unlink(ALIST(curwin)); |
2742 if (eap->cmdidx == CMD_argglobal) | 2733 if (eap->cmdidx == CMD_argglobal) |
2743 ALIST(curwin) = &global_alist; | 2734 ALIST(curwin) = &global_alist; |
2744 else /* eap->cmdidx == CMD_arglocal */ | 2735 else /* eap->cmdidx == CMD_arglocal */ |
2745 alist_new(); | 2736 alist_new(); |
2746 #else | |
2747 ex_ni(eap); | |
2748 return; | |
2749 #endif | |
2750 } | 2737 } |
2751 | 2738 |
2752 if (!ends_excmd(*eap->arg)) | 2739 if (!ends_excmd(*eap->arg)) |
2753 { | 2740 { |
2754 /* | 2741 /* |
2755 * ":args file ..": define new argument list, handle like ":next" | 2742 * ":args file ..": define new argument list, handle like ":next" |
2756 * Also for ":argslocal file .." and ":argsglobal file ..". | 2743 * Also for ":argslocal file .." and ":argsglobal file ..". |
2757 */ | 2744 */ |
2758 ex_next(eap); | 2745 ex_next(eap); |
2759 } | 2746 } |
2760 else | 2747 else if (eap->cmdidx == CMD_args) |
2761 #if defined(FEAT_LISTCMDS) | |
2762 if (eap->cmdidx == CMD_args) | |
2763 #endif | |
2764 { | 2748 { |
2765 /* | 2749 /* |
2766 * ":args": list arguments. | 2750 * ":args": list arguments. |
2767 */ | 2751 */ |
2768 if (ARGCOUNT > 0) | 2752 if (ARGCOUNT > 0) |
2779 msg_putchar(']'); | 2763 msg_putchar(']'); |
2780 msg_putchar(' '); | 2764 msg_putchar(' '); |
2781 } | 2765 } |
2782 } | 2766 } |
2783 } | 2767 } |
2784 #if defined(FEAT_LISTCMDS) | |
2785 else if (eap->cmdidx == CMD_arglocal) | 2768 else if (eap->cmdidx == CMD_arglocal) |
2786 { | 2769 { |
2787 garray_T *gap = &curwin->w_alist->al_ga; | 2770 garray_T *gap = &curwin->w_alist->al_ga; |
2788 | 2771 |
2789 /* | 2772 /* |
2798 AARGLIST(curwin->w_alist)[gap->ga_len].ae_fnum = | 2781 AARGLIST(curwin->w_alist)[gap->ga_len].ae_fnum = |
2799 GARGLIST[i].ae_fnum; | 2782 GARGLIST[i].ae_fnum; |
2800 ++gap->ga_len; | 2783 ++gap->ga_len; |
2801 } | 2784 } |
2802 } | 2785 } |
2803 #endif | |
2804 } | 2786 } |
2805 | 2787 |
2806 /* | 2788 /* |
2807 * ":previous", ":sprevious", ":Next" and ":sNext". | 2789 * ":previous", ":sprevious", ":Next" and ":sNext". |
2808 */ | 2790 */ |
2949 i = curwin->w_arg_idx + (int)eap->line2; | 2931 i = curwin->w_arg_idx + (int)eap->line2; |
2950 do_argfile(eap, i); | 2932 do_argfile(eap, i); |
2951 } | 2933 } |
2952 } | 2934 } |
2953 | 2935 |
2954 #if defined(FEAT_LISTCMDS) || defined(PROTO) | |
2955 /* | 2936 /* |
2956 * ":argedit" | 2937 * ":argedit" |
2957 */ | 2938 */ |
2958 void | 2939 void |
2959 ex_argedit(exarg_T *eap) | 2940 ex_argedit(exarg_T *eap) |
3310 for (i = 0; i < count; ++i) | 3291 for (i = 0; i < count; ++i) |
3311 vim_free(files[i]); | 3292 vim_free(files[i]); |
3312 return -1; | 3293 return -1; |
3313 } | 3294 } |
3314 | 3295 |
3315 #endif /* FEAT_LISTCMDS */ | |
3316 | |
3317 #if defined(FEAT_CMDL_COMPL) || defined(PROTO) | 3296 #if defined(FEAT_CMDL_COMPL) || defined(PROTO) |
3318 /* | 3297 /* |
3319 * Function given to ExpandGeneric() to obtain the possible arguments of the | 3298 * Function given to ExpandGeneric() to obtain the possible arguments of the |
3320 * argedit and argdelete commands. | 3299 * argedit and argdelete commands. |
3321 */ | 3300 */ |
3326 return NULL; | 3305 return NULL; |
3327 | 3306 |
3328 return alist_name(&ARGLIST[idx]); | 3307 return alist_name(&ARGLIST[idx]); |
3329 } | 3308 } |
3330 #endif | 3309 #endif |
3310 | |
3331 | 3311 |
3332 #ifdef FEAT_EVAL | 3312 #ifdef FEAT_EVAL |
3333 /* | 3313 /* |
3334 * ":compiler[!] {name}" | 3314 * ":compiler[!] {name}" |
3335 */ | 3315 */ |
5192 && ((struct source_cookie *)getline_cookie( | 5172 && ((struct source_cookie *)getline_cookie( |
5193 fgetline, cookie))->finished); | 5173 fgetline, cookie))->finished); |
5194 } | 5174 } |
5195 #endif | 5175 #endif |
5196 | 5176 |
5197 #if defined(FEAT_LISTCMDS) || defined(PROTO) | |
5198 /* | 5177 /* |
5199 * ":checktime [buffer]" | 5178 * ":checktime [buffer]" |
5200 */ | 5179 */ |
5201 void | 5180 void |
5202 ex_checktime(exarg_T *eap) | 5181 ex_checktime(exarg_T *eap) |
5213 if (buf != NULL) /* cannot happen? */ | 5192 if (buf != NULL) /* cannot happen? */ |
5214 (void)buf_check_timestamp(buf, FALSE); | 5193 (void)buf_check_timestamp(buf, FALSE); |
5215 } | 5194 } |
5216 no_check_timestamps = save_no_check_timestamps; | 5195 no_check_timestamps = save_no_check_timestamps; |
5217 } | 5196 } |
5218 #endif | |
5219 | 5197 |
5220 #if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \ | 5198 #if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \ |
5221 && (defined(FEAT_EVAL) || defined(FEAT_MULTI_LANG)) | 5199 && (defined(FEAT_EVAL) || defined(FEAT_MULTI_LANG)) |
5222 # define HAVE_GET_LOCALE_VAL | 5200 # define HAVE_GET_LOCALE_VAL |
5223 static char_u *get_locale_val(int what); | 5201 static char_u *get_locale_val(int what); |