Update packages

This commit is contained in:
Marcus Kammer 2019-12-12 21:36:58 +01:00
parent 1be5e9e070
commit 3487e6b386
26 changed files with 3654 additions and 2 deletions

View file

@ -83,7 +83,7 @@
'(package-enable-at-startup t) '(package-enable-at-startup t)
'(package-selected-packages '(package-selected-packages
(quote (quote
(flymake-eslint json-mode elpy darkroom dockerfile-mode ein spacemacs-theme flucui-themes leuven-theme htmlize scss-mode berrys-theme web-mode python-docstring sphinx-doc sphinx-frontend sphinx-mode ox-nikola racket-mode slime gherkin-mode powershell typescript-mode ob-http ob-ipython ob-restclient nord-theme restclient request restclient-test yaml-mode magit))) (elm-mode flymake-eslint json-mode elpy darkroom dockerfile-mode ein spacemacs-theme flucui-themes leuven-theme htmlize scss-mode berrys-theme web-mode python-docstring sphinx-doc sphinx-frontend sphinx-mode ox-nikola racket-mode slime gherkin-mode powershell typescript-mode ob-http ob-ipython ob-restclient nord-theme restclient request restclient-test yaml-mode magit)))
'(python-shell-interpreter "python3") '(python-shell-interpreter "python3")
'(register-preview-delay 2) '(register-preview-delay 2)
'(register-separator 43) '(register-separator 43)

1
bundle/newsfeeds.el Normal file
View file

@ -0,0 +1 @@

View file

@ -1 +1 @@
Good signature from 066DAFCB81E42C40 GNU ELPA Signing Agent (2019) <elpasign@elpa.gnu.org> (trust undefined) created at 2019-11-30T23:50:03+0100 using RSA Good signature from 066DAFCB81E42C40 GNU ELPA Signing Agent (2019) <elpasign@elpa.gnu.org> (trust undefined) created at 2019-12-07T23:05:03+0100 using RSA

View file

