Klimi's new dotfiles with stow.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 line
1.5 KiB

5 年之前
  1. ;;; haskell-sandbox.el --- Support for sandboxes -*- lexical-binding: t -*-
  2. ;; Copyright (c) 2014 Chris Done. All rights reserved.
  3. ;; This file is free software; you can redistribute it and/or modify
  4. ;; it under the terms of the GNU General Public License as published by
  5. ;; the Free Software Foundation; either version 3, or (at your option)
  6. ;; any later version.
  7. ;; This file is distributed in the hope that it will be useful,
  8. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. ;; GNU General Public License for more details.
  11. ;; You should have received a copy of the GNU General Public License
  12. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ;;; Code:
  14. (require 'cl-lib)
  15. (require 'haskell-session)
  16. (defun haskell-sandbox-path (session)
  17. "If there is a haskell-session, return the path to the usual sandbox location."
  18. (concat (haskell-session-cabal-dir session)
  19. "/.cabal-sandbox"))
  20. (defun haskell-sandbox-exists-p (session)
  21. "Is there a cabal sandbox?"
  22. (file-exists-p (haskell-sandbox-path session)))
  23. (defun haskell-sandbox-pkgdb (session)
  24. "Get the package database of the sandbox."
  25. (let* ((files (directory-files (haskell-sandbox-path session)))
  26. (dir (car (cl-remove-if-not (lambda (file)
  27. (string-match ".conf.d$" file))
  28. files))))
  29. (when dir
  30. (concat (haskell-sandbox-path session) "/" dir))))
  31. (provide 'haskell-sandbox)