#3434: improve vi tags (add non-exported symbols, add tag kinds, add regex tags)
---------------------------------+------------------------------------------
    Reporter:  phercek           |        Owner:  simonmar        
        Type:  feature request   |       Status:  new             
    Priority:  high              |    Milestone:  6.12.1          
   Component:  GHCi              |      Version:  6.10.4          
    Severity:  normal            |   Resolution:                  
    Keywords:  vim tags ctags    |   Difficulty:  Unknown         
    Testcase:                    |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |  
---------------------------------+------------------------------------------
Comment (by phercek):

 You can ignore this comment completely. It is just about some ideas for
 emacs support which I do not really care about.[[BR]]
 I do not know emacs at all (installed it just now and read a bit about
 emacs TAGS in the manual). Anyway I tried two things: adding tag kinds and
 adding static tags to emacs TAGS.[[BR]]
 Although emacs does not have a special field for a tag kind it solves it
 by adding /<kindLetter> to the tag name to distinguish different kinds
 with the same name. This is the way how it is done for Ada code so here is
 a patch which does the same for Haskell (it must be applied on top of
 improveVimTags.dpatch):
 {{{
 diff -rN -u old-ghc.head/ghc/GhciTags.hs new-ghc.head/ghc/GhciTags.hs
 --- old-ghc.head/ghc/GhciTags.hs        2009-09-12 11:06:48.735680788
 +0200
 +++ new-ghc.head/ghc/GhciTags.hs        2009-09-12 11:06:48.975681765
 +0200
 @@ -192,10 +192,10 @@

  -- etags format, for Emacs/XEmacs
  showETag :: TagInfo -> String
 -showETag TagInfo{ tagName = tag, tagLine = lineNo, tagCol = colNo,
 +showETag TagInfo{ tagName = tag, tagKind = kind, tagLine = lineNo, tagCol
 = colNo,
                    tagSrcInfo = Just (srcLine,charPos) }
      =  take colNo srcLine ++ tag
 -    ++ "\x7f" ++ tag
 +    ++ "\x7f" ++ tag ++ ('/':kind:[])
      ++ "\x01" ++ show lineNo
      ++ "," ++ show charPos
  showETag _ = ghcError (CmdLineError "missing source file info in
 showETag")
 }}}

 Addition of tag kinds for emacs seems to work well. But, as far as I could
 figure it out, emacs support for static tags (symbols with file scope) is
 worse compared to vim. It still kind of works. Emacs can cycle over all
 tags with given name but it does not prefer jump to a local tag (the tag
 in the same file from which the jump was initiated). So in the case of
 name clashes it often jumps to incorrect locations. I think it should be
 possible to write an emacs macro which does this well. Still, the result
 is that it is questionable whether emacs tags should contain non-exported
 top level Haskell definitions by default. If you think it should then a
 patch which adds them is here (it must be applied on top of
 improveVimTags.dpatch):
 {{{
 diff -rN -u old-ghc.head/ghc/GhciTags.hs new-ghc.head/ghc/GhciTags.hs
 --- old-ghc.head/ghc/GhciTags.hs        2009-09-12 11:06:48.735680788
 +0200
 +++ new-ghc.head/ghc/GhciTags.hs        2009-09-12 11:06:48.975681765
 +0200
 @@ -139,7 +139,7 @@
    IO.try (writeFile file tags)

  collateAndWriteTags ETags file tagInfos = do -- etags style, Emacs/XEmacs
 -  tagInfoGroups <- makeTagGroupsWithSrcInfo $filter tagExported tagInfos
 +  tagInfoGroups <- makeTagGroupsWithSrcInfo tagInfos
    let tagGroups = map processGroup tagInfoGroups
    IO.try (writeFile file $ concat tagGroups)

 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3434#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to