@ -0,0 +1,209 @@
;;; elm-font-lock.el --- Font locking module for Elm mode.
;; Copyright (C) 2013, 2014 Joseph Collard
;; Copyright (C) 2015 Bogdan Popa
;; Authors: Joseph Collard
;; URL: https://github.com/jcollard/elm-mode
;; This file is not part of GNU Emacs.
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(require 'font-lock)
(require 'rx)
(defgroup elm-font-lock nil
"Font locking for Elm code."
:group 'faces)
(defface elm-font-lock-operators
'((t :inherit font-lock-builtin-face))
"The default face used to highlight operators inside expressions."
:group 'elm-font-lock)
(defcustom elm-font-lock-operators-face 'elm-font-lock-operators
"The face used to highlight operators inside expressions.
To disable this highlighting, set this to nil."
:type '(choice (const nil)
face)
:group 'elm-font-lock)
(defface elm-font-lock-multiline-list-delimiters
'((t :inherit font-lock-keyword-face))
"The default face used to highlight brackets and commas in multiline lists."
:group 'elm-font-lock)
(defcustom elm-font-lock-multiline-list-delimiters-face 'elm-font-lock-multiline-list-delimiters
"The face used to highlight brackets and commas in multilist lists.
To disable this highlighting, set this to nil."
:type '(choice (const nil)
face)
:group 'elm-font-lock)
(defconst elm--keywords
'("let" "case" "in" "if" "of" "then" "else" "effect"
"module" "import" "as" "exposing" "type" "where"
"alias" "port" "infix" "infixr" "infixl")
"Reserved keywords.")
(defconst elm--regexp-keywords
(regexp-opt elm--keywords 'symbols)
"A regular expression representing the reserved keywords.")
(defconst elm--font-lock-keywords
(cons elm--regexp-keywords font-lock-keyword-face)
"Highlighting for keywords.")
(defun elm--syntax-stringify ()
"Syntax propertize triple quoted strings."
(let* ((ppss (save-excursion
(backward-char 3)
(syntax-ppss)))
(string-started (and (not (nth 4 ppss)) (nth 8 ppss)))
(quote-starting-pos (- (point) 3))
(quote-ending-pos (point)))
(if (not string-started)
(put-text-property quote-starting-pos (1+ quote-starting-pos)
'syntax-table (string-to-syntax "|"))
(put-text-property (1- quote-ending-pos) quote-ending-pos
'syntax-table (string-to-syntax "|")))))
(defconst elm--syntax-propertize
(syntax-propertize-rules
;;; Syntax rule for char literals
((rx (and (1+ " ")
(group "'")
(optional "\\") any
(group "'")))
(1 "\"")
(2 "\""))
((rx (and (or point
(not (any ?\\ ?\"))
(and (or (not (any ?\\)) point) ?\\ (* ?\\ ?\\) (any ?\")))
(* ?\\ ?\\)
"\"\"\""))
(0 (ignore (elm--syntax-stringify))))))
(defun elm--syntax-propertize-function (begin end)
"Mark special lexemes between BEGIN and END."
(funcall elm--syntax-propertize begin end)
(save-excursion
(goto-char begin)
(while (re-search-forward "\\\\[({]" end t)
(let ((open (match-beginning 0)))
(add-text-properties open (1+ open) '(syntax-table (1 . nil)))))))
(defvar elm--syntax-table
(let ((st (make-syntax-table)))
;;; Syntax entry for {- -} type comments.
(modify-syntax-entry ?\{ "(}1nb" st)
(modify-syntax-entry ?\} "){4nb" st)
(modify-syntax-entry ?- ". 123" st)
(modify-syntax-entry ?\n ">" st)
(modify-syntax-entry ?\" "\"\"" st)
(modify-syntax-entry ?\\ "\\" st)
st))
;;; Name regexp is according to https://github.com/elm-lang/elm-compiler/blob/353930a474fee4d833f962100edde70417691bca/src/Parse/Helpers.hs#L65
(defconst elm--regexp-function
"^\\([a-z_][0-9A-Za-z_']*\\|([^)]+)\\)"
"A regular expression representing function names.")
(defconst elm--font-lock-functions
(cons elm--regexp-function font-lock-function-name-face)
"Highlighting for function names.")
(defconst elm--regexp-type
"\\<[A-Z][0-9A-Za-z_']*"
"A regular expression representing modules and types.")
(defconst elm--font-lock-types
(cons elm--regexp-type font-lock-type-face)
"Highlighting for module names and types.")
(defconst elm--regexp-operators
(concat "\\(" "`[^`]+`"
"\\|" "\\B\\\\"
"\\|" "[-+*/\\\\|<>=:!@#$%^&,.]+"
"\\)")
"A regular expression representing operators inside expressions.")
(defconst elm--font-lock-operators
(cons elm--regexp-operators '(1 elm-font-lock-operators-face))
"Highlighting for operators inside expressions.")
(defconst elm--regexp-multiline-list-comma-closing-brackets
(concat "^[[:space:]]*" (regexp-opt '("," "]" "}") t))
"A regular expression representing commas and closing brackets in multiline lists and records.")
(defconst elm--font-lock-multiline-list-comma-closing-brackets
(cons elm--regexp-multiline-list-comma-closing-brackets
'(1 elm-font-lock-multiline-list-delimiters-face))
"Highlighting for commas and closing brackets in multiline lists and records.")
(defun elm--match-multiline-list-opening-bracket (limit)
"Highlighting search function for opening brackets in multiline lists and records.
Also highlights opening brackets without a matching bracket."
(when (elm--search-forward-opening-bracket limit)
(let ((opening (point))
(eol (line-end-position))
(closing (elm--search-forward-closing-bracket)))
(if (or (= closing opening) (> closing eol))
(progn
(set-match-data (match-data))
(goto-char (+ 1 opening))
t)
(elm--match-multiline-list-opening-bracket limit)))))
(defun elm--search-forward-opening-bracket (limit)
"Go to the next opening bracket up to LIMIT."
(if (search-forward-regexp (regexp-opt '("[" "{")) limit t)
(progn
(backward-char)
t)))
(defun elm--search-forward-closing-bracket ()
"Go to the next matching bracket, assuming that the cursor is on an opening bracket."
(ignore-errors
(save-match-data
(forward-sexp)))
(point))
(defconst elm--font-lock-multiline-list-opening-brackets
'(elm--match-multiline-list-opening-bracket (0 elm-font-lock-multiline-list-delimiters-face))
"Highlighting for opening brackets in multiline lists and records.")
(defconst elm--font-lock-highlighting
(list (list elm--font-lock-keywords
elm--font-lock-functions
elm--font-lock-types
elm--font-lock-multiline-list-comma-closing-brackets
elm--font-lock-multiline-list-opening-brackets
elm--font-lock-operators)
nil nil))
(defun turn-on-elm-font-lock ()
"Turn on Elm font lock."
(setq font-lock-multiline t)
(set-syntax-table elm--syntax-table)
(set (make-local-variable 'syntax-propertize-function) #'elm--syntax-propertize-function)
(set (make-local-variable 'font-lock-defaults) elm--font-lock-highlighting))
(provide 'elm-font-lock)
;;; elm-font-lock.el ends here

Binary file not shown.

View file

@ -0,0 +1,66 @@
;;; elm-format.el --- Automatically format an Elm buffer.
;; Copyright (C) 2015 Bogdan Popa
;; Author: Bogdan Popa
;; URL: https://github.com/jcollard/elm-mode
;; This file is not part of GNU Emacs.
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(require 'reformatter)
(defcustom elm-format-on-save nil
"When non-nil, run `elm-format-buffer' on save.
This variable is obsolete, and you should prefer to enable
`elm-format-on-save-mode' by adding it to your `elm-mode-hook',
or by placing a clause like the following in the .dir-locals.el
for your project:
((elm-mode (mode . elm-format-on-save)))"
:group 'elm-format
:type 'boolean)
(defcustom elm-format-elm-version "0.19"
"The version of Elm against which code should be formatted."
:group 'elm-format
:type '(choice (const :tag "Default: 0.19" "0.19")
(const :tag "0.18" "0.18")
(const :tag "0.17" "0.17")
(const :tag "0.16" "0.16")))
(defcustom elm-format-command "elm-format"
"The name of the `elm-format' command."
:group 'elm-format
:type 'string)
;;;###autoload (autoload 'elm-format-buffer "elm-format" nil t)
;;;###autoload (autoload 'elm-format-on-save-mode "elm-format" nil t)
(reformatter-define elm-format
:program elm-format-command
:args (list "--stdin" "--elm-version" elm-format-elm-version "--yes")
:group 'elm-format
:lighter " ElmFmt")
;;;###autoload
(define-obsolete-function-alias 'elm-mode-format-buffer 'elm-format-buffer "20190113")
(provide 'elm-format)
;;; elm-format.el ends here

Binary file not shown.

View file

@ -0,0 +1,17 @@
;;; elm-imenu.el --- imenu support for elm
;;; Commentary:
;;; Code:
(require 'imenu)
(defun elm-imenu-create-index ()
"Create an imenu index for the current buffer."
(save-excursion
(imenu--generic-function
'(("Type" "^type \\([A-Z][^ \n]+\\)" 1)
("Type Alias" "^type alias \\([A-Z][^ \n]+\\)" 1)
("Port" "^port \\([^ ]+\\)" 1)
("Function" "^\\([^ ]+\\) :" 1)))))
(provide 'elm-imenu)
;;; elm-imenu.el ends here

Binary file not shown.

File diff suppressed because it is too large Load diff

Binary file not shown.

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -0,0 +1,263 @@
;;; elm-mode-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "elm-font-lock" "elm-font-lock.el" (0 0 0 0))
;;; Generated autoloads from elm-font-lock.el
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "elm-font-lock" '("turn-on-elm-font-lock" "elm-")))
;;;***
;;;### (autoloads nil "elm-format" "elm-format.el" (0 0 0 0))
;;; Generated autoloads from elm-format.el
(autoload 'elm-format-buffer "elm-format" nil t)
(autoload 'elm-format-on-save-mode "elm-format" nil t)
(define-obsolete-function-alias 'elm-mode-format-buffer 'elm-format-buffer "20190113")
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "elm-format" '("elm-format-")))
;;;***
;;;### (autoloads nil "elm-imenu" "elm-imenu.el" (0 0 0 0))
;;; Generated autoloads from elm-imenu.el
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "elm-imenu" '("elm-imenu-create-index")))
;;;***
;;;### (autoloads nil "elm-indent" "elm-indent.el" (0 0 0 0))
;;; Generated autoloads from elm-indent.el
(autoload 'elm-indent-mode "elm-indent" "\
``Intelligent'' Elm indentation mode.
This deals with the layout rules of Elm.
\\[elm-indent-cycle] starts the cycle which proposes new
possibilities as long as the TAB key is pressed. Any other key
or mouse click terminates the cycle and is interpreted except for
RET which merely exits the cycle.
Other special keys are:
\\[elm-indent-insert-equal]
inserts an =
Invokes `elm-indent-hook' if not nil.
\(fn &optional ARG)" t nil)
(define-obsolete-function-alias 'turn-on-elm-indent 'elm-indent-mode)
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "elm-indent" '("turn-off-elm-indent" "elm-indent-")))
;;;***
;;;### (autoloads nil "elm-interactive" "elm-interactive.el" (0 0
;;;;;; 0 0))
;;; Generated autoloads from elm-interactive.el
(autoload 'elm-interactive-mode "elm-interactive" "\
Major mode for `run-elm-interactive'.
\\{elm-interactive-mode-map}
\(fn)" t nil)
(autoload 'run-elm-interactive "elm-interactive" "\
Run an inferior instance of `elm-repl' inside Emacs.
\(fn)" t nil)
(autoload 'elm-repl-load "elm-interactive" "\
Load an interactive REPL if there isn't already one running.
Changes the current root directory to be the directory with the closest
package json if one exists otherwise sets it to be the working directory
of the file specified.
\(fn)" t nil)
(autoload 'elm-repl-push "elm-interactive" "\
Push the region from BEG to END to an interactive REPL.
\(fn BEG END)" t nil)
(autoload 'elm-repl-push-decl "elm-interactive" "\
Push the current top level declaration to the REPL.
\(fn)" t nil)
(autoload 'run-elm-reactor "elm-interactive" "\
Run the Elm reactor process.
\(fn)" t nil)
(autoload 'elm-preview-buffer "elm-interactive" "\
Preview the current buffer using Elm reactor (in debug mode if DEBUG is truthy).
\(fn DEBUG)" t nil)
(autoload 'elm-preview-main "elm-interactive" "\
Preview the main elm file using Elm reactor (in debug mode if DEBUG is truthy).
\(fn DEBUG)" t nil)
(autoload 'elm-compile-buffer "elm-interactive" "\
Compile the current buffer into OUTPUT.
\(fn &optional OUTPUT)" t nil)
(autoload 'elm-compile-main "elm-interactive" "\
Compile the main elm file into OUTPUT.
\(fn &optional OUTPUT)" t nil)
(autoload 'elm-compile-clean-imports "elm-interactive" "\
Remove unused imports from the current buffer, PROMPT optionally before deleting.
\(fn &optional PROMPT)" t nil)
(autoload 'elm-sort-imports "elm-interactive" "\
Sort the import list in the current buffer.
\(fn)" t nil)
(autoload 'elm-compile-add-annotations "elm-interactive" "\
Add missing type annotations to the current buffer, PROMPT optionally before inserting.
\(fn &optional PROMPT)" t nil)
(autoload 'elm-create-package "elm-interactive" "\
Generate a new package definition in the current directory.
\(fn)" t nil)
(autoload 'elm-package-catalog "elm-interactive" "\
Show the package catalog, refreshing the list if REFRESH is truthy.
\(fn REFRESH)" t nil)
(autoload 'elm-package-refresh-contents "elm-interactive" "\
Refresh the package list.
\(fn)" t nil)
(autoload 'elm-import "elm-interactive" "\
Import a module, refreshing if REFRESH is truthy.
\(fn REFRESH)" t nil)
(autoload 'elm-documentation-lookup "elm-interactive" "\
Lookup the documentation for a function, refreshing if REFRESH is truthy.
\(fn REFRESH)" t nil)
(autoload 'elm-package-mode "elm-interactive" "\
Special mode for elm-package.
\\{elm-package-mode-map}
\(fn)" t nil)
(autoload 'elm-oracle-type-at-point "elm-interactive" "\
Print the type of the function at point to the minibuffer.
\(fn)" t nil)
(autoload 'elm-eldoc "elm-interactive" "\
Get the type of the function at point for eldoc.
\(fn)" nil nil)
(autoload 'elm-oracle-doc-at-point "elm-interactive" "\
Show the documentation of the value at point.
\(fn)" t nil)
(autoload 'elm-oracle-completion-at-point-function "elm-interactive" "\
Completion at point function for elm-oracle.
\(fn)" nil nil)
(autoload 'elm-oracle-setup-completion "elm-interactive" "\
Set up standard completion.
Add this function to your `elm-mode-hook' to enable an
elm-specific `completion-at-point' function.
\(fn)" nil nil)
(autoload 'elm-oracle-setup-ac "elm-interactive" "\
Set up auto-complete support.
Add this function to your `elm-mode-hook'.
\(fn)" nil nil)
(autoload 'company-elm "elm-interactive" "\
Provide completion info according to COMMAND and ARG. IGNORED is not used.
\(fn COMMAND &optional ARG &rest IGNORED)" t nil)
(autoload 'elm-test-project "elm-interactive" "\
Run the elm-test command on the current project.
\(fn)" t nil)
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "elm-interactive" '("elm-" "ac-source-elm")))
;;;***
;;;### (autoloads nil "elm-mode" "elm-mode.el" (0 0 0 0))
;;; Generated autoloads from elm-mode.el
(autoload 'elm-mode "elm-mode" "\
Major mode for editing Elm source code.
\(fn)" t nil)
(add-to-list 'auto-mode-alist '("\\.elm\\'" . elm-mode))
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "elm-mode" '("elm-")))
;;;***
;;;### (autoloads nil "elm-tags" "elm-tags.el" (0 0 0 0))
;;; Generated autoloads from elm-tags.el
(autoload 'elm-mode-goto-tag-at-point "elm-tags" "\
Go to tag at point.
\(fn)" t nil)
(autoload 'elm-mode-generate-tags "elm-tags" "\
Generate a TAGS file for the current project.
\(fn)" t nil)
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "elm-tags" '("elm-tags-")))
;;;***
;;;### (autoloads nil "elm-util" "elm-util.el" (0 0 0 0))
;;; Generated autoloads from elm-util.el
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "elm-util" '("elm-")))
;;;***
;;;### (autoloads nil nil ("elm-mode-pkg.el") (0 0 0 0))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; elm-mode-autoloads.el ends here

View file

@ -0,0 +1,16 @@
(define-package "elm-mode" "20191125.1919" "Major mode for Elm"
'((f "0.17")
(let-alist "1.0.4")
(seq "2.2")
(s "1.7.0")
(emacs "24.4")
(dash "2.13.0")
(reformatter "0.3"))
:authors
'(("Joseph Collard"))
:maintainer
'("Joseph Collard")
:url "https://github.com/jcollard/elm-mode")
;; Local Variables:
;; no-byte-compile: t
;; End:

View file

@ -0,0 +1,181 @@
;;; elm-mode.el --- Major mode for Elm
;; Copyright (C) 2013, 2014 Joseph Collard
;; Copyright (C) 2015, 2016 Bogdan Popa
;; Author: Joseph Collard
;; Package-Requires: ((f "0.17") (let-alist "1.0.4") (seq "2.2") (s "1.7.0") (emacs "24.4") (dash "2.13.0") (reformatter "0.3"))
;; URL: https://github.com/jcollard/elm-mode
;; This file is not part of GNU Emacs.
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Provides a major mode for editing Elm source code, and working with
;; common core and third-party Elm tools including the compiler, repl,
;; elm-format and more.
;;; Code:
(require 'elm-tags)
(require 'elm-format)
(require 'elm-imenu)
(require 'elm-indent)
(require 'elm-interactive)
(require 'elm-font-lock)
(defgroup elm nil
"Support for the elm programming language."
:link '(url-link :tag "Github" "https://github.com/jcollard/elm-mode")
:group 'languages)
(defun elm-beginning-of-defun (&optional arg)
"Move backward to the beginning of an ELM \"defun\".
With ARG, do it that many times. Negative arg -N means move
forward to Nth following beginning of defun. Returns t unless
search stops due to beginning or end of buffer.
Find the roots of this function in the c-awk-mode."
(interactive "p")
(or arg (setq arg 1))
(save-match-data
(let ((found t) ; Has the most recent regexp search found b-of-defun?
(regexp "^[^- \t\n\r]"))
(if (>= arg 0)
;; Go back one defun each time round the following loop. (For +ve arg)
(while (and found (< 0 arg) (not (eq (point) (point-min))))
;; Go back one "candidate" each time round the next loop until one
;; is genuinely a beginning-of-defun.
(setq found (search-backward-regexp
regexp (point-min) 'stop-at-limit))
(when found
(while (and (forward-line -1)
(looking-at regexp)
(not (= (point-min) (point)))))
(forward-line))
(setq arg (1- arg)))
;; The same for a -ve arg.
(if (not (eq (point) (point-max))) (forward-char 1))
(while (and found (< arg 0) (not (eq (point) (point-max)))) ; The same for -ve arg.
(setq found (search-forward-regexp
regexp (point-min) 'stop-at-limit))
(setq arg (1+ arg))))
(eq arg 0))))
(defun elm-end-of-defun (&optional arg)
"Move forward to the end of an ELM \"defun\".
With ARG, do it that many times. Negative arg -N means move
forward to Nth previous end of defun. Returns t unless
search stops due to beginning or end of buffer.
Find the roots of this function in the c-awk-mode."
(interactive "p")
(or arg (setq arg 1))
(save-match-data
(let ((found t) ; Has the most recent regexp search found b-of-defun?
(regexp "^\n\n"))
(if (>= arg 0)
;; Go back one defun each time round the following loop. (For +ve arg)
(while (and found (< 0 arg) (not (eq (point) (point-max))))
;; Go back one "candidate" each time round the next loop until one
;; is genuinely a beginning-of-defun.
(setq found (search-forward-regexp
regexp
(point-max) 'stop-at-limit))
(setq arg (1- arg)))
;; The same for a -ve arg.
(if (not (eq (point) (point-min))) (forward-char 1))
(while (and found (< arg 0) (not (eq (point) (point-min)))) ; The same for -ve arg.
(setq found (search-backward-regexp
regexp (point-min) 'stop-at-limit))
(setq arg (1+ arg)))
(if found (goto-char (match-beginning 0))))
(eq arg 0))))
(defun elm-mode-after-save-handler ()
"Perform various operations upon saving a buffer."
(when elm-sort-imports-on-save
(elm-sort-imports))
(when elm-tags-on-save
(elm-mode-generate-tags))
(when (or elm-sort-imports-on-save
elm-tags-on-save)
(let ((before-save-hook '())
(after-save-hook '()))
(basic-save-buffer))))
(defvar elm-mode-map
(let ((map (make-keymap)))
(define-key map (kbd "C-c C-f") 'elm-mode-format-buffer)
(define-key map (kbd "C-c M-t") 'elm-mode-generate-tags)
(define-key map (kbd "M-.") 'elm-mode-goto-tag-at-point)
(define-key map (kbd "M-,") 'pop-tag-mark)
(define-key map (kbd "C-c C-l") 'elm-repl-load)
(define-key map (kbd "C-c C-p") 'elm-repl-push)
(define-key map (kbd "C-c C-e") 'elm-repl-push-decl)
(define-key map (kbd "C-c C-z") 'run-elm-interactive)
(define-key map (kbd "C-c C-a") 'elm-compile-add-annotations)
(define-key map (kbd "C-c C-r") 'elm-compile-clean-imports)
(define-key map (kbd "C-c C-c") 'elm-compile-buffer)
(define-key map (kbd "C-c M-c") 'elm-compile-main)
(define-key map (kbd "C-c M-k") 'elm-package-catalog)
(define-key map (kbd "C-c C-n") 'elm-preview-buffer)
(define-key map (kbd "C-c C-m") 'elm-preview-main)
(define-key map (kbd "C-c C-d") 'elm-documentation-lookup)
(define-key map (kbd "C-c C-i") 'elm-import)
(define-key map (kbd "C-c C-s") 'elm-sort-imports)
(define-key map (kbd "C-c C-t") 'elm-oracle-type-at-point)
(define-key map (kbd "C-c M-d") 'elm-oracle-doc-at-point)
(define-key map (kbd "C-c C-v") 'elm-test-project)
map)
"Keymap for Elm major mode.")
;;;###autoload
(define-derived-mode elm-mode prog-mode "Elm"
"Major mode for editing Elm source code."
(setq-local indent-tabs-mode nil)
;; Elm is not generally suitable for electric indentation, since
;; there is no unambiguously correct indent level for any given
;; line.
(when (boundp 'electric-indent-inhibit)
(setq-local electric-indent-inhibit t))
(setq-local comment-start "--")
(setq-local comment-end "")
(setq-local imenu-create-index-function #'elm-imenu-create-index)
(setq-local paragraph-separate "\\(\r\t\n\\|-}\\)$")
(setq-local beginning-of-defun-function #'elm-beginning-of-defun)
(setq-local end-of-defun-function #'elm-end-of-defun)
(add-function :before-until (local 'eldoc-documentation-function) #'elm-eldoc)
(when elm-format-on-save
(elm-format-on-save-mode))
(add-hook 'after-save-hook #'elm-mode-after-save-handler nil t)
(turn-on-elm-font-lock))
;; We enable intelligent indenting, but users can remove this from the
;; hook if they prefer.
(add-hook 'elm-mode-hook 'elm-indent-mode)
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.elm\\'" . elm-mode))
(provide 'elm-mode)
;;; elm-mode.el ends here

Binary file not shown.

View file

@ -0,0 +1,71 @@
;;; elm-tags.el --- etags support for Elm.
;; Copyright (C) 2016 Bogdan Popa
;; Author: Bogdan Popa
;; URL: https://github.com/jcollard/elm-mode
;; This file is not part of GNU Emacs.
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(require 'elm-util)
(require 'f)
(defcustom elm-tags-on-save nil
"Controls whether or not TAGS files should be generated on save."
:group 'elm-tags
:type 'boolean)
(defcustom elm-tags-exclude-elm-stuff t
"Controls whether or not sources in the `elm-stuff' directory should be excluded from the TAGS file."
:group 'elm-tags
:type 'boolean)
(defconst elm-tags-regexps
(f-join
(f-dirname load-file-name)
"elm.tags"))
;;;###autoload
(defun elm-mode-goto-tag-at-point ()
"Go to tag at point."
(interactive)
(let ((tag (find-tag-default)))
(unless tag
(user-error "No tag candidate found around point"))
(find-tag tag)))
;;;###autoload
(defun elm-mode-generate-tags ()
"Generate a TAGS file for the current project."
(interactive)
(when (elm--has-dependency-file)
(let* ((default-directory (elm--find-dependency-file-path))
(find-command "find . -type f -name \"*.elm\" -print")
(exclude-command (if elm-tags-exclude-elm-stuff
(concat find-command " | egrep -v elm-stuff")
find-command))
(etags-command (concat
exclude-command
" | etags --language=none --regex=@"
(shell-quote-argument elm-tags-regexps)
" -")))
(call-process-shell-command (concat etags-command "&") nil 0))))
(provide 'elm-tags)
;;; elm-tags.el ends here

Binary file not shown.

View file

@ -0,0 +1,153 @@
;;; elm-utils.el --- General utility functions used by Elm mode modules.
;; Copyright (C) 2013, 2014 Joseph Collard
;; Copyright (C) 2015 Bogdan Popa
;; Author: Joseph Collard
;; URL: https://github.com/jcollard/elm-mode
;; This file is not part of GNU Emacs.
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(require 'f)
(require 'json)
(require 'let-alist)
(require 's)
(require 'haskell-decl-scan nil 'noerror)
(require 'inf-haskell nil 'noerror)
(defcustom elm-main-file "Main.elm"
"Allows for a custom main file to be specified."
:type 'string
:group 'elm-util)
(defcustom elm-flash-duration 0.40
"Time in seconds for which declarations will be highlighted when applicable."
:type 'number
:group 'elm-util)
(defcustom elm-package-json
"elm-package.json"
"The name of the package JSON configuration file.
Set to \"elm.json\" for use with Elm 0.19."
:type 'string
:group 'elm-util)
(defun elm--get-module-name ()
"Return the qualified name of the module in the current buffer."
(save-excursion
(goto-char (point-min))
(unless (re-search-forward "module +\\([A-Z][A-Za-z0-9.]*\\)" nil t)
(error "Module declaration not found"))
(buffer-substring-no-properties (match-beginning 1) (match-end 1))))
(defun elm--get-decl ()
"Return the current declaration.
Relies on `haskell-mode' stuff."
(unless (fboundp #'haskell-ds-backward-decl)
(error "This functionality requires haskell-mode"))
(save-excursion
(goto-char (1+ (point)))
(let* ((start (or (haskell-ds-backward-decl) (point-min)))
(end (or (haskell-ds-forward-decl) (point-max)))
(raw-decl (s-trim-right (buffer-substring start end)))
(lines (split-string raw-decl "\n"))
(first-line (car lines))
;; Shadow the defcustom pulse-delay variable.
(pulse-delay (/ elm-flash-duration 10.0)))
(pulse-momentary-highlight-region start end)
(if (string-match-p "^[a-z].*:" first-line)
(cdr lines)
lines))))
(defun elm--build-import-statement ()
"Generate a statement that will import the current module."
(concat "import " (elm--get-module-name) " exposing (..) \n"))
(defun elm--get-buffer-dirname ()
"Return the absolute dirname of the current buffer."
(file-name-as-directory default-directory))
(defun elm--buffer-local-file-name ()
"Return the current file name relative to the dependency file."
(let ((dirname (buffer-file-name))
(deppath (elm--find-dependency-file-path)))
(f-relative dirname deppath)))
(defun elm--find-elm-test-root-directory ()
"Find the directory from which to run \"elm-test\".
This is determined by looking for the closest parent directory
which is not called \"tests\" and which contains a file named as
per the `elm-package-json' variable."
(or (locate-dominating-file
default-directory
(lambda (dir)
(and (not (s-suffix-p "/tests/" dir))
(file-exists-p (expand-file-name elm-package-json dir)))))
(error "No %s found in non-test parent directories" elm-package-json)))
(defun elm--find-dependency-file-path ()
"Recursively search for a directory containing a package JSON file."
(or (locate-dominating-file default-directory elm-package-json)
(file-name-as-directory (f-dirname (buffer-file-name)))))
(defun elm--has-dependency-file ()
"Check if a dependency file exists."
(f-exists? (f-join (elm--find-dependency-file-path) elm-package-json)))
(declare-function elm-create-package "elm-interactive.el" nil)
(defun elm--assert-dependency-file ()
"Report an error unless there is a package file."
(unless (elm--has-dependency-file)
(if (yes-or-no-p "Elm package file not found. Create a new package?")
(call-interactively #'elm-create-package)
(error "Elm package file not found"))))
(defun elm--read-dependency-file ()
"Find and read the JSON dependency file into an object."
(elm--assert-dependency-file)
(let ((dep-file (f-join (elm--find-dependency-file-path) elm-package-json)))
(json-read-file dep-file)))
(defun elm--find-main-file ()
"Find the main elm file."
(let-alist (elm--read-dependency-file)
(let ((source-dir (aref .source-directories 0)))
(if (equal "." source-dir)
elm-main-file
(f-join source-dir elm-main-file)))))
(defun elm--shell-and-command ()
"Determine the appropriate 'and' command for the current shell.
Currently only special cases the Fish shell, returning '; and ' when
Fish is used as the default system shell. Returns ' && ' in all other
cases."
;; TODO: Windows?
(let* ((shell (getenv "SHELL"))
(executable (car (reverse (s-split "/" shell)))))
(pcase executable
("fish" "; and ")
(_ " && "))))
(provide 'elm-util)
;;; elm-util.el ends here

Binary file not shown.

View file

@ -0,0 +1,4 @@
/^module +\([^ ]+\)/\1/
/^ +[=|] *\([A-Z][^ ]*\)/\1/
/^\(type +alias\|type\) +\([^ ]+\)/\2/
/^\((\([^)]+\))\|[^ ]+\).*=/\1/

View file

@ -0,0 +1,74 @@
;;; reformatter-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "reformatter" "reformatter.el" (0 0 0 0))
;;; Generated autoloads from reformatter.el
(autoload 'reformatter-define "reformatter" "\
Define a reformatter command with NAME.
When called, the reformatter will use PROGRAM and any ARGS to
reformat the current buffer. The contents of the buffer will be
passed as standard input to the reformatter, which should output
them to standard output. A nonzero exit code will be reported as
failure, and the output of the command to standard error will be
displayed to the user.
The macro accepts the following keyword arguments:
:program (required)
Provides a form which should evaluate to a string at runtime,
e.g. a literal string, or the name of a variable which holds
the program path.
:args
If provided, this is a form which evaluates to a list of
strings at runtime. Default is the empty list.
:mode
Unless nil, also generate a minor mode that will call the
reformatter command from `before-save-hook' when enabled.
Default is t.
:group
If provided, this is the custom group used for any generated
modes or custom variables. Don't forget to declare this group
using a `defgroup' form.
:lighter
If provided, this is a mode lighter string which will be used
for the \"-on-save\" minor mode. It should have a leading
space. The supplied value will be used as the default for a
generated custom variable which specifies the mode lighter.
Default is nil, ie. no lighter.
:keymap
If provided, this is the symbol name of the \"-on-save\" mode's
keymap, which you must declare yourself. Default is no keymap.
\(fn NAME &key PROGRAM ARGS (MODE t) LIGHTER KEYMAP GROUP)" nil t)
(function-put 'reformatter-define 'lisp-indent-function 'defun)
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "reformatter" '("reformatter-replace-buffer-contents-from-file")))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; reformatter-autoloads.el ends here

View file

@ -0,0 +1,2 @@
;;; -*- no-byte-compile: t -*-
(define-package "reformatter" "20191103.357" "Define commands which run reformatters on the current buffer" '((emacs "24.3")) :commit "6c5e7f64c5ac1178dff5ca28d9809c08398fb3e6" :keywords '("convenience" "tools") :authors '(("Steve Purcell" . "steve@sanityinc.com")) :maintainer '("Steve Purcell" . "steve@sanityinc.com") :url "https://github.com/purcell/reformatter.el")

View file

@ -0,0 +1,227 @@
;;; reformatter.el --- Define commands which run reformatters on the current buffer -*- lexical-binding: t; -*-
;; Copyright (C) 2019 Steve Purcell
;; Author: Steve Purcell <steve@sanityinc.com>
;; Keywords: convenience, tools
;; Homepage: https://github.com/purcell/reformatter.el
;; Package-Requires: ((emacs "24.3"))
;; Package-Version: 20191103.357
;; Package-X-Original-Version: 0
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; This library lets elisp authors easily define an idiomatic command
;; to reformat the current buffer using a command-line program,
;; together with an optional minor mode which can apply this command
;; automatically on save.
;; In its initial release it supports only reformatters which read
;; from stdin and write to stdout, but a more versatile interface will
;; be provided as development continues.
;; As an example, let's define a reformat command that applies the
;; "dhall format" command. We'll assume here that we've already defined a
;; variable `dhall-command' which holds the string name or path of the
;; dhall executable:
;; (reformatter-define dhall-format
;; :program dhall-command
;; :args '("format"))
;; The `reformatter-define' macro expands to code which generates
;; `dhall-format-buffer' and `dhall-format-region' interactive
;; commands, and a local minor mode called
;; `dhall-format-on-save-mode'. The :args" and :program expressions
;; will be evaluated at runtime, so they can refer to variables that
;; may (later) have a buffer-local value. A custom variable will be
;; generated for the mode lighter, with the supplied value becoming
;; the default.
;; The generated minor mode allows idiomatic per-directory or per-file
;; customisation, via the "modes" support baked into Emacs' file-local
;; and directory-local variables mechanisms. For example, users of
;; the above example might add the following to a project-specific
;; .dir-locals.el file:
;; ((dhall-mode
;; (mode . dhall-format-on-save)))
;; See the documentation for `reformatter-define', which provides a
;; number of options for customising the generated code.
;; Library authors might like to provide autoloads for the generated
;; code, e.g.:
;; ;;;###autoload (autoload 'dhall-format-buffer "current-file" nil t)
;; ;;;###autoload (autoload 'dhall-format-region "current-file" nil t)
;; ;;;###autoload (autoload 'dhall-format-on-save-mode "current-file" nil t)
;;; Code:
(eval-when-compile
(require 'cl-lib))
(require 'ansi-color)
;;;###autoload
(cl-defmacro reformatter-define (name &key program args (mode t) lighter keymap group)
"Define a reformatter command with NAME.
When called, the reformatter will use PROGRAM and any ARGS to
reformat the current buffer. The contents of the buffer will be
passed as standard input to the reformatter, which should output
them to standard output. A nonzero exit code will be reported as
failure, and the output of the command to standard error will be
displayed to the user.
The macro accepts the following keyword arguments:
:program (required)
Provides a form which should evaluate to a string at runtime,
e.g. a literal string, or the name of a variable which holds
the program path.
:args
If provided, this is a form which evaluates to a list of
strings at runtime. Default is the empty list.
:mode
Unless nil, also generate a minor mode that will call the
reformatter command from `before-save-hook' when enabled.
Default is t.
:group
If provided, this is the custom group used for any generated
modes or custom variables. Don't forget to declare this group
using a `defgroup' form.
:lighter
If provided, this is a mode lighter string which will be used
for the \"-on-save\" minor mode. It should have a leading
space. The supplied value will be used as the default for a
generated custom variable which specifies the mode lighter.
Default is nil, ie. no lighter.
:keymap
If provided, this is the symbol name of the \"-on-save\" mode's
keymap, which you must declare yourself. Default is no keymap.
"
(declare (indent defun))
(cl-assert (symbolp name))
(cl-assert program)
;; Note: we skip using `gensym' here because the macro arguments are only
;; referred to once below, but this may have to change later.
(let* ((buffer-fn-name (intern (format "%s-buffer" name)))
(region-fn-name (intern (format "%s-region" name)))
(minor-mode-form
(when mode
(let ((on-save-mode-name (intern (format "%s-on-save-mode" name)))
(lighter-name (intern (format "%s-on-save-mode-lighter" name))))
`(progn
(defcustom ,lighter-name ,lighter
,(format "Mode lighter for `%s'." on-save-mode-name)
:group ,group
:type 'string)
(define-minor-mode ,on-save-mode-name
,(format "When enabled, call `%s' when this buffer is saved.
To enable this unconditionally in a major mode, add this mode
to the major mode's hook. To enable it in specific files or directories,
use the local variables \"mode\" mechanism, e.g. in \".dir-locals.el\" you
might use:
((some-major-mode
(mode . %s-on-save)))
" buffer-fn-name name) nil
:global nil
:lighter ,lighter-name
:keymap ,keymap
:group ,group
(if ,on-save-mode-name
(add-hook 'before-save-hook ',buffer-fn-name nil t)
(remove-hook 'before-save-hook ',buffer-fn-name t))))))))
`(progn
(defun ,region-fn-name (beg end &optional display-errors)
"Reformats the region from BEG to END.
When called interactively, or with prefix argument
DISPLAY-ERRORS, shows a buffer if the formatting fails."
(interactive "rp")
(let* ((err-file (make-temp-file ,(symbol-name name)))
(out-file (make-temp-file ,(symbol-name name)))
;; Setting this coding system might not universally be
;; the best default, but was apparently necessary for
;; some hand-rolled reformatter functions that this
;; library was written to replace.
(coding-system-for-read 'utf-8)
(coding-system-for-write 'utf-8))
(unwind-protect
(let* ((error-buffer (get-buffer-create ,(format "*%s errors*" name)))
(retcode
(apply 'call-process-region beg end ,program
nil (list (list :file out-file) err-file)
nil
,args)))
(with-current-buffer error-buffer
(let ((inhibit-read-only t))
(insert-file-contents err-file nil nil nil t)
(ansi-color-apply-on-region (point-min) (point-max)))
(special-mode))
(if (zerop retcode)
(save-restriction
;; This replacement method minimises
;; disruption to marker positions and the
;; undo list
(narrow-to-region beg end)
(reformatter-replace-buffer-contents-from-file out-file)
;; In future this might be made optional, or a user-provided
;; ":after" form could be inserted for execution
(delete-trailing-whitespace))
(if display-errors
(display-buffer error-buffer)
(message ,(concat (symbol-name name) " failed: see %s") (buffer-name error-buffer)))))
(delete-file err-file)
(delete-file out-file))))
(defun ,buffer-fn-name (&optional display-errors)
"Reformats the current buffer.
When called interactively, or with prefix argument
DISPLAY-ERRORS, shows a buffer if the formatting fails."
(interactive "p")
(message "Formatting buffer")
(,region-fn-name (point-min) (point-max) display-errors))
;; This alias will be removed in a future version
(defalias ',name ',buffer-fn-name)
,minor-mode-form)))
(defun reformatter-replace-buffer-contents-from-file (file)
"Replace the accessible portion of the current buffer with the contents of FILE."
;; While the function `replace-buffer-contents' exists in recent
;; Emacs versions, it exhibits pathologically slow behaviour in many
;; cases, and the simple replacement approach we use instead is well
;; proven and typically preserves point and markers to a reasonable
;; degree.
(insert-file-contents file nil nil nil t))
(provide 'reformatter)
;;; reformatter.el ends here

Binary file not shown.