Skip to content

Add support for guessing project license #464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ivan-m opened this issue Feb 12, 2015 · 1 comment
Closed

Add support for guessing project license #464

ivan-m opened this issue Feb 12, 2015 · 1 comment

Comments

@ivan-m
Copy link
Contributor

ivan-m commented Feb 12, 2015

I can do a PR for this; just not sure if it should go into haskell-cabal.el or haskell-mode.el:

(defun haskell-guess-license ()
  "Guess the license of this project.
If there is no valid .cabal file to get the license field from,
return nil."
  (interactive)
  (when buffer-file-name
    (let ((cabal-file (haskell-cabal-find-file (file-name-directory buffer-file-name))))
      (when (and cabal-file (file-readable-p cabal-file))
        (with-temp-buffer
          (insert-file-contents cabal-file)
          (haskell-cabal-get-setting "license"))))))

One possible change would be to optionally provide the file to act on rather than making it strictly necessary to use it interactively.

@chrisdone
Copy link
Member

haskell-cabal seems okay.

ivan-m added a commit to ivan-m/haskell-mode that referenced this issue Feb 14, 2015
A generalised version of what I proposed in haskell#464.
@ivan-m ivan-m closed this as completed Feb 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants