Add org mode cube

This commit is contained in:
Sameer Rahmani 2021-07-02 15:48:30 +01:00
parent b3d5cd422d
commit 0ef18bea8d
6 changed files with 79 additions and 10 deletions

View File

@ -36,6 +36,7 @@
(require 'cubes/terminal) (require 'cubes/terminal)
(require 'cubes/java) (require 'cubes/java)
(require 'cubes/snippets) (require 'cubes/snippets)
(require 'cubes/org)
;; ============== MY STUFF ============================== ;; ============== MY STUFF ==============================
(custom-set-faces (custom-set-faces
@ -119,10 +120,10 @@
(fg42/c++-cube) (fg42/c++-cube)
(fg42/yaml-cube) (fg42/yaml-cube)
(fg42/flycheck-cube) (fg42/flycheck-cube)
(fg42/org-cube)
(fg42/golang-cube) (fg42/golang-cube)
(fg42/projectile-cube) (fg42/projectile-cube)
(fg42/rcirc-cube :server '(("irc.freenode.net" :channels ("#fg42" "#5hit" "#serene-lang" "#technotux") :nick "lxsameer") (fg42/rcirc-cube :server '(("irc.libera.chat" :channels ("#fg42" "#5hit" "#serene-lang" "#technotux" "#emacs" "#c++") :nick "lxsameer")
("irc.oftc.net" :channels ("#llvm") :nick "lxsameer"))) ("irc.oftc.net" :channels ("#llvm") :nick "lxsameer")))
(fg42/vterm-cube) (fg42/vterm-cube)

View File

@ -54,9 +54,19 @@
:config :config
(add-hook 'lsp-mode-hook 'lsp-ui-mode))) (add-hook 'lsp-mode-hook 'lsp-ui-mode)))
(defcube fg42/cmake-cube
(:docs "cubes/fg42/cpp-cube.org"
:flag-default t
:flag cmake)
(fpkg/use cmake-mode)
(fpkg/use eldoc-cmake))
(defcube fg42/c++-cube (defcube fg42/c++-cube
(:docs "cubes/fg42/cpp-cube.org" (:docs "cubes/fg42/cpp-cube.org"
:no-flag t) :no-flag t)
(fg42/cmake-cube)
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode)) (add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
(add-hook 'c++-mode-hook (lambda () (add-hook 'c++-mode-hook (lambda ()
(lsp) (lsp)
@ -72,14 +82,22 @@
:flag company) :flag company)
(fpkg/use company (fpkg/use company
:init (global-company-mode) :bind (:map company-active-map
("M-n" . company-select-next)
("M-p" . company-select-previous)
("TAB" . company-complete-common-or-cycle)
("M-d" . company-show-doc-buffer))
:config :config
(progn (progn
;; Use Company for completion ;; Use Company for completion
(bind-key [remap completion-at-point] #'company-complete company-mode-map) (bind-key [remap completion-at-point] #'company-complete company-mode-map)
(setq company-show-numbers t)
(setq company-idle-delay 0)
(setq company-tooltip-limit 20)
(setq company-echo-delay 0)
(setq company-tooltip-align-annotations t) (setq company-tooltip-align-annotations t)
(setq company-dabbrev-downcase nil))) (setq company-dabbrev-downcase nil)
(global-company-mode)))
;; TODO: Move company box to a new cube ;; TODO: Move company box to a new cube
(fpkg/use company-box (fpkg/use company-box

View File

@ -21,6 +21,7 @@
;; ;;
;;; Commentary: ;;; Commentary:
;;; Code: ;;; Code:
(require 'server)
(require 'fpkg) (require 'fpkg)
(require 'fg42/cube) (require 'fg42/cube)
@ -28,6 +29,10 @@
"Enable the support for font icones in FG42." t) "Enable the support for font icones in FG42." t)
(defflag server
"Enable the support for server mode in FG42." t)
(defcube fg42/pinentry-cube (defcube fg42/pinentry-cube
(:docs "cubes/fg42/pinentry-cube.org" (:docs "cubes/fg42/pinentry-cube.org"
:flag pinentry :flag pinentry
@ -192,6 +197,10 @@
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode) (add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
(when-flag server
(if (not (server-running-p))
(server-start)))
;; Call the editor related cubes. They will be run only if ;; Call the editor related cubes. They will be run only if
;; their flag is active otherwise they will be skipped ;; their flag is active otherwise they will be skipped
(fg42/font-cube) (fg42/font-cube)

View File

@ -24,7 +24,7 @@
(defvar fg42/default-rcirc-servers (defvar fg42/default-rcirc-servers
'(("chat.freenode.net" '(("irc.libera.chat/6697"
:channels ("#fg42")))) :channels ("#fg42"))))
(defun fg42/rcirc-connect () (defun fg42/rcirc-connect ()

View File

@ -25,13 +25,48 @@
;; way. Cubes are composable and a composition of cubes creates an editor. ;; way. Cubes are composable and a composition of cubes creates an editor.
;; ;;
;;; Code: ;;; Code:
(require 'fpkg)
(require 'fg42/cube) (require 'fg42/cube)
(defcube fg42/org-cube () (defcube fg42/org-cube
;;:hooks '((org-mode-hook . iii)) (:docs "cubes/fg42/org-cube.org"
;:init #'iii :flag org
:dependencies '((:name org :version :latest))) :flag-default t)
(let ((capture-key (or (plist-get fg42/org-cube-params :capture-key)
(kbd "<f6>")))
(org-home (or (plist-get fg42/org-cube-params :org-home) "~/orgs"))
(notes-file (or (plist-get fg42/org-cube-params :org-home) "~/orgs/notes.org")))
(fpkg/use org-bullets
:hook (org-mode . org-bullets-mode))
(fpkg/use org-mode
:init
(progn
(require 'org-capture)
(global-set-key capture-key 'org-capture)
(setq org-directory org-home)
(setq org-default-notes-file notes-file)
(setq org-capture-templates
'(("t" "Todo" entry (file+headline (expand-file-name "main.org" org-home) "New Tasks")
(file (expand-file-name "templates/todo" org-home))
:prepend t)
("l" "Link" entry (file+headline (expand-file-name "bookmarks.org" org-home) "Links")
(file (expand-file-name "templates/links" org-home))
:prepend t
:empty-lines 1)
("h" "Thoughts" entry (file+datetree (expand-file-name "journal.org" org-home))
(file (expand-file-name "templates/thoughts" org-home)))))
(setq org-refile-targets '((org-agenda-files :maxlevel . 3)))
(with-eval-after-load "ox-latex"
(setq org-latex-default-packages-alist
(append '(("hidelinks" "hyperref" nil))
org-latex-default-packages-alist)))
(unless (server-running-p)
(require 'org-protocol))))))
(provide 'cubes/org) (provide 'cubes/org)
;;; org.el ends here ;;; org.el ends here

View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# contributor: lxsameer <lxsameer@gnu.org>
# name: Latex frac
# key: fr
# --
\frac{$1}{$2} $0