File tree Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -445,23 +445,19 @@ OTHER-WINDOW use `find-file-other-window'."
445
445
(plist-get section :data-start-column ))
446
446
447
447
(defun haskell-cabal-enum-targets ()
448
- " Enumerate targets from .cabal file."
449
- (defvar haskell-cabal-source-bearing-sections )
448
+ " Enumerate .cabal targets."
450
449
(let ((cabal-file (haskell-cabal-find-file)))
451
450
(when (and cabal-file (file-readable-p cabal-file))
452
451
(with-temp-buffer
453
452
(insert-file-contents cabal-file)
454
- (let* ((targets (mapcar (lambda (arg ) (haskell-cabal--all-instances arg))
455
- haskell-cabal-source-bearing-sections)))
456
- (apply #'append targets))))))
457
-
458
- (defun haskell-cabal--all-instances (target )
459
- " Return list of all instances of TARGET section."
460
- (goto-char (point-min ))
461
- (let (matches)
462
- (while (re-search-forward (concat target " +\\ ([[:word:]-]+\\ )" ) nil t )
463
- (push (match-string 1 ) matches))
464
- (sort matches 'string< )))
453
+ (haskell-cabal-mode )
454
+ (let (matches)
455
+ (goto-char (point-min ))
456
+ (haskell-cabal-next-section)
457
+ (while (not (eobp ))
458
+ (push (haskell-cabal-section-value (haskell-cabal-section)) matches)
459
+ (haskell-cabal-next-section))
460
+ (reverse matches))))))
465
461
466
462
(defmacro haskell-cabal-with-subsection (subsection replace &rest funs )
467
463
" Copy subsection data into a temporary buffer, save indentation
You can’t perform that action at this time.
0 commit comments