From 1b7dcb2f705f5074f2b60d0b2e33d2a4982dfab2 Mon Sep 17 00:00:00 2001 From: Hettomei Date: Fri, 8 May 2015 01:16:12 +0200 Subject: [PATCH 01/12] Macro cleanup: FEAT_GUI and ALWAYS_USE_GUI --- src/nvim/message.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/nvim/message.c b/src/nvim/message.c index 5b4c90cc8f..8263ff4896 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -2234,15 +2234,11 @@ void mch_errmsg(char *str) { int len; -#if (defined(UNIX) || defined(FEAT_GUI)) && !defined(ALWAYS_USE_GUI) +#ifdef UNIX /* On Unix use stderr if it's a tty. * When not going to start the GUI also use stderr. * On Mac, when started from Finder, stderr is the console. */ - if ( -# ifdef UNIX - isatty(2) -# endif - ) { + if (os_isatty(2)) { fprintf(stderr, "%s", str); return; } @@ -2284,16 +2280,12 @@ void mch_errmsg(char *str) */ void mch_msg(char *str) { -#if (defined(UNIX) || defined(FEAT_GUI)) && !defined(ALWAYS_USE_GUI) +#ifdef UNIX /* On Unix use stdout if we have a tty. This allows "vim -h | more" and * uses mch_errmsg() when started from the desktop. * When not going to start the GUI also use stdout. * On Mac, when started from Finder, stderr is the console. */ - if ( -# ifdef UNIX - isatty(2) -# endif - ) { + if (os_isatty(2)) { printf("%s", str); return; } From 031758ad5c2422ddf68bfe747baa922f11418c52 Mon Sep 17 00:00:00 2001 From: Hettomei Date: Fri, 8 May 2015 13:02:05 +0200 Subject: [PATCH 02/12] Macro cleanup: FEAT_GUI_W32 --- src/nvim/eval.c | 1 - src/nvim/menu.c | 6 +++--- src/nvim/vim.h | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/nvim/eval.c b/src/nvim/eval.c index b43ab238cd..40727cf68b 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -9937,7 +9937,6 @@ static void f_has(typval_T *argvars, typval_T *rettv) "arabic", "autocmd", #if defined(FEAT_BROWSE) && (defined(USE_FILE_CHOOSER) \ - || defined(FEAT_GUI_W32) \ || defined(FEAT_GUI_MOTIF)) "browsefilter", #endif diff --git a/src/nvim/menu.c b/src/nvim/menu.c index 06351581ea..4e5d554866 100644 --- a/src/nvim/menu.c +++ b/src/nvim/menu.c @@ -460,7 +460,7 @@ add_menu_path ( menu->silent[i] = menuarg->silent[0]; } } -#if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32) \ +#if defined(FEAT_TOOLBAR) \ && (defined(FEAT_BEVAL) || defined(FEAT_GUI_GTK)) /* Need to update the menu tip. */ if (modes & MENU_TIP_MODE) @@ -613,8 +613,8 @@ remove_menu ( menu->modes |= child->modes; if (modes & MENU_TIP_MODE) { free_menu_string(menu, MENU_INDEX_TIP); -#if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32) \ - && (defined(FEAT_BEVAL) || defined(FEAT_GUI_GTK)) +#if defined(FEAT_TOOLBAR) && \ + (defined(FEAT_BEVAL) || defined(FEAT_GUI_GTK)) /* Need to update the menu tip. */ if (gui.in_use) gui_mch_menu_set_tip(menu); diff --git a/src/nvim/vim.h b/src/nvim/vim.h index c88a8872f3..e9606a7294 100644 --- a/src/nvim/vim.h +++ b/src/nvim/vim.h @@ -338,7 +338,7 @@ enum { * functions of these names. The declarations would break if the defines had * been seen at that stage. But it must be before globals.h, where error_ga * is declared. */ -#if !defined(FEAT_GUI_W32) && !defined(FEAT_GUI_X11) \ +#if !defined(FEAT_GUI_X11) \ && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MAC) # define mch_errmsg(str) fprintf(stderr, "%s", (str)) # define display_errors() fflush(stderr) From 6d937315b6719edc841a399b71c47f329e19124f Mon Sep 17 00:00:00 2001 From: Hettomei Date: Fri, 8 May 2015 13:06:53 +0200 Subject: [PATCH 03/12] Macro cleanup: FEAT_GUI_MOTIF --- src/nvim/eval.c | 3 +-- src/nvim/normal.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 40727cf68b..0a30c90b69 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -9936,8 +9936,7 @@ static void f_has(typval_T *argvars, typval_T *rettv) #endif "arabic", "autocmd", -#if defined(FEAT_BROWSE) && (defined(USE_FILE_CHOOSER) \ - || defined(FEAT_GUI_MOTIF)) +#if defined(FEAT_BROWSE) && defined(USE_FILE_CHOOSER) "browsefilter", #endif "byte_offset", diff --git a/src/nvim/normal.c b/src/nvim/normal.c index b66bc31b74..514fc5c68f 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -2105,8 +2105,7 @@ do_mouse ( * NOTE: Ignore right button down and drag mouse events. * Windows only shows the popup menu on the button up event. */ -#if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) \ - || defined(FEAT_GUI_MAC) +#if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MAC) if (!is_click) return false; #endif From 848a5e2e879cbbec3e577dd125cd2b6b02e82332 Mon Sep 17 00:00:00 2001 From: Hettomei Date: Fri, 8 May 2015 13:08:08 +0200 Subject: [PATCH 04/12] Macro cleanup: USE_FILE_CHOOSER --- src/nvim/eval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 0a30c90b69..e8fe1dbd82 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -9936,7 +9936,7 @@ static void f_has(typval_T *argvars, typval_T *rettv) #endif "arabic", "autocmd", -#if defined(FEAT_BROWSE) && defined(USE_FILE_CHOOSER) +#ifdef FEAT_BROWSE "browsefilter", #endif "byte_offset", From 343040f318f7590aa2f0964470a0343b96bbaa76 Mon Sep 17 00:00:00 2001 From: Hettomei Date: Fri, 8 May 2015 13:10:30 +0200 Subject: [PATCH 05/12] Macro cleanup: FEAT_BEVAL --- src/nvim/menu.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/nvim/menu.c b/src/nvim/menu.c index 4e5d554866..850c474f33 100644 --- a/src/nvim/menu.c +++ b/src/nvim/menu.c @@ -460,8 +460,7 @@ add_menu_path ( menu->silent[i] = menuarg->silent[0]; } } -#if defined(FEAT_TOOLBAR) \ - && (defined(FEAT_BEVAL) || defined(FEAT_GUI_GTK)) +#if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) /* Need to update the menu tip. */ if (modes & MENU_TIP_MODE) gui_mch_menu_set_tip(menu); @@ -613,8 +612,7 @@ remove_menu ( menu->modes |= child->modes; if (modes & MENU_TIP_MODE) { free_menu_string(menu, MENU_INDEX_TIP); -#if defined(FEAT_TOOLBAR) && \ - (defined(FEAT_BEVAL) || defined(FEAT_GUI_GTK)) +#if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) /* Need to update the menu tip. */ if (gui.in_use) gui_mch_menu_set_tip(menu); From 5360324974be724f8485aec39f75aeb06a58cb04 Mon Sep 17 00:00:00 2001 From: Hettomei Date: Fri, 8 May 2015 14:36:49 +0200 Subject: [PATCH 06/12] Macro cleanup: FEAT_TOOLBAR --- src/nvim/menu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nvim/menu.c b/src/nvim/menu.c index 850c474f33..03369f5635 100644 --- a/src/nvim/menu.c +++ b/src/nvim/menu.c @@ -460,7 +460,7 @@ add_menu_path ( menu->silent[i] = menuarg->silent[0]; } } -#if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) +#if defined(FEAT_GUI_GTK) /* Need to update the menu tip. */ if (modes & MENU_TIP_MODE) gui_mch_menu_set_tip(menu); @@ -612,7 +612,7 @@ remove_menu ( menu->modes |= child->modes; if (modes & MENU_TIP_MODE) { free_menu_string(menu, MENU_INDEX_TIP); -#if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) +#if defined(FEAT_GUI_GTK) /* Need to update the menu tip. */ if (gui.in_use) gui_mch_menu_set_tip(menu); From bd819aaed0f72b43b553ba5b5e34df7fcb3f600c Mon Sep 17 00:00:00 2001 From: Hettomei Date: Fri, 8 May 2015 14:40:10 +0200 Subject: [PATCH 07/12] Macro cleanup: FEAT_GUI_GTK --- src/nvim/menu.c | 11 ----------- src/nvim/normal.c | 2 +- src/nvim/vim.h | 3 +-- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/nvim/menu.c b/src/nvim/menu.c index 03369f5635..41ecfd2890 100644 --- a/src/nvim/menu.c +++ b/src/nvim/menu.c @@ -460,11 +460,6 @@ add_menu_path ( menu->silent[i] = menuarg->silent[0]; } } -#if defined(FEAT_GUI_GTK) - /* Need to update the menu tip. */ - if (modes & MENU_TIP_MODE) - gui_mch_menu_set_tip(menu); -#endif } return OK; @@ -612,11 +607,6 @@ remove_menu ( menu->modes |= child->modes; if (modes & MENU_TIP_MODE) { free_menu_string(menu, MENU_INDEX_TIP); -#if defined(FEAT_GUI_GTK) - /* Need to update the menu tip. */ - if (gui.in_use) - gui_mch_menu_set_tip(menu); -#endif } if ((menu->modes & MENU_ALL_MODES) == 0) { /* The menu item is no longer valid in ANY mode, so delete it */ @@ -1331,7 +1321,6 @@ void ex_emenu(exarg_T *eap) } #if defined(FEAT_GUI_MSWIN) \ - || defined(FEAT_GUI_GTK) \ || defined(FEAT_BEVAL_TIP) /* * Given a menu descriptor, e.g. "File.New", find it in the menu hierarchy. diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 514fc5c68f..c69306ed47 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -2105,7 +2105,7 @@ do_mouse ( * NOTE: Ignore right button down and drag mouse events. * Windows only shows the popup menu on the button up event. */ -#if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MAC) +#if defined(FEAT_GUI_MAC) if (!is_click) return false; #endif diff --git a/src/nvim/vim.h b/src/nvim/vim.h index e9606a7294..5e424f5375 100644 --- a/src/nvim/vim.h +++ b/src/nvim/vim.h @@ -338,8 +338,7 @@ enum { * functions of these names. The declarations would break if the defines had * been seen at that stage. But it must be before globals.h, where error_ga * is declared. */ -#if !defined(FEAT_GUI_X11) \ - && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MAC) +#if !defined(FEAT_GUI_X11) && !defined(FEAT_GUI_MAC) # define mch_errmsg(str) fprintf(stderr, "%s", (str)) # define display_errors() fflush(stderr) # define mch_msg(str) printf("%s", (str)) From db9bcadb0585b1a94031350263d185e7974bf0b1 Mon Sep 17 00:00:00 2001 From: Hettomei Date: Fri, 8 May 2015 14:41:02 +0200 Subject: [PATCH 08/12] Macro cleanup: FEAT_GUI_X11 --- src/nvim/vim.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nvim/vim.h b/src/nvim/vim.h index 5e424f5375..446d1e0265 100644 --- a/src/nvim/vim.h +++ b/src/nvim/vim.h @@ -338,7 +338,7 @@ enum { * functions of these names. The declarations would break if the defines had * been seen at that stage. But it must be before globals.h, where error_ga * is declared. */ -#if !defined(FEAT_GUI_X11) && !defined(FEAT_GUI_MAC) +#if !defined(FEAT_GUI_MAC) # define mch_errmsg(str) fprintf(stderr, "%s", (str)) # define display_errors() fflush(stderr) # define mch_msg(str) printf("%s", (str)) From 9b58fc69860406b42b86546138f4dae14190ea63 Mon Sep 17 00:00:00 2001 From: Hettomei Date: Fri, 8 May 2015 14:42:59 +0200 Subject: [PATCH 09/12] Macro cleanup: FEAT_GUI_MAC --- src/nvim/normal.c | 4 ---- src/nvim/vim.h | 12 ++++-------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/nvim/normal.c b/src/nvim/normal.c index c69306ed47..7b445dcab6 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -2105,10 +2105,6 @@ do_mouse ( * NOTE: Ignore right button down and drag mouse events. * Windows only shows the popup menu on the button up event. */ -#if defined(FEAT_GUI_MAC) - if (!is_click) - return false; -#endif return false; } if (which_button == MOUSE_LEFT diff --git a/src/nvim/vim.h b/src/nvim/vim.h index 446d1e0265..17f9cbc310 100644 --- a/src/nvim/vim.h +++ b/src/nvim/vim.h @@ -332,19 +332,15 @@ enum { /* Maximum number of bytes in a multi-byte character. It can be one 32-bit * character of up to 6 bytes, or one 16-bit character of up to three bytes * plus six following composing characters of three bytes each. */ -# define MB_MAXBYTES 21 +#define MB_MAXBYTES 21 /* This has to go after the include of proto.h, as proto/gui.pro declares * functions of these names. The declarations would break if the defines had * been seen at that stage. But it must be before globals.h, where error_ga * is declared. */ -#if !defined(FEAT_GUI_MAC) -# define mch_errmsg(str) fprintf(stderr, "%s", (str)) -# define display_errors() fflush(stderr) -# define mch_msg(str) printf("%s", (str)) -#else -# define USE_MCH_ERRMSG -#endif +#define mch_errmsg(str) fprintf(stderr, "%s", (str)) +#define display_errors() fflush(stderr) +#define mch_msg(str) printf("%s", (str)) #include "nvim/globals.h" /* global variables and messages */ #include "nvim/buffer_defs.h" /* buffer and windows */ From 28d39db1712d10902b260ee402b014cd3e9c4b55 Mon Sep 17 00:00:00 2001 From: Hettomei Date: Fri, 8 May 2015 14:44:05 +0200 Subject: [PATCH 10/12] Macro cleanup: FEAT_GUI_MSWIN --- src/nvim/menu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/nvim/menu.c b/src/nvim/menu.c index 41ecfd2890..c532c19667 100644 --- a/src/nvim/menu.c +++ b/src/nvim/menu.c @@ -1320,8 +1320,7 @@ void ex_emenu(exarg_T *eap) EMSG2(_("E335: Menu not defined for %s mode"), mode); } -#if defined(FEAT_GUI_MSWIN) \ - || defined(FEAT_BEVAL_TIP) +#if defined(FEAT_BEVAL_TIP) /* * Given a menu descriptor, e.g. "File.New", find it in the menu hierarchy. */ From b69f1b85f5966bd5fcc589a90ccde0b8cd3b2762 Mon Sep 17 00:00:00 2001 From: Hettomei Date: Fri, 8 May 2015 14:46:23 +0200 Subject: [PATCH 11/12] Macro cleanup: FEAT_BEVAL_TIP --- src/nvim/menu.c | 53 ------------------------------------------------- 1 file changed, 53 deletions(-) diff --git a/src/nvim/menu.c b/src/nvim/menu.c index c532c19667..a8bf4ee5be 100644 --- a/src/nvim/menu.c +++ b/src/nvim/menu.c @@ -1320,59 +1320,6 @@ void ex_emenu(exarg_T *eap) EMSG2(_("E335: Menu not defined for %s mode"), mode); } -#if defined(FEAT_BEVAL_TIP) -/* - * Given a menu descriptor, e.g. "File.New", find it in the menu hierarchy. - */ -vimmenu_T *gui_find_menu(char_u *path_name) -{ - vimmenu_T *menu = NULL; - char_u *name; - char_u *saved_name; - char_u *p; - - menu = root_menu; - - saved_name = vim_strsave(path_name); - - name = saved_name; - while (*name) { - /* find the end of one dot-separated name and put a NUL at the dot */ - p = menu_name_skip(name); - - while (menu != NULL) { - if (menu_name_equal(name, menu)) { - if (menu->children == NULL) { - /* found a menu item instead of a sub-menu */ - if (*p == NUL) - EMSG(_("E336: Menu path must lead to a sub-menu")); - else - EMSG(_(e_notsubmenu)); - menu = NULL; - goto theend; - } - if (*p == NUL) /* found a full match */ - goto theend; - break; - } - menu = menu->next; - } - if (menu == NULL) /* didn't find it */ - break; - - /* Found a match, search the sub-menu. */ - menu = menu->children; - name = p; - } - - if (menu == NULL) - EMSG(_("E337: Menu not found - check menu names")); -theend: - xfree(saved_name); - return menu; -} -#endif - /* * Translation of menu names. Just a simple lookup table. */ From 3b06ce200b56c575a58cadc89bf237d8fa89fd4e Mon Sep 17 00:00:00 2001 From: Hettomei Date: Thu, 14 May 2015 23:21:08 +0200 Subject: [PATCH 12/12] Macro cleanup: FEAT_SHORTCUT, replace with WIN32 --- src/nvim/buffer.c | 2 +- src/nvim/eval.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index b4b36f7fc0..4724f98eca 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -3576,7 +3576,7 @@ void fname_expand(buf_T *buf, char_u **ffname, char_u **sfname) *sfname = *ffname; *ffname = (char_u *)fix_fname((char *)*ffname); /* expand to full path */ -#ifdef FEAT_SHORTCUT +#ifdef WIN32 if (!buf->b_p_bin) { char_u *rfname; diff --git a/src/nvim/eval.c b/src/nvim/eval.c index e8fe1dbd82..f5489afcb6 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -12427,7 +12427,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv) #endif p = get_tv_string(&argvars[0]); -#ifdef FEAT_SHORTCUT +#ifdef WIN32 { char_u *v = NULL;