Browse Source

Add org mode cube

modify-logo
Sameer Rahmani 1 year ago
parent
commit
0ef18bea8d
  1. 5
      config/fg42.user.v3.el
  2. 24
      core/cubes/autocompletion.el
  3. 9
      core/cubes/editor.el
  4. 2
      core/cubes/irc/core.el
  5. 43
      core/cubes/org.el
  6. 6
      core/cubes/snippets/org-mode/frac

5
config/fg42.user.v3.el

@ -36,6 +36,7 @@ @@ -36,6 +36,7 @@
(require 'cubes/terminal)
(require 'cubes/java)
(require 'cubes/snippets)
(require 'cubes/org)
;; ============== MY STUFF ==============================
(custom-set-faces
@ -119,10 +120,10 @@ @@ -119,10 +120,10 @@
(fg42/c++-cube)
(fg42/yaml-cube)
(fg42/flycheck-cube)
(fg42/org-cube)
(fg42/golang-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")))
(fg42/vterm-cube)

24
core/cubes/autocompletion.el

@ -54,9 +54,19 @@ @@ -54,9 +54,19 @@
:config
(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
(:docs "cubes/fg42/cpp-cube.org"
:no-flag t)
(fg42/cmake-cube)
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
(add-hook 'c++-mode-hook (lambda ()
(lsp)
@ -72,14 +82,22 @@ @@ -72,14 +82,22 @@
:flag 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
(progn
;; Use Company for completion
(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-dabbrev-downcase nil)))
(setq company-dabbrev-downcase nil)
(global-company-mode)))
;; TODO: Move company box to a new cube
(fpkg/use company-box

9
core/cubes/editor.el

@ -21,6 +21,7 @@ @@ -21,6 +21,7 @@
;;
;;; Commentary:
;;; Code:
(require 'server)
(require 'fpkg)
(require 'fg42/cube)
@ -28,6 +29,10 @@ @@ -28,6 +29,10 @@
"Enable the support for font icones in FG42." t)
(defflag server
"Enable the support for server mode in FG42." t)
(defcube fg42/pinentry-cube
(:docs "cubes/fg42/pinentry-cube.org"
:flag pinentry
@ -192,6 +197,10 @@ @@ -192,6 +197,10 @@
(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
;; their flag is active otherwise they will be skipped
(fg42/font-cube)

2
core/cubes/irc/core.el

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

43
core/cubes/org.el

@ -25,13 +25,48 @@ @@ -25,13 +25,48 @@
;; way. Cubes are composable and a composition of cubes creates an editor.
;;
;;; Code:
(require 'fpkg)
(require 'fg42/cube)
(defcube fg42/org-cube ()
;;:hooks '((org-mode-hook . iii))
;:init #'iii
:dependencies '((:name org :version :latest)))
(defcube fg42/org-cube
(:docs "cubes/fg42/org-cube.org"
:flag org
: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)
;;; org.el ends here

6
core/cubes/snippets/org-mode/frac

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