Ticket #24 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

QuickFixCmdPost autocommand is ran on every buffer

Reported by: Masse Owned by: claus
Priority: minor Milestone:
Component: --- Version:
Keywords: Cc:

Description

The au QuickFixCmdPost make if autocommand on line 177 is ran on every buffer, whether or not they are haskell buffers or not. This causes errors on filetypes other than haskell, as the functions and variables are declared as local to a buffer and therefore not declared for nothing else than haskell buffers. Besides the event only makes sense on haskell sources.

Way to reproduce: vim test.hs :e test.py :make <observe errors>

Suggestion: Make it buffer local, so that the autocommand is launched only on relevant buffers. However as far as I know you can't both pattern match and make it buffer-local, but personally I'd still prefer having cache updated after every quickfix than getting errors after trying to :make on non-haskell buffers.

Change History

Changed 4 years ago by haskellmode

  • status changed from new to closed
  • resolution set to fixed

Good point. Instead of replacing one scope problem with another, I've made the autocommand check the current compiler:

hunk ./compiler/ghc.vim 186
-au QuickFixCmdPost make if GHC_CountErrors()==0 | silent call GHC_BrowseAll() | endif
+au QuickFixCmdPost make if exists("current_compiler") && current_compiler=="ghc" && GHC_CountErrors()==0) | silent call GHC_BrowseAll() | endif

Fixed in darcs repo.

Note: See TracTickets for help on using tickets.