Skip to content

Commit c0b157d

Browse files
committed
Make directory argument mandatory in hasktags command composer
1 parent c358be5 commit c0b157d

File tree

1 file changed

+27
-34
lines changed

1 file changed

+27
-34
lines changed

haskell-cabal.el

Lines changed: 27 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,52 +1079,45 @@ buffer not visiting a file returns nil."
10791079
(when buffer-file-name
10801080
(file-name-directory buffer-file-name))))
10811081

1082-
(defun haskell-cabal--compose-hasktags-command (&optional cabal-dir)
1083-
"Prepare command to execute hasktags for current file.
1082+
(defun haskell-cabal--compose-hasktags-command (dir)
1083+
"Prepare command to execute `hasktags` command in DIR folder.
10841084
By default following parameters are passed to Hasktags
10851085
executable:
10861086
-e - generate ETAGS file
10871087
-x - generate additional information in CTAGS file.
10881088
1089-
Tries to find cabal file location, give optional CABAL-DIR parameter to
1090-
override it. If cabal file not found uses current file
1091-
directory if current buffer is visiting a file. Otherwise returns nil.
1092-
10931089
This function takes into account user's operation system: in case
1094-
of Windows it generates simple command like
1090+
of Windows it generates simple command, relying on Hasktags
1091+
itself to find source files:
10951092
10961093
hasktags --output=DIR\TAGS -x -e DIR
10971094
1098-
relying on Hasktags itself to find source files;
1099-
11001095
In other cases it uses `find` command to find all source files
11011096
recursively avoiding visiting unnecessary heavy directories like
11021097
.git, .svn, _darcs and build directories created by
1103-
cabal-install, stack, etc."
1104-
(let ((dir (or cabal-dir (haskell-cabal--find-tags-dir))))
1105-
(when dir
1106-
(if (eq system-type 'windows-nt)
1107-
(format "hasktags --output=\"%s\\TAGS\" -x -e \"%s\"" dir dir)
1108-
(format "cd %s && %s | %s"
1109-
dir
1110-
(concat "find . "
1111-
"-type d \\( "
1112-
"-path ./.git "
1113-
"-o -path ./.svn "
1114-
"-o -path ./_darcs "
1115-
"-o -path ./.stack-work "
1116-
"-o -path ./dist "
1117-
"-o -path ./.cabal-sandbox "
1118-
"\\) -prune "
1119-
"-o -type f \\( "
1120-
"-name '*.hs' "
1121-
"-or -name '*.lhs' "
1122-
"-or -name '*.hsc' "
1123-
"\\) -not \\( "
1124-
"-name '#*' "
1125-
"-or -name '.*' "
1126-
"\\) -print0")
1127-
"xargs -0 hasktags -e -x")))))
1098+
cabal-install, stack, etc and passes list of found files to Hasktags."
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")))
11281121

11291122
(provide 'haskell-cabal)
11301123
;;; haskell-cabal.el ends here

0 commit comments

Comments
 (0)