@@ -1069,6 +1069,55 @@ source-section."
1069
1069
; ; unwind
1070
1070
(haskell-mode-toggle-interactive-prompt-state t )))
1071
1071
1072
- (provide 'haskell-cabal )
1073
1072
1073
+ (defun haskell-cabal--compose-hasktags-command (&optional cabal-dir )
1074
+ " Prepare command to execute hasktags for current file.
1075
+ By default following parameters are passed to Hasktags
1076
+ executable:
1077
+ -e - generate ETAGS file
1078
+ -x - generate additional information in CTAGS file.
1079
+
1080
+ Tries to find cabal file location, give optional CABAL-DIR
1081
+ parameter to override it. If cabal file not found uses current
1082
+ file directory.
1083
+
1084
+ This function takes into account user's operation system: in case
1085
+ of Windows it generates simple command like
1086
+
1087
+ hasktags --output=DIR\T AGS -x -e DIR
1088
+
1089
+ relying on Hasktags itself to find source files;
1090
+
1091
+ In other cases it uses `find` command to find all source files
1092
+ recursively avoiding visiting unnecessary heavy directories like
1093
+ .git, .svn, _darcs and build directories created by
1094
+ cabal-install, stack, etc."
1095
+ (let ((dir (or cabal-dir
1096
+ (haskell-cabal-find-dir)
1097
+ (file-name-directory buffer-file-name))))
1098
+ (when dir
1099
+ (if (eq system-type 'windows-nt )
1100
+ (format " hasktags --output=\" %s \\ TAGS\" -x -e \" %s \" " dir dir)
1101
+ (format " cd %s && %s | %s "
1102
+ dir
1103
+ (concat " find . "
1104
+ " -type d \\ ( "
1105
+ " -path ./.git "
1106
+ " -o -path ./.svn "
1107
+ " -o -path ./_darcs "
1108
+ " -o -path ./.stack-work "
1109
+ " -o -path ./dist "
1110
+ " -o -path ./.cabal-sandbox "
1111
+ " \\ ) -prune "
1112
+ " -o -type f \\ ( "
1113
+ " -name '*.hs' "
1114
+ " -or -name '*.lhs' "
1115
+ " -or -name '*.hsc' "
1116
+ " \\ ) -not \\ ( "
1117
+ " -name '#*' "
1118
+ " -or -name '.*' "
1119
+ " \\ ) -print0" )
1120
+ " xargs -0 hasktags -e -x" )))))
1121
+
1122
+ (provide 'haskell-cabal )
1074
1123
; ;; haskell-cabal.el ends here
0 commit comments