From 40114d16318cb80282123b27df8eceb7d1069492 Mon Sep 17 00:00:00 2001 From: Sean Dewar <6256228+seandewar@users.noreply.github.com> Date: Tue, 13 Jan 2026 23:09:21 +0000 Subject: [PATCH] refactor: remove dead code, adjust comment Removed code doesn't seem to do anything? Looks like a clobbered remnant from when do_filetype_autocmd lived in did_set_string_option. Doc comment for wipe_buffer doesn't decrement top_file_num since a2d25b7 (2016), which presumably means the comment on marks doesn't apply either. (fmark_T::fnum can't refer to the wrong buffer as numbers aren't reused here anymore) --- src/nvim/autocmd.c | 5 ----- src/nvim/buffer.c | 5 +---- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c index 152184e75c..8ce2ff771d 100644 --- a/src/nvim/autocmd.c +++ b/src/nvim/autocmd.c @@ -2737,7 +2737,6 @@ void do_filetype_autocmd(buf_T *buf, bool force) return; // disallow recursion } - char **varp = &buf->b_p_ft; int secure_save = secure; // Reset the secure flag, since the value of 'filetype' has @@ -2751,9 +2750,5 @@ void do_filetype_autocmd(buf_T *buf, bool force) apply_autocmds(EVENT_FILETYPE, buf->b_p_ft, buf->b_fname, force || ft_recursive == 1, buf); ft_recursive--; - // Just in case the old "buf" is now invalid - if (varp != &(buf->b_p_ft)) { - varp = NULL; - } secure = secure_save; } diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index fb8235c1b3..38008a1239 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -4141,10 +4141,7 @@ bool buf_contents_changed(buf_T *buf) return differ; } -/// Wipe out a buffer and decrement the last buffer number if it was used for -/// this buffer. Call this to wipe out a temp buffer that does not contain any -/// marks. -/// +/// Wipe out a (typically temporary) buffer. /// @param aucmd When true trigger autocommands. void wipe_buffer(buf_T *buf, bool aucmd) {