chore: Push current state
This commit is contained in:
parent
94ec3f0eef
commit
51788861d2
183
README.org
183
README.org
@ -1,5 +1,186 @@
|
||||
* How To Use
|
||||
|
||||
#+begin_src sh :results output scalar
|
||||
ln -sf <THIS_REPO> ~/.emacs.d
|
||||
cp -r <USB_MOUNT> ~/.emacs.d
|
||||
chown -R <YOUR_USER> ~/.emacs.d
|
||||
# ln -sf <THIS_REPO> ~/.emacs.d
|
||||
#+end_src
|
||||
|
||||
* Introduction
|
||||
|
||||
*"Original" EMACS:*
|
||||
- 1976
|
||||
- David A. Moon & Guy L. Steele Jr.
|
||||
- Set of macros for the TECO editor (char based editor)
|
||||
|
||||
*Gosling Emacs:*
|
||||
- 1981
|
||||
- James Gosling (the Java® guy)
|
||||
|
||||
*GNU Emacs:*
|
||||
- 1984
|
||||
- Richard Stallman aka. [[http://stallman.org/saint.html][Saint IGNUcius]] /(saint in the Church of Emacs)/
|
||||
|
||||
*Latest Release*: Emacs 30.1
|
||||
*Released:* February, 2025
|
||||
|
||||
Emacs uses ~emacs-lisp~:
|
||||
- lisp dialect
|
||||
- functional (not pure though)
|
||||
- specially developed to configure Emacs
|
||||
|
||||
** Variables
|
||||
|
||||
#+begin_src emacs-lisp :results output scalar
|
||||
(defvar my/var nil "My very own variable")
|
||||
(setq my/var "Hey Emacs!")
|
||||
(print my/var)
|
||||
;; There are more... (setq-local, setq-default)
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
: "
|
||||
: \"Hey Emacs!\"
|
||||
: "
|
||||
|
||||
** Functions
|
||||
|
||||
#+begin_src emacs-lisp :results output scalar
|
||||
(defun test ()
|
||||
"Docstring"
|
||||
(interactive)
|
||||
(print my/var))
|
||||
|
||||
(test)
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp :results output scalar
|
||||
(defun more (a b &optional c d &rest e)
|
||||
(interactive)
|
||||
; 'a 'b 'c 'd '(...)
|
||||
(print (concat a b c d (mapconcat #'identity e ""))))
|
||||
|
||||
(more "1" "2" "3" "4" "5" "6" "7")
|
||||
(more "1" "2" "3")
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
: "
|
||||
: \"1234567\"
|
||||
:
|
||||
: \"123\"
|
||||
: "
|
||||
|
||||
#+begin_src emacs-lisp :results output scalar
|
||||
(defun print-name (&rest args)
|
||||
(interactive)
|
||||
(let ((first (plist-get args :first))
|
||||
(last (or (plist-get args :last) "?")))
|
||||
(princ last)
|
||||
(when first
|
||||
(princ ", ")
|
||||
(princ first))))
|
||||
|
||||
(print-name :first "Philip" :last "B1")
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
: "B1, Philip"
|
||||
|
||||
** Let Bindings
|
||||
|
||||
#+begin_src emacs-lisp :results output scalar
|
||||
(defun another-test (a b)
|
||||
"Multiplies `A' times `B' and adds them afterwards"
|
||||
(interactive)
|
||||
(let* ((x a)
|
||||
(y (* x b)))
|
||||
(+ x y)))
|
||||
|
||||
(print (another-test 2 4))
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
: "
|
||||
: 10
|
||||
: "
|
||||
|
||||
** Hooks
|
||||
|
||||
#+begin_src emacs-lisp :results output scalar
|
||||
(defun my/fun () (message "Emacs is cool!"))
|
||||
(add-hook 'after-save-hook #'my/fun)
|
||||
;; (remove-hook 'after-save-hook 'my/fun)
|
||||
#+end_src
|
||||
|
||||
** Package Management & Configuration
|
||||
|
||||
*Package Manager*
|
||||
- https://github.com/radian-software/straight.el
|
||||
|
||||
#+begin_src emacs-lisp :results output scalar
|
||||
; Standard is package.el
|
||||
(straight-use-package 'nix-mode)
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
: ""
|
||||
|
||||
*Configuration Macro*
|
||||
- https://github.com/jwiegley/use-package
|
||||
|
||||
#+begin_src emacs-lisp :results output scalar
|
||||
(straight-use-package 'use-package)
|
||||
|
||||
;; Macro that provides syntactic sugar
|
||||
(use-package color-moccur
|
||||
;; Creates autoloads for these commands
|
||||
;; Defers loading of the module until command is used
|
||||
:commands (isearch-moccur isearch-all)
|
||||
;; Keybindings
|
||||
:bind (("M-s O" . moccur)
|
||||
:map isearch-mode-map
|
||||
("M-o" . isearch-moccur)
|
||||
("M-O" . isearch-moccur-all))
|
||||
;; Before package is loaded
|
||||
:init
|
||||
(setq isearch-lazy-highlight t)
|
||||
;; After package is loaded
|
||||
:config
|
||||
(use-package moccur-edit))
|
||||
#+end_src
|
||||
|
||||
** Tour de Emacs Config
|
||||
|
||||
.emacs.d/
|
||||
├── early-init.el
|
||||
├── init.el
|
||||
└── cnf/
|
||||
├── app
|
||||
└── lang
|
||||
|
||||
** Tasks
|
||||
*** Keybinding
|
||||
|
||||
- Create a new keybinding for the ~emacs-lisp-mode~ that executes ~eval-last-sexp~ with the binding ~SPC x e~ while in ~normal~ mode
|
||||
|
||||
**** Possible Solution
|
||||
|
||||
#+begin_src emacs-lisp :results output scalar
|
||||
(my-leader
|
||||
:keymaps 'emacs-lisp-mode-map
|
||||
:states 'normal
|
||||
"x" '(:ignore t :which-key "Eval")
|
||||
"x e" 'eval-last-sexp
|
||||
"x b" 'eval-buffer)
|
||||
#+end_src
|
||||
|
||||
*** Package
|
||||
|
||||
- Install a new package using straight, e.g. ~swiper~ (or something else)
|
||||
|
||||
**** Possible Solution
|
||||
|
||||
#+begin_src emacs-lisp :results output scalar
|
||||
(straight-use-package 'swiper)
|
||||
#+end_src
|
||||
|
@ -5,21 +5,7 @@
|
||||
;; ORD-MODE: Basically jupiter notebooks/markdown on steroids
|
||||
(with-eval-after-load 'org (require 'a-orgmode))
|
||||
|
||||
;; MAGIT: A nice git frontend
|
||||
(straight-use-package 'magit)
|
||||
(setq magit-bury-buffer-function #'quit-window
|
||||
magit-display-buffer-function #'display-buffer)
|
||||
|
||||
(with-eval-after-load 'magit
|
||||
(transient-append-suffix 'magit-push "-u"
|
||||
'(1 "=s" "Skip gitlab pipeline" "--push-option=ci.skip"))
|
||||
(transient-append-suffix 'magit-push "=s"
|
||||
'(1 "=D" "DEBUG" "--push-option=ci.variable=DEBUG=1")) ;; no special meaning for gitlab
|
||||
(transient-append-suffix 'magit-push "=D"
|
||||
'(1 "=V" "Set CI variable" "--push-option=ci.variable=")) ;; Will prompt, can only set one extra variable
|
||||
(transient-append-suffix 'magit-push "=V"
|
||||
'(1 "=O" "Set push option" "--push-option="))
|
||||
)
|
||||
(require 'a-magit)
|
||||
|
||||
;; YASNIPPET: snippets
|
||||
(straight-use-package 'yasnippet)
|
||||
|
@ -5,32 +5,7 @@
|
||||
(setq dired-listing-switches "-lFahv --group-directories-first"
|
||||
dired-dwim-target t
|
||||
delete-by-moving-to-trash t
|
||||
dired-ls-F-marks-symlinks t
|
||||
dired-compress-files-alist '(("\\.tar\\.gz\\'" . "tar -cf - %i | gzip -c9 > %o")
|
||||
("\\.tar\\.bz2\\'" . "tar -cf - %i | bzip2 -c9 > %o")
|
||||
("\\.tar\\.xz\\'" . "tar -cf - %i | xz -c9 > %o")
|
||||
("\\.tar\\.zst\\'" . "tar -cf - %i | zstd -19 -o %o")
|
||||
("\\.tar\\.lz\\'" . "tar -cf - %i | lzip -c9 > %o")
|
||||
("\\.tar\\.lzo\\'" . "tar -cf - %i | lzop -c9 > %o")
|
||||
("\\.zip\\'" . "zip %o -r --filesync %i")
|
||||
("\\.pax\\'" . "pax -wf %o %i"))
|
||||
dired-compress-file-suffixes '(("\\.tar\\.gz\\'" #1="" "gzip -dc %i | tar -xf -")
|
||||
("\\.tar\\.xz\\'" #1# "xz -dc %i | tar -xf -")
|
||||
("\\.tgz\\'" #1# "gzip -dc %i | tar -xf -")
|
||||
("\\.gz\\'" #1# "gzip -d")
|
||||
("\\.lz\\'" #1# "lzip -d")
|
||||
("\\.Z\\'" #1# "uncompress")
|
||||
("\\.z\\'" #1# "gzip -d")
|
||||
("\\.dz\\'" #1# "dictunzip")
|
||||
("\\.tbz\\'" ".tar" "bunzip2")
|
||||
("\\.bz2\\'" #1# "bunzip2")
|
||||
("\\.xz\\'" #1# "unxz")
|
||||
("\\.zip\\'" #1# "7z x -aoa -o%o %i")
|
||||
("\\.tar\\.zst\\'" #1# "unzstd -c %i | tar -xf -")
|
||||
("\\.tzst\\'" #1# "unzstd -c %i | tar -xf -")
|
||||
("\\.zst\\'" #1# "unzstd --rm")
|
||||
("\\.7z\\'" #1# "7z x -aoa -o%o %i")
|
||||
("\\.tar\\'" ".tgz" nil)))
|
||||
dired-ls-F-marks-symlinks t)
|
||||
|
||||
(add-hook 'dired-mode-hook
|
||||
(lambda ()
|
||||
@ -68,8 +43,7 @@
|
||||
(straight-use-package 'dired-launch)
|
||||
(setq dired-launch-command '("xdg-open"))
|
||||
(setf dired-launch-extensions-map
|
||||
'(;; xml files with bpmn in it
|
||||
("xopp" ("xournalpp"))
|
||||
'(("xopp" ("xournalpp"))
|
||||
("drawio.html" ("drawio"))
|
||||
("drawio" ("drawio"))))
|
||||
|
||||
|
@ -2,6 +2,9 @@
|
||||
;; NOTE: org-mode is required in essentials.el so we use the git instead of the shipped version ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; FIXME: A recent org version introduced this feature which currently breaks stuff
|
||||
(setq org-element-cache-persistent nil)
|
||||
|
||||
;; HTMLIZE: html export for orgmode
|
||||
(straight-use-package 'htmlize)
|
||||
|
||||
@ -87,7 +90,7 @@ modified here."
|
||||
org-export-in-background nil
|
||||
org-html-htmlize-output-type 'inline-css
|
||||
|
||||
;; REQUIRES: y -S plantuml graphviz
|
||||
;; REQUIRES: plantuml graphviz
|
||||
;; org-plantuml-jar-path (expand-file-name "/usr/share/java/plantuml/plantuml.jar")
|
||||
|
||||
;; Visuals like nice looking headings, fontification (bold, italic, etc.)
|
||||
@ -234,11 +237,11 @@ modified here."
|
||||
|
||||
;; ORG-DOWNLOAD
|
||||
;; TODO: Setup for seemless insertion of screenshots
|
||||
(setq org-download-screenshot-file "~/sync/screenshots/tmp/orgcapture.png"
|
||||
org-download-screenshot-method "grim -g $(slurp -b '#000000a0' -c '#00000000') -o %s"
|
||||
org-download-image-attr-list '("#+ATTR_ORG: :width 600")
|
||||
org-download-annotate-function (lambda(link) ""))
|
||||
(setq-default org-download-image-dir "./ORGPICS")
|
||||
;; (setq org-download-screenshot-file "~/sync/screenshots/tmp/orgcapture.png"
|
||||
;; org-download-screenshot-method "grim -g $(slurp -b '#000000a0' -c '#00000000') -o %s"
|
||||
;; org-download-image-attr-list '("#+ATTR_ORG: :width 600")
|
||||
;; org-download-annotate-function (lambda(link) ""))
|
||||
;; (setq-default org-download-image-dir "./ORGPICS")
|
||||
|
||||
;; KEYBINDINGS
|
||||
(my-leader
|
||||
|
@ -14,7 +14,6 @@
|
||||
;; "<XF86AudioLowerVolume>" 'evil-scroll-down
|
||||
;; "<XF86AudioRaiseVolume>" 'evil-scroll-up
|
||||
)
|
||||
|
||||
;; This is a reference to the leader key defined in essentials.el
|
||||
;; It basically means: <YOUR-LEADER> + whatever is configured below
|
||||
;; E.g. "SPC SPC" actually means "SPC SPC SPC" because it is prefix with `my-leader'
|
||||
@ -29,6 +28,11 @@
|
||||
"SPC" '(:ignore t :which-key "Mode Specific Binds")
|
||||
"SPC SPC" 'counsel-M-x
|
||||
|
||||
"u" '(lambda ()
|
||||
(interactive)
|
||||
(let ((current-prefix-arg 1))
|
||||
(call-interactively #'eval-last-sexp)))
|
||||
|
||||
"f" 'counsel-find-file
|
||||
"g" 'magit-status
|
||||
"h" 'evil-avy-goto-line
|
||||
@ -73,7 +77,7 @@
|
||||
|
||||
;; edit stuff
|
||||
"e" '(:ignore t :which-key "Edit")
|
||||
"e c" '((lambda() (interactive) (dired my/emacsconf)) :which-key "edit emacs config")
|
||||
"e c" '((lambda() (interactive) (dired (concat user-emacs-directory))) :which-key "edit emacs config")
|
||||
|
||||
;; ui stuff
|
||||
"q" '(:ignore t :which-key "Quality :)")
|
||||
|
@ -6,8 +6,7 @@
|
||||
;; Defer garbage collection further back in the startup process
|
||||
(setq gc-cons-threshold most-positive-fixnum)
|
||||
;; In Emacs 27+, package initialization occurs before `user-init-file' is
|
||||
;; loaded, but after `early-init-file'. Doom handles package initialization, so
|
||||
;; we must prevent Emacs from doing it early!
|
||||
;; loaded, but after `early-init-file'. We use `straight' as our package manager
|
||||
(setq package-enable-at-startup nil)
|
||||
(advice-add #'package--ensure-init-file :override #'ignore)
|
||||
|
||||
|
1
init.el
1
init.el
@ -26,6 +26,7 @@
|
||||
(require 'additionals)
|
||||
(require 'global-keybindings)
|
||||
(require 'functions)
|
||||
(require 'programming)
|
||||
|
||||
;; set gc values back to smth reasonable
|
||||
(setq gc-cons-threshold 104857600) ;; 100 MegaByte (LSP)
|
||||
|
@ -1,7 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: clocktable
|
||||
# key: <ct
|
||||
# --
|
||||
|
||||
#+BEGIN: clocktable :scope file :compact t :emphasize t :lang de :link t :block week$0
|
||||
#+END
|
@ -1,7 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: drill
|
||||
# key: <d
|
||||
# --
|
||||
*** $1 :drill:
|
||||
$2
|
||||
**** Answer
|
Loading…
x
Reference in New Issue
Block a user