It builds, submodules
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,165 +0,0 @@
|
||||
#+title: Aner's Emacs Development Configuration
|
||||
#+property: header-args :results silent
|
||||
|
||||
* Base dev
|
||||
|
||||
** Require
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(require 'azos-emacs-base)
|
||||
#+end_src
|
||||
|
||||
** Flycheck
|
||||
|
||||
Flycheck is for syntax checking. Mode-specific configs in their relevant sections.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package flycheck
|
||||
:config
|
||||
(global-flycheck-mode 1)
|
||||
)
|
||||
#+end_src
|
||||
|
||||
* Dev modes
|
||||
** Irony-mode
|
||||
|
||||
Must work on this. While it does work, can get slow and for weird projects can
|
||||
show errors.
|
||||
|
||||
Namespace indent disabling based on:
|
||||
https://stackoverflow.com/questions/13825188/suppress-c-namespace-indentation-in-emacs
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
;; == irony-mode ==
|
||||
(use-package irony
|
||||
:ensure t
|
||||
:defer t
|
||||
:init
|
||||
(add-hook 'c++-mode-hook 'irony-mode)
|
||||
(add-hook 'c-mode-hook 'irony-mode)
|
||||
(add-hook 'objc-mode-hook 'irony-mode)
|
||||
:config
|
||||
;; replace the `completion-at-point' and `complete-symbol' bindings in
|
||||
;; irony-mode's buffers by irony-mode's function
|
||||
(defun azos/irony-mode-hook ()
|
||||
(define-key irony-mode-map [remap completion-at-point]
|
||||
'irony-completion-at-point-async)
|
||||
(define-key irony-mode-map [remap complete-symbol]
|
||||
'irony-completion-at-point-async))
|
||||
(add-hook 'irony-mode-hook 'azos/irony-mode-hook)
|
||||
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
|
||||
|
||||
(defconst azos/cc-style
|
||||
'("gnu"
|
||||
(c-offsets-alist . ((innamespace . [0])))
|
||||
(c-basic-offset . 4)))
|
||||
|
||||
(c-add-style "azos/cc-style" azos/cc-style)
|
||||
(add-hook 'irony-mode-hook (lambda () (c-set-style "azos/cc-style")))
|
||||
)
|
||||
#+end_src
|
||||
|
||||
Integration with flycheck
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package flycheck-irony
|
||||
:after flycheck irony
|
||||
:config
|
||||
(add-hook 'flycheck-mode-hook #'flycheck-irony-setup)
|
||||
(add-hook 'c++-mode-hook (lambda () (setq flycheck-checker 'irony)))
|
||||
)
|
||||
#+end_src
|
||||
|
||||
** CMake
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package cmake-mode)
|
||||
#+end_src
|
||||
|
||||
** YAML
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package yaml-mode)
|
||||
#+end_src
|
||||
|
||||
** Nix
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package nix-mode)
|
||||
#+end_src
|
||||
|
||||
** Python
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setq
|
||||
;; python-shell-interpreter "python3"
|
||||
python-shell-completion-native-enable nil)
|
||||
|
||||
(defun azos/python/set-fringes () "Sets fringes for python"
|
||||
(setq left-fringe-width 10 right-fringe-width 0))
|
||||
|
||||
(add-hook 'python-mode-hook 'azos/python/set-fringes)
|
||||
|
||||
(use-package elpy
|
||||
:ensure t
|
||||
:defer t)
|
||||
;; :init
|
||||
;; (elpy-enable))
|
||||
|
||||
(define-key azos/global-minor-mode/open-keymap
|
||||
(kbd "r p") 'run-python)
|
||||
#+end_src
|
||||
|
||||
*** org src block
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setq org-babel-python-command "python3")
|
||||
#+end_src
|
||||
|
||||
** Rust
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package rust-mode)
|
||||
#+end_src
|
||||
|
||||
** Jupyter (ein)
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package ein
|
||||
:config
|
||||
(setq ein:output-area-inlined-images t)
|
||||
(add-hook 'ein:notebook-mode-hook (lambda () (progn
|
||||
;; (elpy-mode -1)
|
||||
(define-key ein:notebook-mode-map (kbd "C-c C-k") nil)))))
|
||||
#+end_src
|
||||
|
||||
** Python
|
||||
|
||||
*** Python version for ORG
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(require 'ob)
|
||||
(setq org-babel-python-command "python3")
|
||||
#+end_src
|
||||
|
||||
* ORG
|
||||
|
||||
** Async blocks
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package ob-async
|
||||
:config
|
||||
;Setting command of async blocks to Python3
|
||||
(add-hook 'ob-async-pre-execute-src-block-hook
|
||||
'(lambda ()
|
||||
(setq org-babel-python-command "python3")
|
||||
))
|
||||
)
|
||||
#+end_src
|
||||
|
||||
* Provide
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(provide 'azos-emacs-dev)
|
||||
(add-hook 'after-init-hook (lambda () (require 'azos-emacs-dev)))
|
||||
#+end_src
|
||||
@@ -1,246 +0,0 @@
|
||||
#+title: Aner's Emacs Editor Configuration
|
||||
#+property: header-args :results silent
|
||||
|
||||
* Base dev
|
||||
|
||||
** Require
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(require 'azos-emacs-base)
|
||||
#+end_src
|
||||
|
||||
* Editor modes
|
||||
|
||||
** Pandoc
|
||||
|
||||
Pandoc mode lets us export different formats to PDF.
|
||||
|
||||
Added for use with markdown.
|
||||
|
||||
Binding to startup is 'C-c /'
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package pandoc-mode
|
||||
:hook
|
||||
(markdown-mode . pandoc-mode))
|
||||
#+end_src
|
||||
|
||||
** Graphviz
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package graphviz-dot-mode)
|
||||
#+end_src
|
||||
|
||||
** Markdown
|
||||
|
||||
Based on [[https://www.reddit.com/r/emacs/comments/u5owr4/how_to_enable_variablepitchmode_for_markdownmode/][this]] post
|
||||
detailing variable pitch.
|
||||
|
||||
We default to github-flavored markdown and show it as variable pitch.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package markdown-mode
|
||||
:mode (("\\.md$" . gfm-mode)
|
||||
("\\.mkd$" . gfm-mode))
|
||||
:hook (gfm-mode . variable-pitch-mode)
|
||||
:diminish markdown-live-preview-mode
|
||||
:config
|
||||
(when (bound-and-true-p lsp-mode)
|
||||
(variable-pitch-mode -1))
|
||||
(set-face-attribute 'markdown-pre-face nil
|
||||
:background "LemonChiffon1" :extend t)
|
||||
)
|
||||
#+end_src
|
||||
|
||||
Let's add a TOC
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package markdown-toc)
|
||||
#+end_src
|
||||
|
||||
* ORG
|
||||
|
||||
** PDF exporting
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setq org-latex-listings 'minted
|
||||
org-export-babel-evaluate nil
|
||||
org-latex-pdf-process
|
||||
(list (concat "latexmk -xelatex -shell-escape -interaction=nonstopmode "
|
||||
"-output-directory=%o %f ; latexmk -c %f")))
|
||||
|
||||
(require 'ox-latex)
|
||||
(unless (boundp 'org-latex-classes)
|
||||
(setq org-latex-classes nil))
|
||||
#+end_src
|
||||
|
||||
This code removes unecessary files after each export
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(add-to-list 'org-latex-logfiles-extensions "tex")
|
||||
#+end_src
|
||||
|
||||
Creating classes
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defvar anerenv/latex-class-common-header
|
||||
"[DEFAULT-PACKAGES]
|
||||
\\usepackage{polyglossia}
|
||||
\\usepackage[cache=false]{minted}
|
||||
\\usepackage{xcolor}
|
||||
\\usepackage{amsfonts}
|
||||
\\usepackage{transparent}
|
||||
\\usepackage{amsmath}
|
||||
\\definecolor{codebg}{rgb}{0.95,0.95,0.95}
|
||||
\\setdefaultlanguage{english}
|
||||
\\setlength{\\parindent}{0in}
|
||||
|
||||
\\DeclareMathOperator*{\\argmax}{arg\\,max}
|
||||
\\DeclareMathOperator*{\\argmin}{arg\\,min}
|
||||
\\newfontfamily\\hebrewfont{LiberationSans}[Script=Hebrew]
|
||||
\\newfontfamily\\hebrewfonttt{LiberationSans}[Script=Hebrew]
|
||||
\\newfontfamily\\hebrewfontsf{LiberationSans}[Script=Hebrew]
|
||||
\\setotherlanguage{hebrew}
|
||||
" "Default common class header")
|
||||
|
||||
(setq org-latex-classes
|
||||
(list (list "article"
|
||||
(concat "\\documentclass{article}
|
||||
" anerenv/latex-class-common-header
|
||||
"\\setminted{
|
||||
bgcolor=codebg,
|
||||
breaklines=true,
|
||||
mathescape,
|
||||
fontsize=\\scriptsize,
|
||||
linenos=false,
|
||||
}
|
||||
")
|
||||
'("\\section{%s}" . "\\section*{%s}")
|
||||
'("\\subsection{%s}" . "\\subsection*{%s}")
|
||||
'("\\subsubsection{%s}" . "\\subsubsection*{%s}")
|
||||
'("\\paragraph{%s}" . "\\paragraph*{%s}")
|
||||
'("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
|
||||
(list "beamer"
|
||||
(concat "\\documentclass{beamer}
|
||||
" anerenv/latex-class-common-header
|
||||
"\\setminted{
|
||||
bgcolor={},
|
||||
breaklines=true,
|
||||
mathescape,
|
||||
fontsize=\\scriptsize,
|
||||
linenos=false,
|
||||
}
|
||||
")
|
||||
'("\\section{%s}" . "\\section*{%s}")
|
||||
'("\\subsection{%s}" . "\\subsection*{%s}")
|
||||
'("\\subsubsection{%s}" . "\\subsubsection*{%s}")
|
||||
'("\\paragraph{%s}" . "\\paragraph*{%s}")
|
||||
'("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
|
||||
)
|
||||
#+end_src
|
||||
|
||||
This should render Hebrew text.
|
||||
|
||||
#+begin_export latex
|
||||
\begin{hebrew}
|
||||
#+end_export
|
||||
זה אמור לעבוד
|
||||
#+begin_export latex
|
||||
\end{hebrew}
|
||||
#+end_export
|
||||
|
||||
** DOCX exporting
|
||||
|
||||
Taken from https://www.reddit.com/r/emacs/comments/zjv1gj/org_files_to_docx/
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defun anerenv/org/export-docx-with-pandoc ()
|
||||
"Use Pandoc to convert .org to .docx.
|
||||
Comments:
|
||||
- The `-N' flag numbers the headers lines.
|
||||
- Use the `--from org' flag to have this function work on files
|
||||
that are in Org syntax but do not have a .org extension"
|
||||
(interactive)
|
||||
(message "exporting .org to .docx")
|
||||
(shell-command
|
||||
(concat "pandoc -N --from org " (buffer-file-name)
|
||||
" -o "
|
||||
(file-name-sans-extension (buffer-file-name))
|
||||
(format-time-string "-%Y-%m-%d-%H%M%S") ".docx")))
|
||||
#+end_src
|
||||
|
||||
** Latex previews
|
||||
|
||||
We don't want to create ltximg directories all over the place.
|
||||
Let's store all ltximg previews in tmp directory.
|
||||
|
||||
Latex scaling from
|
||||
|
||||
https://karthinks.com/software/scaling-latex-previews-in-emacs/
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setq org-format-latex-header
|
||||
"\\documentclass{article}
|
||||
\\usepackage[usenames]{color}
|
||||
[PACKAGES]
|
||||
[DEFAULT-PACKAGES]
|
||||
\\pagestyle{empty} % do not remove
|
||||
% The settings below are copied from fullpage.sty
|
||||
\\setlength{\\textwidth}{\\paperwidth}
|
||||
\\addtolength{\\textwidth}{-3cm}
|
||||
\\setlength{\\oddsidemargin}{1.5cm}
|
||||
\\addtolength{\\oddsidemargin}{-2.54cm}
|
||||
\\setlength{\\evensidemargin}{\\oddsidemargin}
|
||||
\\setlength{\\textheight}{\\paperheight}
|
||||
\\addtolength{\\textheight}{-\\headheight}
|
||||
\\addtolength{\\textheight}{-\\headsep}
|
||||
\\addtolength{\\textheight}{-\\footskip}
|
||||
\\addtolength{\\textheight}{-3cm}
|
||||
\\setlength{\\topmargin}{1.5cm}
|
||||
\\addtolength{\\topmargin}{-2.54cm}
|
||||
\\DeclareMathOperator*{\\argmax}{arg\\,max}
|
||||
\\DeclareMathOperator*{\\argmin}{arg\\,min}"
|
||||
)
|
||||
|
||||
(setq org-preview-latex-image-directory (concat user-emacs-directory "ltximg/"))
|
||||
|
||||
(setq org-latex-create-formula-image-program 'dvisvgm)
|
||||
|
||||
(setq org-format-latex-options (plist-put org-format-latex-options :scale 1))
|
||||
#+end_src
|
||||
|
||||
** Presentation
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package org-present
|
||||
:config
|
||||
(add-hook 'org-present-mode-hook (lambda ()
|
||||
(evil-emacs-state)
|
||||
(blink-cursor-mode 0)
|
||||
(org-present-big)
|
||||
(org-display-inline-images)
|
||||
(org-present-read-only)
|
||||
(setq-local global-hl-line-mode nil)
|
||||
(org-present-hide-cursor)
|
||||
(olivetti-mode 1)
|
||||
(display-line-numbers-mode 0)))
|
||||
|
||||
(add-hook 'org-present-mode-quit-hook (lambda ()
|
||||
(org-present-small)
|
||||
(blink-cursor-mode 1)
|
||||
(org-remove-inline-images)
|
||||
(org-present-show-cursor)
|
||||
(org-present-read-write)
|
||||
(evil-normal-state)
|
||||
(setq-local global-hl-line-mode 1)
|
||||
(olivetti-mode 0)
|
||||
(display-line-numbers-mode 1)))
|
||||
)
|
||||
#+end_src
|
||||
|
||||
* Provide
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(provide 'azos-emacs-editor)
|
||||
(add-hook 'after-init-hook (lambda () (require 'azos-emacs-editor)))
|
||||
#+end_src
|
||||
@@ -1,357 +0,0 @@
|
||||
#+title: Aner's Emacs EXWM Configuration
|
||||
#+property: header-args :results silent
|
||||
|
||||
* Base setup
|
||||
** Require
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(require 'azos-emacs-station)
|
||||
(require 'azos-emacs-base)
|
||||
#+end_src
|
||||
|
||||
* EXWM
|
||||
|
||||
We execute the following code only if started with EXWM argument
|
||||
|
||||
** EXWM Setup
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defvar azos/exwm/load-hook nil "Load EXWM hook")
|
||||
|
||||
(defun azos/exwm/load-exwm (switch) "Loads EXWM"
|
||||
(use-package exwm
|
||||
:ensure t
|
||||
:config
|
||||
(require 'exwm)
|
||||
(require 'exwm-randr)
|
||||
;Workspaces
|
||||
(setq exwm-workspace-number 4
|
||||
exwm-layout-show-all-buffers t
|
||||
exwm-workspace-show-all-buffers t)
|
||||
;System tray
|
||||
(require 'exwm-systemtray)
|
||||
(setq exwm-systemtray-background-color "LightYellow3")
|
||||
(exwm-systemtray-enable)
|
||||
|
||||
;In EXWM mode, no evil
|
||||
(add-to-list 'evil-emacs-state-modes 'exwm-mode)
|
||||
(run-hooks 'azos/exwm/load-hook)
|
||||
|
||||
;Enable
|
||||
(exwm-randr-enable)
|
||||
(exwm-enable)
|
||||
))
|
||||
#+end_src
|
||||
|
||||
** Smart buffer naming
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(add-hook 'azos/exwm/load-hook (lambda () (progn
|
||||
|
||||
(add-hook 'exwm-update-class-hook
|
||||
(lambda ()
|
||||
(unless (or (string-prefix-p "sun-awt-X11-" exwm-instance-name)
|
||||
(string= "gimp" exwm-instance-name))
|
||||
(string-prefix-p "qute" exwm-instance-name)
|
||||
(exwm-workspace-rename-buffer exwm-class-name))))
|
||||
|
||||
(add-hook 'exwm-update-title-hook
|
||||
(lambda ()
|
||||
(when (or (not exwm-instance-name)
|
||||
(string-prefix-p "sun-awt-X11-" exwm-instance-name)
|
||||
(string-prefix-p "qute" exwm-instance-name)
|
||||
(string= "gimp" exwm-instance-name))
|
||||
(exwm-workspace-rename-buffer exwm-title))))
|
||||
|
||||
(add-hook 'exwm-update-class-hook
|
||||
(lambda ()
|
||||
(when (or (not exwm-instance-name)
|
||||
(string-prefix-p "mpv" exwm-class-name))
|
||||
(exwm-workspace-rename-buffer (concat "mpv | " exwm-title)))))
|
||||
|
||||
)))
|
||||
#+end_src
|
||||
|
||||
** Basic keybindings
|
||||
|
||||
Global keybindings can be defined with `exwm-input-global-keys'.
|
||||
Here are a few examples:
|
||||
#+begin_src emacs-lisp
|
||||
(add-hook 'azos/exwm/load-hook (lambda ()
|
||||
(setq exwm-input-global-keys
|
||||
`(
|
||||
;; Bind "s-<f2>" to "slock", a simple X display locker.
|
||||
([s-f2] . (lambda ()
|
||||
(interactive)
|
||||
(start-process "" nil "/usr/bin/slock")))
|
||||
([s-<tab>] . persp-switch)
|
||||
;; Bind "s-r" to exit char-mode and fullscreen mode.
|
||||
([?\s-r] . exwm-reset)
|
||||
;; Bind "s-w" to switch workspace interactively.
|
||||
([?\s-w] . exwm-workspace-switch)
|
||||
;; Bind "s-0" to "s-9" to switch to a workspace by its index.
|
||||
,@(mapcar (lambda (i)
|
||||
`(,(kbd (format "s-%d" i)) .
|
||||
(lambda ()
|
||||
(interactive)
|
||||
(exwm-workspace-switch-create ,i))))
|
||||
(number-sequence 0 9))
|
||||
;; Bind "s-&" to launch applications ('M-&' also works if the output
|
||||
;; buffer does not bother you).
|
||||
([?\s-&] . (lambda (command)
|
||||
(interactive (list (read-shell-command "$ ")))
|
||||
(start-process-shell-command command nil command)))
|
||||
))))
|
||||
|
||||
(defun azos/exwm/take-screenshot ()
|
||||
(interactive)
|
||||
(shell-command "flameshot gui")
|
||||
)
|
||||
|
||||
(defun azos/exwm/start-qutebrowser ()
|
||||
(interactive)
|
||||
(start-process "qutebrowser" nil "qutebrowser"))
|
||||
|
||||
(add-hook 'azos/exwm/load-hook (lambda () (progn
|
||||
(define-key azos/global-minor-mode/open-keymap
|
||||
(kbd "q") 'azos/exwm/start-qutebrowser)
|
||||
(define-key azos/global-minor-mode/keymap
|
||||
(kbd "<print>") 'azos/exwm/take-screenshot))))
|
||||
#+end_src
|
||||
|
||||
** Better modeline
|
||||
|
||||
This currently does nothing and I am not sure why.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defvar azos/exwm/modeline-hash-table (make-hash-table)
|
||||
"Table to store relative face change cookies in")
|
||||
|
||||
(defface azos/exwm/modeline-remap-style
|
||||
(list (list t (list :background azos/evil-color-insert)))
|
||||
"Make the backgrounds pop to green")
|
||||
|
||||
(defun azos/exwm/input-mode-modeline () "Changes modeline based on input mode"
|
||||
(let ((currbuff (current-buffer)))
|
||||
(if (eq exwm--input-mode 'char-mode)
|
||||
;;line
|
||||
(let ((remap-cookie (gethash currbuff
|
||||
azos/exwm/modeline-hash-table)))
|
||||
(if remap-cookie
|
||||
(progn
|
||||
(face-remap-remove-relative remap-cookie)
|
||||
(remhash currbuff
|
||||
azos/exwm/modeline-hash-table))))
|
||||
;;char
|
||||
(puthash
|
||||
currbuff
|
||||
(face-remap-add-relative 'mode-line
|
||||
'azos/exwm/modeline-remap-style)
|
||||
azos/exwm/modeline-hash-table)
|
||||
)))
|
||||
(add-hook 'exwm-input-input-mode-change-hook 'azos/exwm/input-mode-modeline)
|
||||
;; (set-face-attribute 'mode-line nil :box nil :background "AliceBlue")
|
||||
;; (set-face-attribute 'mode-line-inactive nil :box nil :background "LightYellow3")
|
||||
#+end_src
|
||||
|
||||
** RANDR screen settings
|
||||
|
||||
Enabling randr. Automatic mapping of randr screens to workspaces.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defun azos/exwm/get-monitor-list ()
|
||||
(mapcar (lambda (x) (match-string (string-match "^[A-Za-z]+-*[0-9]+" x) x))
|
||||
(azos/re-seq "^[A-Za-z]+-*[0-9]+ connected"
|
||||
(shell-command-to-string "xrandr"))))
|
||||
|
||||
(defun azos/exwm/add-indexes (list)
|
||||
(azos/exwm/add-indexes-i list 1)
|
||||
)
|
||||
|
||||
(defun azos/exwm/add-indexes-i (list i)
|
||||
(if list
|
||||
(cons i (cons (car list) (azos/exwm/add-indexes-i (cdr list) (+ i 1))))
|
||||
nil))
|
||||
|
||||
(defun azos/exwm/update-randr-monitor-plist ()
|
||||
(interactive)
|
||||
(progn
|
||||
(start-process
|
||||
"xlayoutdisplay" nil "xlayoutdisplay")
|
||||
(setq exwm-randr-workspace-monitor-plist
|
||||
(azos/exwm/add-indexes (azos/exwm/get-monitor-list)))
|
||||
(exwm-randr-refresh)))
|
||||
|
||||
(add-hook 'azos/exwm/load-hook (lambda () (progn
|
||||
(add-hook 'exwm-randr-screen-change-hook
|
||||
'azos/exwm/update-randr-monitor-plist)
|
||||
|
||||
(define-key azos/global-minor-mode/keymap
|
||||
(kbd "s-x") 'azos/exwm/update-randr-monitor-plist))))
|
||||
#+end_src
|
||||
|
||||
** Prefix keys
|
||||
|
||||
Sending simulated keys to X windows
|
||||
#+begin_src emacs-lisp
|
||||
(add-hook 'azos/exwm/load-hook (lambda () (progn
|
||||
(setq exwm-input-prefix-keys
|
||||
'(?\C-x ?\C-u ?\C-h ?\M-x ?\M-& ?\M-: ?\s-d
|
||||
?\s-m ?\s-r ?\s-s ?\s-q ?\H-l ?\C-w)))))
|
||||
#+end_src
|
||||
|
||||
** Desktop environment
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package desktop-environment :after exwm)
|
||||
#+end_src
|
||||
|
||||
** Bluetooth
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package bluetooth :after exwm)
|
||||
#+end_src
|
||||
|
||||
** Pulse
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package pulseaudio-control :after exwm)
|
||||
#+end_src
|
||||
|
||||
** Media keys
|
||||
|
||||
https://gist.github.com/ajyoon/5323b999a01dce8db2d4456da1740fe3
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(add-hook 'azos/exwm/load-hook (lambda ()
|
||||
(progn
|
||||
(dolist (k '(
|
||||
XF86AudioLowerVolume
|
||||
XF86AudioRaiseVolume
|
||||
XF86AudioPlay
|
||||
XF86AudioStop
|
||||
XF86AudioPrev
|
||||
XF86AudioNext))
|
||||
(push k exwm-input-prefix-keys))
|
||||
|
||||
(exwm-input-set-key
|
||||
(kbd "<XF86AudioRaiseVolume>")
|
||||
(lambda ()
|
||||
(interactive) (start-process
|
||||
"pactl" nil "pactl" "set-sink-volume" "0" "+5%")))
|
||||
(exwm-input-set-key
|
||||
(kbd "<XF86AudioLowerVolume>")
|
||||
(lambda ()
|
||||
(interactive) (start-process
|
||||
"pactl" nil "pactl" "set-sink-volume" "0" "-5%")))
|
||||
|
||||
(exwm-input-set-key
|
||||
(kbd "<XF86AudioMute>")
|
||||
(lambda ()
|
||||
(interactive) (start-process
|
||||
"pactl" nil "pactl" "set-sink-mute" "0" "toggle")))
|
||||
|
||||
(exwm-input-set-key
|
||||
(kbd "<XF86AudioPlay>")
|
||||
'desktop-environment-toggle-music)
|
||||
|
||||
(exwm-input-set-key
|
||||
(kbd "<XF86AudioNext>")
|
||||
'desktop-environment-music-next)
|
||||
|
||||
(exwm-input-set-key
|
||||
(kbd "<XF86AudioPrev>")
|
||||
'desktop-environment-music-previous)
|
||||
|
||||
(exwm-input-set-key
|
||||
(kbd "<XF86AudioStop>")
|
||||
'desktop-environment-music-stop)
|
||||
|
||||
(exwm-input-set-key
|
||||
(kbd "<XF86AudioPause>")
|
||||
'desktop-environment-toggle-music)
|
||||
|
||||
(exwm-input-set-key
|
||||
(kbd "<XF86MonBrightnessUp>")
|
||||
(lambda ()
|
||||
(interactive) (start-process
|
||||
"light" nil "light" "-A" "5")))
|
||||
|
||||
(exwm-input-set-key
|
||||
(kbd "<XF86MonBrightnessDown>")
|
||||
(lambda ()
|
||||
(interactive) (start-process
|
||||
"light" nil "light" "-U" "5")))
|
||||
)))
|
||||
#+end_src
|
||||
|
||||
In the event =xbacklight= doesn't work, the following command can be run:
|
||||
|
||||
#+begin_example
|
||||
xrandr --output eDP1 --brightness 0.5
|
||||
#+end_example
|
||||
|
||||
** Dedicated processes
|
||||
|
||||
We'd want to be able to quickly map processes (Spotify, etc.) to
|
||||
keybindings, and have dedicated buffers for them (so they don't reopen).
|
||||
|
||||
We first define variables to be used later, and a function that checks, for each
|
||||
new process, should it be displayed in a new buffer/tab.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defvar azos/exwm/startproc-regex-buffname-list nil
|
||||
"Match between buffer and tab.")
|
||||
(defun azos/exwm/startproc-check-for-buff-entry ()
|
||||
"On new buffer, check if requested to display differently"
|
||||
(let ((entry (cdr (car (seq-filter
|
||||
(lambda (e) (string-match (car e) (buffer-name)))
|
||||
azos/exwm/startproc-regex-buffname-list
|
||||
)))))
|
||||
(if entry
|
||||
(let ((rn (nth 0 entry)) (tn (nth 1 entry)) (buff (current-buffer)))
|
||||
;; Too much complication for renaming
|
||||
;; (if requested-name (rename-buffer requested-name))
|
||||
(progn
|
||||
(if tn (tab-bar-switch-to-tab tn))
|
||||
(switch-to-buffer buff)
|
||||
)))))
|
||||
|
||||
(add-hook 'exwm-manage-finish-hook 'azos/exwm/startproc-check-for-buff-entry)
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defun azos/exwm/start-proc-dedicated
|
||||
(name tab-name procregex proc &rest args)
|
||||
(let ((buff (car (seq-filter (lambda (b
|
||||
)
|
||||
(string-match procregex (buffer-name b)))
|
||||
(buffer-list)))))
|
||||
(if buff
|
||||
;; Found buffer, display
|
||||
(progn
|
||||
(if tab-name (tab-bar-switch-to-tab tab-name))
|
||||
(switch-to-buffer buff)
|
||||
)
|
||||
;;No known buffer, add entry to alist
|
||||
(let ((new-entry `(,procregex ,tab-name ,name))) (progn
|
||||
(add-to-list 'azos/exwm/startproc-regex-buffname-list
|
||||
new-entry)
|
||||
(apply 'start-process name nil proc
|
||||
args))))))
|
||||
#+end_src
|
||||
|
||||
** EXWM Ending
|
||||
|
||||
End the execute only if EXWM block.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(add-to-list 'command-switch-alist '("--start-exwm" . azos/exwm/load-exwm))
|
||||
#+end_src
|
||||
|
||||
* Provide
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(provide 'azos-emacs-exwm)
|
||||
(add-hook 'after-init-hook (lambda () (require 'azos-emacs-exwm)))
|
||||
#+end_src
|
||||
@@ -1,300 +0,0 @@
|
||||
#+title: Aner's Emacs Station Configuration
|
||||
#+property: header-args :results silent
|
||||
|
||||
* Base setup
|
||||
** Require
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(require 'azos-emacs-base)
|
||||
#+end_src
|
||||
|
||||
* Major modes
|
||||
|
||||
** Mail
|
||||
|
||||
*** General instructions
|
||||
|
||||
Due to the fact that setting up email in general is complicated, I'll recap the process here.
|
||||
|
||||
Before ANYTHING, setup pass.
|
||||
|
||||
https://wiki.archlinux.org/title/Pass
|
||||
|
||||
Initialize password
|
||||
|
||||
Then for gmail, used
|
||||
|
||||
#+begin_src bash :results none :exports code
|
||||
pass init <ID>
|
||||
pass insert gmail.com/<username>
|
||||
#+end_src
|
||||
|
||||
It prompted for password, I put it in.
|
||||
|
||||
Then setup mbsync properly. The ansible files already take care of that.
|
||||
|
||||
Then we setup ~/.mbsyncrc. This file is important and is not linked to repository for security reasons.
|
||||
|
||||
https://wiki.archlinux.org/title/isync
|
||||
|
||||
Wrote mbsyncrc
|
||||
|
||||
|
||||
Created all directories
|
||||
|
||||
Went into gmail settings to allow less secure things.
|
||||
|
||||
https://notmuchmail.org/getting-started/
|
||||
|
||||
We then RUN notmuch, and notmuch setup for prompt.
|
||||
|
||||
Adding emails can be done with notmuch new
|
||||
|
||||
*** Config
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
;; (defvar azos/mail/sync-list nil "List of functions with args to sync mail")
|
||||
|
||||
;; (defun azos/mail/lieer-sync-func-str (maildir)
|
||||
;; (concat "cd " maildir " && gmi sync -s"))
|
||||
|
||||
;; (defun azos/mail/mbsync-func-str ()
|
||||
;; "mbsync -a")
|
||||
|
||||
;; (defun azos/mail/pre-sync-func-str ()
|
||||
;; (concat (mapconcat 'eval (mapcar 'apply azos/mail/sync-list) " &\n")
|
||||
;; "\nwait\n"))
|
||||
|
||||
;; (defun azos/mail/sync-notify () (interactive)
|
||||
;; (let ((command (concat (azos/mail/pre-sync-func-str)
|
||||
;; "{ if [[ $(notmuch new | grep \"No new mail\") ]]; "
|
||||
;; "then dunstify -u low \"Synced mail\" ; "
|
||||
;; "else dunstify \"New mail!\" ; fi ; } || "
|
||||
;; "dunstify -u critical \"Error syncing mail\"")))
|
||||
;; (start-process-shell-command "mailsync" "*mailsync*" command)))
|
||||
|
||||
;; (defun azos/mail/sync-n-notify ()
|
||||
;; (let ((command (concat (azos/mail/pre-sync-func-str)
|
||||
;; "{ if [[ $(notmuch new | grep \"No new mail\") ]]; "
|
||||
;; "then : ; "
|
||||
;; "else dunstify \"New mail!\" ; fi ; } || "
|
||||
;; "dunstify -u critical \"Error syncing mail\"")))
|
||||
;; (start-process-shell-command "mailsync" "*mailsync*" command)))
|
||||
|
||||
;; (defun azos/mail/set-sync-list (sync-list)
|
||||
;; "Set list of mails and start timer"
|
||||
;; (progn
|
||||
;; (setq azos/mail/sync-list sync-list)))
|
||||
;; ; (azos/run-timer 'mail-sync 'azos/mail/sync-n-notify (* 60 10))))
|
||||
|
||||
(use-package notmuch
|
||||
:straight (:type built-in)
|
||||
:init
|
||||
(setq-default
|
||||
notmuch-hello-sections
|
||||
'(notmuch-hello-insert-saved-searches
|
||||
notmuch-hello-insert-alltags)
|
||||
notmuch-always-prompt-for-sender t
|
||||
message-sendmail-envelope-from 'header)
|
||||
:config
|
||||
(evil-collection-notmuch-setup)
|
||||
(add-hook 'notmuch-show-mode 'azos/default-variable-pitch)
|
||||
(setq send-mail-function 'sendmail-send-it
|
||||
notmuch-search-oldest-first nil
|
||||
message-cite-style message-cite-style-gmail
|
||||
message-citation-line-function
|
||||
'message-insert-formatted-citation-line)
|
||||
(defun azos/notmuch-archive () "Archive a message" (interactive)
|
||||
(progn
|
||||
(evil-collection-notmuch-toggle-tag "arx" "search" 'ignore)
|
||||
(evil-collection-notmuch-toggle-tag "inbox" "search"
|
||||
'notmuch-search-next-thread)
|
||||
))
|
||||
(defun azos/notmuch-keep () "Mark important message for keeps" (interactive)
|
||||
(progn
|
||||
(evil-collection-notmuch-toggle-tag "keep" "search"
|
||||
'notmuch-search-next-thread)))
|
||||
|
||||
(defun azos/notmuch-delete-gmail () "Delete a message, no inbox"
|
||||
(interactive)
|
||||
(progn
|
||||
(evil-collection-notmuch-toggle-tag "deleted" "search" 'ignore)
|
||||
(evil-collection-notmuch-toggle-tag "trash" "search" 'ignore)
|
||||
(evil-collection-notmuch-toggle-tag "inbox" "search"
|
||||
'notmuch-search-next-thread)))
|
||||
|
||||
(defun azos/notmuch-toggle-inbox () "Toggles inbox tag" (interactive)
|
||||
(evil-collection-notmuch-toggle-tag "inbox" "search" 'ignore))
|
||||
|
||||
(dolist (state '(normal visual))
|
||||
(evil-collection-define-key state 'notmuch-search-mode-map
|
||||
"d" 'azos/notmuch-delete-gmail
|
||||
"I" 'azos/notmuch-toggle-inbox
|
||||
"D" 'evil-collection-notmuch-search-toggle-delete
|
||||
"A" 'azos/notmuch-archive
|
||||
"K" 'azos/notmuch-keep))
|
||||
(evil-collection-define-key 'normal 'notmuch-show-mode-map
|
||||
(kbd "M-j") nil
|
||||
(kbd "K") nil
|
||||
(kbd "M-k") nil)
|
||||
|
||||
:bind
|
||||
(:map azos/global-minor-mode/open-keymap
|
||||
("m" . notmuch))
|
||||
)
|
||||
#+end_src
|
||||
|
||||
Run this command to make sendmail use the right thing
|
||||
|
||||
#+begin_src bash :results none :exports code
|
||||
sudo ln -s /usr/bin/msmtp /usr/sbin/sendmail
|
||||
#+end_src
|
||||
|
||||
Then we go to
|
||||
|
||||
https://wiki.archlinux.org/title/isync
|
||||
|
||||
We will do this manually.
|
||||
|
||||
*** Signatures
|
||||
|
||||
Taken from
|
||||
|
||||
https://emacs.stackexchange.com/questions/27759/do-not-automatically-sign-emails-directed-to-mailing-lists-and-such
|
||||
|
||||
Thanks to Dan of Stackoverflow.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defvar azos/mail/blacklist-addresses nil
|
||||
"List of email addresses (as strings) to blacklist for
|
||||
`mml-secure-message-sign'.")
|
||||
|
||||
(defun azos/mail/secure-sign-maybe ()
|
||||
"Use `mml-secure-message-sign' unless the addressee is in the
|
||||
`azos/mail/blacklist-addresses'."
|
||||
(let ((addresses (mapcar (lambda (address)
|
||||
(when (string-match
|
||||
"\\(<?\\)\\([^@< ]+@[^@> ]+\\)\\(>?\\)"
|
||||
address)
|
||||
(match-string 2 address)))
|
||||
;; (split-string (message-field-value "To")
|
||||
;; "," t "[[:blank:]]+"))))
|
||||
(split-string (concat (message-field-value "To")
|
||||
", "
|
||||
(message-field-value "Cc"))
|
||||
"," t "[[:blank:]]+"))))
|
||||
;; skip secure signing when an address is blacklisted
|
||||
(unless (delq nil (mapcar (lambda (address)
|
||||
(car (member address azos/mail/blacklist-addresses)))
|
||||
addresses))
|
||||
(mml-secure-message-sign))))
|
||||
#+end_src
|
||||
|
||||
** Elfeed
|
||||
|
||||
MPV from https://www.reddit.com/r/emacs/comments/7usz5q/youtube_subscriptions_using_elfeed_mpv_no_browser/
|
||||
|
||||
https://medium.com/emacs/using-elfeed-to-view-videos-6dfc798e51e6
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package elfeed
|
||||
:init
|
||||
(defun azos/elfeed/v-mpv (url)
|
||||
"Watch a video from URL in MPV"
|
||||
(start-process "mpv" nil "mpv" url))
|
||||
|
||||
(defun azos/elfeed/view-mpv (&optional use-generic-p)
|
||||
"Youtube-feed link"
|
||||
(interactive "P")
|
||||
(let ((entries (elfeed-search-selected)))
|
||||
(cl-loop for entry in entries
|
||||
do (elfeed-untag entry 'unread)
|
||||
when (elfeed-entry-link entry)
|
||||
do (azos/elfeed/v-mpv it))
|
||||
(mapc #'elfeed-search-update-entry entries)))
|
||||
|
||||
(defun slurp (f)
|
||||
(with-temp-buffer
|
||||
(insert-file-contents f)
|
||||
(buffer-substring-no-properties
|
||||
(point-min)
|
||||
(point-max))))
|
||||
|
||||
(setq-default elfeed-search-filter "@3-days-ago")
|
||||
:config
|
||||
(evil-collection-elfeed-setup)
|
||||
)
|
||||
#+end_src
|
||||
|
||||
*** Elfeed tube
|
||||
|
||||
https://github.com/karthink/elfeed-tube
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package elfeed-tube
|
||||
:ensure t ;; or :straight t
|
||||
:after elfeed
|
||||
:demand t
|
||||
:config
|
||||
;; (setq elfeed-tube-auto-save-p nil) ; default value
|
||||
;; (setq elfeed-tube-auto-fetch-p t) ; default value
|
||||
(elfeed-tube-setup)
|
||||
|
||||
:bind (:map elfeed-show-mode-map
|
||||
("F" . elfeed-tube-fetch)
|
||||
([remap save-buffer] . elfeed-tube-save)
|
||||
:map elfeed-search-mode-map
|
||||
("F" . elfeed-tube-fetch)
|
||||
([remap save-buffer] . elfeed-tube-save)))
|
||||
|
||||
(use-package elfeed-tube-mpv
|
||||
:ensure t ;; or :straight t
|
||||
:after elfeed-tube
|
||||
:bind (:map elfeed-show-mode-map
|
||||
("C-c C-f" . elfeed-tube-mpv-follow-mode)
|
||||
("C-c C-w" . elfeed-tube-mpv-where)))
|
||||
#+end_src
|
||||
|
||||
** Pass
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package pass
|
||||
:bind
|
||||
(:map azos/global-minor-mode/open-keymap
|
||||
("p" . 'password-store-copy)))
|
||||
#+end_src
|
||||
|
||||
** Calendar
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(evil-collection-calendar-setup)
|
||||
#+end_src
|
||||
|
||||
** OpenSCAD
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package scad-mode)
|
||||
|
||||
; Disabling for now
|
||||
;; (use-package scad-preview
|
||||
;; :straight '(
|
||||
;; scad-preview
|
||||
;; :type git
|
||||
;; :host github
|
||||
;; :repo "zk-phi/scad-preview"))
|
||||
#+end_src
|
||||
|
||||
** Kubernetes
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package kubernetes
|
||||
:ensure t
|
||||
:commands (kubernetes-overview))
|
||||
#+end_src
|
||||
|
||||
* Provide
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(provide 'azos-emacs-station)
|
||||
(add-hook 'after-init-hook (lambda () (require 'azos-emacs-station)))
|
||||
#+end_src
|
||||
Reference in New Issue
Block a user