Skip to content

Add support for guessing project license #464

Closed
@ivan-m

Description

@ivan-m

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions