Function: haskell-cabal-visit-file
haskell-cabal-visit-file is an interactive and natively compiled
function defined in haskell-cabal.el.
Signature
(haskell-cabal-visit-file OTHER-WINDOW)
Documentation
Locate and visit package description file for file visited by current buffer.
This uses haskell-cabal-find-file to locate the closest
".cabal" file and open it. This command assumes a common Cabal
project structure where the ".cabal" file is in the top-folder
of the project, and all files related to the project are in or
below the top-folder. If called with non-nil prefix argument
OTHER-WINDOW use find-file-other-window.
Key Bindings
This command is not in any keymaps.
Source Code
;; Defined in /nix/store/9lz2mhw95f9fqxr9mnq46k3f6qz3aq83-emacs-packages-deps/share/emacs/site-lisp/elpa/haskell-mode-20260904.1042/haskell-cabal.el
;;;###autoload
(defun haskell-cabal-visit-file (other-window)
"Locate and visit package description file for file visited by current buffer.
This uses `haskell-cabal-find-file' to locate the closest
\".cabal\" file and open it. This command assumes a common Cabal
project structure where the \".cabal\" file is in the top-folder
of the project, and all files related to the project are in or
below the top-folder. If called with non-nil prefix argument
OTHER-WINDOW use `find-file-other-window'."
(interactive "P")
;; Note: We aren't allowed to rely on haskell-session here (which,
;; in pathological cases, can have a different .cabal file
;; associated with the current buffer)
(if buffer-file-name
(let ((cabal-file (haskell-cabal-find-file (file-name-directory buffer-file-name))))
(if cabal-file
(if other-window
(find-file-other-window cabal-file)
(find-file cabal-file))
(error "Could not locate \".cabal\" file for %S" buffer-file-name)))
(error "Cannot locate \".cabal\" file for buffers not visiting any file")))