diff --git a/.gitlab/merge_request_templates/contribution.md b/.gitlab/merge_request_templates/contribution.md deleted file mode 100644 index b9f1985..0000000 --- a/.gitlab/merge_request_templates/contribution.md +++ /dev/null @@ -1,16 +0,0 @@ -## Summary - - - -### QA - - - -### Checklist - -[ ] Is the linter happy? -[ ] Is the byte compiler happy (no warning) ? -[ ] Is it backward compatible -[ ] Did you document your changes ? -[ ] Did you update the CHANGELOG ? -[ ] Did you actually test your changes ? diff --git a/core/cubes/autocompletion.el b/core/cubes/autocompletion.el index 67fbb02..1e33702 100644 --- a/core/cubes/autocompletion.el +++ b/core/cubes/autocompletion.el @@ -1,4 +1,4 @@ -;;; EditorCubes --- The common cubes for FG42 -*- lexical-binding: t; -*- +;;; AutocompletionCubes --- The completion related cubes for FG42 -*- lexical-binding: t; -*- ;; ;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors ;; @@ -32,11 +32,13 @@ :init (global-flycheck-mode))) + (defcube fg42/yaml-cube (:docs "cubes/fg42/prog-cubes.org" :no-flag t) (fpkg/use yaml-mode)) + (defcube fg42/lsp-cube (:docs "cubes/fg42/lsp-cube.org" :flag lsp) diff --git a/core/cubes/editor.el b/core/cubes/editor.el index 156efae..9f9627a 100644 --- a/core/cubes/editor.el +++ b/core/cubes/editor.el @@ -28,6 +28,15 @@ "Enable the support for font icones in FG42.") +(defcube fg42/exec-path-cube + (:docs "cubes/fg42/exec-path-cube.org" + :flag exec-path-from-shell) + (fpkg/use exec-path-from-shell + :init + (when (memq window-system '(mac ns x)) + (exec-path-from-shell-initialize)))) + + (defcube fg42/cursor-cube (:docs "cubes/fg42/cursor-cube.org" :flag cursor-type) diff --git a/core/cubes/golang.el b/core/cubes/golang.el new file mode 100644 index 0000000..146c66a --- /dev/null +++ b/core/cubes/golang.el @@ -0,0 +1,50 @@ +;;; GolangCubes --- The Golang cubes for FG42 -*- lexical-binding: t; -*- +;; +;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors +;; +;; Author: Sameer Rahmani +;; URL: https://gitlab.com/FG42/FG42 +;; Version: 3.0.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 . +;; +;;; Commentary: +;;; Code: +(require 'fpkg) +(require 'fg42/cube) +(require 'fg42/utils) + +(autoload-cube 'fg42/initialize-golang "golang/core.el" "Initalize the go mode.") + +(defcube fg42/golang-cube + (:docs "cubes/fg42/golang-cube.org" + :flag golang) + + (fpkg/use go-mode + :defer t + :mode "\\.go\\'" + :config + (progn + (add-hook 'go-mode-hook 'fg42/initialize-golang) + (when-flag lsp + (add-hook 'go-mode-hook + (lambda () + (when (not (boundp 'lsp)) + (require 'lsp) + (lsp-deferred)))))))) + + + +(provide 'cubes/golang) +;;; golang.el ends here diff --git a/core/cubes/golang/core.el b/core/cubes/golang/core.el new file mode 100644 index 0000000..6c6305d --- /dev/null +++ b/core/cubes/golang/core.el @@ -0,0 +1,64 @@ +;;; GolangCubes --- The Golang cubes for FG42 -*- lexical-binding: t; -*- +;; +;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors +;; +;; Author: Sameer Rahmani +;; URL: https://gitlab.com/FG42/FG42 +;; Version: 3.0.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 . +;; +;;; Commentary: +;;; Code: +(require 'fg42/flags) + + +(defun fg42/go-path-from-env () + "Gets gopath from OS env." + (exec-path-from-shell-copy-env "GOPATH")) + + +(defun fg42/go-path-binary (gopath) + "Gets Go binaries path with respect to the given GOPATH." + ;; TODO: Use `expand-file-name' here + (concat gopath "/bin")) + +(defun fg42/initialize-golang () + "Setup Emacs hooks and turn necessary modes on." + (when-flag lsp + (lsp-register-custom-settings + '(("gopls.completeUnimported" t t) + ("gopls.staticcheck" t t))) + (add-hook 'before-save-hook + (lambda () + (when (eq major-mode 'go-mode) + (lsp-format-buffer t) + (lsp-organize-imports t))))) + + (when-flag company + (setq-local company-backends + '(company-capf + company-dabbrev + company-dabbrev-code))) + + (let ((go-path (or (plist-get fg42/golang-cube-params :go-path) + (fg42/go-path-from-env)))) + (add-to-list 'exec-path (fg42/go-path-binary go-path))) + + (local-set-key (kbd "M-.") #'godef-jump) + (local-set-key (kbd "M-*") 'pop-tag-mark)) + + +(provide 'cubes/golang/core) +;;; core.el ends here diff --git a/core/cubes/wm/core.el b/core/cubes/wm/core.el index c83404e..a5a6be0 100644 --- a/core/cubes/wm/core.el +++ b/core/cubes/wm/core.el @@ -21,9 +21,10 @@ ;; ;;; Commentary: ;;; Code: +(require 'fg42/flags) (defun wm-randr () - "RandR support for WM" + "RandR support for wm." (when-wm (require 'exwm-randr) (setq exwm-randr-workspace-output-plist '(0 "HDMI-1" diff --git a/core/fg42/flags.el b/core/fg42/flags.el index a9a72e2..1f5e5ce 100644 --- a/core/fg42/flags.el +++ b/core/fg42/flags.el @@ -99,7 +99,7 @@ For example, `(fg42/merge-flags (list f1 f2 f3) f4 -f2)' will return `(f1 f3 f4) (member flag cube-local-flags)) `,@body `(if (member ',flag fg42/flags) - ,body + ,@body nil))) diff --git a/dev.org b/dev.org index 4e41311..f6e7d7d 100644 --- a/dev.org +++ b/dev.org @@ -48,6 +48,7 @@ On the first level, I should feel comfortable with it. (package-install 'exec-path-from-shell) (exec-path-from-shell-initialize) #+END_SRC +** TODO Turn on yasnippet mode for Go mode * Things that didn't work out - rbenv - helm