diff src/fileio.c @ 29867:6eaef7375f17 v9.0.0272

patch 9.0.0272: BufReadCmd not triggered when loading a "nofile" buffer Commit: https://github.com/vim/vim/commit/b1d2c8116cb5577961ea109651fb888b5e58265f Author: Bram Moolenaar <Bram@vim.org> Date: Fri Aug 26 11:55:01 2022 +0100 patch 9.0.0272: BufReadCmd not triggered when loading a "nofile" buffer Problem: BufReadCmd not triggered when loading a "nofile" buffer. (Maxim Kim) Solution: Call readfile() but bail out before reading a file. (closes #10983)
author Bram Moolenaar <Bram@vim.org>
date Fri, 26 Aug 2022 13:00:04 +0200
parents 6c7eddcce52c
children adc2dec6d27d
line wrap: on
line diff
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -108,6 +108,7 @@ filemess(
  * READ_STDIN	read from stdin instead of a file
  * READ_BUFFER	read from curbuf instead of a file (converting after reading
  *		stdin)
+ * READ_NOFILE	do not read a file, only trigger BufReadCmd
  * READ_DUMMY	read into a dummy buffer (to check if file contents changed)
  * READ_KEEP_UNDO  don't clear undo info or read it from a file
  * READ_FIFO	read from fifo/socket instead of a file
@@ -309,6 +310,9 @@ readfile(
 #endif
 
 	curbuf->b_op_start = orig_start;
+
+	if (flags & READ_NOFILE)
+	    return FAIL;
     }
 
     if ((shortmess(SHM_OVER) || curbuf->b_help) && p_verbose == 0)