From fa0da6b5e5851708a90f322458dafaf02677e1eb Mon Sep 17 00:00:00 2001 From: benj Date: Mon, 1 Feb 2021 19:59:25 -0800 Subject: updating emacs broke stuff so I shoved it back into the hole... --- .lsp-session-v1 | 1 + custom.el | 2 +- init.el | 103 +++++++++++++++++++++++++++++++--- settings/setup-company-mode.el | 2 +- settings/setup-haskell-mode.el | 13 ++++- settings/setup-lsp-mode.el | 4 ++ settings/setup-opam.el | 122 ----------------------------------------- settings/setup-scala-mode.el | 7 --- settings/setup-web-mode.el | 7 +++ transient/history.el | 21 +++++++ 10 files changed, 142 insertions(+), 140 deletions(-) create mode 100644 .lsp-session-v1 delete mode 100644 settings/setup-opam.el delete mode 100644 settings/setup-scala-mode.el create mode 100644 transient/history.el diff --git a/.lsp-session-v1 b/.lsp-session-v1 new file mode 100644 index 0000000..5fde148 --- /dev/null +++ b/.lsp-session-v1 @@ -0,0 +1 @@ +#s(lsp-session ("/home/benj/workspace/prep" "/home/benj/workspace/eudyptula/task1" "/home/benj/workspace/unixman" "/home/benj/workspace/imagine/imagine-services") nil #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ())) \ No newline at end of file diff --git a/custom.el b/custom.el index e948b38..c7910f3 100644 --- a/custom.el +++ b/custom.el @@ -11,7 +11,7 @@ '("8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4" "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" default)) '(flycheck-display-errors-function #'flycheck-pos-tip-error-messages) '(package-selected-packages - '(erlang rust-mode flymake-go go-mode gradle-mode treemacs-projectile treemacs protobuf-mode yaml-mode web-mode visual-regexp-steroids systemd solarized-theme smart-mode-line slime purescript-mode projectile-ripgrep play-routes-mode paredit org-bullets multiple-cursors modern-cpp-font-lock magit lsp-ui ido-vertical-mode highlight-escape-sequences flycheck-pos-tip flycheck-haskell flycheck-clojure flycheck-clangcheck flx-ido ensime ember-mode elm-mode dockerfile-mode cquery company-lsp company-glsl company-c-headers cmake-mode clojure-snippets clojure-mode-extra-font-locking ace-window)) + '(elixir-mode add-node-modules-path prettier-js prettier hasklig-mode jq-mode uuidgen restclient erlang rust-mode flymake-go go-mode gradle-mode treemacs-projectile treemacs protobuf-mode yaml-mode web-mode visual-regexp-steroids systemd solarized-theme smart-mode-line slime purescript-mode projectile-ripgrep play-routes-mode paredit org-bullets multiple-cursors modern-cpp-font-lock magit lsp-ui ido-vertical-mode highlight-escape-sequences flycheck-pos-tip flycheck-haskell flycheck-clojure flycheck-clangcheck flx-ido ensime ember-mode elm-mode dockerfile-mode cquery company-lsp company-glsl company-c-headers cmake-mode clojure-snippets clojure-mode-extra-font-locking ace-window)) '(safe-local-variable-values '((projectile-project-run-cmd . "./build/jmessageGtk")))) (custom-set-faces ;; custom-set-faces was added by Custom. diff --git a/init.el b/init.el index be09868..e60cc56 100644 --- a/init.el +++ b/init.el @@ -1,3 +1,96 @@ +(defun make-obsolete (obsolete-name current-name &optional when) + "Make the byte-compiler warn that function OBSOLETE-NAME is obsolete. +OBSOLETE-NAME should be a function name or macro name (a symbol). + +The warning will say that CURRENT-NAME should be used instead. +If CURRENT-NAME is a string, that is the `use instead' message +\(it should end with a period, and not start with a capital). +WHEN should be a string indicating when the function +was first made obsolete, for example a date or a release number." + (declare (advertised-calling-convention + ;; New code should always provide the `when' argument. + (obsolete-name current-name when) "23.1")) + (put obsolete-name 'byte-obsolete-info + ;; The second entry used to hold the `byte-compile' handler, but + ;; is not used any more nowadays. + (purecopy (list current-name nil when))) + obsolete-name) + +(defmacro define-obsolete-function-alias (obsolete-name current-name + &optional when docstring) + "Set OBSOLETE-NAME's function definition to CURRENT-NAME and mark it obsolete. + +\(define-obsolete-function-alias \\='old-fun \\='new-fun \"22.1\" \"old-fun's doc.\") + +is equivalent to the following two lines of code: + +\(defalias \\='old-fun \\='new-fun \"old-fun's doc.\") +\(make-obsolete \\='old-fun \\='new-fun \"22.1\") + +WHEN should be a string indicating when the function was first +made obsolete, for example a date or a release number. + +See the docstrings of `defalias' and `make-obsolete' for more details." + (declare (doc-string 4) + (advertised-calling-convention + ;; New code should always provide the `when' argument. + (obsolete-name current-name when &optional docstring) "23.1")) + `(progn + (defalias ,obsolete-name ,current-name ,docstring) + (make-obsolete ,obsolete-name ,current-name ,when))) + +(defun make-obsolete-variable (obsolete-name current-name &optional when access-type) + "Make the byte-compiler warn that OBSOLETE-NAME is obsolete. +The warning will say that CURRENT-NAME should be used instead. +If CURRENT-NAME is a string, that is the `use instead' message. +WHEN should be a string indicating when the variable +was first made obsolete, for example a date or a release number. +ACCESS-TYPE if non-nil should specify the kind of access that will trigger + obsolescence warnings; it can be either `get' or `set'." + (declare (advertised-calling-convention + ;; New code should always provide the `when' argument. + (obsolete-name current-name when &optional access-type) "23.1")) + (put obsolete-name 'byte-obsolete-variable + (purecopy (list current-name access-type when))) + obsolete-name) + +(defmacro define-obsolete-variable-alias (obsolete-name current-name + &optional when docstring) + "Make OBSOLETE-NAME a variable alias for CURRENT-NAME and mark it obsolete. +This uses `defvaralias' and `make-obsolete-variable' (which see). +See the Info node `(elisp)Variable Aliases' for more details. + +If CURRENT-NAME is a defcustom or a defvar (more generally, any variable +where OBSOLETE-NAME may be set, e.g. in an init file, before the +alias is defined), then the define-obsolete-variable-alias +statement should be evaluated before the defcustom, if user +customizations are to be respected. The simplest way to achieve +this is to place the alias statement before the defcustom (this +is not necessary for aliases that are autoloaded, or in files +dumped with Emacs). This is so that any user customizations are +applied before the defcustom tries to initialize the +variable (this is due to the way `defvaralias' works). + +WHEN should be a string indicating when the variable was first +made obsolete, for example a date or a release number. + +For the benefit of Customize, if OBSOLETE-NAME has +any of the following properties, they are copied to +CURRENT-NAME, if it does not already have them: +`saved-value', `saved-variable-comment'." + (declare (doc-string 4) + (advertised-calling-convention + ;; New code should always provide the `when' argument. + (obsolete-name current-name when &optional docstring) "23.1")) + `(progn + (defvaralias ,obsolete-name ,current-name ,docstring) + ;; See Bug#4706. + (dolist (prop '(saved-value saved-variable-comment)) + (and (get ,obsolete-name prop) + (null (get ,current-name prop)) + (put ,current-name prop (get ,obsolete-name prop)))) + (make-obsolete-variable ,obsolete-name ,current-name ,when))) + ;;; init.el --- initialize emacs configuration ;;; Author: Benj Bellon @@ -26,7 +119,7 @@ ;; Are we on a mac? (setq is-mac (equal system-type 'darwin)) - +(setq create-lockfiles nil) ;; Added by Package.el. This must come before configurations of ;; installed packages. Don't delete this line. If you don't want it, ;; just comment it out by adding a semicolon to the start of the line. @@ -65,7 +158,6 @@ dockerfile-mode elm-mode ember-mode - ensime erlang exec-path-from-shell flx-ido @@ -76,6 +168,7 @@ flycheck-pos-tip go-mode haskell-mode + hasklig-mode highlight-escape-sequences ido-vertical-mode json @@ -83,7 +176,6 @@ lsp-ui magit markdown-mode - merlin modern-cpp-font-lock multiple-cursors paredit @@ -97,7 +189,6 @@ rust-mode rust-playground sbt-mode - scala-mode slime smart-mode-line solarized-theme @@ -164,7 +255,6 @@ (require 'setup-purescript-mode) (require 'setup-python-mode) (require 'setup-rust-mode) -(require 'setup-scala-mode) (require 'setup-slime-mode) (require 'setup-terraform-mode) (require 'setup-treemacs) @@ -174,9 +264,6 @@ (require 'setup-yaml-mode) (require 'setup-yasnippet) -;; ## added by OPAM user-setup for emacs / base ## 56ab50dc8996d2bb95e7856a6eddb17b ## you can edit, but keep this line -(require 'setup-opam) -;; ## end of OPAM user-setup addition for emacs / base ## keep this line ;; utility globals (require 'fetch-includes) diff --git a/settings/setup-company-mode.el b/settings/setup-company-mode.el index fbe3468..068abef 100644 --- a/settings/setup-company-mode.el +++ b/settings/setup-company-mode.el @@ -18,7 +18,7 @@ (setq company-go-gocode-command (concat (getenv "HOME") "/go/bin/gocode")) -(push 'company-lsp company-backends) +;; (push 'company-lsp company-backends) (push 'company-go company-backends) (push 'company-terraform company-backends) (add-hook 'after-init-hook 'global-company-mode) diff --git a/settings/setup-haskell-mode.el b/settings/setup-haskell-mode.el index ea3f1f9..b74de32 100644 --- a/settings/setup-haskell-mode.el +++ b/settings/setup-haskell-mode.el @@ -1,6 +1,17 @@ (require 'haskell-mode) (require 'flycheck-haskell) -(setq inferior-haskell-find-project-root nil) +(defun haskell/pretty-symbols () + (setq prettify-symbols-alist + '( + ("\\" . ?λ) + (">=" . ?≥) + ("<=" . ?≤) + ("()" . ?∅)))) + +(add-hook 'haskell-mode-hook 'hasklig-mode) +(add-hook 'haskell-mode-hook 'haskell/pretty-symbols) + +;; (setq inferior-haskell-find-project-root nil) (provide 'setup-haskell-mode) diff --git a/settings/setup-lsp-mode.el b/settings/setup-lsp-mode.el index d6f1189..cef50ac 100644 --- a/settings/setup-lsp-mode.el +++ b/settings/setup-lsp-mode.el @@ -4,6 +4,10 @@ (setq cquery-executable "/usr/local/bin/cquery") +(setq gc-cons-threshold 100000000) +(setq read-process-output-max (* 1024 1024)) ;; 1mb +(setq lsp-completion-provider :capf) + (add-hook 'c-mode-hook #'lsp) (add-hook 'c++-mode-hook #'lsp) diff --git a/settings/setup-opam.el b/settings/setup-opam.el deleted file mode 100644 index f413d15..0000000 --- a/settings/setup-opam.el +++ /dev/null @@ -1,122 +0,0 @@ -;; ## added by OPAM user-setup for emacs / base ## cfd3c9b7837c85cffd0c59de521990f0 ## you can edit, but keep this line -(provide 'setup-opam) - -;; Base configuration for OPAM - -(defun opam-shell-command-to-string (command) - "Similar to shell-command-to-string, but returns nil unless the process - returned 0, and ignores stderr (shell-command-to-string ignores return value)" - (let* ((return-value 0) - (return-string - (with-output-to-string - (setq return-value - (with-current-buffer standard-output - (process-file shell-file-name nil '(t nil) nil - shell-command-switch command)))))) - (if (= return-value 0) return-string nil))) - -(defun opam-update-env (switch) - "Update the environment to follow current OPAM switch configuration" - (interactive - (list - (let ((default - (car (split-string (opam-shell-command-to-string "opam switch show --safe"))))) - (completing-read - (concat "opam switch (" default "): ") - (split-string (opam-shell-command-to-string "opam switch list -s --safe") "\n") - nil t nil nil default)))) - (let* ((switch-arg (if (= 0 (length switch)) "" (concat "--switch " switch))) - (command (concat "opam config env --safe --sexp " switch-arg)) - (env (opam-shell-command-to-string command))) - (when (and env (not (string= env ""))) - (dolist (var (car (read-from-string env))) - (setenv (car var) (cadr var)) - (when (string= (car var) "PATH") - (setq exec-path (split-string (cadr var) path-separator))))))) - -(opam-update-env nil) - -(defvar opam-share - (let ((reply (opam-shell-command-to-string "opam config var share --safe"))) - (when reply (substring reply 0 -1)))) - -(add-to-list 'load-path (concat opam-share "/emacs/site-lisp")) -;; OPAM-installed tools automated detection and initialisation - -(defun opam-setup-tuareg () - (add-to-list 'load-path (concat opam-share "/tuareg") t) - (load "tuareg-site-file")) - -(defun opam-setup-add-ocaml-hook (h) - (add-hook 'tuareg-mode-hook h t) - (add-hook 'caml-mode-hook h t)) - -(defun opam-setup-complete () - (if (require 'company nil t) - (opam-setup-add-ocaml-hook - (lambda () - (company-mode) - (defalias 'auto-complete 'company-complete))) - (require 'auto-complete nil t))) - -(defun opam-setup-ocp-indent () - (opam-setup-complete) - (autoload 'ocp-setup-indent "ocp-indent" "Improved indentation for Tuareg mode") - (autoload 'ocp-indent-caml-mode-setup "ocp-indent" "Improved indentation for Caml mode") - (add-hook 'tuareg-mode-hook 'ocp-setup-indent t) - (add-hook 'caml-mode-hook 'ocp-indent-caml-mode-setup t)) - -(defun opam-setup-ocp-index () - (autoload 'ocp-index-mode "ocp-index" "OCaml code browsing, documentation and completion based on build artefacts") - (opam-setup-add-ocaml-hook 'ocp-index-mode)) - -(defun opam-setup-merlin () - (opam-setup-complete) - (require 'merlin) - (opam-setup-add-ocaml-hook 'merlin-mode) - - (defcustom ocp-index-use-auto-complete nil - "Use auto-complete with ocp-index (disabled by default by opam-user-setup because merlin is in use)" - :group 'ocp_index) - (defcustom merlin-ac-setup 'easy - "Use auto-complete with merlin (enabled by default by opam-user-setup)" - :group 'merlin-ac) - - ;; So you can do it on a mac, where `C-` and `C-` are used - ;; by spaces. - (define-key merlin-mode-map - (kbd "C-c ") 'merlin-type-enclosing-go-up) - (define-key merlin-mode-map - (kbd "C-c ") 'merlin-type-enclosing-go-down) - (set-face-background 'merlin-type-face "skyblue")) - -(defun opam-setup-utop () - (autoload 'utop "utop" "Toplevel for OCaml" t) - (autoload 'utop-minor-mode "utop" "Minor mode for utop" t) - (add-hook 'tuareg-mode-hook 'utop-minor-mode)) - -(defvar opam-tools - '(("tuareg" . opam-setup-tuareg) - ("ocp-indent" . opam-setup-ocp-indent) - ("ocp-index" . opam-setup-ocp-index) - ("merlin" . opam-setup-merlin) - ("utop" . opam-setup-utop))) - -(defun opam-detect-installed-tools () - (let* - ((command "opam list --installed --short --safe --color=never") - (names (mapcar 'car opam-tools)) - (command-string (mapconcat 'identity (cons command names) " ")) - (reply (opam-shell-command-to-string command-string))) - (when reply (split-string reply)))) - -(defvar opam-tools-installed (opam-detect-installed-tools)) - -(defun opam-auto-tools-setup () - (interactive) - (dolist (tool opam-tools) - (when (member (car tool) opam-tools-installed) - (funcall (symbol-function (cdr tool)))))) - -(opam-auto-tools-setup) -;; ## end of OPAM user-setup addition for emacs / base ## keep this line diff --git a/settings/setup-scala-mode.el b/settings/setup-scala-mode.el deleted file mode 100644 index c249a4e..0000000 --- a/settings/setup-scala-mode.el +++ /dev/null @@ -1,7 +0,0 @@ -(require 'scala-mode) -(require 'ensime) - -(add-hook 'scala-mode-hook 'ensime-scala-mode-hook) - -(provide 'setup-scala-mode) - diff --git a/settings/setup-web-mode.el b/settings/setup-web-mode.el index 48e300c..b55e93b 100644 --- a/settings/setup-web-mode.el +++ b/settings/setup-web-mode.el @@ -7,9 +7,12 @@ (add-to-list 'auto-mode-alist '("\\.hbs\\'" . web-mode)) (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode)) (add-to-list 'auto-mode-alist '("\\.js\\'" . web-mode)) +(add-to-list 'auto-mode-alist '("\\.ts\\'" . web-mode)) +(add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode)) (add-to-list 'auto-mode-alist '("\\.json\\'" . web-mode)) (add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode)) (add-to-list 'auto-mode-alist '("\\.tpl\\'" . web-mode)) +(add-to-list 'auto-mode-alist '("\\.eex\\'" . web-mode)) (set-face-attribute 'web-mode-doctype-face nil :foreground "misty rose") @@ -30,6 +33,10 @@ (setq web-mode-style-padding 2) (setq web-mode-script-padding 2)) +(eval-after-load 'web-mode + '(add-hook 'web-mode-hook #'add-node-modules-path)) + (add-hook 'web-mode-hook 'indent-offset) +(add-hook 'web-mode-hook 'prettier-js-mode) (provide 'setup-web-mode) diff --git a/transient/history.el b/transient/history.el new file mode 100644 index 0000000..e911e11 --- /dev/null +++ b/transient/history.el @@ -0,0 +1,21 @@ +((magit-branch nil) + (magit-commit nil) + (magit-diff + ("--no-ext-diff" "--stat")) + (magit-dispatch nil) + (magit-file-dispatch nil) + (magit-gitignore nil) + (magit-log + ("-n256" "--graph" "--decorate")) + (magit-merge nil) + (magit-pull nil) + (magit-push nil) + (magit-rebase nil) + (magit-reset nil) + (magit-revert + ("--edit")) + (magit-revision-history "ORIG_HEAD") + (magit-run nil) + (magit-show-refs nil) + (magit-stash nil) + (magit-tag nil)) -- cgit v1.2.3