@@ -5650,6 +5650,73 @@ write_viminfo_bufferlist(FILE *fp)
56505650}
56515651#endif
56525652
5653+ /*
5654+ * Return TRUE if "buf" is the quickfix buffer.
5655+ */
5656+ int
5657+ bt_quickfix (buf_T * buf )
5658+ {
5659+ return buf != NULL && buf -> b_p_bt [0 ] == 'q' ;
5660+ }
5661+
5662+ /*
5663+ * Return TRUE if "buf" is a terminal buffer.
5664+ */
5665+ int
5666+ bt_terminal (buf_T * buf )
5667+ {
5668+ return buf != NULL && buf -> b_p_bt [0 ] == 't' ;
5669+ }
5670+
5671+ /*
5672+ * Return TRUE if "buf" is a "nofile", "acwrite" or "terminal" buffer.
5673+ * This means the buffer name is not a file name.
5674+ */
5675+ int
5676+ bt_nofile (buf_T * buf )
5677+ {
5678+ return buf != NULL && ((buf -> b_p_bt [0 ] == 'n' && buf -> b_p_bt [2 ] == 'f' )
5679+ || buf -> b_p_bt [0 ] == 'a'
5680+ || buf -> b_p_bt [0 ] == 't' );
5681+ }
5682+
5683+ /*
5684+ * Return TRUE if "buf" is a "nowrite", "nofile" or "terminal" buffer.
5685+ */
5686+ int
5687+ bt_dontwrite (buf_T * buf )
5688+ {
5689+ return buf != NULL && (buf -> b_p_bt [0 ] == 'n' || buf -> b_p_bt [0 ] == 't' );
5690+ }
5691+
5692+ int
5693+ bt_dontwrite_msg (buf_T * buf )
5694+ {
5695+ if (bt_dontwrite (buf ))
5696+ {
5697+ EMSG (_ ("E382: Cannot write, 'buftype' option is set" ));
5698+ return TRUE;
5699+ }
5700+ return FALSE;
5701+ }
5702+
5703+ /*
5704+ * Return TRUE if the buffer should be hidden, according to 'hidden', ":hide"
5705+ * and 'bufhidden'.
5706+ */
5707+ int
5708+ buf_hide (buf_T * buf )
5709+ {
5710+ /* 'bufhidden' overrules 'hidden' and ":hide", check it first */
5711+ switch (buf -> b_p_bh [0 ])
5712+ {
5713+ case 'u' : /* "unload" */
5714+ case 'w' : /* "wipe" */
5715+ case 'd' : return FALSE; /* "delete" */
5716+ case 'h' : return TRUE; /* "hide" */
5717+ }
5718+ return (p_hid || cmdmod .hide );
5719+ }
56535720
56545721/*
56555722 * Return special buffer name.
0 commit comments