Skip to content

:ctags and :etags command can receive haskell source files as a parameter

A friend of mine accidentally lost a bunch of uncomited code because he passed the name of his source file to ghci's ctags command

:ctags hisstuff.hs

He tought that the ctags parameter was the name of the file to create the ctags from. Instead, that parameter is actually for the name of the file to write the tags to. His Haskell source file was instantly overwritten by the tag info.

The source of this confusion is that the the documentation from the :help command just says it takes a "file" parameter, without explicitly mentioning that its the name of the *output* file.

:ctags[!] [<file>]          create tags file for Vi (default: "tags")
                            (!: use regex instead of line number)

:etags [<file>]             create tags file for Emacs (default: "TAGS")

I think it would be safer to use a more precise name here instead of <file>. Something like <output> or <outputFile>. It might also be a good idea to forbid the ctags and etags commands from overwriting existing "hs" and "lhs" source files. If a user types :ctags something.hs then its almost certainly a mistake with potentially destructive consequences.

Trac metadata
Trac field Value
Version 7.10.2
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information