diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-07-25 23:31:12 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-07-25 23:31:12 +0200 |
commit | f0a521f4f76904edb74e182c12732189b347ff68 (patch) | |
tree | 6814c7f84c1f6120b504d427bca34feaf9c36a45 /src/buffer.c | |
parent | fc716d725613c3b5934e7eac6573adde8e4f8183 (diff) | |
download | vim-git-f0a521f4f76904edb74e182c12732189b347ff68.tar.gz |
patch 8.0.0776: function prototypes missing without the quickfix featurev8.0.0776
Problem: Function prototypes missing without the quickfix feature. (Tony
Mechelynck)
Solution: Move non-quickfix functions to buffer.c.
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/buffer.c b/src/buffer.c index fb1331736..4dbb9e91b 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5650,6 +5650,73 @@ write_viminfo_bufferlist(FILE *fp) } #endif +/* + * Return TRUE if "buf" is the quickfix buffer. + */ + int +bt_quickfix(buf_T *buf) +{ + return buf != NULL && buf->b_p_bt[0] == 'q'; +} + +/* + * Return TRUE if "buf" is a terminal buffer. + */ + int +bt_terminal(buf_T *buf) +{ + return buf != NULL && buf->b_p_bt[0] == 't'; +} + +/* + * Return TRUE if "buf" is a "nofile", "acwrite" or "terminal" buffer. + * This means the buffer name is not a file name. + */ + int +bt_nofile(buf_T *buf) +{ + return buf != NULL && ((buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f') + || buf->b_p_bt[0] == 'a' + || buf->b_p_bt[0] == 't'); +} + +/* + * Return TRUE if "buf" is a "nowrite", "nofile" or "terminal" buffer. + */ + int +bt_dontwrite(buf_T *buf) +{ + return buf != NULL && (buf->b_p_bt[0] == 'n' || buf->b_p_bt[0] == 't'); +} + + int +bt_dontwrite_msg(buf_T *buf) +{ + if (bt_dontwrite(buf)) + { + EMSG(_("E382: Cannot write, 'buftype' option is set")); + return TRUE; + } + return FALSE; +} + +/* + * Return TRUE if the buffer should be hidden, according to 'hidden', ":hide" + * and 'bufhidden'. + */ + int +buf_hide(buf_T *buf) +{ + /* 'bufhidden' overrules 'hidden' and ":hide", check it first */ + switch (buf->b_p_bh[0]) + { + case 'u': /* "unload" */ + case 'w': /* "wipe" */ + case 'd': return FALSE; /* "delete" */ + case 'h': return TRUE; /* "hide" */ + } + return (p_hid || cmdmod.hide); +} /* * Return special buffer name. |