Skip to content

Commit

Permalink
Version bump haskell-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilfred committed Dec 29, 2023
1 parent 1585eb1 commit 1c8ca2f
Show file tree
Hide file tree
Showing 48 changed files with 845 additions and 919 deletions.
17 changes: 0 additions & 17 deletions elpa/haskell-mode-20210908.1543/haskell-mode-pkg.el

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ This file uses Org mode. Some useful (default) key-bindings:
- Use "<backtab>" to cycle visibility of all nodes
- Use "C-c C-o" to open links

* Changes in 17.5

- See [[https://github.com/haskell/haskell-mode/compare/v17.4...v17.5][Git history]]

* Changes in 17.4

- See [[https://github.com/haskell/haskell-mode/compare/v17.3...v17.4][Git history]]

* Changes in 17.3

- See [[https://github.com/haskell/haskell-mode/compare/v17.2...v17.3][Git history]]

* Changes in 17.2

- See [[https://github.com/haskell/haskell-mode/compare/v17.1...v17.2][Git history]]

* Changes in 17.1

- Require at least Emacs 25.1
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
(require 'haskell-mode)
(require 'haskell-font-lock)

;;;###autoload
(defgroup ghc-core nil
"Major mode for viewing pretty printed GHC Core output."
:link '(custom-manual "(haskell-mode)")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
(defun ghci-script-mode-load ()
"Load the current script file into the GHCi session."
(interactive)
(let ((buffer (haskell-session-interactive-buffer (haskell-session)))
(filename (buffer-file-name)))
(save-buffer)
(save-buffer)
(let ((filename (buffer-file-name))
(buffer (haskell-session-interactive-buffer (haskell-session))))
(with-current-buffer buffer
(set-marker haskell-interactive-mode-prompt-start (point-max))
(haskell-interactive-mode-run-expr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
(opt (+ ,ws)
(group-n 3
"as")))
;; TODO: fun hook highlighting is incompelete
;; TODO: fun hook highlighting is incomplete
(seq (group-n 2
(or "call"
"fun")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,22 +99,29 @@ By default these are:
(defvar haskell-cabal-font-lock-keywords
;; The comment syntax can't be described simply in syntax-table.
;; We could use font-lock-syntactic-keywords, but is it worth it?
'(("^[ \t]*--.*" . font-lock-comment-face)
("^ *\\([^ \t:]+\\):" (1 font-lock-keyword-face))
("^\\(Library\\)[ \t]*\\({\\|$\\)" (1 font-lock-keyword-face))
("^\\(Executable\\|Test-Suite\\|Benchmark\\|Common\\|package\\)[ \t]+\\([^\n \t]*\\)"
'(;; comments
("^[ \t]*--.*" . font-lock-comment-face)
;; fields ending in colon
("^ *\\([^ \t:]+\\):\\( +\\|$\\)" (1 font-lock-keyword-face))
;; stanzas that start a line, followed by an identifier
("^\\(Library\\|Executable\\|Test-Suite\\|Benchmark\\|Common\\|Package\\|Flag\\|Repository\\)[ \t]+\\([^\n \t]*\\)"
(1 font-lock-keyword-face) (2 font-lock-function-name-face))
("^\\(Flag\\|install-dirs\\|repository\\)[ \t]+\\([^\n \t]*\\)"
(1 font-lock-keyword-face) (2 font-lock-constant-face))
("^\\(Source-Repository\\)[ \t]+\\(head\\|this\\)"
(1 font-lock-keyword-face) (2 font-lock-constant-face))
("^\\(haddock\\|source-repository-package\\|program-locations\\|program-default-options\\)\\([ \t]\\|$\\)"
(1 font-lock-keyword-face))
("^ *\\(if\\)[ \t]+.*\\({\\|$\\)" (1 font-lock-keyword-face))
("^ *\\(}[ \t]*\\)?\\(else\\)[ \t]*\\({\\|$\\)"
(2 font-lock-keyword-face))
("\\<\\(?:True\\|False\\)\\>"
(0 font-lock-constant-face))))
;; stanzas that start a line, followed by a constant
("^\\(Source-Repository\\)[ \t]+\\(head\\|this\\)" (1 font-lock-keyword-face) (2 font-lock-constant-face))
;; stanzas that start a line, followed by a constant in cabal config
("^\\(install-dirs\\)[ \t]+\\(global\\|user\\)" (1 font-lock-keyword-face) (2 font-lock-constant-face))
;; stanzas that start a line
("^\\(Library\\|Custom-Setup\\|source-repository-package\\)[ \t]*$" (1 font-lock-keyword-face))
;; stanzas that start a line in cabal config
("^\\(haddock\\|init\\|program-locations\\|program-default-options\\)[ \t]*$" (1 font-lock-keyword-face))
;; stanzas that can live inside if-blocks
("^[ \t]*\\(program-options\\)$" (1 font-lock-keyword-face))
;; if clause
("^ *\\(if\\|elif\\)[ \t]+.*$" (1 font-lock-keyword-face))
;; else clause
("^ *\\(else\\)[ \t]*$" (1 font-lock-keyword-face))
;; True/False
("\\<\\(?:True\\|False\\)\\>" (0 font-lock-constant-face))))

(defvar haskell-cabal-buffers nil
"List of Cabal buffers.")
Expand Down Expand Up @@ -160,7 +167,7 @@ it from list if one of the following conditions are hold:
map))

;;;###autoload
(define-derived-mode haskell-cabal-mode fundamental-mode "Haskell-Cabal"
(define-derived-mode haskell-cabal-mode text-mode "Haskell-Cabal"
"Major mode for Cabal package description files."
(setq-local font-lock-defaults
'(haskell-cabal-font-lock-keywords t t nil nil))
Expand Down Expand Up @@ -232,8 +239,9 @@ file), then this function returns nil."

;;;###autoload
(defun haskell-cabal-get-dir (&optional use-defaults)
"Get the Cabal dir for a new project. Various ways of figuring this out,
and indeed just prompting the user. Do them all."
"Get the Cabal dir for a new project.
Various ways of figuring this out, and indeed just prompting the user. Do them
all."
(let* ((file (haskell-cabal-find-file))
(dir (if file (file-name-directory file) default-directory)))
(if use-defaults
Expand Down Expand Up @@ -348,7 +356,6 @@ OTHER-WINDOW use `find-file-other-window'."
"help"
"run"))

;;;###autoload
(defgroup haskell-cabal nil
"Haskell cabal files"
:group 'haskell
Expand All @@ -361,7 +368,9 @@ OTHER-WINDOW use `find-file-other-window'."
(defconst haskell-cabal-conditional-regexp "^[ \t]*\\(\\if\\|else\\|}\\)")

(defun haskell-cabal-classify-line ()
"Classify the current line into 'section-header 'subsection-header 'section-data 'comment and 'empty '"
"Classify the current line's type.
Possible results are \\='section-header \\='subsection-header \\='section-data
\\='comment and \\='empty"
(save-excursion
(beginning-of-line)
(cond
Expand Down Expand Up @@ -494,7 +503,8 @@ OTHER-WINDOW use `find-file-other-window'."
((equal component-type "benchmark") "bench"))))

(defun haskell-cabal-enum-targets (&optional process-type)
"Enumerate .cabal targets. PROCESS-TYPE determines the format of the returned target."
"Enumerate .cabal targets.
PROCESS-TYPE determines the format of the returned target."
(let ((cabal-file (haskell-cabal-find-file))
(process-type (if process-type process-type 'ghci)))
(when (and cabal-file (file-readable-p cabal-file))
Expand Down Expand Up @@ -699,22 +709,22 @@ Respect the COMMA-STYLE, see
`haskell-cabal-strip-list-and-detect-style' for the possible
styles."
(cl-case comma-style
('before
(before
(goto-char (point-min))
(while (haskell-cabal-ignore-line-p) (forward-line))
(indent-to 2)
(forward-line)
(haskell-cabal-each-line
(unless (haskell-cabal-ignore-line-p)
(insert ", "))))
('after
(after
(goto-char (point-max))
(while (equal 0 (forward-line -1))
(unless (haskell-cabal-ignore-line-p)
(end-of-line)
(insert ",")
(beginning-of-line))))
('single
(single
(goto-char (point-min))
(while (not (eobp))
(end-of-line)
Expand Down Expand Up @@ -924,9 +934,10 @@ resulting buffer-content. Unmark line at the end."
haskell-cabal-source-bearing-sections))))

(defun haskell-cabal-line-filename ()
"Expand filename in current line according to the subsection type
"Expand filename in current line according to the subsection type.
Module names in exposed-modules and other-modules are expanded by replacing each dot (.) in the module name with a forward slash (/) and appending \".hs\"
Module names in exposed-modules and other-modules are expanded by replacing each
dot (.) in the module name with a forward slash (/) and appending \".hs\"
Example: Foo.Bar.Quux ==> Foo/Bar/Quux.hs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"Returns `t' if line is empty or composed only of whitespace."
(save-excursion
(beginning-of-line)
(= (point-at-eol)
(= (line-end-position)
(progn (skip-chars-forward "[:blank:]") (point)))))

(defun haskell-indented-block ()
Expand Down Expand Up @@ -92,7 +92,7 @@ indentation if dir=-1"
(save-excursion
(goto-char (point-max))
(while (zerop (forward-line -1))
(goto-char (point-at-bol))
(goto-char (line-beginning-position))
(when (= (current-indentation) 0) (haskell-hide-toggle)))))

(defvar haskell-collapse-mode-map
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
(require 'haskell-utils)
(require 'highlight-uses-mode)
(require 'haskell-cabal)
(require 'haskell-ghc-support)

(defcustom haskell-mode-stylish-haskell-path "stylish-haskell"
"Path to `stylish-haskell' executable."
Expand Down Expand Up @@ -652,11 +653,11 @@ happened since function invocation)."
(cl-case res-type
;; neither popup presentation buffer
;; nor insert response in error case
('unknown-command
(unknown-command
(message "This command requires GHCi 8+ or GHCi-ng. Please read command description for details."))
('option-missing
(option-missing
(message "Could not infer type signature. You need to load file first. Also :set +c is required, see customization `haskell-interactive-set-+c'. Please read command description for details."))
('interactive-error (message "Wrong REPL response: %s" sig))
(interactive-error (message "Wrong REPL response: %s" sig))
(otherwise
(if insert-value
;; Only insert type signature and do not present it
Expand All @@ -676,9 +677,9 @@ happened since function invocation)."
(cdr (reverse haskell-utils-async-post-command-flag))))
;; Present the result only when response is valid and not asked
;; to insert result
(haskell-command-echo-or-present response)))
(haskell-command-echo-or-present response))))

(haskell-utils-async-stop-watching-changes init-buffer))))))))
(haskell-utils-async-stop-watching-changes init-buffer)))))))

(make-obsolete 'haskell-process-generate-tags
'haskell-mode-generate-tags
Expand Down Expand Up @@ -935,5 +936,14 @@ newlines and extra whitespace in signature before insertion."
(insert sig "\n")
(indent-to col)))))

(defun haskell-command-insert-language-pragma (extension)
"Insert a {-# LANGUAGE _ #-} pragma at the top of the current
buffer for the given extension."
(interactive
(list (completing-read "Extension: " haskell-ghc-supported-extensions)))
(save-excursion
(goto-char (point-min))
(insert (format "{-# LANGUAGE %s #-}\n" extension))))

(provide 'haskell-commands)
;;; haskell-commands.el ends here
Original file line number Diff line number Diff line change
Expand Up @@ -34,43 +34,47 @@
(require 'ansi-color)
(eval-when-compile (require 'subr-x))

;;;###autoload
(defgroup haskell-compile nil
"Settings for Haskell compilation mode"
:link '(custom-manual "(haskell-mode)compilation")
:group 'haskell)

(defcustom haskell-compile-cabal-build-command
"cabal build --ghc-option=-ferror-spans"
"Default build command to use for `haskell-cabal-build' when a cabal file is detected.
"Default build command to use for `haskell-cabal-build'.
It is used when a cabal file is detected.
For legacy compat, `%s' is replaced by the cabal package top folder."
:group 'haskell-compile
:type 'string)

(defcustom haskell-compile-cabal-build-alt-command
"cabal clean -s && cabal build --ghc-option=-ferror-spans"
"Alternative build command to use when `haskell-cabal-build' is called with a negative prefix argument.
"Alternative build command to use when `haskell-cabal-build'.
It is used when `haskell-cabal-build' is called with a negative prefix argument.
For legacy compat, `%s' is replaced by the cabal package top folder."
:group 'haskell-compile
:type 'string)

(defcustom haskell-compile-stack-build-command
"stack build --fast"
"Default build command to use for `haskell-stack-build' when a stack file is detected.
"Default build command to use for `haskell-stack-build'.
It is used when a stack file is detected.
For legacy compat, `%s' is replaced by the stack package top folder."
:group 'haskell-compile
:type 'string)

(defcustom haskell-compile-stack-build-alt-command
"stack clean && stack build --fast"
"Alternative build command to use when `haskell-stack-build' is called with a negative prefix argument.
"Alternative build command to use when `haskell-stack-build'.
It is used when `haskell-stack-build' is called with a negative prefix argument.
For legacy compat, `%s' is replaced by the stack package top folder."
:group 'haskell-compile
:type 'string)

(defcustom haskell-compile-command
"ghc -Wall -ferror-spans -fforce-recomp -c %s"
"Default build command to use for `haskell-cabal-build' when no cabal or stack file is detected.
"Default build command to use for `haskell-cabal-build'.
It is used when no cabal or stack file is detected.
The `%s' placeholder is replaced by the current buffer's filename."
:group 'haskell-compile
:type 'string)
Expand All @@ -84,8 +88,8 @@ The `%s' placeholder is replaced by the current buffer's filename."
(defcustom haskell-compiler-type
'auto
"Controls whether to use cabal, stack, or ghc to compile.
Auto (the default) means infer from the presence of a cabal or stack spec file,
following same rules as haskell-process-type."
Auto (the default) means infer from the presence of a cabal or stack spec file,
following same rules as haskell-process-type."
:type '(choice (const auto) (const ghc) (const stack) (const cabal))
:group 'haskell-compile)
(make-variable-buffer-local 'haskell-compiler-type)
Expand Down
Loading

0 comments on commit 1c8ca2f

Please sign in to comment.