diff options
author | Piotr Szarmanski | 2023-08-23 22:08:44 +0200 |
---|---|---|
committer | Piotr Szarmanski | 2023-08-23 22:08:44 +0200 |
commit | b099fa5ac0f12d0ed8e1f7442e47a768b86855a6 (patch) | |
tree | fe307dd97efc0e1aa6083cf8c43344d00b7a0adc | |
parent | d0feb966e128c59ffedfd729ceac536b1f6e8c99 (diff) |
-rw-r--r-- | config.org | 370 | ||||
-rw-r--r-- | emacs-manifest.scm | 19 | ||||
-rw-r--r-- | init.el | 18 | ||||
-rw-r--r-- | packages.scm | 39 | ||||
-rw-r--r-- | templates/latex | 13 | ||||
-rw-r--r-- | templates/lisp-mode | 26 | ||||
-rw-r--r-- | templates/prog-mode | 29 |
7 files changed, 301 insertions, 213 deletions
@@ -176,6 +176,15 @@ rather than globally (setq enable-recursive-minibuffers t) (minibuffer-depth-indicate-mode 1) #+end_src +** Enable pixel-wise scrolling +#+begin_src emacs-lisp + (setq window-resize-pixelwise t) + (setq frame-resize-pixelwise t) +#+end_src +** Enable emacs server +#+begin_src emacs-lisp + (server-start) +#+end_src ** Set context-menu-mode #+begin_src emacs-lisp (context-menu-mode 1) @@ -610,8 +619,7 @@ Based on the setup described [[https://writepermission.com/org-blogging-rss-feed Public key: [[https://ykonai.net/key.asc][[11B2 E4AF 4833 D7A5 BEAF 3566 CC6D 0555 B66F 03AC]]] [[https://git.ykonai.net][Some projects]] - - [[./internet.html][Internet catalogue]]\n\n" +\n\n" (org-list-to-org list))) (setq yk/rss-alist (list "blog-rss" @@ -777,28 +785,6 @@ possible completions :init (which-key-mode)) #+END_SRC -** Package =swiper= -*** Description -When doing C-s to search, you get this very nice and neat mini-buffer that you -can traverse with the arrow keys (or C-n and C-p) and then press <RET> to select -where you want to go -*** Code -#+BEGIN_SRC emacs-lisp - (use-package swiper - :demand t - :bind ("C-s" . 'swiper)) -#+END_SRC -** Package =avy= -*** Description -Avy is a very useful package; instead of having to move your cursor to a line -that is very far away, just do M - s and type the character that you want to -move to -*** Code -#+BEGIN_SRC emacs-lisp - (use-package avy - :bind - ("M-s" . avy-goto-char)) -#+END_SRC ** Package =switch-window= *** Description Switch window is a neat package because instead of having to painstakingly do @@ -817,31 +803,6 @@ pick the one you want to move to according to the letter it is assigned to :bind ([remap other-window] . switch-window)) #+END_SRC -** Package =ido= and =ido-vertical= -*** Description -For the longest time I used the default way of switching and killing buffers in -Emacs. Same for finding files. Ido-mode made these three tasks IMMENSELY easier -and more intuitive. Please not that I still use the default way M - x works -because I believe all you really need for it is which-key -*** Code -#+BEGIN_SRC emacs-lisp - (use-package ido - :init - (ido-mode 1) - :config - (setq ido-enable-flex-matching nil) - (setq ido-create-new-buffer 'always) - (setq ido-everywhere t)) - - (use-package ido-vertical-mode - :init - (ido-vertical-mode 1)) - ; This enables arrow keys to select while in ido mode. If you want to - ; instead use the default Emacs keybindings, change it to - ; "'C-n-and-C-p-only" - (setq ido-vertical-define-keys 'C-n-C-p-up-and-down) - (define-key ido-file-completion-map (kbd "C-w") 'ido-delete-backward-updir) -#+END_SRC ** Package =async= *** Description Utilize asynchronous processes whenever possible @@ -1121,7 +1082,10 @@ FIXME, STUB, in source files. (lambda () (setq forth-indent-level 4) (setq forth-minor-indent-level 2) - (setq forth-hilight-level 3)))) + (setq forth-hilight-level 3))) + (defun forth () + (interactive) + (comint-run "gforth"))) #+end_src ** Package =corfu= #+begin_src emacs-lisp @@ -1140,6 +1104,179 @@ FIXME, STUB, in source files. (corfu-mode 1))) (add-hook 'minibuffer-setup-hook #'corfu-enable-always-in-minibuffer 1)) #+end_src +** Package =orderless= +#+begin_src emacs-lisp + (use-package orderless + :demand t + :init + ;; Configure a custom style dispatcher (see the Consult wiki) +; (setq orderless-style-dispatchers '(+orderless-consult-dispatch orderless-affix-dispatch) +; orderless-component-separator #'orderless-escapable-split-on-space) + (setq completion-styles '(orderless basic) + completion-category-defaults nil + completion-category-overrides '((file (styles partial-completion))))) +#+end_src +** Package =vertico= +#+begin_src emacs-lisp + (use-package vertico + :demand t + :init + (vertico-mode) + + ;; Different scroll margin + ;; (setq vertico-scroll-margin 0) + + ;; Show more candidates + ;; (setq vertico-count 20) + + ;; Grow and shrink the Vertico minibuffer + ;; (setq vertico-resize t) + + (setq vertico-cycle t)) +#+end_src +** Package =consult= +#+begin_src emacs-lisp + ;; Example configuration for Consult + (use-package consult + :demand t + ;; Replace bindings. Lazily loaded due by `use-package'. + :bind (;; C-c bindings in `mode-specific-map' + ("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 r b" . consult-bookmark) ;; orig. bookmark-jump + ;; 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 e" . consult-compile-error) + ("M-g f" . consult-flymake) ;; Alternative: consult-flycheck + ("M-g g" . consult-goto-line) ;; orig. goto-line + ("M-g M-g" . consult-goto-line) ;; orig. goto-line + ("M-g o" . consult-outline) ;; Alternative: consult-org-heading + ("M-g m" . consult-mark) + ("M-g k" . consult-global-mark) + ("M-g i" . consult-imenu) + ("M-g I" . consult-imenu-multi) + ;; M-s bindings in `search-map' + ("M-s d" . consult-find) + ("M-s D" . consult-locate) + ("M-s g" . consult-grep) + ("M-s G" . consult-git-grep) + ("M-s r" . consult-ripgrep) + + ("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) + + ;; Global + ("C-s" . consult-line) + :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) + + ;; The :init configuration is always executed (Not lazy) + :init + + ;; Optionally 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) + + ;; Optionally 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) + + ;; Use Consult to select xref locations with preview + (setq xref-show-xrefs-function #'consult-xref + xref-show-definitions-function #'consult-xref) + + ;; Configure other variables and modes in the :config section, + ;; after lazily loading the package. + :config + + ;; Optionally 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)) + + ;; Optionally configure the narrowing key. + ;; Both < and C-+ work reasonably well. + (setq consult-narrow-key "<") ;; "C-+" + + ;; 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) + + ;; By default `consult-project-function' uses `project-root' from project.el. + ;; Optionally configure a different project root function. + ;;;; 1. project.el (the default) + ;; (setq consult-project-function #'consult--default-project--function) + ;;;; 2. vc.el (vc-root-dir) + ;; (setq consult-project-function (lambda (_) (vc-root-dir))) + ;;;; 3. locate-dominating-file + ;; (setq consult-project-function (lambda (_) (locate-dominating-file "." ".git"))) + ;;;; 4. projectile.el (projectile-project-root) + ;; (autoload 'projectile-project-root "projectile") + ;; (setq consult-project-function (lambda (_) (projectile-project-root))) + ;;;; 5. No project support + ;; (setq consult-project-function nil) + ) +#+end_src +** Package =marginalia= +#+begin_src emacs-lisp + (use-package marginalia + :demand t + :bind (:map minibuffer-local-map + ("M-A" . marginalia-cycle)) + :init + (marginalia-mode)) +#+end_src +** Package =tempel= +Template package. +#+begin_src emacs-lisp + (use-package tempel + :bind (("M-+" . tempel-complete) ;; Alternative tempel-expand + ("M-*" . tempel-insert)) + :config + (setq tempel-path (list (expand-file-name "templates/*" user-emacs-directory)))) + +#+end_src ** Package =ef-themes= *** Description This is a set of more colorful themes made by Prot. I liked a lot of the things @@ -1159,7 +1296,12 @@ theme seems very pretty on the other hand. (setq-default TeX-master nil) (setq TeX-parse-self t) (setq TeX-auto-save t) - (setq TeX-engine 'luatex)) + (setq TeX-engine 'luatex) + ;; Enable LaTeX math support + (add-hook 'LaTeX-mode-map #'LaTeX-math-mode) + + ;; Enable reference mangment + (add-hook 'LaTeX-mode-map #'reftex-mode)) #+end_src ** Package =calibredb= *** Code @@ -1302,6 +1444,19 @@ since it is more contained inside of Emacs. (global-set-key (kbd "C-x g") #'gnus) #+end_src +*** Set C-x C-g to async call =mbsync= -a +#+begin_src emacs-lisp + (defun async-mbsync () + (interactive) + (make-process + :name "mbsync" + :command '("mbsync" "-a") + :sentinel #'(lambda (proc msg) + (when (eq (process-status proc) 'exit) + (message "Completed mbsync."))))) + + (global-set-key (kbd "C-x C-g") #'async-mbsync) +#+end_src *** Put everything in ~/news This should essentially put everything under ~/news. #+begin_src emacs-lisp @@ -1537,116 +1692,3 @@ Make =q= kill the buffer in image-mode. (connection-local-set-profiles '(:application tramp :machine "ykonai.net") 'remote-path-guix) #+end_src -* Skeletons -All skeletons are under =insert/= functions. Use =C-c s=, which will prompt for -a skeleton to choose. -** asdf-system-def -Insert a simple template for the asdf =defsystem= form. Prompts for the system -name. -#+begin_src emacs-lisp - (define-skeleton insert/asdf-system-def - "Insert a basic asdf system definition." - "System name: " - "(defsystem \"" str "\"" \n - > ":author \"mail@ykonai.net\"" \n - > ":license \"LGPLv3 or later\"" \n - > ":depends-on ()"\n - > ":components" \n - > "((:module \"src\"" \n - > ":serial t" \n - > ":components ((:file \"package\"))))" \n - > ":in-order-to ((test-op (test-op :" str "/test))))" \n - \n - "(defsystem \"" str "/test\"" \n - > ":name \"" str "/test\"" - > ":depends-on (\"" str "\" \"fiveam\")" \n - > ":perform (test-op (op c)" \n - > "(symbol-call :fiveam :run! (find-symbol* :" str "-tests :" str "/test)))" \n - > ":components" \n - > "((:module \"tests\"" \n - > ":serial t" \n - > ":components ((:file \"package\")))))" - '(indent-region (buffer-end 0) (buffer-end 1))) - -#+end_src -** defpackage -Insert a simple defpackage form. Prompts for the package name. -#+begin_src emacs-lisp - (define-skeleton insert/defpackage - "Insert a simple defpackage form." - "(defpackage :" str \n - > "(:use common-lisp" _ ")" - > "(:export))") -#+end_src -** LaTeX article -Basic LaTeX template. -#+begin_src emacs-lisp - (define-skeleton insert/math-article - "Insert a simple LaTeX template." - "insert title" - "\\documentclass{article}" \n - "\\usepackage{polski}" \n - "\\usepackage{amsmath}" \n - "\\usepackage{amsfonts}" \n - "\\usepackage{graphics}" \n - "\\title{" str "}" \n - "\\author{Piotr Szarmański}" \n - "\\begin{document}" \n - "\\maketitle" \n \n - "\\end{document}") -#+end_src -** copyright template -#+begin_src emacs-lisp - (define-skeleton insert/copyright-gpl - "Insert a GPLv3 copyright header." - "Project name: " - ";; This file is part of " str "." \n - ";; Copyright (C) " (format "%d" (decoded-time-year (decode-time))) " Piotr Szarmański" \n \n - ";; " str " is free software: you can redistribute it and/or modify it under the" \n - ";; terms of the GNU General Public License as published by the Free" \n - ";; Software Foundation, either version 3 of the License, or (at your option) any" \n - ";; later version." \n \n - ";; " str " is distributed in the hope that it will be useful, but WITHOUT ANY" \n - ";; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR" \n - ";; A PARTICULAR PURPOSE. See the GNU General Public License for more details." \n - \n - ";; You should have received a copy of the GNU General Public License along with" \n - ";; "str". If not, see <https://www.gnu.org/licenses/>." \n \n) - - (define-skeleton insert/copyright-lgpl - "Insert a GPLv3 copyright header." - "Project name: " - ";; This file is part of " str "." \n - ";; Copyright (C) " (format "%d" (decoded-time-year (decode-time))) " Piotr Szarmański" \n \n - ";; " str " is free software: you can redistribute it and/or modify it under the" \n - ";; terms of the Lesser GNU General Public License as published by the Free" \n - ";; Software Foundation, either version 3 of the License, or (at your option) any" \n - ";; later version." \n \n - ";; " str " is distributed in the hope that it will be useful, but WITHOUT ANY" \n - ";; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR" \n - ";; A PARTICULAR PURPOSE. See the GNU General Public License for more details." \n - \n - ";; You should have received a copy of the GNU General Public License along with" \n - ";; "str". If not, see <https://www.gnu.org/licenses/>." \n \n) -#+end_src -** insert-/skeleton [C-c s] -#+begin_src emacs-lisp - (defvar insert-/skeleton-list nil - "A list of `insert/' skeleton function strings.") - - (setf insert-/skeleton-list - (let ((symbol-list nil)) - (mapatoms (lambda (sym) (when (string-prefix-p "insert/" (symbol-name sym)) - (setf symbol-list - (cons (string-trim-left (symbol-name sym) "insert/") symbol-list))))) - symbol-list)) - - (defun insert-/skeleton (skeleton) - "Prompt to insert one of the `insert/' skeleton functions." - (interactive - (list - (completing-read "Skeleton: " insert-/skeleton-list))) - (call-interactively (intern (concat "insert/" skeleton)))) - - (global-set-key (kbd "C-c s") 'insert-/skeleton) -#+end_src diff --git a/emacs-manifest.scm b/emacs-manifest.scm index d0cd090..6d236d5 100644 --- a/emacs-manifest.scm +++ b/emacs-manifest.scm @@ -21,21 +21,18 @@ (define aot-compile-packages (package-input-rewriting `((,emacs-minimal . ,emacs)) #:deep? #t)) -(define without-ess-tests - (options->transformation - '((without-tests . "emacs-buttercup") - (without-tests . "emacs-clojure-mode")))) +;; (define without-ess-tests +;; (options->transformation +;; '((without-tests . "emacs-buttercup") +;; (without-tests . "emacs-clojure-mode")))) (define emacs-extensions (map (compose rewrite-with-my-geiser aot-compile-packages) (list emacs emacs-which-key - emacs-swiper emacs-auctex emacs-ox-rss - emacs-avy emacs-switch-window - emacs-ido-vertical-mode emacs-async emacs-page-break-lines emacs-magit @@ -60,8 +57,12 @@ emacs-cider emacs-paredit emacs-elfeed - - emacs-ef-themes))) + emacs-ef-themes + emacs-vertico + emacs-consult + emacs-marginalia + emacs-tempel + emacs-orderless))) @@ -64,7 +64,23 @@ (seek . emms-player-mpd-seek) (seek-to . emms-player-mpd-seek-to))) '(safe-local-variable-values - '((Package . CL-USER) + '((eval let + ((root-dir-unexpanded + (locate-dominating-file default-directory ".dir-locals.el"))) + (when root-dir-unexpanded + (let* + ((root-dir + (file-local-name + (expand-file-name root-dir-unexpanded))) + (root-dir* + (directory-file-name root-dir))) + (unless + (boundp 'geiser-guile-load-path) + (defvar geiser-guile-load-path 'nil)) + (make-local-variable 'geiser-guile-load-path) + (require 'cl-lib) + (cl-pushnew root-dir* geiser-guile-load-path :test #'string-equal)))) + (Package . CL-USER) (Syntax . ANSI-Common-Lisp) (Base . 10) (eval progn diff --git a/packages.scm b/packages.scm deleted file mode 100644 index bf39574..0000000 --- a/packages.scm +++ /dev/null @@ -1,39 +0,0 @@ -(use-modules (guix packages) - (guix build-system emacs) - (guix download) - ((guix licenses) #:prefix license:)) - -(define emacs-ef-themes - (package - (name "emacs-ef-themes") - (version "0.5.0") - (source (origin - (method url-fetch) - (uri (string-append "https://elpa.gnu.org/packages/ef-themes-" - version ".tar")) - (sha256 - (base32 - "1k73q48vg7vyjmnvizinwn9if481ajq63ps2iwb01f1brrhmbf5v")))) - (build-system emacs-build-system) - (home-page "https://git.sr.ht/~protesilaos/ef-themes") - (synopsis "Colorful and legible themes") - (description - "# Ef (εὖ) themes for GNU Emacs - -IMAGES HERE: <https://protesilaos.com/emacs/ef-themes-pictures>. - -The `ef-themes` are a collection of light and dark themes for GNU Emacs whose -goal is to provide colorful (\"pretty\") yet legible options for users who want -something with a bit more flair than the `modus-themes` (also designed by me). -Watch the presentation, which demonstrates each of the eight themes in the -collection: <https://protesilaos.com/codelog/2022-08-18-ef-themes-demo/>. - -+ Package name (GNU ELPA): `ef-themes` + Official manual: -<https://protesilaos.com/emacs/ef-themes> + Change log: -<https://protesilaos.com/emacs/ef-themes-changelog> + Sample pictures: -<https://protesilaos.com/emacs/ef-themes-pictures> + Git repo on SourceHut: -<https://git.sr.ht/~protesilaos/ef-themes> - Mirrors: + GitHub: -<https://github.com/protesilaos/ef-themes> + GitLab: -<https://gitlab.com/protesilaos/ef-themes> + Mailing list: -<https://lists.sr.ht/~protesilaos/ef-themes>") - (license license:gpl3+))) diff --git a/templates/latex b/templates/latex new file mode 100644 index 0000000..76f5503 --- /dev/null +++ b/templates/latex @@ -0,0 +1,13 @@ +tex-mode + +(article "\\documentclass{article}" n + "\\usepackage{polski}" n + "\\usepackage{amsmath}" n + "\\usepackage{amsfonts}" n + "\\usepackage{graphics}" n + "\\title{" p "}" n + "\\author{Piotr Szarmański}" n + "\\begin{document}" n + "\\maketitle" n n + "\\end{document}") + diff --git a/templates/lisp-mode b/templates/lisp-mode new file mode 100644 index 0000000..d1bb771 --- /dev/null +++ b/templates/lisp-mode @@ -0,0 +1,26 @@ +lisp-mode + +(defsystem "(defsystem \"" (s var) "\"" n> + ":author \"mail@ykonai.net\"" n> + ":license \"LGPLv3 or later\"" n> + ":depends-on ()"n> + ":components" n> + "((:module \"src\"" n> + ":serial t" n> + ":components ((:file \"package\"))))" n> + ":in-order-to ((test-op (test-op :" (s var) "/test))))" n> + n> + "(defsystem \"" (s var) "/test\"" n> + ":name \"" (s var) "/test\"" n> + ":depends-on (\"" (s var) "\" \"fiveam\")" n> + ":perform (test-op (op c)" n> + "(symbol-call :fiveam :run! (find-symbol* :" (s var) "-tests :" (s var) "/test)))" n> + ":components" n> + "((:module \"tests\"" n> + ":serial t" n> + ":components ((:file \"package\")))))") + +(defpackage "(defpackage #:" p + n> "(:use #:common-lisp " q ")" + n> "(:export))") + diff --git a/templates/prog-mode b/templates/prog-mode new file mode 100644 index 0000000..817dff2 --- /dev/null +++ b/templates/prog-mode @@ -0,0 +1,29 @@ +prog-mode + +(gpl3 ";; This file is part of " (s name) "." n + ";; Copyright (C) " (format "%d" (decoded-time-year (decode-time))) " Piotr Szarmański" n n + ";; " (s name) " is free software: you can redistribute it and/or modify it under the" n + ";; terms of the GNU General Public License as published by the Free" n + ";; Software Foundation, either version 3 of the License, or (at your option) any" n + ";; later version." n n + ";; " (s name) " is distributed in the hope that it will be useful, but WITHOUT ANY" n + ";; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR" n + ";; A PARTICULAR PURPOSE. See the GNU General Public License for more details." n + n + ";; You should have received a copy of the GNU General Public License along with" n + ";; "(s name)". If not, see <https://www.gnu.org/licenses/>." n n) + + +(lgpl3 ";; This file is part of " (s name) "." n + ";; Copyright (C) " (format "%d" (decoded-time-year (decode-time))) " Piotr Szarmański" n n + ";; " (s name) " is free software: you can redistribute it and/or modify it under the" n + ";; terms of the Lesser GNU General Public License as published by the Free" n + ";; Software Foundation, either version 3 of the License, or (at your option) any" n + ";; later version." n n + ";; " (s name) " is distributed in the hope that it will be useful, but WITHOUT ANY" n + ";; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR" n + ";; A PARTICULAR PURPOSE. See the Lesser GNU General Public License for more details." n + n + ";; You should have received a copy of the Lesser GNU General Public License along with" n + ";; "(s name)". If not, see <https://www.gnu.org/licenses/>." n n) + |