Add necessary cubes to swtich to v3

I've added some cubes including 'selectrum', 'company'
'lsp', 'smart-mode-line', 'mini-modline' and several
others which allows me to switch to v3 and continue
from there. Some of the cubes are not in the right place
but will move them to an appropriate location later on
This commit is contained in:
Sameer Rahmani 2021-05-02 22:47:01 +01:00
parent 3921015fbe
commit d4aa08311f
6 changed files with 177 additions and 3 deletions

View File

@ -0,0 +1,73 @@
;;; EditorCubes --- The common cubes for FG42 -*- lexical-binding: t; -*-
;;
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
;;
;; Author: Sameer Rahmani <lxsameer@gnu.org>
;; 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 <http://www.gnu.org/licenses/>.
;;
;;; Commentary:
;;; Code:
(require 'fpkg)
(require 'fg42/cube)
(defcube fg42/lsp-cube
(:docs "cubes/fg42/lsp-cube.org")
(fpkg/use lsp-mode
:commands lsp
:init
(setq lsp-headerline-breadcrumb-enable nil))
(fpkg/use lsp-ui
:config
(add-hook 'lsp-mode-hook 'lsp-ui-mode)))
(defcube fg42/c++-cube
(:docs "cubes/fg42/cpp-cube.org")
(add-hook 'c++-mode-hook (lambda ()
(lsp)
(require 'company-capf)
(require 'company-box)
(setq company-backends
'((company-capf
company-keywords))))))
(defcube fg42/company-cube
(:docs "cubes/fg42/company-cube.org")
(fpkg/use company
:init (global-company-mode)
:config
(progn
;; Use Company for completion
(bind-key [remap completion-at-point] #'company-complete company-mode-map)
(setq company-tooltip-align-annotations t
;; Easy navigation to candidates with M-<n>
company-show-numbers t)
(setq company-dabbrev-downcase nil)))
(fpkg/use company-box
:after company
:config
(add-hook 'company-mode-hook 'company-box-mode)))
(provide 'cubes/autocompletion)
;;; editor.el ends here

View File

@ -1,4 +1,4 @@
;;; ElispCube --- The elisp cube for FG42 -*- lexical-binding: t; -*-
;;; EditorCubes --- The common cubes for FG42 -*- lexical-binding: t; -*-
;;
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
;;
@ -52,8 +52,38 @@
;; Sets the default font to fg42 font
(add-to-list 'default-frame-alist
(cons 'font (format "%s-%d" font size)))
(set-face-attribute 'default t :font font)))
(defcube fg42/dracula-theme-cube
(:docs "cubes/fg42/dracula-theme-cube.org")
(fpkg/use dracula-theme
:init
(progn
(load-theme 'dracula t)
(enable-theme 'dracula))))
(defcube fg42/selectrum-cube
(:docs "cubes/fg42/editor-cube.org")
(fpkg/use selectrum
:defer nil
:init
(selectrum-mode +1))
(fpkg/use selectrum-prescient
:defer t
:init
(progn
(selectrum-prescient-mode +1)
(prescient-persist-mode +1)))
;; TODO: Disbale ctrlf in WM mode
(fpkg/use ctrlf
:defer t
:init
(ctrlf-mode +1)))
(defcube fg42/editor-cube
(:docs "cubes/fg42/editor-cube.org")

54
core/cubes/modeline.el Normal file
View File

@ -0,0 +1,54 @@
;;; ModelineCubes --- The modeline related cubes for FG42 -*- lexical-binding: t; -*-
;;
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
;;
;; Author: Sameer Rahmani <lxsameer@gnu.org>
;; 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 <http://www.gnu.org/licenses/>.
;;
;;; Commentary:
;;; Code:
(require 'fpkg)
(require 'fg42/cube)
(defcube fg42/modeline-cube
(:docs "cubes/fg42/modeline-cube.org")
(fpkg/use smart-mode-line
:straight (smart-mode-line :source melpa)
:defer nil
:init
(progn
(setq sml/theme 'respectful)
(setq sml/no-confirm-load-theme t)
(sml/setup)))
(fpkg/use mini-modeline
:straight (mini-modeline :repo "kiennq/emacs-mini-modeline"
:host github
:type git)
:after smart-mode-line
:init
(setq mini-modeline-enhance-visual t)
:defer nil
:config
(mini-modeline-mode t)))
(provide 'cubes/modeline)
;;; modeline.el ends here

View File

@ -84,7 +84,7 @@ For example, `(fg42/merge-flags (list f1 f2 f3) f4 -f2)' will return `(f1 f3 f4)
"Define a new flag FLAG-NAME with the given DOCSTRING."
(let ((var-name (intern (format "fg42/-flag-%s" flag-name))))
`(if (boundp ',var-name)
(warn (foramt "Flag name `%s' already defined" ,flag-name))
(warn (format "Flag name `%s' already defined" ,(format "%s" flag-name)))
(progn
(defvar ,var-name t)
(add-to-list 'fg42/available-flags ',flag-name)))))

View File

@ -29,12 +29,28 @@
;;(require 'use-package)
(defun inject-straight (args)
"Inject `:straight t' to ARGS it the key was missing."
(if (member :straight args)
args
(append args '(:straight t))))
(defun inject-defer (args)
"Inject `:defer t' to ARGS it the key was missing."
(if (member :defer args)
args
(append args '(:defer t))))
(defmacro fpkg/use (pkg &rest details)
"Install the given package details PKG via use-package and straight."
(declare (indent defun))
(if (and (listp details) (< 0 (length details)))
`(use-package ,pkg :straight ,@details :defer t)
(let ((params (inject-straight (inject-defer details))))
(progn
(message ">>> %s %s" pkg details)
`(use-package ,pkg ,@params)))
`(use-package ,pkg :straight t :defer t)))

View File

@ -40,6 +40,7 @@ On the first level, I should feel comfortable with it.
** TODO Reformat the modeline
** TODO Create a macro similar to =with-ability= to run a block of code only if the given cube was active
** TODO Enable =straight= and =use-package= integration on compile time. Checout out =fpkg/core.el=
** TODO Check the =dracula= theme settings and configurations
* Things that didn't work out
- rbenv
- helm