Compare commits

...

3 Commits

Author SHA1 Message Date
Sameer Rahmani 21f6eea0b5
Add svg-tag-mode in disabled state to v4 2024-04-06 14:09:05 +01:00
Sameer Rahmani b871fabd14
Add consult support to v4 2024-04-06 13:54:08 +01:00
Sameer Rahmani 37956c6b8b
Add org support to v4 2024-04-06 12:53:30 +01:00
8 changed files with 452 additions and 87 deletions

View File

@ -33,9 +33,6 @@
"Enable the support for org-journal in FG42." t)
(defvar fg42/default-org-journal-heder
"#+TITLE: Yearly Journal
#+STARTUP: folded logdrawer logdone logreschedule indent content align constSI entitiespretty")
(defcube fg42/org-ql-cube

View File

@ -85,9 +85,7 @@
expand-region
eros
org
org-journal
org-bullets
org-sidebar
org-modern
org-super-agenda
org-ql
ctrlf
@ -122,7 +120,8 @@
marginalia
nerd-icons
forge
)
svg-tag-mode
consult)
(provide 'fg42/deps)
;;; deps.el ends here

View File

@ -31,12 +31,17 @@
(require 'fg42/langs/python)
(require 'fg42/langs/elisp)
(require 'fg42/langs/nix)
(require 'fg42/git)
(require 'fg42/wm))
(require 'fg42/wm)
(require 'fg42/org)
(require 'fg42/minibuffer)
(require 'fg42/graphics))
(require 'server)
(require 'fg42/modeline)
(defvar fg42/font '("Fira Mono" 12)
"Font name and size to be used with FG42. (Default (\"Fira Mono\" 12).")
@ -126,20 +131,12 @@ contextual information."
:init
(setq epa-pinentry-mode 'loopback))
(use! imenu
"The Imenu facility offers a way to find the major definitions in a file by name."
:bind (("M-i" . imenu)))
(use! imenu-list
"his Emacs minor-mode creates an automatically updated buffer
called `Ilist' that is populated with the current buffer's imenu entries.
The `Ilist' buffer is typically shown as a sidebar (Emacs vertically splits the window)."
:bind (("C-'" . imenu-list-smart-toggle)))
(use! emojify
"Adds support for emojis to `FG42'"
:hook (emacs-startup . global-emojify-mode))
(use! discover
"Adds support for the discover.el `https://github.com/mickeynp/discover.el'.")
@ -161,56 +158,6 @@ contextual information."
"This cube controls the different aspect of buffer navigation"
:bind ("C-<tab>" . ace-window))
(use! vertico
"Vertico provides a performant and minimalistic vertical completion UI
based on the default completion system. The focus of Vertico is to provide
a UI which behaves correctly under all circumstances."
:config
(require 'vertico-multiform)
(require 'vertico-flat)
(require 'vertico-grid)
(require 'vertico-buffer)
(require 'vertico-indexed)
(require 'vertico-quick)
(require 'vertico-repeat)
(vertico-mode)
(vertico-multiform-mode)
;; Configure the display per command.
;; Use a buffer with indices for imenu
(setq vertico-multiform-commands
'((imenu buffer indexed)))
;; Configure the display per completion category.
;; Use the grid display for files and a buffer
;; for the consult-grep commands.
(setq vertico-multiform-categories
'((file grid)))
(setq vertico-count 10)
(setq vertico-cycle t)
(when-wm
(setq vertico-multiform-commands
'((t flat)))
(setq vertico-multiform-categories
'((file flat)))))
(use! orderless
"This package provides an orderless completion style that divides the
pattern into space-separated components, and matches candidates that
match all of the components in any order."
:init
(setq completion-styles '(orderless basic)
completion-category-defaults nil
completion-category-overrides '((file (styles partial-completion)))))
(use! marginalia
"Adds useful info to minibuffers completions."
:commands marginalia-mode
:hook (emacs-startup . marginalia-mode))
(when-not-wm
(use! flyspell
@ -227,26 +174,11 @@ match all of the components in any order."
:init
(savehist-mode))
;; Minibuffer related stuff
(use! ctrlf
"Single buffer text search."
:config
(ctrlf-mode +1))
(use! display-line-numbers
"The builtin replacement of linum. It's is pretty fast."
:config
(global-display-line-numbers-mode 1)))
(use! all-the-icons
"A utility package to collect various Icon Fonts and propertize them within
Emacs."
:if (display-graphic-p))
(use! nerd-icons
"A utility package to collect various Icon Fonts and propertize them within
Emacs."
:if (display-graphic-p))
(use! yasnippet
"A Snippet is a template system for Emacs. "
@ -350,7 +282,8 @@ shipped with Emacs."
(when (not (server-running-p))
(when-wm
(setq server-name "fg42-wm"))
(server-start))
(server-start)
(require 'org-protocol))
(when-wm
;; Activating the WM mode

55
lisp/fg42/graphics.el Normal file
View File

@ -0,0 +1,55 @@
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
;;
;; Copyright (c) 2010-2024 Sameer Rahmani <lxsameer@gnu.org>
;;
;; Author: Sameer Rahmani <lxsameer@gnu.org>
;; URL: https://devheroes.codes/FG42/FG42
;; Version: 4.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:
(eval-when-compile
(require 'fpkg))
(use! emojify
"Adds support for emojis to `FG42'"
:if (display-graphic-p)
:hook (emacs-startup . global-emojify-mode))
(use! all-the-icons
"A utility package to collect various Icon Fonts and propertize them within
Emacs."
:if (display-graphic-p))
(use! nerd-icons
"A utility package to collect various Icon Fonts and propertize them within
Emacs."
:if (display-graphic-p))
(use! svg-tag-mode
"A minor mode to replace keywords or regular expression with SVG tags."
:if (display-graphic-p)
:commands global-svg-tag-mode
:config
(setq svg-tag-tags
'(("\\(:[A-Z]+:\\)" . ((lambda (tag)
(svg-tag-make tag :beg 1 :end -1))))
(":TODO " . ((lambda (tag) (svg-tag-make tag)))))))
(provide 'fg42/graphics)
;;; graphics.el ends here

200
lisp/fg42/minibuffer.el Normal file
View File

@ -0,0 +1,200 @@
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
;;
;; Copyright (c) 2010-2024 Sameer Rahmani <lxsameer@gnu.org>
;;
;; Author: Sameer Rahmani <lxsameer@gnu.org>
;; URL: https://devheroes.codes/FG42/FG42
;; Version: 4.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:
(eval-when-compile
(require 'fpkg))
(use! vertico
"Vertico provides a performant and minimalistic vertical completion UI
based on the default completion system. The focus of Vertico is to provide
a UI which behaves correctly under all circumstances."
:config
(require 'vertico-multiform)
(require 'vertico-flat)
(require 'vertico-grid)
(require 'vertico-buffer)
(require 'vertico-indexed)
(require 'vertico-quick)
(require 'vertico-repeat)
(vertico-mode)
(vertico-multiform-mode)
;; Configure the display per command.
;; Use a buffer with indices for imenu
(setq vertico-multiform-commands
'((imenu buffer indexed)))
;; Configure the display per completion category.
;; Use the grid display for files and a buffer
;; for the consult-grep commands.
(setq vertico-multiform-categories
'((file grid)))
(setq vertico-count 10)
(setq vertico-cycle t)
(when-wm
(setq vertico-multiform-commands
'((t flat)))
(setq vertico-multiform-categories
'((file flat)))))
(use! orderless
"This package provides an orderless completion style that divides the
pattern into space-separated components, and matches candidates that
match all of the components in any order."
:init
(setq completion-styles '(orderless basic)
completion-category-defaults nil
completion-category-overrides '((file (styles partial-completion)))))
(use! marginalia
"Adds useful info to minibuffers completions."
:commands marginalia-mode
:hook (emacs-startup . marginalia-mode))
(when-not-wm
(use! ctrlf
"Single buffer text search."
:config
(ctrlf-mode +1)))
(use! consult
"Consult provides search and navigation commands based on the Emacs completion
function completing-read. "
;; C-c bindings in `mode-specific-map'
:bind (("C-c M-x" . consult-mode-command)
("C-c h" . consult-history)
("C-c k" . consult-kmacro)
("C-c m" . consult-man)
("C-c i" . consult-info)
([remap Info-search] . consult-info)
;; C-x bindings in `ctl-x-map'
("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
("C-x b" . consult-buffer) ;; orig. switch-to-buffer
("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
("C-x t b" . consult-buffer-other-tab) ;; orig. switch-to-buffer-other-tab
("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
;; Custom M-# bindings for fast register access
("M-#" . consult-register-load)
("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
("C-M-#" . consult-register)
;; Other custom bindings
("M-y" . consult-yank-pop) ;; orig. yank-pop
;; M-g bindings in `goto-map'
("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
("M-g g" . consult-goto-line)
("M-g M-g" . consult-goto-line)
("M-g o" . consult-outline) ;; Alternative: consult-org-heading
("M-g m" . consult-mark)
("M-g k" . consult-global-mark)
;; M-s bindings in `search-map'
("M-s d" . consult-fd)
("M-s c" . consult-locate)
("M-s g" . consult-grep)
("M-s G" . consult-git-grep)
("M-s r" . consult-ripgrep)
("M-s l" . consult-line)
("M-s L" . consult-line-multi)
("M-s k" . consult-keep-lines)
("M-s u" . consult-focus-lines)
;; Isearch integration
("M-s e" . consult-isearch-history)
:map isearch-mode-map
("M-e" . consult-isearch-history) ;; orig. isearch-edit-string
("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string
("M-s l" . consult-line) ;; needed by consult-line to detect isearch
("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch
;; Minibuffer history
:map minibuffer-local-map
("M-s" . consult-history) ;; orig. next-matching-history-element
("M-r" . consult-history)) ;; orig. previous-matching-history-element
;; Enable automatic preview at point in the *Completions* buffer. This is
;; relevant when you use the default completion UI.
:hook (completion-list-mode . consult-preview-at-point-mode)
:init
;; Configure the register formatting. This improves the register
;; preview for `consult-register', `consult-register-load',
;; `consult-register-store' and the Emacs built-ins.
(setq register-preview-delay 0.5
register-preview-function #'consult-register-format)
;; Tweak the register preview window.
;; This adds thin lines, sorting and hides the mode line of the window.
(advice-add #'register-preview :override #'consult-register-window)
:config
;; For some reason `consult's autoloads do not work
(require 'consult-xref)
;; Use Consult to select xref locations with preview
(setq xref-show-xrefs-function #'consult-xref
xref-show-definitions-function #'consult-xref)
;; Configure preview. The default value
;; is 'any, such that any key triggers the preview.
;; (setq consult-preview-key 'any)
;; (setq consult-preview-key "M-.")
;; (setq consult-preview-key '("S-<down>" "S-<up>"))
;; For some commands and buffer sources it is useful to configure the
;; :preview-key on a per-command basis using the `consult-customize' macro.
(consult-customize
consult-theme :preview-key '(:debounce 0.2 any)
consult-ripgrep consult-git-grep consult-grep
consult-bookmark consult-recent-file consult-xref
consult--source-bookmark consult--source-file-register
consult--source-recent-file consult--source-project-recent-file
;; :preview-key "M-."
:preview-key '(:debounce 0.4 any))
;; Configure the narrowing key.
;; Both < and C-+ work reasonably well.
(setq consult-narrow-key "<") ;; "C-+"
(autoload 'projectile-project-root "projectile")
(setq consult-project-function (lambda (_) (projectile-project-root)))
;; Optionally make narrowing help available in the minibuffer.
;; You may want to use `embark-prefix-help-command' or which-key instead.
;; (define-key consult-narrow-map (vconcat consult-narrow-key "?") #'consult-narrow-help)
)
;; For some reason `consult's autoloads do not work
(use! consult-imenu
"Setup the `consult-imenu' stuff."
:after consult
:bind (("M-i" . consult-imenu)
("M-I" . consult-imenu-multi)))
(use! consult-compile
"Setup the `consult-compile' stuff."
:after consult
:bind (("M-g e" . consult-compile-error)))
(provide 'fg42/minibuffer)
;;; minibuffer.el ends here

View File

@ -28,8 +28,6 @@
(defvar fg42/modeline-views nil
"A list of Noether views to use for modeline.")
(defvar fg42/additional-views nil
"A list of Noether views to be added to the default views.")
(defface fg42/-disabled-modeline-active-border
'((t
@ -50,9 +48,9 @@
to Emacs modeline."
:if (display-graphic-p)
:after projectile
:commands noether-global-mode
:config
;;(require 'noether)
(require 'noether-views)
;; Disable the default modeline

183
lisp/fg42/org.el Normal file
View File

@ -0,0 +1,183 @@
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
;;
;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors
;;
;; Author: Sameer Rahmani <lxsameer@gnu.org>
;; URL: https://devheroes.codes/FG42/FG42
;; Version: 4.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:
(eval-when-compile
(require 'fpkg))
(defvar fg42/org-super-agenda-groups nil)
(defvar fg42/org-home "~/.orgs"
"The location to the org file repository.")
(defvar fg42/default-org-journal-heder
"
#+TITLE: Yearly Journal
#+STARTUP: folded logdrawer logdone logreschedule indent content align constSI entitiespretty
"
"Org journal header.")
(defvar fg42/notes-file "notes.org")
(defvar fg42/global-tags nil)
(defvar fg42/agenda-files "main.org")
(use! org-ql
"This package provides a query language for Org files. It offers two
syntax styles: Lisp-like sexps and search engine-like keywords.
It includes three libraries: The `org-ql' library is flexible and may
be used as a backend for other tools. The libraries `org-ql-search' and
`helm-org-ql' (a separate package) provide interactive search commands
and saved views."
:after org)
(use! org-super-agenda
"This package lets you supercharge your Org daily/weekly agenda. The idea is
to group items into sections, rather than having them all in one big list.
Now you can sort-of do this already with custom agenda commands, but when you
do that, you lose the daily/weekly aspect of the agenda: items are no longer
shown based on deadline/scheduled timestamps, but are shown no-matter-what.
h
For more information checkout `https://github.com/alphapapa/org-super-agenda'"
:after org-agenda
:config
(setq org-agenda-skip-scheduled-if-done t
org-agenda-skip-deadline-if-done t
org-agenda-include-deadlines t
org-agenda-compact-blocks t
org-agenda-start-day nil ;; Today
org-agenda-span 1
org-super-agenda-groups fg42/org-super-agenda-groups)
(org-super-agenda-mode))
;; (defun fg42/org-journal-find-location ()
;; "Open today's journal.
;; But specify a non-nil prefix argument in order to
;; inhibit inserting the heading; `org-capture' will insert the heading."
;; (org-journal-new-entry t)
;; (unless (eq org-journal-file-type 'daily)
;; (org-narrow-to-subtree))
;; (goto-char (point-max)))
;; (use! org-journal
;; :init
;; ;; Change default prefix key; needs to be set before loading org-journal
;; (setq org-journal-prefix-key "C-c j ")
;; :config
;; (setq org-journal-file-type journal-type
;; org-journal-file-header journal-header
;; org-journal-dir (expand-file-name "journal" org-home)
;; org-journal-date-format "%Y-%m-%d (%A): "))
;; '("j" "Journal Entry" plain #'fg42/org-journal-find-location
;; "** %(format-time-string org-journal-time-format)%^{Title} %^G\n %?\n\n*** Context:\n %i\n From: %a"
;; :jump-to-captured t
;; :immediate-finish nil)
(use! org-capture
"Quickly capture what is in your head."
:bind (("<f6>" . org-capture))
:init
(setq-default
org-capture-templates
(eval
`(list
'("t" "Todo" entry (file+headline ,(expand-file-name "main.org" fg42/org-home) "New Tasks")
(file ,(expand-file-name "templates/todo" fg42/org-home))
:prepend t)
'("l" "Link" entry (file+headline ,(expand-file-name "bookmarks.org" fg42/org-home) "Links")
(file ,(expand-file-name "templates/links" fg42/org-home))
:prepend t
:immediate-finish t
:empty-lines 1)
'("h" "Thoughts" entry (file+datetree ,(expand-file-name "journal.org" fg42/org-home))
(file ,(expand-file-name "templates/thoughts" fg42/org-home)))))))
(use! org-protocol
"`org-protocol' intercepts calls from emacsclient to trigger custom actions without external
dependencies. Only one protocol has to be configured with your external applications or
the operating system, to trigger an arbitrary number of custom actions. Just register
your custom sub-protocol and handler with the variable `org-protocol-protocol-alist'.")
(use! org
"A GNU Emacs major mode for keeping notes, authoring documents, computational notebooks,
literate programming, maintaining to-do lists, planning projects, and more in a fast
and effective plain text system.
For more info on ~org-mode~ check out `https://orgmode.org/'"
:init
(setq
org-auto-align-tags nil
org-tags-column 0
org-catch-invisible-edits 'show-and-error
org-special-ctrl-a/e t
org-insert-heading-respect-content t)
org-tag-alist fg42/global-tags
;; Org styling, hide markup etc.
org-hide-emphasis-markers t
org-pretty-entities t
org-ellipsis ""
;; Agenda styling
org-agenda-tags-column 0
org-agenda-block-separator ?─
org-agenda-time-grid
'((daily today require-timed)
(800 1000 1200 1400 1600 1800 2000)
" ┄┄┄┄┄ " "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄")
org-agenda-current-time-string
"<── now ─────────────────────────────────────────────────"
org-agenda-files (concat (file-name-as-directory fg42/org-home)
fg42/agenda-files)
org-directory fg42/org-home
org-default-notes-file (concat (file-name-as-directory fg42/org-home)
fg42/notes-file)
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))))
(use! org-modern
"A modern look for the old org."
:hook ((org-mode . org-modern-mode)
(org-agenda-finalize . org-modern-mode)))
(provide 'fg42/org)
;;; org.el ends here

View File

@ -23,7 +23,7 @@ python311, python3Packages,
# This is a set of system tools required for FG42
# to work.
pyright, emacs, ripgrep, git, texinfo, vazir-fonts, fira-code, nerdfonts
, fira-mono, noto-fonts, gcc, ltex-ls, bash, tree-sitter
, fira-mono, noto-fonts, gcc, ltex-ls, bash, tree-sitter, fd
, aspellWithDicts,
supportWM ? true, xorg, slock,
@ -43,7 +43,7 @@ let
dicts = aspellWithDicts (dicts: with dicts; [ en en-computers en-science ]);
runtimeBins = [ ripgrep git ltex-ls tree-sitter direnv nix nil dicts ]
runtimeBins = [ ripgrep git ltex-ls tree-sitter direnv nix nil dicts fd ]
++ (lib.optional supportPython [
python311
# Python deps