Patch 9.0.0263
Problem: Too many #ifdefs.
Solution: Make some functions always available.
Files: src/buffer.c, src/change.c, src/ex_cmds2.c, src/fileio.c,
src/netbeans.c, src/errors.h, src/ex_cmds.c, src/viminfo.c,
src/window.c, src/drawscreen.c, src/session.c, src/bufwrite.c,
src/evalbuffer.c, src/ex_docmd.c
*** ../vim-9.0.0262/src/buffer.c 2022-08-25 13:54:13.453841129 +0100
--- src/buffer.c 2022-08-25 14:44:22.394538901 +0100
***************
*** 222,230 ****
// Read the file if there is one.
if (curbuf->b_ffname != NULL
- #ifdef FEAT_QUICKFIX
&& !bt_quickfix(curbuf)
- #endif
&& !bt_nofilename(curbuf)
#ifdef FEAT_NETBEANS_INTG
&& netbeansReadFile
--- 222,228 ----
***************
*** 1328,1338 ****
return FAIL;
}
#ifdef FEAT_PROP_POPUP
! if ((flags & DOBUF_NOPOPUP) && bt_popup(buf)
! # ifdef FEAT_TERMINAL
! && !bt_terminal(buf)
! #endif
! )
return OK;
#endif
--- 1326,1332 ----
return FAIL;
}
#ifdef FEAT_PROP_POPUP
! if ((flags & DOBUF_NOPOPUP) && bt_popup(buf) && !bt_terminal(buf))
return OK;
#endif
***************
*** 1445,1455 ****
{
// Skip current and unlisted bufs. Also skip a quickfix
// buffer, it might be deleted soon.
! if (buf == curbuf || !buf->b_p_bl
! #if defined(FEAT_QUICKFIX)
! || bt_quickfix(buf)
! #endif
! )
buf = NULL;
else if (buf->b_ml.ml_mfp == NULL)
{
--- 1439,1445 ----
{
// Skip current and unlisted bufs. Also skip a quickfix
// buffer, it might be deleted soon.
! if (buf == curbuf || !buf->b_p_bl || bt_quickfix(buf))
buf = NULL;
else if (buf->b_ml.ml_mfp == NULL)
{
***************
*** 1487,1496 ****
}
// in non-help buffer, try to skip help buffers, and vv
if (buf->b_help == curbuf->b_help && buf->b_p_bl
! #if defined(FEAT_QUICKFIX)
! && !bt_quickfix(buf)
! #endif
! )
{
if (buf->b_ml.ml_mfp != NULL) // found loaded buffer
break;
--- 1477,1483 ----
}
// in non-help buffer, try to skip help buffers, and vv
if (buf->b_help == curbuf->b_help && buf->b_p_bl
! && !bt_quickfix(buf))
{
if (buf->b_ml.ml_mfp != NULL) // found loaded buffer
break;
***************
*** 1508,1518 ****
if (buf == NULL) // No loaded buffer, find listed one
{
FOR_ALL_BUFFERS(buf)
! if (buf->b_p_bl && buf != curbuf
! #if defined(FEAT_QUICKFIX)
! && !bt_quickfix(buf)
! #endif
! )
break;
}
if (buf == NULL) // Still no buffer, just take one
--- 1495,1501 ----
if (buf == NULL) // No loaded buffer, find listed one
{
FOR_ALL_BUFFERS(buf)
! if (buf->b_p_bl && buf != curbuf && !bt_quickfix(buf))
break;
}
if (buf == NULL) // Still no buffer, just take one
***************
*** 1521,1530 ****
buf = curbuf->b_next;
else
buf = curbuf->b_prev;
- #if defined(FEAT_QUICKFIX)
if (bt_quickfix(buf))
buf = NULL;
- #endif
}
}
--- 1504,1511 ----
***************
*** 1987,1995 ****
&& curbuf->b_ffname == NULL
&& curbuf->b_nwindows <= 1
&& (curbuf->b_ml.ml_mfp == NULL || BUFEMPTY())
- #if defined(FEAT_QUICKFIX)
&& !bt_quickfix(curbuf)
- #endif
&& !curbufIsChanged());
}
--- 1968,1974 ----
***************
*** 3787,3801 ****
vim_snprintf_add(buffer, IOSIZE, "\"%s%s%s%s%s%s",
curbufIsChanged() ? (shortmess(SHM_MOD)
? " [+]" : _(" [Modified]")) : " ",
! (curbuf->b_flags & BF_NOTEDITED)
! #ifdef FEAT_QUICKFIX
! && !bt_dontwrite(curbuf)
! #endif
? _("[Not edited]") : "",
! (curbuf->b_flags & BF_NEW)
! #ifdef FEAT_QUICKFIX
! && !bt_dontwrite(curbuf)
! #endif
? new_file_message() : "",
(curbuf->b_flags & BF_READERR) ? _("[Read errors]") : "",
curbuf->b_p_ro ? (shortmess(SHM_RO) ? _("[RO]")
--- 3766,3774 ----
vim_snprintf_add(buffer, IOSIZE, "\"%s%s%s%s%s%s",
curbufIsChanged() ? (shortmess(SHM_MOD)
? " [+]" : _(" [Modified]")) : " ",
! (curbuf->b_flags & BF_NOTEDITED) && !bt_dontwrite(curbuf)
? _("[Not edited]") : "",
! (curbuf->b_flags & BF_NEW) && !bt_dontwrite(curbuf)
? new_file_message() : "",
(curbuf->b_flags & BF_READERR) ? _("[Read errors]") : "",
curbuf->b_p_ro ? (shortmess(SHM_RO) ? _("[RO]")
***************
*** 5676,5702 ****
return buf != NULL && buf->b_p_bt[0] == NUL;
}
- #if defined(FEAT_QUICKFIX) || defined(PROTO)
/*
* Return TRUE if "buf" is the quickfix buffer.
*/
int
bt_quickfix(buf_T *buf)
{
return buf != NULL && buf->b_p_bt[0] == 'q';
! }
#endif
- #if defined(FEAT_TERMINAL) || defined(PROTO)
/*
* Return TRUE if "buf" is a terminal buffer.
*/
int
bt_terminal(buf_T *buf)
{
return buf != NULL && buf->b_p_bt[0] == 't';
! }
#endif
/*
* Return TRUE if "buf" is a help buffer.
--- 5649,5679 ----
return buf != NULL && buf->b_p_bt[0] == NUL;
}
/*
* Return TRUE if "buf" is the quickfix buffer.
*/
int
bt_quickfix(buf_T *buf)
{
+ #ifdef FEAT_QUICKFIX
return buf != NULL && buf->b_p_bt[0] == 'q';
! #else
! return FALSE;
#endif
+ }
/*
* Return TRUE if "buf" is a terminal buffer.
*/
int
bt_terminal(buf_T *buf)
{
+ #if defined(FEAT_TERMINAL)
return buf != NULL && buf->b_p_bt[0] == 't';
! #else
! return FALSE;
#endif
+ }
/*
* Return TRUE if "buf" is a help buffer.
***************
*** 5764,5770 ****
|| buf->b_p_bt[0] == 'p');
}
- #if defined(FEAT_QUICKFIX) || defined(PROTO)
int
bt_dontwrite_msg(buf_T *buf)
{
--- 5741,5746 ----
***************
*** 5775,5781 ****
}
return FALSE;
}
- #endif
/*
* Return TRUE if the buffer should be hidden, according to 'hidden', ":hide"
--- 5751,5756 ----
*** ../vim-9.0.0262/src/change.c 2022-08-22 15:19:12.728328961 +0100
--- src/change.c 2022-08-25 14:33:39.491773548 +0100
***************
*** 100,110 ****
// Create a swap file if that is wanted.
// Don't do this for "nofile" and "nowrite" buffer types.
! if (curbuf->b_may_swap
! #ifdef FEAT_QUICKFIX
! && !bt_dontwrite(curbuf)
! #endif
! )
{
int save_need_wait_return = need_wait_return;
--- 100,106 ----
// Create a swap file if that is wanted.
// Don't do this for "nofile" and "nowrite" buffer types.
! if (curbuf->b_may_swap && !bt_dontwrite(curbuf))
{
int save_need_wait_return = need_wait_return;
*** ../vim-9.0.0262/src/ex_cmds2.c 2022-06-13 21:36:48.000000000 +0100
--- src/ex_cmds2.c 2022-08-25 14:34:05.239718710 +0100
***************
*** 27,36 ****
bufref_T bufref;
if (!(p_aw || p_awa) || !p_write
- #ifdef FEAT_QUICKFIX
// never autowrite a "nofile" or "nowrite" buffer
|| bt_dontwrite(buf)
- #endif
|| (!forceit && buf->b_p_ro) || buf->b_ffname == NULL)
return FAIL;
set_bufref(&bufref, buf);
--- 27,34 ----
*** ../vim-9.0.0262/src/fileio.c 2022-08-14 14:16:07.987582278 +0100
--- src/fileio.c 2022-08-25 14:48:54.322151413 +0100
***************
*** 514,522 ****
// Create a swap file now, so that other Vims are warned
// that we are editing this file. Don't do this for a
// "nofile" or "nowrite" buffer type.
- #ifdef FEAT_QUICKFIX
if (!bt_dontwrite(curbuf))
- #endif
{
check_need_swap(newfile);
// SwapExists autocommand may mess things up
--- 514,520 ----
***************
*** 595,603 ****
// Create a swap file now, so that other Vims are warned that we are
// editing this file.
// Don't do this for a "nofile" or "nowrite" buffer type.
- #ifdef FEAT_QUICKFIX
if (!bt_dontwrite(curbuf))
- #endif
{
check_need_swap(newfile);
if (!read_stdin && (curbuf != old_curbuf
--- 593,599 ----
***************
*** 3407,3415 ****
char_u *p;
if (buf->b_fname != NULL
- #ifdef FEAT_QUICKFIX
&& !bt_nofilename(buf)
- #endif
&& !path_with_url(buf->b_fname)
&& (force
|| buf->b_sfname == NULL
--- 3403,3409 ----
*** ../vim-9.0.0262/src/netbeans.c 2022-08-14 14:16:07.995582211 +0100
--- src/netbeans.c 2022-08-25 14:34:48.383628251 +0100
***************
*** 2152,2161 ****
if (p_write
&& !buf->bufp->b_p_ro
&& buf->bufp->b_ffname != NULL
! #ifdef FEAT_QUICKFIX
! && !bt_dontwrite(buf->bufp)
! #endif
! )
{
bufref_T bufref;
--- 2152,2158 ----
if (p_write
&& !buf->bufp->b_p_ro
&& buf->bufp->b_ffname != NULL
! && !bt_dontwrite(buf->bufp))
{
bufref_T bufref;
*** ../vim-9.0.0262/src/errors.h 2022-08-23 21:41:12.008852903 +0100
--- src/errors.h 2022-08-25 14:36:12.855455742 +0100
***************
*** 954,962 ****
INIT(= N_("E380: At bottom of quickfix stack"));
EXTERN char e_at_top_of_quickfix_stack[]
INIT(= N_("E381: At top of quickfix stack"));
EXTERN char e_cannot_write_buftype_option_is_set[]
INIT(= N_("E382: Cannot write, 'buftype' option is set"));
- #endif
EXTERN char e_invalid_search_string_str[]
INIT(= N_("E383: Invalid search string: %s"));
EXTERN char e_search_hit_top_without_match_for_str[]
--- 954,962 ----
INIT(= N_("E380: At bottom of quickfix stack"));
EXTERN char e_at_top_of_quickfix_stack[]
INIT(= N_("E381: At top of quickfix stack"));
+ #endif
EXTERN char e_cannot_write_buftype_option_is_set[]
INIT(= N_("E382: Cannot write, 'buftype' option is set"));
EXTERN char e_invalid_search_string_str[]
INIT(= N_("E383: Invalid search string: %s"));
EXTERN char e_search_hit_top_without_match_for_str[]
*** ../vim-9.0.0262/src/ex_cmds.c 2022-08-14 14:16:07.987582278 +0100
--- src/ex_cmds.c 2022-08-25 14:54:22.753661923 +0100
***************
*** 1677,1688 ****
(char *)opt, (char *)fname);
}
else
! vim_snprintf((char *)end, (size_t)(buflen - (end - buf)),
! #ifdef FEAT_QUICKFIX
! " %s %s",
! #else
! " %s%s", // " > %s" causes problems on Amiga
! #endif
(char *)opt, (char *)fname);
}
--- 1677,1683 ----
(char *)opt, (char *)fname);
}
else
! vim_snprintf((char *)end, (size_t)(buflen - (end - buf)), " %s %s",
(char *)opt, (char *)fname);
}
***************
*** 1947,1957 ****
* and a file name is required.
* "nofile" and "nowrite" buffers cannot be written implicitly either.
*/
! if (!other && (
! #ifdef FEAT_QUICKFIX
! bt_dontwrite_msg(curbuf) ||
! #endif
! check_fname() == FAIL
#ifdef UNIX
|| check_writable(curbuf->b_ffname) == FAIL
#endif
--- 1942,1948 ----
* and a file name is required.
* "nofile" and "nowrite" buffers cannot be written implicitly either.
*/
! if (!other && (bt_dontwrite_msg(curbuf) || check_fname() == FAIL
#ifdef UNIX
|| check_writable(curbuf->b_ffname) == FAIL
#endif
*** ../vim-9.0.0262/src/viminfo.c 2022-01-31 14:42:58.000000000 +0000
--- src/viminfo.c 2022-08-25 14:45:35.150434165 +0100
***************
*** 434,445 ****
{
if (buf->b_fname == NULL
|| !buf->b_p_bl
- #ifdef FEAT_QUICKFIX
|| bt_quickfix(buf)
- #endif
- #ifdef FEAT_TERMINAL
|| bt_terminal(buf)
- #endif
|| removable(buf->b_ffname))
continue;
--- 434,441 ----
***************
*** 1994,2004 ****
static int
skip_for_viminfo(buf_T *buf)
{
! return
! #ifdef FEAT_TERMINAL
! bt_terminal(buf) ||
! #endif
! removable(buf->b_ffname);
}
/*
--- 1990,1996 ----
static int
skip_for_viminfo(buf_T *buf)
{
! return bt_terminal(buf) || removable(buf->b_ffname);
}
/*
*** ../vim-9.0.0262/src/window.c 2022-08-14 14:16:08.003582142 +0100
--- src/window.c 2022-08-25 15:06:29.204531366 +0100
***************
*** 172,183 ****
case 's':
CHECK_CMDWIN;
reset_VIsual_and_resel(); // stop Visual mode
- #ifdef FEAT_QUICKFIX
// When splitting the quickfix window open a new buffer in it,
// don't replicate the quickfix buffer.
if (bt_quickfix(curbuf))
goto newwindow;
- #endif
#ifdef FEAT_GUI
need_mouse_correct = TRUE;
#endif
--- 172,181 ----
***************
*** 189,200 ****
case 'v':
CHECK_CMDWIN;
reset_VIsual_and_resel(); // stop Visual mode
- #ifdef FEAT_QUICKFIX
// When splitting the quickfix window open a new buffer in it,
// don't replicate the quickfix buffer.
if (bt_quickfix(curbuf))
goto newwindow;
- #endif
#ifdef FEAT_GUI
need_mouse_correct = TRUE;
#endif
--- 187,196 ----
***************
*** 228,236 ****
case 'n':
CHECK_CMDWIN;
reset_VIsual_and_resel(); // stop Visual mode
- #ifdef FEAT_QUICKFIX
newwindow:
- #endif
if (Prenum)
// window height
vim_snprintf((char *)cbuf, sizeof(cbuf) - 5, "%ld", Prenum);
--- 224,230 ----
*** ../vim-9.0.0262/src/drawscreen.c 2022-08-22 15:19:12.728328961 +0100
--- src/drawscreen.c 2022-08-25 14:44:32.394521175 +0100
***************
*** 482,492 ****
len += (int)STRLEN(p + len);
}
#endif
! if (bufIsChanged(wp->w_buffer)
! #ifdef FEAT_TERMINAL
! && !bt_terminal(wp->w_buffer)
! #endif
! )
{
vim_snprintf((char *)p + len, MAXPATHL - len, "%s", "[+]");
len += (int)STRLEN(p + len);
--- 482,488 ----
len += (int)STRLEN(p + len);
}
#endif
! if (bufIsChanged(wp->w_buffer) && !bt_terminal(wp->w_buffer))
{
vim_snprintf((char *)p + len, MAXPATHL - len, "%s", "[+]");
len += (int)STRLEN(p + len);
*** ../vim-9.0.0262/src/session.c 2022-05-18 22:00:41.000000000 +0100
--- src/session.c 2022-08-25 14:49:27.698102795 +0100
***************
*** 148,158 ****
&& term_should_restore(wp->w_buffer);
#endif
if (wp->w_buffer->b_fname == NULL
- #ifdef FEAT_QUICKFIX
// When 'buftype' is "nofile" can't restore the window contents.
! || bt_nofilename(wp->w_buffer)
! #endif
! )
return (ssop_flags & SSOP_BLANK);
if (bt_help(wp->w_buffer))
return (ssop_flags & SSOP_HELP);
--- 148,155 ----
&& term_should_restore(wp->w_buffer);
#endif
if (wp->w_buffer->b_fname == NULL
// When 'buftype' is "nofile" can't restore the window contents.
! || bt_nofilename(wp->w_buffer))
return (ssop_flags & SSOP_BLANK);
if (bt_help(wp->w_buffer))
return (ssop_flags & SSOP_HELP);
***************
*** 374,383 ****
# endif
// Load the file.
else if (wp->w_buffer->b_ffname != NULL
! # ifdef FEAT_QUICKFIX
! && !bt_nofilename(wp->w_buffer)
! # endif
! )
{
// Editing a file in this buffer: use ":edit file".
// This may have side effects! (e.g., compressed or network file).
--- 371,377 ----
# endif
// Load the file.
else if (wp->w_buffer->b_ffname != NULL
! && !bt_nofilename(wp->w_buffer))
{
// Editing a file in this buffer: use ":edit file".
// This may have side effects! (e.g., compressed or network file).
***************
*** 708,718 ****
{
if (!(only_save_windows && buf->b_nwindows == 0)
&& !(buf->b_help && !(ssop_flags & SSOP_HELP))
- #ifdef FEAT_TERMINAL
// Skip terminal buffers: finished ones are not useful, others
// will be resurrected and result in a new buffer.
&& !bt_terminal(buf)
- #endif
&& buf->b_fname != NULL
&& buf->b_p_bl)
{
--- 702,710 ----
***************
*** 818,827 ****
if (ses_do_win(wp)
&& wp->w_buffer->b_ffname != NULL
&& !bt_help(wp->w_buffer)
! #ifdef FEAT_QUICKFIX
! && !bt_nofilename(wp->w_buffer)
! #endif
! )
{
if (need_tabnext && put_line(fd, "tabnext") == FAIL)
goto fail;
--- 810,816 ----
if (ses_do_win(wp)
&& wp->w_buffer->b_ffname != NULL
&& !bt_help(wp->w_buffer)
! && !bt_nofilename(wp->w_buffer))
{
if (need_tabnext && put_line(fd, "tabnext") == FAIL)
goto fail;
*** ../vim-9.0.0262/src/bufwrite.c 2022-07-31 11:50:37.437635544 +0100
--- src/bufwrite.c 2022-08-25 14:48:22.618197300 +0100
***************
*** 742,750 ****
&& reset_changed
&& whole
&& buf == curbuf
- #ifdef FEAT_QUICKFIX
&& !bt_nofilename(buf)
- #endif
&& !filtering
&& (!append || vim_strchr(p_cpo, CPO_FNAMEAPP) != NULL)
&& vim_strchr(p_cpo, CPO_FNAMEW) != NULL)
--- 742,748 ----
***************
*** 813,823 ****
if (!(did_cmd = apply_autocmds_exarg(EVENT_FILEAPPENDCMD,
sfname, sfname, FALSE, curbuf, eap)))
{
- #ifdef FEAT_QUICKFIX
if (overwriting && bt_nofilename(curbuf))
nofile_err = TRUE;
else
- #endif
apply_autocmds_exarg(EVENT_FILEAPPENDPRE,
sfname, sfname, FALSE, curbuf, eap);
}
--- 811,819 ----
***************
*** 846,856 ****
}
else
{
- #ifdef FEAT_QUICKFIX
if (overwriting && bt_nofilename(curbuf))
nofile_err = TRUE;
else
- #endif
apply_autocmds_exarg(EVENT_BUFWRITEPRE,
sfname, sfname, FALSE, curbuf, eap);
}
--- 842,850 ----
***************
*** 860,870 ****
if (!(did_cmd = apply_autocmds_exarg(EVENT_FILEWRITECMD,
sfname, sfname, FALSE, curbuf, eap)))
{
- #ifdef FEAT_QUICKFIX
if (overwriting && bt_nofilename(curbuf))
nofile_err = TRUE;
else
- #endif
apply_autocmds_exarg(EVENT_FILEWRITEPRE,
sfname, sfname, FALSE, curbuf, eap);
}
--- 854,862 ----
*** ../vim-9.0.0262/src/evalbuffer.c 2022-07-23 09:52:00.333814262 +0100
--- src/evalbuffer.c 2022-08-25 14:48:33.942180943 +0100
***************
*** 93,103 ****
// buffer, these don't use the full path.
FOR_ALL_BUFFERS(buf)
if (buf->b_fname != NULL
! && (path_with_url(buf->b_fname)
! #ifdef FEAT_QUICKFIX
! || bt_nofilename(buf)
! #endif
! )
&& STRCMP(buf->b_fname, avar->vval.v_string) == 0)
break;
}
--- 93,99 ----
// buffer, these don't use the full path.
FOR_ALL_BUFFERS(buf)
if (buf->b_fname != NULL
! && (path_with_url(buf->b_fname) || bt_nofilename(buf))
&& STRCMP(buf->b_fname, avar->vval.v_string) == 0)
break;
}
*** ../vim-9.0.0262/src/ex_docmd.c 2022-08-22 15:19:12.732328943 +0100
--- src/ex_docmd.c 2022-08-25 14:55:41.381541928 +0100
***************
*** 55,62 ****
# define qf_history ex_ni
# define ex_helpgrep ex_ni
# define ex_vimgrep ex_ni
- #endif
- #if !defined(FEAT_QUICKFIX)
# define ex_cclose ex_ni
# define ex_copen ex_ni
# define ex_cwindow ex_ni
--- 55,60 ----
*** ../vim-9.0.0262/src/version.c 2022-08-25 13:54:13.453841129 +0100
--- src/version.c 2022-08-25 15:10:05.452189132 +0100
***************
*** 733,734 ****
--- 733,736 ----
{ /* Add new patch number below this line */
+ /**/
+ 263,
/**/
--
SIGFUN -- signature too funny (core dumped)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220825141154.339A61C090E%40moolenaar.net.