In order to automatically trigger a mark holding the last cursor position when I left a buffer or window, I added these statements to my ~/.vimrc:for more background on why I wanted to add these commands please refer to this vi.stackexchange question.  autocmd BufLeave * :normal mBautocmd WinLeave * :normal mWThe statements are causing errors when moving out of, or closing buffers created by NERDTree or netrw. e.g. when closing a netrw buffer.Error detected while processing function <SNR>85_NetrwBookHistHandler:line  154:E121: Undefined variable: g:netrw_bookmarklistE15: Invalid expression: g:netrw_bookmarklist[iremove - 1]line  158:E121: Undefined variable: g:netrw_bookmarklistE116: Invalid arguments for function removeline  159:E121: Undefined variable: dremoveAlso NERDTree is sometimes making addiditonal copies of directories, so when I run git status, git is showing new  directories.I suspect the cause of the error is the fact that NERDTree and netrw are creating new mappings, so that the command :normal mB when executed in a  NERDTree buffer is triggering something like m,l -which in NERDTree mappings means modify and list rather than set a new mark.Does this reasoning sound right?If so how could I detect when focus is in a NERDTree or netrw buffer, so the mappings can be turned off. Otherwise what could the cause to this problem? 
autocmd mark statements causing problems with nerd tree and netrw?
netrw;plugin nerdtree