commit 8b482ef82e875649ee38dec2d20b47bb77cf244a parent d6cf6f44d49c5879324d5f244af9134f0d417576 Author: Vincent Demeester <vincent@sbr.pm> Date: Tue, 24 Oct 2023 17:57:17 +0200 tools/emacs: remove old-config Signed-off-by: Vincent Demeester <vincent@sbr.pm> Diffstat:
D | tools/emacs/old-config/00-base.el | | | 44 | -------------------------------------------- |
D | tools/emacs/old-config/00-clean.el | | | 64 | ---------------------------------------------------------------- |
D | tools/emacs/old-config/README.org | | | 1 | - |
D | tools/emacs/old-config/config-appearance.el | | | 259 | ------------------------------------------------------------------------------- |
D | tools/emacs/old-config/config-buffers.el | | | 213 | ------------------------------------------------------------------------------- |
D | tools/emacs/old-config/config-compile.el | | | 70 | ---------------------------------------------------------------------- |
D | tools/emacs/old-config/config-completion.el | | | 321 | ------------------------------------------------------------------------------- |
D | tools/emacs/old-config/config-dired.el | | | 229 | ------------------------------------------------------------------------------- |
D | tools/emacs/old-config/config-editing.el | | | 306 | ------------------------------------------------------------------------------- |
D | tools/emacs/old-config/config-elfeed.el | | | 122 | ------------------------------------------------------------------------------- |
D | tools/emacs/old-config/config-files.el | | | 87 | ------------------------------------------------------------------------------- |
D | tools/emacs/old-config/config-keybindings.el | | | 14 | -------------- |
D | tools/emacs/old-config/config-mails.el | | | 74 | -------------------------------------------------------------------------- |
D | tools/emacs/old-config/config-misc.el | | | 17 | ----------------- |
D | tools/emacs/old-config/config-mouse.el | | | 20 | -------------------- |
D | tools/emacs/old-config/config-music.el | | | 40 | ---------------------------------------- |
D | tools/emacs/old-config/config-navigating.el | | | 151 | ------------------------------------------------------------------------------ |
D | tools/emacs/old-config/config-org.el | | | 620 | ------------------------------------------------------------------------------- |
D | tools/emacs/old-config/config-projects.el | | | 77 | ----------------------------------------------------------------------------- |
D | tools/emacs/old-config/config-search.el | | | 111 | ------------------------------------------------------------------------------- |
D | tools/emacs/old-config/config-shells.el | | | 401 | ------------------------------------------------------------------------------- |
D | tools/emacs/old-config/config-vcs.el | | | 207 | ------------------------------------------------------------------------------- |
D | tools/emacs/old-config/config-web.el | | | 87 | ------------------------------------------------------------------------------- |
D | tools/emacs/old-config/config-windows.el | | | 61 | ------------------------------------------------------------- |
D | tools/emacs/old-config/programming-config.el | | | 18 | ------------------ |
D | tools/emacs/old-config/programming-containers.el | | | 31 | ------------------------------- |
D | tools/emacs/old-config/programming-cue.el | | | 9 | --------- |
D | tools/emacs/old-config/programming-elisp.el | | | 7 | ------- |
D | tools/emacs/old-config/programming-go.el | | | 33 | --------------------------------- |
D | tools/emacs/old-config/programming-lsp.el | | | 44 | -------------------------------------------- |
D | tools/emacs/old-config/programming-nix.el | | | 27 | --------------------------- |
D | tools/emacs/old-config/programming-web.el | | | 41 | ----------------------------------------- |
D | tools/emacs/old-config/setup-style.el | | | 44 | -------------------------------------------- |
D | tools/emacs/old-config/writing.el | | | 30 | ------------------------------ |
34 files changed, 0 insertions(+), 3880 deletions(-)
diff --git a/tools/emacs/old-config/00-base.el b/tools/emacs/old-config/00-base.el @@ -1,44 +0,0 @@ -;;; 00-base.el --- -*- lexical-binding: t; -*- -;;; Commentary: -;;; Emacs *absolute* base configuration -;;; Code: - -(setq frame-title-form '("%b")) ;; do not add "GNU Emacs at …" -(setq use-short-answers t) ;; for emacs and above, replace defalias yes-or-no-p -(setq read-answer-short t) ;; accepts single-character answers, very similar to above - -(put 'overwrite-mode 'disabled t) ;; I don't really want to use overwrite-mod, ever -(setq initial-buffer-choice t) ;; always start with *scratch* - -(setq use-dialog-box nil) ;; never use dialog box (no mouse >:D) -(setq use-file-dialog nil) ;; never use file dialog (gtk) -(setq echo-keystrokes 0.1) ;; display command keystrokes quickly - -(global-unset-key (kbd "C-z")) -(global-unset-key (kbd "C-x C-z")) -(global-unset-key (kbd "C-h h")) - -;; Custom file management -(defconst vde/custom-file (locate-user-emacs-file "custom.el") - "File used to store settings from Customization UI.") - -(setq minibuffer-prompt-properties - '(read-only t cursor-intangible t face minibuffer-prompt)) - -(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) - -(use-package cus-edit - :config - (setq - custom-file vde/custom-file - custom-buffer-done-kill nil ; Kill when existing - custom-buffer-verbose-help nil ; Remove redundant help text - custom-unlispify-tag-names nil ; Show me the real variable name - custom-unlispify-menu-entries nil) - (unless (file-exists-p custom-file) - (write-region "" nil custom-file)) - - (load vde/custom-file 'no-error 'no-message)) - -(provide '00-base) -;;; 00-base.el ends here diff --git a/tools/emacs/old-config/00-clean.el b/tools/emacs/old-config/00-clean.el @@ -1,64 +0,0 @@ -;;; 00-clean.el --- -*- lexical-binding: t; -*- -;;; Commentary: -;;; no-littering and recentf configurations -;;; Note: this file is autogenerated from an org-mode file. -;;; Code: -(use-package recentf - :config - (setq recentf-max-saved-items 200 - recentf-auto-cleanup 360 - recentf-show-file-shortcuts-flag nil) - (recentf-mode 1) - (add-to-list 'recentf-exclude "^/\\(?:ssh\\|su\\|sudo\\)?:") - ;; Magic advice to rename entries in recentf when moving files in - ;; dired. - (defun rjs/recentf-rename-notify (oldname newname &rest args) - (if (file-directory-p newname) - (rjs/recentf-rename-directory oldname newname) - (rjs/recentf-rename-file oldname newname))) - - (defun rjs/recentf-rename-file (oldname newname) - (setq recentf-list - (mapcar (lambda (name) - (if (string-equal name oldname) - newname - oldname)) - recentf-list)) - recentf-cleanup) - - (defun rjs/recentf-rename-directory (oldname newname) - ;; oldname, newname and all entries of recentf-list should already - ;; be absolute and normalised so I think this can just test whether - ;; oldname is a prefix of the element. - (setq recentf-list - (mapcar (lambda (name) - (if (string-prefix-p oldname name) - (concat newname (substring name (length oldname))) - name)) - recentf-list)) - recentf-cleanup) - - (advice-add 'dired-rename-file :after #'rjs/recentf-rename-notify)) - -(use-package no-littering ; Keep .emacs.d clean - :config - (require 'recentf) - (add-to-list 'recentf-exclude no-littering-var-directory) - (add-to-list 'recentf-exclude no-littering-etc-directory) - - ;; Move this in its own thing - (setq - create-lockfiles nil - delete-old-versions t - kept-new-versions 6 - kept-old-versions 2 - version-control t) - - (setq - backup-directory-alist - `((".*" . ,(no-littering-expand-var-file-name "backup/"))) - auto-save-file-name-transforms - `((".*" ,(no-littering-expand-var-file-name "auto-save/") t)))) - -(provide '00-clean) -;;; 00-clean.el ends here diff --git a/tools/emacs/old-config/README.org b/tools/emacs/old-config/README.org @@ -1 +0,0 @@ -This holds configuration files for different modes and languages diff --git a/tools/emacs/old-config/config-appearance.el b/tools/emacs/old-config/config-appearance.el @@ -1,259 +0,0 @@ -;;; config-appearance.el --- -*- lexical-binding: t -*- -;;; Commentary: -;;; Appearance configuration -;;; Code: -(declare-function projectile-project-name "projectile") - -(use-package emacs - :defer 3 - :bind ("C-c f r" . mu-reset-fonts) - :commands (mu-reset-fonts) - :hook (after-init . mu-reset-fonts) - :config - ;; For displaying emojies 😛🦁 - (set-fontset-font t 'symbol "Apple Color Emoji") - (set-fontset-font t 'symbol "Noto Color Emoji" nil 'append) - (set-fontset-font t 'symbol "Segoe UI Emoji" nil 'append) - (set-fontset-font t 'symbol "Symbola" nil 'append) - (defun mu-reset-fonts () - "Reset fonts to my preferences." - (interactive) - (when (member font-family-mono (font-family-list)) - (set-face-attribute 'default nil - :family font-family-mono - :height font-height) - (set-face-attribute 'fixed-pitch nil - :family font-family-mono)) - (when (member font-family-sans (font-family-list)) - (set-face-attribute 'variable-pitch nil - :family font-family-sans - :weight 'regular)) - (set-fontset-font t 'symbol "Apple Color Emoji") - (set-fontset-font t 'symbol "Noto Color Emoji" nil 'append) - (set-fontset-font t 'symbol "Segoe UI Emoji" nil 'append) - (set-fontset-font t 'symbol "Symbola" nil 'append))) - -(use-package emacs - :config - (setq-default use-file-dialog nil - use-dialog-box nil - echo-keystrokes 0.1 - line-number-display-limit-width 10000 - indicate-buffer-boundaries 'left - indicate-empty-lines +1) - (line-number-mode 1) - (column-number-mode 1) - (global-unset-key (kbd "C-z")) - (global-unset-key (kbd "C-x C-z")) - (global-unset-key (kbd "C-h h")) - ;; let's enable it for all programming major modes - (add-hook 'prog-mode-hook #'hl-line-mode) - ;; and for all modes derived from text-mode - (add-hook 'text-mode-hook #'hl-line-mode)) - -(use-package hl-todo - :commands (hl-todo-mode) - :hook ((prog-mode . hl-todo-mode))) - -(use-package frame - :unless noninteractive - :commands vde/cursor-type-mode - :config - (setq-default cursor-type 'box) - (setq-default cursor-in-non-selected-windows '(bar . 2)) - (setq-default blink-cursor-blinks 50) - (setq-default blink-cursor-interval nil) ; 0.75 would be my choice - (setq-default blink-cursor-delay 0.2) - - (blink-cursor-mode -1) - - (define-minor-mode vde/cursor-type-mode - "Toggle between static block and pulsing bar cursor." - :init-value nil - :global t - (if vde/cursor-type-mode - (progn - (setq-local blink-cursor-interval 0.75 - cursor-type '(bar . 2) - cursor-in-non-selected-windows 'hollow) - (blink-cursor-mode 1)) - (dolist (local '(blink-cursor-interval - cursor-type - cursor-in-non-selected-windows)) - (kill-local-variable `,local)) - (blink-cursor-mode -1)))) - -(use-package emacs - :config - (setq-default custom-safe-themes t) - (setq-default custom--inhibit-theme-enable nil) - - (defun vde/before-load-theme (&rest args) - "Clear existing theme settings instead of layering them. -Ignores `ARGS'." - (mapc #'disable-theme custom-enabled-themes)) - - (advice-add 'load-theme :before #'vde/before-load-theme)) - -(use-package emacs - :config - (setq window-divider-default-right-width 1) - (setq window-divider-default-bottom-width 1) - (setq window-divider-default-places 'right-only) - :hook (after-init . window-divider-mode)) - -(use-package tab-bar - :unless noninteractive - :config - (setq-default tab-bar-close-button-show nil) - (setq-default tab-bar-close-last-tab-choice 'tab-bar-mode-disable) - (setq-default tab-bar-close-tab-select 'recent) - (setq-default tab-bar-new-tab-choice t) - (setq-default tab-bar-new-tab-to 'right) - (setq-default tab-bar-position nil) - (setq-default tab-bar-show t) - (setq-default tab-bar-tab-hints nil) - (setq-default tab-bar-tab-name-function 'vde/tab-bar-tab-name) - - (defun vde/tab-bar-tab-name () - "Generate tab name from the buffer of the selected window *or* projectile." - (cond - ((boundp 'projectile-project-name) (if (string-equal (projectile-project-name) "-") - (tab-bar-tab-name-current-with-count) - (projectile-project-name))) - ((project-current) (let ((project-path (vde-project--project-current))) - (cond ((string-prefix-p "~/src" project-path) - (directory-file-name (file-relative-name project-path "~/src"))) - ((string-prefix-p "~/desktop" project-path) - (directory-file-name (file-relative-name project-path "~/desktop"))) - ((string-prefix-p "/etc" project-path) - (directory-file-name (file-relative-name project-path "/etc"))) - (t - (file-relative-name project-path))))) - (t (tab-bar-tab-name-current-with-count)))) - - (defun vde/complete-tab-bar-tab-dwim () - "Do-What-I-Mean function for getting to a `tab-bar-mode' tab. -If no other tab exists, create one and switch to it. If there is -one other tab (so two in total) switch to it without further -questions. Else use completion to select the tab to switch to." - (interactive) - (let ((tabs (mapcar (lambda (tab) - (alist-get 'name tab)) - (tab-bar--tabs-recent)))) - (cond ((eq tabs nil) - (tab-new)) - ((eq (length tabs) 1) - (tab-next)) - (t - (tab-bar-switch-to-tab - (completing-read "Select tab: " tabs nil t)))))) - - :bind (("C-x t t" . vde/complete-tab-bar-tab-dwim) - ("C-x t s" . tab-switcher))) - -(use-package moody - :unless noninteractive - :config - (setq-default x-underline-at-descent-line t - ;; Show buffer position percentage starting from top - mode-line-percent-position '(-3 "%o")) - - (setq-default mode-line-format - '("%e" - mode-line-front-space - mode-line-client - mode-line-modified - mode-line-remote - mode-line-frame-identification - mode-line-buffer-identification " " mode-line-position - (vc-mode vc-mode) - (multiple-cursors-mode mc/mode-line) - " " mode-line-modes - mode-line-end-spaces)) - - (setq-default global-mode-string (remove 'display-time-string global-mode-string) - mode-line-end-spaces - (list (propertize " " 'display '(space :align-to (- right 19))) - 'display-time-string)) - (advice-add #'vc-git-mode-line-string :filter-return #'my-replace-git-status) - (defun my-replace-git-status (tstr) - (let* ((tstr (replace-regexp-in-string "Git" "" tstr)) - (first-char (substring tstr 0 1)) - (rest-chars (substring tstr 1))) - (cond - ((string= ":" first-char) ;;; Modified - (replace-regexp-in-string "^:" "~ " tstr)) - ((string= "-" first-char) ;; No change - (replace-regexp-in-string "^-" "- " tstr)) - (t tstr)))) - (moody-replace-mode-line-buffer-identification) - (moody-replace-vc-mode)) - -(use-package minions - :unless noninteractive - :config - (setq-default minions-mode-line-lighter "λ=" - minions-mode-line-delimiters '("" . "") - minions-direct '(flycheck-mode)) - (minions-mode +1)) - -(use-package time - :unless noninteractive - :config - (setq-default display-time-24hr-format t - display-time-day-and-date t - display-time-world-list '(("Europe/Paris" "Paris") - ("Europe/London" "London") - ("America/New_York" "Boston") - ("America/Los_Angeles" "San Francisco") - ("Asia/Calcutta" "Bangalore") - ("Australia/Brisbane" "Brisbane")) - display-time-string-forms - '((format "%s %s %s, %s:%s" - dayname - monthname day - 24-hours minutes))) - (display-time)) - -(use-package lin - :unless noninteractive - :config - (setq lin-face 'lin-blue) - (setq lin-mode-hooks - '(bongo-mode-hook - dired-mode-hook - elfeed-search-mode-hook - git-rebase-mode-hook - ibuffer-mode-hook - ilist-mode-hook - ledger-report-mode-hook - log-view-mode-hook - magit-log-mode-hook - mu4e-headers-mode - notmuch-search-mode-hook - notmuch-tree-mode-hook - occur-mode-hook - org-agenda-mode-hook - tabulated-list-mode-hook)) - (lin-global-mode)) - -(use-package tooltip - :unless noninteractive - :config - (setq tooltip-delay 0.5) - (setq tooltip-short-delay 0.5) - (setq x-gtk-use-system-tooltips nil) - (setq tooltip-frame-parameters - '((name . "tooltip") - (internal-border-width . 6) - (border-width . 0) - (no-special-glyphs . t))) - :hook (after-init-hook . tooltip-mode)) - -(use-package alert - :config - (setq alert-default-style 'libnotify)) - -(provide 'config-appearance) -;;; config-appearance.el ends here diff --git a/tools/emacs/old-config/config-buffers.el b/tools/emacs/old-config/config-buffers.el @@ -1,213 +0,0 @@ -;;; config-buffers.el --- -*- lexical-binding: t; -*- -;;; Commentary: -;;; Buffer related configurations -;;; Code: - -(use-package popper - :commands (popper-mode) - :bind ((("C-`" . popper-toggle-latest) - ("M-`" . popper-cycle) - ("C-M-`" . popper-toggle-type))) - :init - (setq popper-reference-buffers - '("\\*Messages\\*" - "Output\\*$" "\\*Pp Eval Output\\*$" - "\\*Compile-Log\\*" - ;; "\\*Completions\\*" - "\\*Warnings\\*" - "\\*Async Shell Command\\*" - "\\*Apropos\\*" - "\\*Backtrace\\*" - "\\*Calendar\\*" - "\\*Embark Actions\\*" - "\\*Finder\\*" - "\\*Kill Ring\\*" - - bookmark-bmenu-mode - comint-mode - compilation-mode - help-mode helpful-mode - tabulated-list-mode - Buffer-menu-mode - - gnus-article-mode devdocs-mode - grep-mode occur-mode rg-mode deadgrep-mode ag-mode pt-mode - ivy-occur-mode ivy-occur-grep-mode - process-menu-mode list-environment-mode cargo-process-mode - youdao-dictionary-mode osx-dictionary-mode fanyi-mode - - "^\\*eshell.*\\*.*$" eshell-mode - "^\\*shell.*\\*.*$" shell-mode - "^\\*terminal.*\\*.*$" term-mode - "^\\*vterm.*\\*.*$" vterm-mode - - "\\*DAP Templates\\*$" dap-server-log-mode - "\\*ELP Profiling Restuls\\*" profiler-report-mode - "\\*Flycheck errors\\*$" " \\*Flycheck checker\\*$" - "\\*Paradox Report\\*$" "\\*package update results\\*$" "\\*Package-Lint\\*$" - "\\*[Wo]*Man.*\\*$" - "\\*ert\\*$" overseer-buffer-mode - "\\*gud-debug\\*$" - "\\*lsp-help\\*$" "\\*lsp session\\*$" - "\\*quickrun\\*$" - "\\*tldr\\*$" - "\\*vc-.*\\*$" - "^\\*elfeed-entry\\*$" - "^\\*macro expansion\\**" - - "\\*Agenda Commands\\*" "\\*Org Select\\*" "\\*Capture\\*" "^CAPTURE-.*\\.org*" - "\\*Gofmt Errors\\*$" "\\*Go Test\\*$" godoc-mode - "\\*docker-containers\\*" "\\*docker-images\\*" "\\*docker-networks\\*" "\\*docker-volumes\\*" - "\\*prolog\\*" inferior-python-mode inf-ruby-mode swift-repl-mode - "\\*rustfmt\\*$" rustic-compilation-mode rustic-cargo-clippy-mode - rustic-cargo-outdated-mode rustic-cargo-test-moed)) - (setq popper-group-function #'popper-group-by-project) - :config - (popper-echo-mode 1)) - -(use-package emacs - :unless noninteractive - :config - ;; Configure `display-buffer' behaviour for some special buffers - (setq-default display-buffer-alist - '(;; bottom side window - ;; ("\\*e?shell.*" - ;; (display-buffer-in-side-window) - ;; (window-height . 0.25) - ;; (side . bottom) - ;; (slot . -1)) - ;; ("\\*v?term.*" - ;; (display-buffer-in-side-window) - ;; (window-height . 0.25) - ;; (side . bottom) - ;; (slot . -1)) - (".*\\*\\(Completions\\).*" - (display-buffer-in-side-window) - (window-height . 0.16) - (side . bottom) - (slot . 0) - (window-parameters . ((no-other-window . t)))) - ("\\*\\(Backtrace\\|Warnings\\|Compile-Log\\|[Hh]elp\\|Messages\\)\\*" - (display-buffer-in-side-window) - (window-height . 0.25) - (side . bottom) - (slot . 0)) - ("\\*\\(helpful\\).*" - (display-buffer-in-side-window) - (window-height . 0.25) - (side . bottom) - (slot . 0)) - ("\\*.*\\(compilation\\|go test\\).*" - (display-buffer-in-side-window) - (window-height . 0.25) - (side . bottom) - (slot . 0)) - ("\\*\\(ielm\\).*" - (display-buffer-in-side-window) - (window-height . 0.25) - (side . bottom) - (slot . 1)) - ;; right side window - ("\\*wclock*" - (display-buffer-in-side-window) - (window-width . 0.20) - (side . right) - (slot . -1)) - ("\\*undo-tree*" - (display-buffer-in-side-window) - (window-width . 0.20) - (side . right) - (slot . -1)) - ("\\*\\(Flycheck\\|Package-Lint\\).*" - (display-buffer-in-side-window) - (window-width . 0.40) - (side . right) - (slot . 0) - (window-parameters . ((no-other-window . t) - (mode-line-format . (" " - mode-line-buffer-identification))))) - ;; ("\\*Custom.*" - ;; (display-buffer-in-side-window) - ;; (window-width . 0.20) - ;; (side . right) - ;; (slot . 2)) - ("\\*Embark Occur.*" - (display-buffer-at-bottom)))) - (setq window-sides-vertical nil) - (setq window-combination-resize t) ; Size new windows proportionally - :bind (("C-x +" . balance-windows-area) - ("<C-f7>" . window-toggle-side-windows))) - -(use-package savehist - :unless noninteractive - :config - (setq-default history-length 10000 - savehist-save-minibuffer-history t - savehist-autosave-interval 180 - savehist-additional-variables '(extended-command-history - search-ring - regexp-search-ring - comint-input-ring - compile-history - last-kbd-macro - shell-command-history - projectile-project-command-history)) - (savehist-mode 1)) - -(use-package uniquify - :unless noninteractive - :config - (setq-default uniquify-buffer-name-style 'post-forward - uniquify-separator ":" - uniquify-ignore-buffers-re "^\\*" - uniquify-after-kill-buffer-p t)) - -(use-package ibuffer - :unless noninteractive - :commands (ibuffer) - :bind (("C-x C-b" . ibuffer) - ([remap list-buffers] . ibuffer)) - :config - (setq-default ibuffer-expert t - ibuffer-filter-group-name-face 'font-lock-doc-face - ibuffer-default-sorting-mode 'filename/process - ibuffer-use-header-line t - ibuffer-show-empty-filter-groups nil) - ;; Use human readable Size column instead of original one - (define-ibuffer-column size-h - (:name "Size" :inline t) - (cond - ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0))) - ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0))) - (t (format "%8d" (buffer-size))))) - - (setq ibuffer-formats - '((mark modified read-only " " - (name 18 18 :left :elide) - " " - (size-h 9 -1 :right) - " " - (mode 16 16 :left :elide) - " " - filename-and-process) - (mark modified read-only " " - (name 18 18 :left :elide) - " " - (size 9 -1 :right) - " " - (mode 16 16 :left :elide) - " " - (vc-status 16 16 :left) - " " - filename-and-process)))) - -(use-package ibuffer-vc - :unless noninteractive - :commands (ibuffer-vc-set-filter-groups-by-vc-root) - :hook (ibuffer . (lambda () - (ibuffer-vc-set-filter-groups-by-vc-root) - (unless (eq ibuffer-sorting-mode 'filename/process) - (ibuffer-do-sort-by-filename/process))))) - -(provide 'config-buffers) -;;; config-buffers.el ends here diff --git a/tools/emacs/old-config/config-compile.el b/tools/emacs/old-config/config-compile.el @@ -1,70 +0,0 @@ -;;; config-compile.el --- -*- lexical-binding: t; -*- -;;; Commentary: -;;; Generic compilation configuration -;;; Code: - -;; UseCompile -(use-package compile - :unless noninteractive - :commands (compile) - :preface - (autoload 'ansi-color-apply-on-region "ansi-color") - - (defvar compilation-filter-start) - - (defun vde/colorize-compilation-buffer () - (unless (or (derived-mode-p 'grep-mode) - (derived-mode-p 'ag-mode) - (derived-mode-p 'rg-mode)) - (let ((inhibit-read-only t)) - (ansi-color-apply-on-region compilation-filter-start (point))))) - (defun vde/goto-address-mode () - (unless (or (derived-mode-p 'grep-mode) - (derived-mode-p 'ag-mode) - (derived-mode-p 'rg-mode)) - (goto-address-mode t))) - :config - (setq-default compilation-scroll-output t - ;; I'm not scared of saving everything. - compilation-ask-about-save nil - ;; Automatically scroll and jump to the first error - ;; compilation-scroll-output 'next-error - ;; compilation-scroll-output 'first-error - ;; compilation-auto-jump-to-first-error t - ;; Skip over warnings and info messages in compilation - compilation-skip-threshold 2 - ;; Don't freeze when process reads from stdin - compilation-disable-input t - ;; Show three lines of context around the current message - compilation-context-lines 3 - ) - (add-hook 'comint-output-filter-functions - 'comint-watch-for-password-prompt) - (setq-default comint-password-prompt-regexp - (concat - "\\(" - "^Enter passphrase.*:" - "\\|" - "^Repeat passphrase.*:" - "\\|" - "[Pp]assword for '[a-z0-9_-.]+':" - "\\|" - "\\[sudo\\] [Pp]assword for [a-z0-9_-.]+:" - "\\|" - "[a-zA-Z0-9]'s password:" - "\\|" - "^[Pp]assword:" - "\\|" - "^[Pp]assword (again):" - "\\|" - ".*\\([Ww]ork\\|[Pp]ersonal\\).* password:" - "\\|" - "Password for '([^()]+)' GNOME keyring" - "\\|" - "Password for 'http.*github.*':" - "\\)")) - (add-hook 'compilation-filter-hook #'vde/colorize-compilation-buffer) - (add-hook 'compilation-mode-hook #'vde/goto-address-mode)) - -(provide 'config-compile) -;;; config-compile.el ends here diff --git a/tools/emacs/old-config/config-completion.el b/tools/emacs/old-config/config-completion.el @@ -1,321 +0,0 @@ -;;; config-completion.el --- -*- lexical-binding: t -*- -;;; Commentary: -;;; Setup completion framework -;;; Code - -;; (use-package orderless -;; :unless noninteractive -;; :config -;; (setq orderless-regexp-separator " +") -;; (setq orderless-matching-styles -;; '(orderless-prefixes -;; orderless-literal -;; orderless-regexp -;; orderless-flex)) -;; -;; (defun vde/orderless-literal-dispatcher (pattern _index _total) -;; "Literal style dispatcher using the equals sign as a suffix. -;; It matches PATTERN _INDEX and _TOTAL according to how Orderless -;; parses its input." -;; (when (string-suffix-p "=" pattern) -;; `(orderless-literal . ,(substring pattern 0 -1)))) -;; -;; (setq orderless-style-dispatchers '(vde/orderless-literal-dispatcher)) -;; :bind (:map minibuffer-local-completion-map -;; ("SPC" . nil))) ; space should never complete -;; -;; (use-package marginalia -;; :config -;; (setq marginalia-max-relative-age 0) ; time is absolute here! -;; (setq marginalia-annotators '(marginalia-annotators-heavy -;; marginalia-annotators-light)) -;; (marginalia-mode 1)) -;; -;; (use-package minibuffer -;; :unless noninteractive -;; :config -;; (setq completion-cycle-threshold 3) -;; (setq completion-flex-nospace nil) -;; (setq completion-pcm-complete-word-inserts-delimiters t) -;; (setq completion-pcm-word-delimiters "-_./:| ") -;; (setq completion-ignore-case t) -;; (setq-default case-fold-search nil) ; For general regexp -;; ;; NOTE: flex completion is introduced in Emacs 27 -;; (setq completion-show-help nil) -;; (setq completion-styles -;; '(substring initials flex partial-completion orderless)) -;; (setq completion-category-overrides -;; '((file (styles partial-completion)))) -;; ;; The following two are updated in Emacs 28. They concern the -;; ;; *Completions* buffer. -;; (setq completions-format 'one-column) -;; (setq completions-detailed t) -;; -;; ;; Grouping of completions for Emacs 28 -;; (setq completions-group t) -;; (setq completions-group-sort nil) -;; (setq completions-group-format -;; (concat -;; (propertize " " 'face 'completions-group-separator) -;; (propertize " %s " 'face 'completions-group-title) -;; (propertize " " 'face 'completions-group-separator -;; 'display '(space :align-to right)))) -;; -;; (setq enable-recursive-minibuffers t) -;; (setq read-answer-short t) -;; (setq read-buffer-completion-ignore-case t) -;; (setq read-file-name-completion-ignore-case t) -;; (setq resize-mini-windows t) -;; (setq minibuffer-eldef-shorten-default t) -;; -;; (file-name-shadow-mode 1) -;; (minibuffer-depth-indicate-mode 1) -;; (minibuffer-electric-default-mode 1) -;; -;; (defun vde/focus-minibuffer () -;; "Focus the active minibuffer. -;; -;; Bind this to `completion-list-mode-map' to M-v to easily jump -;; between the list of candidates present in the \\*Completions\\* -;; buffer and the minibuffer (because by default M-v switches to the -;; completions if invoked from inside the minibuffer." -;; (interactive) -;; (let ((mini (active-minibuffer-window))) -;; (when mini -;; (select-window mini)))) -;; -;; (defun vde/focus-minibuffer-or-completions () -;; "Focus the active minibuffer or the \\*Completions\\*. -;; -;; If both the minibuffer and the Completions are present, this -;; command will first move per invocation to the former, then the -;; latter, and then continue to switch between the two. -;; -;; The continuous switch is essentially the same as running -;; `vde/focus-minibuffer' and `switch-to-completions' in -;; succession." -;; (interactive) -;; (let* ((mini (active-minibuffer-window)) -;; (completions (get-buffer-window "*Completions*"))) -;; (cond ((and mini -;; (not (minibufferp))) -;; (select-window mini nil)) -;; ((and completions -;; (not (eq (selected-window) -;; completions))) -;; (select-window completions nil))))) -;; -;; ;; Technically, this is not specific to the minibuffer, but I define -;; ;; it here so that you can see how it is also used from inside the -;; ;; "Completions" buffer -;; (defun vde/describe-symbol-at-point (&optional arg) -;; "Get help (documentation) for the symbol at point. -;; -;; With a prefix argument, switch to the *Help* window. If that is -;; already focused, switch to the most recently used window -;; instead." -;; (interactive "P") -;; (let ((symbol (symbol-at-point))) -;; (when symbol -;; (describe-symbol symbol))) -;; (when current-prefix-arg -;; (let ((help (get-buffer-window "*Help*"))) -;; (when help -;; (if (not (eq (selected-window) help)) -;; (select-window help) -;; (select-window (get-mru-window))))))) -;; -;; ;; Defines, among others, aliases for common actions to Super-KEY. -;; ;; Normally these should go in individual package declarations, but -;; ;; their grouping here makes things easier to understand. -;; :bind (("M-v" . vde/focus-minibuffer-or-completions) -;; :map completion-list-mode-map -;; ("h" . vde/describe-symbol-at-point) -;; ("n" . next-line) -;; ("p" . previous-line) -;; ("f" . next-completion) -;; ("b" . previous-completion) -;; ("M-v" . vde/focus-minibuffer))) -;; -;; (use-package vertico -;; :unless noninteractive -;; :config -;; (setq vertico-scroll-margin 0) -;; (setq vertico-count 10) -;; (setq vertico-resize nil) -;; (setq vertico-cycle t) -;; (vertico-mode)) -;; -;; (use-package embark -;; :unless noninteractive -;; :bind (("C-." . embark-act)) -;; :init -;; (setq prefix-help-command #'embark-prefix-help-command) -;; (setq embark-cycle-key "C-.")) -;; -;; (use-package embark-consult -;; :after (embark consult)) -;; -;; (use-package consult -;; :unless noninteractive -;; :after minibuffer -;; :init -;; ;; Use Consult to select xref locations with preview -;; (setq xref-show-xrefs-function #'consult-xref -;; xref-show-definitions-function #'consult-xref) -;; (setq consult-narrow-key "<") ;; (kbd "C-+") -;; :config -;; (consult-customize -;; consult-ripgrep consult-git-grep consult-grep consult-bookmark consult-xref -;; consult--source-recent-file consult--source-project-recent-file consult--source-bookmark -;; :preview-key (kbd "M-.")) -;; (setq consult-async-input-debounce 0.5) -;; (setq consult-async-input-throttle 0.8) -;; (setq consult-project-root-function -;; (lambda () -;; (when-let (project (project-current)) -;; (car (project-roots project))))) -;; -;; :bind (("M-X" . consult-mode-command) -;; ("C-c b" . consult-bookmark) -;; ("C-c k" . consult-kmacro) -;; ;; C-x bindings (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 -;; ;; Other custom bindings -;; ("M-y" . consult-yank-pop) ;; orig. yank-pop -;; ("<help> a" . consult-apropos) ;; orig. apropos-command -;; ;; M-g bindings (goto-map) -;; ("M-g e" . consult-compile-error) -;; ("M-g g" . consult-goto-line) ;; orig. goto-line -;; ("M-g M-g" . consult-goto-line) ;; orig. goto-line -;; ("M-g m" . consult-mark) -;; ("M-g o" . consult-outline) -;; ("M-g i" . consult-imenu) -;; ("M-g I" . consult-imenu-multi) -;; ;; "live" search -;; ("M-s s g" . consult-grep) -;; ("M-s s G" . consult-gip-grep) -;; ("M-s s r" . consult-ripgrep) -;; ("M-s l" . consult-line) -;; ("M-s k" . consult-keep-lines) -;; ("M-s u" . consult-focus-lines) -;; ;; Isearch integration -;; ("M-s e" . consult-isearch) -;; :map minibuffer-local-completion-map -;; ("<tab>" . minibuffer-force-complete) -;; :map isearch-mode-map -;; ("M-e" . consult-isearch) ;; orig. isearch-edit-string -;; ("M-s e" . consult-isearch) ;; orig. isearch-edit-string -;; ("M-s l" . consult-line) ;; needed by consult-line to detect isearch -;; ("M-s L" . consult-line-multi))) -;; -;; (use-package consult-dir -;; :bind (("C-x C-d" . consult-dir) -;; :map minibuffer-local-completion-map -;; ("C-x C-d" . consult-dir) -;; ("C-x C-j" . consult-dir-jump-file))) -;; -;; (use-package corfu -;; :ensure -;; ;; Optional customizations -;; ;; :custom -;; ;; (corfu-cycle t) ;; Enable cycling for `corfu-next/previous' -;; ;; (corfu-auto t) ;; Enable auto completion -;; ;; (corfu-commit-predicate nil) ;; Do not commit selected candidates on next input -;; ;; (corfu-quit-at-boundary t) ;; Automatically quit at word boundary -;; ;; (corfu-quit-no-match t) ;; Automatically quit if there is no match -;; ;; (corfu-preview-current nil) ;; Disable current candidate preview -;; ;; (corfu-preselect-first nil) ;; Disable candidate preselection -;; ;; (corfu-echo-documentation nil) ;; Disable documentation in the echo area -;; ;; (corfu-scroll-margin 5) ;; Use scroll margin -;; -;; ;; You may want to enable Corfu only for certain modes. -;; ;; :hook ((prog-mode . corfu-mode) -;; ;; (shell-mode . corfu-mode) -;; ;; (eshell-mode . corfu-mode)) -;; -;; ;; Recommended: Enable Corfu globally. This is recommended since dabbrev can -;; ;; be used globally (M-/). -;; :hook (((prog-mode tex-mode) . corfu-mode) ; text-mode -;; ((shell-mode eshell-mode) . my/corfu-shell-settings)) -;; :bind (:map corfu-map -;; ("TAB" . corfu-next) -;; ([tab] . corfu-next) -;; ("S-TAB" . corfu-previous) -;; ([backtab] . corfu-previous) -;; ("M-." . corfu-show-location) -;; ("C-n" . nil) -;; ("C-p" . nil) -;; ("M-h" . nil) -;; ("C-h" . corfu-show-documentation)) -;; :config -;; (setq corfu-auto nil -;; corfu-cycle t -;; corfu-quit-no-match t -;; corfu-preselect-first nil -;; corfu-quit-at-boundary nil -;; corfu-scroll-margin 5) -;; (defun my/corfu-shell-settings () -;; (setq-local corfu-quit-at-boundary t -;; corfu-quit-no-match t -;; corfu-auto nil) -;; (setq-local corfu-map (copy-keymap corfu-map) -;; completion-cycle-threshold nil) -;; (define-key corfu-map "\r" #'corfu-insert-and-send) -;; (corfu-mode)) -;; (defun corfu-insert-and-send () -;; (interactive) -;; ;; 1. First insert the completed candidate -;; (corfu-insert) -;; ;; 2. Send the entire prompt input to the shell -;; (cond -;; ((and (derived-mode-p 'eshell-mode) (fboundp 'eshell-send-input)) -;; (eshell-send-input)) -;; ((derived-mode-p 'comint-mode) -;; (comint-send-input))))) -;; -;; (use-package kind-icon -;; :ensure t -;; :after corfu -;; :custom -;; (kind-icon-default-face 'corfu-default) ; to compute blended backgrounds correctly -;; :config -;; (add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter)) -;; -;; ;; Add extensions -;; (use-package cape -;; :ensure -;; :bind (("C-c p i" . cape-ispell) -;; ("C-c p f" . cape-file) -;; ("C-c p /" . cape-dabbrev) -;; ("C-c p w" . cape-dict) -;; ("C-c p k" . cape-keyword) -;; ("C-c p s" . cape-symbol)) -;; :init -;; ;; Add `completion-at-point-functions', used by `completion-at-point'. -;; (add-to-list 'completion-at-point-functions #'cape-file) -;; (add-to-list 'completion-at-point-functions #'cape-tex) -;; (add-to-list 'completion-at-point-functions #'cape-dabbrev) -;; (add-to-list 'completion-at-point-functions #'cape-keyword) -;; (add-to-list 'completion-at-point-functions #'cape-symbol) -;; :config -;; (setq cape-dict-file "/usr/share/dict/words") -;; -;; (use-package pcomplete -;; :defer -;; :config -;; ;; Silence the pcomplete capf, no errors or messages! -;; (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent) -;; ;; (advice-remove 'pcomplete-completions-at-point #'cape-wrap-silent) -;; -;; ;; Ensure that pcomplete does not write to the buffer -;; ;; and behaves as a pure `completion-at-point-function'. -;; (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify) -;; ;; (advice-remove 'pcomplete-completions-at-point #'cape-wrap-purify) -;; )) - -(provide 'config-completion) -;;; config-completion.el ends here diff --git a/tools/emacs/old-config/config-dired.el b/tools/emacs/old-config/config-dired.el @@ -1,229 +0,0 @@ -;;; config-dired.el -- -*- lexical-binding: t; -*- -;;; Commentary: -;;; Configuration of Dired -;;; Code: - -;; UseDired -;; (use-package dired -;; :unless noninteractive -;; :commands (dired find-name-dired) -;; :bind (("C-c RET" . vde/open-in-external-app) -;; ("C-c f g" . vde/dired-get-size) -;; ("M-s d" . vde/dired-fd-dirs) -;; ("M-s z" . vde/dired-fd-files-and-dirs) -;; ("C-c f f" . find-name-dired) -;; (:map dired-mode-map -;; ("M-p" . vde/dired-up) -;; ("^" . vde/dired-up) -;; ("<backspace>" . vde/dired-up) -;; ("M-n" . vde/dired-down) -;; ("RET" . find-file-reuse-dir-buffer) -;; ("!" . vde/sudired) -;; ("<prior>" . beginend-dired-mode-goto-beginning) -;; ("<next>" . beginend-dired-mode-goto-end))) -;; :config -;; (setq-default dired-auto-revert-buffer t -;; dired-recursive-copies 'always -;; dired-recursive-deletes 'always -;; dired-isearch-filenames 'dwim -;; delete-by-moving-to-trash t -;; dired-listing-switches "-lFaGh1v --group-directories-first" -;; dired-ls-F-marks-symlinks t -;; dired-dwim-target t) -;; (when (string= system-type "darwin") -;; (setq dired-use-ls-dired t -;; insert-directory-program "/usr/local/bin/gls")) -;; -;; ;; Enable dired-find-alternate-file -;; (put 'dired-find-alternate-file 'disabled nil) -;; -;; ;; Handle long file names -;; (add-hook 'dired-mode-hook #'toggle-truncate-lines) -;; -;; (defun vde/dired-up () -;; "Go to previous directory." -;; (interactive) -;; (find-alternate-file "..")) -;; -;; (defun vde/dired-down () -;; "Enter directory." -;; (interactive) -;; (dired-find-alternate-file)) -;; -;; (defun vde/open-in-external-app () -;; "Open the file(s) at point with an external application." -;; (interactive) -;; (let* ((file-list -;; (dired-get-marked-files))) -;; (mapc -;; (lambda (file-path) -;; (let ((process-connection-type nil)) -;; (start-process "" nil "xdg-open" file-path))) file-list))) -;; -;; (defun find-file-reuse-dir-buffer () -;; "Like `dired-find-file', but reuse Dired buffers." -;; (interactive) -;; (set-buffer-modified-p nil) -;; (let ((file (dired-get-file-for-visit))) -;; (if (file-directory-p file) -;; (find-alternate-file file) -;; (find-file file)))) -;; -;; (defun vde/sudired () -;; "Open directory with sudo in Dired." -;; (interactive) -;; (require 'tramp) -;; (let ((dir (expand-file-name default-directory))) -;; (if (string-match "^/sudo:" dir) -;; (user-error "Already in sudo") -;; (dired (concat "/sudo::" dir))))) -;; -;; (defun vde/dired-get-size () -;; "Quick and easy way to get file size in Dired." -;; (interactive) -;; (let ((files (dired-get-marked-files))) -;; (with-temp-buffer -;; (apply 'call-process "du" nil t nil "-sch" files) -;; (message -;; "Size of all marked files: %s" -;; (progn -;; (re-search-backward "\\(^[0-9.,]+[A-Za-z]+\\).*total$") -;; (match-string 1)))))) -;; (defmacro vde/dired-fd (name doc prompt &rest flags) -;; "Make commands for selecting 'fd' results with completion. -;; NAME is how the function should be named. DOC is the function's -;; documentation string. PROMPT describes the scope of the query. -;; FLAGS are the command-line arguments passed to the 'fd' -;; executable, each of which is a string." -;; `(defun ,name (&optional arg) -;; ,doc -;; (interactive "P") -;; (let* ((vc (vc-root-dir)) -;; (dir (expand-file-name (if vc vc default-directory))) -;; (regexp (read-regexp -;; (format "%s matching REGEXP in %s: " ,prompt -;; (propertize dir 'face 'bold)))) -;; (names (process-lines "fd" ,@flags regexp dir)) -;; (buf "*FD Dired*")) -;; (if names -;; (if arg -;; (dired (cons (generate-new-buffer-name buf) names)) -;; (icomplete-vertical-do () -;; (find-file -;; (completing-read (format "Items matching %s (%s): " -;; (propertize regexp 'face 'success) -;; (length names)) -;; names nil t))))) -;; (user-error (format "No matches for « %s » in %s" regexp dir))))) -;; -;; (vde/dired-fd -;; vde/dired-fd-dirs -;; "Search for directories in VC root or PWD. -;; With \\[universal-argument] put the results in a `dired' buffer. -;; This relies on the external 'fd' executable." -;; "Subdirectories" -;; "-i" "-H" "-a" "-t" "d" "-c" "never") -;; -;; (vde/dired-fd -;; vde/dired-fd-files-and-dirs -;; "Search for files and directories in VC root or PWD. -;; With \\[universal-argument] put the results in a `dired' buffer. -;; This relies on the external 'fd' executable." -;; "Files and dirs" -;; "-i" "-H" "-a" "-t" "d" "-t" "f" "-c" "never") -;; ) -;; -;; (use-package find-dired -;; :after dired -;; :commands (find-name-dired) -;; :config -;; (setq-default find-ls-option ;; applies to `find-name-dired' -;; '("-ls" . "-AFhlv --group-directories-first") -;; find-name-arg "-iname")) -;; -;; (use-package dired-x -;; :after dired -;; :bind ("C-x C-j" . dired-jump) -;; :commands (dired-jump dired-omit-mode) -;; :config -;; (setq-default dired-omit-files (concat dired-omit-files "\\|^\\.+$\\|^\\..+$") -;; dired-omit-verbose nil -;; dired-clean-confirm-killing-deleted-buffers nil)) -;; -;; (use-package dired-aux -;; :unless noninteractive -;; :after dired -;; :config -;; (setq-default -;; ;; Ask for creation of missing directories when copying/moving -;; dired-create-destination-dirs 'ask -;; ;; Search only file names when point is on a file name -;; dired-isearch-filenames'dwim)) -;; -;; (use-package dired-collapse -;; :unless noninteractive -;; :commands (dired-collapse-mode) -;; :hook (dired-mode . dired-collapse-mode)) -;; -;; (use-package async) -;; (use-package dired-async -;; :unless noninteractive -;; :after (dired async) -;; :commands (dired-async-mode) -;; :hook (dired-mode . dired-async-mode)) -;; -;; (use-package dired-narrow -;; :unless noninteractive -;; :after dired -;; :commands (dired-narrow) -;; :bind (:map dired-mode-map -;; ("M-s n" . dired-narrow)) -;; :config -;; (setq-default dired-narrow-exit-when-one-left t -;; dired-narrow-enable-blinking t -;; dired-narrow-blink-time 0.3)) -;; -;; (use-package wdired -;; :unless noninteractive -;; :after dired -;; :commands (wdired-mode -;; wdired-change-to-wdired-mode) -;; :config -;; (setq-default wdired-allow-to-change-permissions t -;; wdired-create-parent-directories t)) -;; -;; (use-package dired-rsync -;; :unless noninteractive -;; :after dired -;; :commands (dired-rsync) -;; :bind (:map dired-mode-map -;; ("r" . dired-rsync))) -;; -;; (use-package dired-subtree -;; :unless noninteractive -;; :after dired -;; :config -;; (setq dired-subtree-use-backgrounds nil) -;; :bind (:map dired-mode-map -;; ("<tab>" . dired-subtree-toggle) -;; ("<C-tab>" . dired-subtree-cycle) -;; ("<S-iso-lefttab>" . dired-subtree-remove))) -;; -;; (use-package diredfl -;; :unless noninteractive -;; :commands (diredfl-mode) -;; :config -;; (setq diredfl-ignore-compressed-flag nil) -;; :hook (dired-mode . diredfl-mode)) -;; -;; (use-package trashed -;; :unless noninteractive -;; :commands (trashed) -;; :config -;; (setq trashed-action-confirmer 'y-or-n-p) -;; (setq trashed-use-header-line t) -;; (setq trashed-sort-key '("Date deleted" . t)) -;; (setq trashed-date-format "%Y-%m-%d %H:%M:%S")) - -(provide 'config-dired) -;; config-dired.el ends here diff --git a/tools/emacs/old-config/config-editing.el b/tools/emacs/old-config/config-editing.el @@ -1,306 +0,0 @@ -;;; config-editing.el --- -*- lexical-binding: t; -*- -;;; Commentary: -;;; Editing configuration -;;; Code: - -(setq-default enable-remote-dir-locals t) - -;; When finding file in non-existing directory, offer to create the -;; parent directory. -(defun with-buffer-name-prompt-and-make-subdirs () - (let ((parent-directory (file-name-directory buffer-file-name))) - (when (and (not (file-exists-p parent-directory)) - (y-or-n-p (format "Directory `%s' does not exist! Create it? " parent-directory))) - (make-directory parent-directory t)))) - -(add-to-list 'find-file-not-found-functions #'with-buffer-name-prompt-and-make-subdirs) - -;; Fix long line "problems" -;; Disable some right-to-left behavior that might not be needed. -;; Learning arabic might make me change this, but for now.. -(setq-default bidi-paragraph-direction 'left-to-right) -(if (version<= "27.1" emacs-version) - (setq bidi-inhibit-bpa t)) -;; Detect if the line in a buffer are so long they could have a performance impact -(if (version<= "27.1" emacs-version) - (global-so-long-mode 1)) - -(use-package saveplace - :unless noninteractive - :config - (save-place-mode 1)) - -;; (use-package smartparens -;; :unless noninteractive -;; :commands (smartparens-mode smartparens-global-mode show-smartparens-global-mode -;; sp-split-sexp sp-newline sp-up-sexp) -;; :hook ((prog-mode . turn-on-smartparens-mode) -;; (markdown-mode . turn-on-smartparens-mode) -;; (org-mode . turn-on-smartparens-mode) -;; (prog-mode . turn-on-show-smartparens-mode) -;; (markdown-mode . turn-on-show-smartparens-mode) -;; (org-mode . turn-on-show-smartparens-mode) -;; (emacs-lisp-mode . turn-on-smartparens-strict-mode)) -;; :config -;; (require 'smartparens-config) -;; -;; (sp-local-pair 'minibuffer-inactive-mode "'" nil :actions nil) -;; (sp-local-pair 'web-mode "{%" "%}") -;; (sp-with-modes '(org-mode) -;; (sp-local-pair "=" "=")) -;; (sp-with-modes 'emacs-lisp-mode -;; ;; disable ', it's the quote character! -;; (sp-local-pair "'" nil :actions nil) -;; ;; also only use the pseudo-quote inside strings where it -;; ;; serves as hyperlink. -;; (sp-local-pair "`" "'" :when '(sp-in-string-p sp-in-comment-p)))) -;; -;; (use-package color-identifiers-mode -;; :unless noninteractive -;; :commands (color-identifiers-mode) -;; :config -;; (setq-default color-identifiers:num-colors 15 -;; color-identifiers:min-color-saturation 0.1 -;; color-identifiers:max-color-saturation 0.9) -;; (defun myfunc-color-identifiers-mode-hook () -;; (let ((faces '(font-lock-comment-face font-lock-comment-delimiter-face font-lock-constant-face font-lock-type-face font-lock-function-name-face font-lock-variable-name-face font-lock-keyword-face font-lock-string-face font-lock-builtin-face font-lock-preprocessor-face font-lock-warning-face font-lock-doc-face font-lock-negation-char-face font-lock-regexp-grouping-construct font-lock-regexp-grouping-backslash))) -;; (dolist (face faces) -;; (face-remap-add-relative face '((:foreground "" :weight normal :slant normal))))) -;; (face-remap-add-relative 'font-lock-keyword-face '((:weight bold :slant normal :foreground "#666666"))) -;; (face-remap-add-relative 'font-lock-comment-face '((:slant italic :weight bold :foreground "#333333"))) -;; (face-remap-add-relative 'font-lock-comment-delimiter-face '((:slant italic :weight bold :foreground "#333333"))) -;; (face-remap-add-relative 'font-lock-builtin-face '((:weight bold :foreground "#666666"))) -;; (face-remap-add-relative 'font-lock-preprocessor-face '((:weight bold))) -;; (face-remap-add-relative 'font-lock-function-name-face '((:underline t))) -;; (face-remap-add-relative 'font-lock-string-face '((:weight normal :foreground "#333333"))) -;; (face-remap-add-relative 'font-lock-constant-face '((:foreground "#666666" :slant italic)))) -;; (add-hook 'color-identifiers-mode-hook 'myfunc-color-identifiers-mode-hook) -;; :hook ((go-mode . color-identifiers-mode) -;; (js-mode . color-identifiers-mode) -;; (python-mode . color-identifiers-mode))) -;; -;; (use-package aggressive-indent -;; :unless noninteractive -;; :bind ("C-c e i" . aggressive-indent-mode) -;; :hook ((lisp-mode . aggressive-indent-mode) -;; (emacs-lisp-mode . aggressive-indent-mode)) -;; :config -;; ;; Free C-c C-q, used in Org and in CIDER -;; (unbind-key "C-c C-q" aggressive-indent-mode-map)) - -(use-package undo-tree - :unless noninteractive - :hook (after-init . global-undo-tree-mode) - :config - (setq-default undo-tree-visualizer-timestamps t - undo-tree-enable-undo-in-region t)) - -;; (use-package whitespace -;; :unless noninteractive -;; :commands (whitespace-mode vde/toggle-invisibles) -;; :config -;; (setq-default whitespace-style '(face tabs spaces trailing space-before-tab newline indentation empty space-after-tab space-mark tab-mark newline-mark)) -;; (defun vde/toggle-invisibles () -;; "Toggles the display of indentation and space characters." -;; (interactive) -;; (if (bound-and-true-p whitespace-mode) -;; (whitespace-mode -1) -;; (whitespace-mode))) -;; :bind ("<f6>" . vde/toggle-invisibles)) -;; -;; (use-package expand-region -;; :unless noninteractive -;; :commands (er/expand-region er/contract-region) -;; :bind (("C-=" . er/expand-region) -;; ("C--". er/contract-region))) -;; -;; (use-package visual-regexp -;; :unless noninteractive -;; :commands (vr/replace vr/query-replace) -;; :bind (("C-c r" . vr/replace) -;; ("C-c %" . vr/query-replace))) -;; -;; (use-package hs-minor-mode -;; :unless noninteractive -;; :hook ((prog-mode . hs-minor-mode))) -;; -;; (use-package easy-kill -;; :unless noninteractive -;; :commands (easy-kill) -;; :config -;; (global-set-key [remap kill-ring-save] 'easy-kill) -;; (global-set-key [remap mark-sexp] 'easy-mark)) - -(use-package display-line-numbers - :unless noninteractive - :hook (prog-mode . display-line-numbers-mode) - :config - (setq-default display-line-numbers-type 'relative) - (defun vde/toggle-line-numbers () - "Toggles the display of line numbers. Applies to all buffers." - (interactive) - (if (bound-and-true-p display-line-numbers-mode) - (display-line-numbers-mode -1) - (display-line-numbers-mode))) - :bind ("<f7>" . vde/toggle-line-numbers)) - -(add-hook 'prog-mode-hook 'toggle-truncate-lines) - -(use-package newcomment - :unless noninteractive - :config - (setq-default comment-empty-lines t - comment-fill-column nil - comment-multi-line t - comment-style 'multi-line) - (defun prot/comment-dwim (&optional arg) - "Alternative to `comment-dwim': offers a simple wrapper -around `comment-line' and `comment-dwim'. - -If the region is active, then toggle the comment status of the -region or, if the major mode defines as much, of all the lines -implied by the region boundaries. - -Else toggle the comment status of the line at point." - (interactive "*P") - (if (use-region-p) - (comment-dwim arg) - (save-excursion - (comment-line arg)))) - - :bind (("C-;" . prot/comment-dwim) - ("C-:" . comment-kill) - ("M-;" . comment-indent) - ("C-x C-;" . comment-box))) - -;; FIXME(vdemeester) Do I need on-the-fly spellcheck *or* not ? -(use-package flyspell - :unless noninteractive - :commands (flyspell-prog-mode flyspell-mode) - :hook((text-mode . flyspell-mode) - (prog-mode . flyspell-prog-mode)) - :config - (define-key flyspell-mode-map (kbd "C-.") nil) - (setq-default flyspell-issue-message-flag nil - flyspell-issue-welcome-flag nil - ispell-program-name "hunspell" - ispell-local-dictionary "en_GB" - ispell-local-dictionary-alist - '(("en_GB" - "[[:alpha:]]" - "[^[:alpha:]]" - "[']" - nil - ("-d" "en_GB,fr_FR") - nil - utf-8)))) -;; -;; (use-package emacs -;; :init -;; (setq-default tab-always-indent 'complete -;; tab-width 4 -;; indent-tabs-mode nil)) - -;; FIXME: enable/disable this through a minor mode -;; can be enable by default in code, disable in adoc-mode, … -;; (use-package emacs -;; :hook (before-save . delete-trailing-whitespace)) - -(use-package delsel - :unless noninteractive - :config - (delete-selection-mode 1)) - -(use-package emacs - :unless noninteractive - :custom - (repeat-on-final-keystroke t) - (set-mark-command-repeat-pop t) - :bind ("M-z" . zap-up-to-char)) - -(use-package emacs - :config - (defun prot/new-line-below () - "Create a new line below the current one. Move the point to -the absolute beginning. Also see `prot/new-line-above'." - (interactive) - (end-of-line) - (newline)) - - (defun prot/new-line-above () - "Create a new line above the current one. Move the point to -the absolute beginning. Also see `prot/new-line-below'." - (interactive) - (beginning-of-line) - (newline) - (forward-line -1)) - - (defun prot/yank-replace-line-or-region () - "Replace the line at point with the contents of the last -stretch of killed text. If the region is active, operate over it -instead. This command can then be followed by the standard -`yank-pop' (default is bound to M-y)." - (interactive) - (if (use-region-p) - (progn - (delete-region (region-beginning) (region-end)) - (yank)) - (progn - (delete-region (point-at-bol) (point-at-eol)) - (yank)))) - - :bind (("C-S-SPC" . contrib/mark-whole-word) - ("<C-return>" . prot/new-line-below) - ("<C-S-return>" . prot/new-line-above) - ("M-SPC" . cycle-spacing) - ("M-o" . delete-blank-lines) - ("<C-f6>" . tear-off-window) - ("C-S-y" . prot/yank-replace-line-or-region))) - -(use-package pdf-tools - :unless noninteractive - :mode ("\\.pdf\\'" . pdf-view-mode) - :config - (setq-default pdf-view-display-size 'fit-page) - (setq pdf-annot-activate-created-annotations t) - (setq pdf-view-midnight-colors '("#ffffff" . "#000000")) - (pdf-tools-install :no-query) - (require 'pdf-occur)) - -;; (use-package paste-sbr -;; :unless noninteractive -;; :commands (htmlize-paste-it) -;; :bind ("C-c e p" . htmlize-paste-it)) - -(use-package scratch - :unless noninteractive - :commands (scratch) - :config - (defun vde/scratch-buffer-setup () - "Add contents to `scratch' buffer and name it accordingly. -If region is active, add its contents to the new buffer." - (let* ((mode major-mode) - (string (format "Scratch buffer for: %s\n\n" mode)) - (region (with-current-buffer (current-buffer) - (if (region-active-p) - (buffer-substring-no-properties - (region-beginning) - (region-end))) - "")) - (text (concat string region))) - (when scratch-buffer - (save-excursion - (insert text) - (goto-char (point-min)) - (comment-region (point-at-bol) (point-at-eol))) - (forward-line 2)) - (rename-buffer (format "*Scratch for %s*" mode) t))) - :hook (scratch-create-buffer . vde/scratch-buffer-setup) - :bind ("C-c s" . scratch)) - -(use-package subword - :diminish - :hook (prog-mode-hook . subword-mode)) - -(provide 'config-editing) -;;; config-editing.el ends here diff --git a/tools/emacs/old-config/config-elfeed.el b/tools/emacs/old-config/config-elfeed.el @@ -1,122 +0,0 @@ -;;; config-elfeed.el --- -*- lexical-binding: t -*- -;;; Commentary: -;;; Elfeed configuration -;;; Code: - -(use-package elfeed - :commands (elfeed) - :bind (("C-c x e" . elfeed) - :map elfeed-show-mode-map - ("q" . 'vde/elfeed-show-quit-window)) - :init - ;; (bind-keys - ;; :map elfeed-show-mode-map - ;; ([remap elfeed-search-quit-window] 'vde/elfeed-show-quit-window)) - :config - (setq-default elfeed-log-level 'debug - elfeed-use-curl 't - elfeed-db-directory "~/sync/elfeed/db/" - elfeed-db-index "~/sync/elfeed/index") - - (setq elfeed-show-entry-switch #'pop-to-buffer - elfeed-show-entry-delete #'delete-window - elfeed-show-unique-buffers t) - - (defun vde/elfeed-show-quit-window () - (interactive) - (if (window-live-p (get-buffer-window "*elfeed-search*")) - (progn - (kill-buffer-and-window) ;Don't use quit-window for this - (select-window (get-buffer-window "*elfeed-search*"))) - (kill-buffer (current-buffer)))) - ;; TODO define what we want for this.. - ;; TODO also probably handle "quit", on "next", … (if tab) - ;; (add-to-list 'display-buffer-alist - ;; '("^\\*elfeed-entry-" - ;; (display-buffer-below-selected) - ;; (direction . bottom) - ;; (window-height . 0.70))) - - ;; (add-to-list 'display-buffer-alist - ;; `("^\\*elfeed-entry-" - ;; (display-buffer-in-tab) - ;; (dedicated . t) - ;; (tab-name . (lambda (buffer alist) - ;; (with-current-buffer buffer - ;; (concat "🚀 " (elfeed-feed-title (elfeed-entry-feed elfeed-show-entry)))))) - ;; (tab-group . "📻 Elfeed"))) - ;; - ;; (add-to-list 'display-buffer-alist - ;; `("\\*elfeed-search\\*" - ;; (display-buffer-in-tab) - ;; (dedicated . t) - ;; (tab-name . "📣 Entries") - ;; (tab-group . "📻 Elfeed"))) - - (elfeed-org) - (defun vde/org-elfeed-entry-store-link () - (when elfeed-show-entry - (let* ((link (elfeed-entry-link elfeed-show-entry)) - (title (elfeed-entry-title elfeed-show-entry))) - (org-store-link-props - :link link - :description title) - ))) - (add-hook 'org-store-link-functions - 'vde/org-elfeed-entry-store-link) - - (defun elfeed-link-title (entry) - "Copy the entry title and URL as org link to the clipboard." - (interactive) - (let* ((link (elfeed-entry-link entry)) - (title (elfeed-entry-title entry)) - (titlelink (org-make-link-string link title)))) - (when titlelink - (kill-new titlelink) - (x-set-selection 'PRIMARY titlelink) - (message "Yanked: %s" titlelink))) - (defun elfeed-show-link-title () - "Copy the current entry title and URL as org link to the clipboard." - (interactive) - (elfeed-link-title elfeed-show-entry)) - - (defun elfeed-show-quick-url-note () - "Fastest way to capture entry link to org agenda from elfeed show mode" - (interactive) - (elfeed-link-title elfeed-show-entry) - (org-capture nil "n") - (yank) - (org-capture-finalize)) - - (defface elfeed-face-tag-reddit - '((t :foreground "#ffb9a0")) - "This is a custom font face for the F1 tag in Elfeed.") - - (push '(f1 elfeed-face-tag-reddit) - elfeed-search-face-alist) - - (defun yt-dl-it (url) - "Downloads the URL in an async shell" - (let ((default-directory "~/desktop/videos")) - (async-shell-command (format "yt-dlp \"%s\"" url)))) - - (defun elfeed-youtube-dl (&optional use-generic-p) - "Youtube-DL 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 (yt-dl-it it)) - (mapc #'elfeed-search-update-entry entries) - (unless (use-region-p) (forward-line)))) - - (define-key elfeed-search-mode-map (kbd "d") 'elfeed-youtube-dl) - - (use-package elfeed-org - :commands (elfeed-org) - :config - (setq-default rmh-elfeed-org-files (list (expand-file-name "feeds.org" org-private-notes-dir))))) - -(provide 'config-elfeed) -;;; config-elfeed.el ends here diff --git a/tools/emacs/old-config/config-files.el b/tools/emacs/old-config/config-files.el @@ -1,87 +0,0 @@ -;;; config-files.el --- -*- lexical-binding: t; -*- -;;; Commentary: -;;; Files related configurations -;;; Code: - -(use-package autoinsert - :init - (setq-default auto-insert-query nil - auto-insert-alist nil) - :config - (auto-insert-mode 1)) - -(use-package files - :commands (revert-buffer) - :bind (("<f5>" . revert-buffer)) - :config - (setq-default view-read-only t)) - -(use-package envrc - :defer 2 - :if (executable-find "direnv") - :bind (:map envrc-mode-map - ("C-c d" . envrc-command-map)) - :config (envrc-global-mode)) - -(use-package hardhat - :init (global-hardhat-mode)) - -(use-package highlight-indentation - :unless noninteractive - :commands (highlight-indentation-mode highlight-indentation-current-column-mode) - :config - (set-face-background 'highlight-indentation-face "#e3e3d3") - (set-face-background 'highlight-indentation-current-column-face "#c3b3b3")) - -(defun vde/delete-this-file () - "Delete the current file, and kill the buffer." - (interactive) - (or (buffer-file-name) (error "No file is currently being edited")) - (when (yes-or-no-p (format "Really delete '%s'?" - (file-name-nondirectory buffer-file-name))) - (delete-file (buffer-file-name)) - (kill-this-buffer))) - -(defun vde/rename-this-file-and-buffer (new-name) - "Renames both current buffer and file it's visiting to NEW-NAME." - (interactive "sNew name: ") - (let ((name (buffer-name)) - (filename (buffer-file-name))) - (unless filename - (error "Buffer '%s' is not visiting a file!" name)) - (if (get-buffer new-name) - (message "A buffer named '%s' already exists!" new-name) - (progn - (when (file-exists-p filename) - (rename-file filename new-name 1)) - (rename-buffer new-name) - (set-visited-file-name new-name))))) - -(bind-key "C-c f D" #'vde/delete-this-file) -(bind-key "C-c f R" #'vde/rename-this-file-and-buffer) - -;; Additional bindings for built-ins -(bind-key "C-c f v d" #'add-dir-local-variable) -(bind-key "C-c f v l" #'add-file-local-variable) -(bind-key "C-c f v p" #'add-file-local-variable-prop-line) - -(defun vde/reload-dir-locals-for-current-buffer () - "Reload dir locals for the current buffer." - (interactive) - (let ((enable-local-variables :all)) - (hack-dir-local-variables-non-file-buffer))) - -(defun vde/reload-dir-locals-for-all-buffers-in-this-directory () - "Reload dir-locals for all buffers in current buffer's `default-directory'." - (interactive) - (let ((dir default-directory)) - (dolist (buffer (buffer-list)) - (with-current-buffer buffer - (when (equal default-directory dir)) - (vde/reload-dir-locals-for-current-buffer))))) - -(bind-key "C-c f v r" #'vde/reload-dir-locals-for-current-buffer) -(bind-key "C-c f v r" #'vde/reload-dir-locals-for-all-buffers-in-this-directory) - -(provide 'config-files) -;;; config-files.el ends here diff --git a/tools/emacs/old-config/config-keybindings.el b/tools/emacs/old-config/config-keybindings.el @@ -1,14 +0,0 @@ -;;; config-keybindings.el --- -*- lexical-binding: t -*- -;;; Commentary: -;;; Key binding specific configuration -;;; Code: - -;; Disable C-x C-n to avoid the disabled command buffer -(unbind-key "C-x C-n" global-map) - -;; Remap dynamic-abbrev to hippie-expand -;; See https://www.masteringemacs.org/article/text-expansion-hippie-expand -;; (global-set-key [remap dabbrev-expand] 'hippie-expand) -;; -;; (provide 'config-keybindings) -;; ;;; config-keybindings.el ends here diff --git a/tools/emacs/old-config/config-mails.el b/tools/emacs/old-config/config-mails.el @@ -1,74 +0,0 @@ -;;; config-mails.el --- -*- lexical-binding: t -*- -;;; Commentary: -;;; Mails configuration -;;; Code: - -(use-package simple - :custom (read-mail-command #'gnus)) - -(use-package auth-source - :config - (setq auth-sources '("~/.authinfo.gpg" "~/.authinfo")) - (setq user-full-name "Vincent Demeester") - (setq user-mail-address "vincent@sbr.pm")) - -(use-package epa-file - :config - (setq epa-file-cache-passphrase-for-symmetric-encryption t) - :init - (epa-file-enable)) - -(setq gnus-init-file (expand-file-name "~/.config/gnus/init.el")) - -(use-package smtpmail - ;;:commands (mail-mode mail-text) - :config - (setq message-send-mail-function 'message-send-mail-with-sendmail) - (setq sendmail-program "msmtp") - (setq message-sendmail-f-is-evil 't) - (setq message-sendmail-extra-arguments '("--read-envelope-from"))) - -(use-package sendmail - ;;:commands (mail-mode mail-text) - :defines (send-mail-function) - :config - (setq-default send-mail-function 'sendmail-send-it - sendmail-program "/home/vincent/bin/msmtp")) - -(use-package message - :commands (message-mode message-cite-original-without-signature) - :hook ((message-mode . my-message-hook)) - :config - (setq mail-user-agent 'message-user-agent - message-wide-reply-confirm-recipients t - message-default-charset 'utf-8 - message-default-mail-headers "Cc: \nBcc: \n" - message-kill-buffer-on-exit t - message-generate-headers-first t) - (add-to-list 'mm-body-charset-encoding-alist '(utf-8 . base64)) - - (defun my-message-hook () - "Message mode hook." - (turn-on-auto-fill))) - -(if *sys/full* - (progn - (setenv "NOTMUCH_CONFIG" (expand-file-name ".config/notmuch/notmuchrc" (getenv "HOME"))) - (use-package notmuch - :disabled - :defer t - :bind ("<f6>" . notmuch) - :config - (setq notmuch-search-oldest-first nil - mail-user-agent 'message-user-agent - notmuch-tree-show-out t) - (setq notmuch-saved-searches - '((:key "i" :name "inbox" :query "tag:Inbox") - (:key "r" :name "redhat inbox folder" :query "folder:redhat/Inbox") - (:key "p" :name "perso inbox folder" :query "folder:perso/Inbox") - (:key "u" :name "unread" :query "tag:unread") - (:key "F" :name "flagged" :query "tag:flagged") - (:key "S" :name "sent" :query "tag:Sent Mail")))))) - -(provide 'config-mails) -;;; config-mails ends here diff --git a/tools/emacs/old-config/config-misc.el b/tools/emacs/old-config/config-misc.el @@ -1,17 +0,0 @@ -;;; config-misc.el --- -*- lexical-binding: t; -*- -;;; Commentary: -;;; Miscellaneous modes configuration -;;; Code: - -(use-package helpful - :unless noninteractive - :bind (("C-h f" . helpful-callable) - ("C-h F" . helpful-function) - ("C-h M" . helpful-macro) - ("C-c h S" . helpful-at-point) - ("C-h k" . helpful-key) - ("C-h v" . helpful-variable) - ("C-h C" . helpful-command))) - -(provide 'config-misc) -;;; config-misc.el ends here diff --git a/tools/emacs/old-config/config-mouse.el b/tools/emacs/old-config/config-mouse.el @@ -1,20 +0,0 @@ -;;; config-mouse.el --- -*- lexical-binding: t -*- -;;; Commentary: -;;; Mouse configuration -;;; Code: - -(use-package mouse - :unless noninteractive - :config - (setq mouse-wheel-scroll-amount - '(1 - ((shift) . 5) - ((meta) . 0.5) - ((control) . text-scale))) - (setq make-pointer-invisible t - mouse-wheel-progressive-speed t - mouse-wheel-follow-mouse t) - :hook (after-init . mouse-wheel-mode)) - -(provide 'config-mouse) -;;; config-mouse.el ends here diff --git a/tools/emacs/old-config/config-music.el b/tools/emacs/old-config/config-music.el @@ -1,40 +0,0 @@ -;;; config-music.el --- -*- lexical-binding: t; -*- -;;; Commentary: -;;; Music configuration -;;; Code: - -;; (use-package bongo -;; :commands (bongo bongo-show) -;; :bind (("C-c x b" . bongo) -;; ("<C-XF86AudioPlay>" . bongo-pause/resume) -;; ("<C-XF86AudioNext>" . bongo-next) -;; ("<C-XF86AudioPrev>" . bongo-previous) -;; ("<M-XF86AudioPlay>" . bongo-show) -;; ("<S-XF86AudioNext>" . bongo-seek-forward-10) -;; ("<S-XF86AudioPrev>" . bongo-seek-backward-10)) -;; :config -;; (setq-default bongo-audio-file-name-extensions -;; '("669" "aac" "amf" "apun" "au" "dsm" "far" "flac" "g18" "g36" "gdm" -;; "imf" "it" "mdz" "med" "mid" "midi" "mka" "mod" "m4a" "mp2" "mp3" -;; "mtm" "ogg" "oga ""opus" "okt" "r36" "ra" "rcp" "rmi" "s3m" "spx" -;; "stm" "stx" "ult" "umx" "uni" "vqf" "wav" "wma" "xm") -;; bongo-custom-backend-matchers -;; '((mpv local-file "m4a") -;; (mpv local-file "oga") -;; (mpv local-file "opus")) -;; bongo-default-directory "/net/sakhalin.home/export/gaia/music" -;; bongo-prefer-library-buffers nil -;; bongo-insert-whole-directory-trees t -;; bongo-logo nil -;; bongo-display-track-icons nil -;; bongo-display-track-lengths nil -;; bongo-display-header-icons nil -;; bongo-display-playback-mode-indicator t -;; bongo-display-inline-playback-progress nil -;; bongo-join-inserted-tracks nil -;; bongo-field-separator (propertize " · " 'face 'shadow)) -;; (bongo-mode-line-indicator-mode -1) -;; (bongo-header-line-mode -1)) - -(provide 'config-music) -;;; config-music ends here diff --git a/tools/emacs/old-config/config-navigating.el b/tools/emacs/old-config/config-navigating.el @@ -1,151 +0,0 @@ -;;; config-navigating.el --- -*- lexical-binding: t -*- -;;; Commentary: -;;; Navigation related configuration -;;; Code: - -(use-package emacs - :config - (setq-default scroll-preserve-screen-position t) - (setq-default scroll-conservatively 1) ; affects `scroll-step' - (setq-default scroll-margin 0) - - (define-minor-mode vde/scroll-centre-cursor-mode - "Toggle centred cursor scrolling behaviour." - :init-value nil - :lighter " S=" - :global nil - (if vde/scroll-centre-cursor-mode - (setq-local scroll-margin (* (frame-height) 2) - scroll-conservatively 0 - maximum-scroll-margin 0.5) - (dolist (local '(scroll-preserve-screen-position - scroll-conservatively - maximum-scroll-margin - scroll-margin)) - (kill-local-variable `,local)))) - - ;; C-c l is used for `org-store-link'. The mnemonic for this is to - ;; focus the Line and also works as a variant of C-l. - :bind ("C-c L" . vde/scroll-centre-cursor-mode)) - -(use-package replace - :config - (setq list-matching-lines-jump-to-current-line t) - ;; See my "Modus themes" for these inherited faces - (setq list-matching-lines-buffer-name-face - '(:inherit modus-theme-intense-neutral :weight bold)) - (setq list-matching-lines-current-line-face - '(:inherit modus-theme-special-mild)) - - (defun vde/occur-url () - "Produce list with all URLs in the current buffer." - (interactive) - (let ((urls browse-url-button-regexp)) - (occur urls "\\&"))) - - :hook ((occur-mode . hl-line-mode) - (occur-mode . (lambda () - (toggle-truncate-lines t)))) - :bind (("M-s M-o" . multi-occur) - :map occur-mode-map - ("t" . toggle-truncate-lines))) - -(use-package avy - :unless noninteractive - :commands (avy-goto-char avy-goto-line avy-goto-word-1 avy-pop-mark avy-goto-char-timer) - :bind (("C-c j w" . avy-goto-word-1) - ("C-c j b" . avy-pop-mark) - ("C-c j t" . avy-goto-char-timer) - ("C-c j l" . avy-goto-line))) - -(use-package hideshow - :unless noninteractive - :commands (hs-show-all hs-toggle-hiding hs-hide-all hs-hide-block hs-hide-level) - :defer 5 - :bind (("C-c @ a" . hs-show-all) - ("C-c @ c" . hs-toggle-hiding) - ("C-c @ t" . hs-hide-all) - ("C-c @ d" . hs-hide-block) - ("C-c @ l" . hs-hide-level))) - -(use-package mwim - :unless noninteractive - :commands (mwim-beginning-of-code-or-line mwim-end-of-code-or-line) - :bind (:map prog-mode-map - ("C-a" . mwim-beginning-of-code-or-line) - ("C-e" . mwim-end-of-code-or-line))) - -(use-package beginend - :unless noninteractive - :defer 5 - :config - (beginend-global-mode 1)) - -(use-package imenu - :unless noninteractive - :config - (setq-default imenu-use-markers t - imenu-auto-rescan t - imenu-auto-rescan-maxout 600000 - imenu-max-item-length 100 - imenu-use-popup-menu nil - imenu-eager-completion-buffer t - imenu-space-replacement " " - imenu-level-separator "/") - - :hook ((imenu-after-jump . (lambda () - (when (and (eq major-mode 'org-mode) - (org-at-heading-p)) - (org-show-entry) - (org-reveal t)))))) - -(use-package flimenu - :unless noninteractive - :config - (flimenu-global-mode 1)) - -(use-package man - :unless noninteractive - :commands (man) - :bind (:map Man-mode-map - ("i" . Man-goto-section) - ("g" . Man-update-manpage))) - -(use-package pulse - :unless noninteractive - :config - (defface vde/pulse-line-modus-theme - '((t :inherit modus-theme-subtle-green :extend t)) - "Ad-hoc face for `vde/pulse-line'. -This is done because it is not possible to highlight empty lines -without the `:extend' property.") - - (defun vde/pulse-line (&optional face) - "Temporarily highlight the current line." - (interactive) - (let ((start (if (eobp) - (line-beginning-position 0) - (line-beginning-position))) - (end (line-beginning-position 2)) - (pulse-delay .04) - (face - (if face - face - 'vde/pulse-line-modus-theme))) - (pulse-momentary-highlight-region start end face))) - (defun ct/yank-pulse-advice (orig-fn &rest args) - ;; Define the variables first - (let (begin end) - ;; Initialize `begin` to the current point before pasting - (setq begin (point)) - ;; Forward to the decorated function (i.e. `yank`) - (apply orig-fn args) - ;; Initialize `end` to the current point after pasting - (setq end (point)) - ;; Pulse to highlight! - (pulse-momentary-highlight-region begin end))) - (advice-add 'yank :around #'ct/yank-pulse-advice) - :bind ("<C-escape>" . vde/pulse-line)) - -(provide 'config-navigating) -;;; config-navigating.el ends here diff --git a/tools/emacs/old-config/config-org.el b/tools/emacs/old-config/config-org.el @@ -1,620 +0,0 @@ -;;; config-org.el --- -*- lexical-binding: t; -*- -;;; Commentary: -;;; Configuration of orgmode. -;;; Code: - -(use-package s) -(use-package dash) - -(defconst org-directory "~/desktop/org/" - "org-mode directory, where most of the org-mode file lives") -(defconst org-projects-dir (expand-file-name "projects" org-directory) - "Primary tasks directory.") -(defconst org-private-notes-dir (expand-file-name "notes" org-directory) - "Directory of private, non-shareable notes.") -(defconst org-notes-dir (expand-file-name "~/src/www/content" org-directory) - "Directory of shareable, technical notes.") -(defconst src-home-dir (expand-file-name "~/src/home" org-directory) - "Directory of my home monorepository, can contain todos there.") -(defconst org-archive-dir (expand-file-name "archive" org-directory) - "Directory of shareable, technical notes.") -(defconst org-completed-dir (expand-file-name "projects" org-archive-dir) - "Directory of completed project files.") -(defconst org-inbox-file (expand-file-name "inbox.org" org-projects-dir) - "New stuff collected in this file.") -(defconst org-next-file (expand-file-name "next.org" org-projects-dir) - "Todo *next* collected in this file.") -(defconst org-incubate-file (expand-file-name "incubate.org" org-projects-dir) - "Ideas simmering on back burner.") -(defconst org-babel-library-file (expand-file-name "org_library_of_babel.org" org-private-notes-dir) - "Org babel library.") -(set-register ?i `(file . ,org-inbox-file)) -(set-register ?I `(file . ,org-incubate-file)) -(set-register ?n `(file . ,org-next-file)) -(use-package org - ;; :ensure org-plus-contrib ;; load from the package instead of internal - :mode (("\\.org$" . org-mode) - ("\\.org.draft$" . org-mode)) - :commands (org-agenda org-capture) - :bind (("C-c o l" . org-store-link) - ("C-c o r r" . org-refile) - ("C-c o a a" . org-agenda) - ("C-c o a r" . my/reload-org-agenda-files) - ("C-c o s" . org-sort) - ("<f12>" . org-agenda) - ("C-c o c" . org-capture) - ;; Skeletons - ("C-c o i p" . vde/org-project) - ("C-c o i n" . vde/org-www-post)) - :config - (define-skeleton vde/org-project - "new org-mode project" - nil - > "#+TITLE: " (skeleton-read "Title: ") \n - > "#+FILETAGS: " (skeleton-read "Tags: ") \n - > "#+CATEGORY: " (skeleton-read "Category: ") \n - > _ \n - > _ \n) - (define-auto-insert '("/projects/.*\\.org\\'" . "projects org files") [vde/org-project]) - (define-skeleton vde/org-www-post - "new www post" - nil - > "#+title: " (skeleton-read "Title: ") \n - > "#+date: " (format-time-string "<%Y-%m-%d %a>") \n - > "#+filetags: " (skeleton-read "Tags: ") \n - > "#+setupfile: " (skeleton-read "Template (default ../templates/2022.org): ") \n - > _ \n - > "* Introduction" - ) - (define-auto-insert '("/content/.*\\.org\\'" . "blog post org files") [vde/org-www-post]) - (define-auto-insert '("/content/.*\\.draft\\'" . "blog post draft files") [vde/org-www-post]) - ;; Org Babel configurations - (when (file-exists-p org-babel-library-file) - (org-babel-lob-ingest org-babel-library-file)) - (defun my/org-agenda-files () - (apply 'append - (mapcar - (lambda (directory) - (directory-files-recursively - directory org-agenda-file-regexp)) - `(,org-projects-dir ,org-notes-dir ,src-home-dir ,org-private-notes-dir ,(expand-file-name "~/src/osp/tasks"))))) - (defun my/reload-org-agenda-files () - (interactive) - (setq org-agenda-files (my/org-agenda-files))) - (setq org-agenda-files (my/org-agenda-files) - org-agenda-file-regexp "^[a-zA-Z0-9-_]+.org$" - org-use-speed-commands t - org-special-ctrl-a/e t - org-special-ctrl-k t - org-todo-keywords '((sequence "TODO(t)" "NEXT(n)" "STARTED(s)" "|" "DONE(d!)" "CANCELED(c@/!)") - (sequence "WAITING(w@/!)" "SOMEDAY(s)" "|" "CANCELED(c@/!)") - (sequence "IDEA(i)" "|" "CANCELED(c@/!)")) - org-todo-state-tags-triggers '(("CANCELLED" ("CANCELLED" . t)) - ("WAITING" ("WAITING" . t)) - (done ("WAITING")) - ("TODO" ("WAITING") ("CANCELLED")) - ("NEXT" ("WAITING") ("CANCELLED")) - ("DONE" ("WAITING") ("CANCELLED"))) - org-use-tag-inheritance t - org-tag-alist '(("linux") ("nixos") ("emacs") ("org") - ("openshift") ("redhat") ("tektoncd") ("kubernetes") ("knative" ) ("docker") - ("docs") ("code") ("review") - (:startgroup . nil) - ("#home" . ?h) ("#work" . ?w) ("#errand" . ?e) ("#health" . ?l) - (:endgroup . nil) - (:startgroup . nil) - ("#link" . ?i) ("#read" . ?r) ("#project" . ?p) - (:endgroup . nil)) - org-log-done 'time - org-log-redeadline 'time - org-log-reschedule 'time - org-log-into-drawer t - org-enforce-todo-dependencies t - org-refile-targets (append '((org-inbox-file :level . 0)) - (->> - (directory-files org-projects-dir nil ".org$") - (--remove (s-starts-with? "." it)) - (--map (format "%s/%s" org-projects-dir it)) - (--map `(,it :level . 1))) - (->> - (directory-files-recursively src-home-dir ".org$") - (--remove (s-starts-with? "." it)) - (--map (format "%s" it)) - (--map `(,it :level . 1))) - (->> - (directory-files-recursively org-notes-dir ".org$") - (--remove (s-starts-with? (format "%s/legacy" org-notes-dir) it)) - (--map (format "%s" it)) - (--map `(,it :level . 1)))) - org-refile-use-outline-path 'file - org-refile-allow-creating-parent-nodes 'confirm - org-outline-path-complete-in-steps nil - org-columns-default-format "%80ITEM(Task) %TODO %3PRIORITY %10Effort(Effort){:} %10CLOCKSUM" - org-fontify-whole-heading-line t - org-pretty-entities t - org-ellipsis " ⤵" - org-archive-location (concat org-completed-dir "/%s::datetree/") - org-use-property-inheritance t - org-priority 67 - org-priority-faces '((?A . "#ff2600") - (?B . "#ff5900") - (?C . "#ff9200") - (?D . "#747474")) - org-global-properties (quote (("EFFORT_ALL" . "0:15 0:30 0:45 1:00 2:00 3:00 4:00 5:00 6:00 0:00") - ("STYLE_ALL" . "habit"))) - org-blank-before-new-entry '((heading . t) - (plain-list-item . nil)) - org-insert-heading-respect-content t - org-yank-adjusted-subtrees t - org-image-actual-width nil - org-startup-with-inline-images nil - org-list-demote-modify-bullet '(("+" . "-") ("-" . "+")) - org-catch-invisible-edits 'error - ;; Put theses into a minor mode - org-indent-indentation-per-level 1 - org-cycle-separator-lines 1 - org-adapt-indentation nil - org-hide-leading-stars t - org-hide-emphasis-markers nil - org-link-file-path-type 'relative) - (setcar (nthcdr 4 org-emphasis-regexp-components) 10) - :hook (org-mode . vde/org-mode-hook)) - -(defun vde/org-mode-hook () - "Org-mode hook" - (setq show-trailing-whitespace t) - (when (not (eq major-mode 'org-agenda-mode)) - (setq fill-column 90) - (auto-revert-mode) - (auto-fill-mode) - (org-indent-mode) - (add-hook 'before-save-hook #'save-and-update-includes nil 'make-it-local))) -(use-package org-agenda - :after org - :commands (org-agenda) - :bind (("C-c o a a" . org-agenda) - ("<f12>" . org-agenda) - ("C-c o r a" . org-agenda-refile)) - :config - (use-package org-super-agenda - :config (org-super-agenda-mode)) - (setq org-agenda-span 'day - org-agenda-start-on-weekday 1 - org-agenda-include-diary t - org-agenda-window-setup 'current-window - org-agenda-skip-scheduled-if-done nil - org-agenda-compact-blocks t - org-agenda-sticky t - org-super-agenda-header-separator "" - org-agenda-custom-commands - `(("l" "Links" - tags "+#link") - ("w" "Agenda" - ((agenda "") - (tags-todo "-goals-incubate-inbox+TODO=\"STARTED\"" - ((org-agenda-overriding-header "Ongoing"))) - (tags-todo "-goals-incubate-inbox+TODO=\"NEXT\"" - ((org-agenda-overriding-header "Next")))) - ((org-super-agenda-groups - '((:name "Important" :priority "A") - (:name "Scheduled" :time-grid t) - (:habit t)))) - (org-agenda-list))))) -(use-package org-capture - :after org - :commands (org-capture) - :config - - (add-to-list 'org-capture-templates - `("l" "Link" entry - (file ,org-inbox-file) - "* %a\n%U\n%?\n%i" - :empty-lines 1)) - - (add-to-list 'org-capture-templates - `("t" "Tasks")) - (add-to-list 'org-capture-templates - `("tt" "New task" entry - (file ,org-inbox-file) - "* %?\n:PROPERTIES:\n:CREATED:\t%U\n:END:\n\n%i\n\nFrom: %a" - :empty-lines 1)) - (add-to-list 'org-capture-templates - `("tr" "PR Review" entry - (file ,org-inbox-file) - "* TODO review gh:%^{issue} :review:\n:PROPERTIES:\n:CREATED:%U\n:END:\n\n%i\n%?\nFrom: %a" - :empty-lines 1)) - - ;; (add-to-list 'org-capture-templates - ;; `("m" "Meeting notes" entry - ;; (file+datetree ,org-meeting-notes-file) - ;; (file ,(concat user-emacs-directory "/etc/orgmode/meeting-notes.org")))) - - (add-to-list 'org-capture-templates - `("w" "Writing")) - :bind (("C-c o c" . org-capture))) - - -;; (use-package org-capture-pop-frame -;; :after org) -(use-package org-protocol - :after org) -(use-package org-clock - :after org - :commands (org-clock-in org-clock-out org-clock-goto) - :config - ;; Setup hooks for clock persistance - (org-clock-persistence-insinuate) - (setq org-clock-clocked-in-display nil - ;; Show lot of clocking history so it's easy to pick items off the C-F11 list - org-clock-history-length 23 - ;; Change tasks to STARTED when clocking in - org-clock-in-switch-to-state 'vde/clock-in-to-started - ;; Clock out when moving task to a done state - org-clock-out-when-done t - ;; Save the running clock and all clock history when exiting Emacs, load it on startup - org-clock-persist t) - (use-package find-lisp) - (defun vde/is-project-p () - "Any task with a todo keyword subtask" - (save-restriction - (widen) - (let ((has-subtask) - (subtree-end (save-excursion (org-end-of-subtree t))) - (is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1))) - (save-excursion - (forward-line 1) - (while (and (not has-subtask) - (< (point) subtree-end) - (re-search-forward "^\*+ " subtree-end t)) - (when (member (org-get-todo-state) org-todo-keywords-1) - (setq has-subtask t)))) - (and is-a-task has-subtask)))) - - (defun vde/is-project-subtree-p () - "Any task with a todo keyword that is in a project subtree. -Callers of this function already widen the buffer view." - (let ((task (save-excursion (org-back-to-heading 'invisible-ok) - (point)))) - (save-excursion - (vde/find-project-task) - (if (equal (point) task) - nil - t)))) - - (defun vde/find-project-task () - "Move point to the parent (project) task if any" - (save-restriction - (widen) - (let ((parent-task (save-excursion (org-back-to-heading 'invisible-ok) (point)))) - (while (org-up-heading-safe) - (when (member (nth 2 (org-heading-components)) org-todo-keywords-1) - (setq parent-task (point)))) - (goto-char parent-task) - parent-task))) - - (defun vde/is-task-p () - "Any task with a todo keyword and no subtask" - (save-restriction - (widen) - (let ((has-subtask) - (subtree-end (save-excursion (org-end-of-subtree t))) - (is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1))) - (save-excursion - (forward-line 1) - (while (and (not has-subtask) - (< (point) subtree-end) - (re-search-forward "^\*+ " subtree-end t)) - (when (member (org-get-todo-state) org-todo-keywords-1) - (setq has-subtask t)))) - (and is-a-task (not has-subtask))))) - - (defun vde/is-subproject-p () - "Any task which is a subtask of another project" - (let ((is-subproject) - (is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1))) - (save-excursion - (while (and (not is-subproject) (org-up-heading-safe)) - (when (member (nth 2 (org-heading-components)) org-todo-keywords-1) - (setq is-subproject t)))) - (and is-a-task is-subproject))) - - (defun vde/clock-in-to-started (kw) - "Switch a task from TODO to STARTED when clocking in. -Skips capture tasks, projects, and subprojects. -Switch projects and subprojects from STARTED back to TODO" - (when (not (and (boundp 'org-capture-mode) org-capture-mode)) - (cond - ((and (member (org-get-todo-state) (list "TODO" "NEXT")) - (vde/is-task-p)) - "STARTED") - ((and (member (org-get-todo-state) (list "STARTED")) - (vde/is-project-p)) - "TODO")))) - :bind (("<f11>" . org-clock-goto))) -(use-package org-habit - :after (org) - :config - (setq org-habit-show-habits-only-for-today nil - org-habit-graph-column 80)) -(use-package org-src - :after (org) - :config - (setq org-src-fontify-natively t - org-src-tab-acts-natively t - org-src-window-setup 'current-window - org-edit-src-content-indentation 0)) -;; my personal -(use-package ol-github - :after (org)) -(use-package ol-gitlab - :after (org)) -(use-package ol-ripgrep - :after (org)) -(use-package ol-rg - :disabled - :after (org)) -(use-package ol-grep - :after (org)) - -;; built-in org-mode -(use-package ol-eshell - :after (org)) -(use-package ol-git-link - :defer 2 - :after (org)) -(use-package ol-gnus - :defer 2 - :after (org)) -(use-package ol-irc - :defer 2 - :after (org)) -(use-package ol-info - :defer 2 - :after (org)) -(use-package ol-man - :defer 2 - :after (org)) -(use-package ol-notmuch - :defer 2 - :after (org)) -(use-package orgit - :after org) -(use-package ob-async - :after org - :commands (ob-async-org-babel-execute-src-block)) -(use-package ob-css - :after org - :commands (org-babel-execute:css)) -(use-package ob-dot - :after org - :commands (org-babel-execute:dot)) -(use-package ob-ditaa - :after org - :commands (org-babel-execute:ditaa) - :config - (setq org-ditaa-jar-path "/home/vincent/.nix-profile/lib/ditaa.jar")) -(use-package ob-emacs-lisp - :after org - :commands (org-babel-execute:emacs-lisp org-babel-execute:elisp)) -(use-package ob-go - :after org - :commands (org-babel-execute:go)) -(use-package ob-gnuplot - :after org - :commands (org-babel-execute:gnuplot)) -(use-package ob-http - :after org - :commands (org-babel-execute:http)) -(use-package ob-js - :after org - :commands (org-babel-execute:js)) -(use-package ob-latex - :after org - :commands (org-babel-execute:latex)) -(use-package ob-python - :after org - :commands (org-babel-execute:python)) -(use-package ob-shell - :after org - :commands (org-babel-execute:ash - org-babel-execute:bash - org-babel-execute:csh - org-babel-execute:dash - org-babel-execute:fish - org-babel-execute:ksh - org-babel-execute:mksh - org-babel-execute:posh - org-babel-execute:sh - org-babel-execute:shell - org-babel-execute:zsh)) -(use-package ob-doc-makefile - :after org - :commands (org-babel-execute:makefile)) -(use-package org - :defer 2 - :config - (defun vde/tangle-all-notes () - "Produce files from my notes folder. -This function will attempt to tangle all org files from `org-notes-dir'. The -assumption is that those will generate configuration file (in `~/src/home'), -and thus keeping the configuration source up-to-date" - (mapc (lambda (x) (org-babel-tangle-file x)) - (ignore-errors - (append (directory-files-recursively org-notes-dir "\.org$") - (directory-files-recursively src-home-dir "\.org$")))))) -(use-package org-journal - :commands (org-journal-new-entry org-capture) - :after org - :bind - (("C-c n j" . org-journal-new-entry) - ("C-c o j" . org-journal-new-entry)) - :config - (defun org-journal-find-location () - "Go to the beginning of the today's journal file. - -This can be used for an org-capture template to create an entry in the journal." - ;; 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) - ;; Position point on the journal's top-level heading so that org-capture - ;; will add the new entry as a child entry. - (widen) - (goto-char (point-min)) - (org-show-entry)) - (add-to-list 'org-capture-templates - `("j" "Journal")) - (add-to-list 'org-capture-templates - `("jj" "Journal entry" entry (function org-journal-find-location) - "** %(format-time-string org-journal-time-format)%^{Title}\n%i%?" - :empty-lines 1)) - (add-to-list 'org-capture-templates - `("je" "Weekly review" entry (function org-journal-find-location) - (file ,(expand-file-name "etc/orgmode/weekly.org" user-emacs-directory)) - :empty-lines 1 :clock-in t :clock-resume t)) - :custom - (org-journal-date-prefix "* ") - (org-journal-file-header "#+TITLE: %Y-v%m Journal\n\n") - (org-journal-file-format "%Y-%m.private.org") - (org-journal-file-type 'monthly) - (org-journal-dir org-private-notes-dir) - (org-journal-date-format "%A, %d %B %Y") - (org-journal-enable-agenda-integration nil)) -(use-package org-id - :after org - :commands contrib/org-id-headlines - :config - (setq org-id-link-to-org-use-id - 'create-if-interactive-and-no-custom-id) - - (defun contrib/org-get-id (&optional pom create prefix) - "Get the CUSTOM_ID property of the entry at point-or-marker -POM. If POM is nil, refer to the entry at point. If the entry -does not have an CUSTOM_ID, the function returns nil. However, -when CREATE is non nil, create a CUSTOM_ID if none is present -already. PREFIX will be passed through to `org-id-new'. In any -case, the CUSTOM_ID of the entry is returned." - (org-with-point-at pom - (let ((id (org-entry-get nil "CUSTOM_ID"))) - (cond - ((and id (stringp id) (string-match "\\S-" id)) - id) - (create - (setq id (org-id-new (concat prefix "h"))) - (org-entry-put pom "CUSTOM_ID" id) - (org-id-add-location id (buffer-file-name (buffer-base-buffer))) - id))))) - - (defun contrib/org-id-headlines () - "Add CUSTOM_ID properties to all headlines in the current -file which do not already have one." - (interactive) - (org-map-entries - (funcall 'contrib/org-get-id (point) 'create)))) -(use-package org-crypt - :after (org) - :config - (org-crypt-use-before-save-magic) - (setq org-tags-exclude-from-inheritance '("crypt"))) -(use-package org-tempo - :after (org)) -(use-package org-attach - :after org - :config - (setq org-link-abbrev-alist '(("att" . org-attach-expand-link)))) -(use-package ox-publish - :after org - :commands (org-publish org-publish-all org-publish-project org-publish-current-project org-publish-current-file) - :config - (setq org-html-coding-system 'utf-8-unix)) -(use-package diary-lib - :after (org) - :config - (setq diary-entry-marker "diary") - (setq diary-show-holidays-flag t) - (setq diary-header-line-flag nil) - (setq diary-mail-days 3) - (setq diary-number-of-entries 3) - (setq diary-comment-start ";") - (setq diary-comment-end "") - (setq diary-date-forms - '((day "/" month "[^/0-9]") - (day "/" month "/" year "[^0-9]") - (day " *" monthname " *" year "[^0-9]") - (monthname " *" day "[^,0-9]") - (monthname " *" day ", *" year "[^0-9]") - (year "[-/]" month "[-/]" day "[^0-9]") - (dayname "\\W")))) - -(use-package org - :defer t - :config - - (defvar org-capture-templates (list)) - (setq org-protocol-default-template-key "l") - - ;; images - (setq org-image-actual-width nil - org-startup-with-inline-images nil) - - ;; Tasks (-> inbox) - - ;; Journal - - (add-to-list 'ispell-skip-region-alist '(":\\(PROPERTIES\\|LOGBOOK\\):" ":END:")) - (add-to-list 'ispell-skip-region-alist '("#\\+BEGIN_SRC" "#\\+END_SRC")) - (add-to-list 'ispell-skip-region-alist '("#\\+BEGIN_EXAMPLE" "#\\+END_EXAMPLE")) - - ;; org-links - ;; from http://endlessparentheses.com/use-org-mode-links-for-absolutely-anything.html - (org-link-set-parameters "tag" - :follow #'endless/follow-tag-link) - (defun endless/follow-tag-link (tag) - "Display a list of TODO headlines with tag TAG. -With prefix argument, also display headlines without a TODO keyword." - (org-tags-view (null current-prefix-arg) tag)) - - (org-link-set-parameters - "org" - :complete (lambda () (+org-link-read-file "org" org-directory)) - :follow (lambda (link) (find-file (expand-file-name link org-directory))) - :face (lambda (link) - (if (file-exists-p (expand-file-name link org-directory)) - 'org-link - 'error))) - (defun +org-link-read-file (key dir) - (let ((file (read-file-name (format "%s: " (capitalize key)) dir))) - (format "%s:%s" - key - (file-relative-name file dir)))) - ) - -(use-package org-tree-slide - :functions (org-display-inline-images - org-remove-inline-images) - :bind (:map org-mode-map - ("s-<f7>" . org-tree-slide-mode) - :map org-tree-slide-mode-map - ("<left>" . org-tree-slide-move-previous-tree) - ("<right>" . org-tree-slide-move-next-tree) - ("S-SPC" . org-tree-slide-move-previous-tree) - ("SPC" . org-tree-slide-move-next-tree)) - :hook ((org-tree-slide-play . (lambda () - (text-scale-increase 4) - (org-display-inline-images) - (read-only-mode 1))) - (org-tree-slide-stop . (lambda () - (text-scale-increase 0) - (org-remove-inline-images) - (read-only-mode -1)))) - :init (setq org-tree-slide-header t - org-tree-slide-slide-in-effect nil - org-tree-slide-heading-emphasis nil - org-tree-slide-cursor-init t - org-tree-slide-modeline-display 'outside - org-tree-slide-skip-done nil - org-tree-slide-skip-comments t - org-tree-slide-content-margin-top 1 - org-tree-slide-skip-outline-level 4)) - -(provide 'config-org) -;;; config-org.el ends here diff --git a/tools/emacs/old-config/config-projects.el b/tools/emacs/old-config/config-projects.el @@ -1,77 +0,0 @@ -;;; config-projects.el --- -*- lexical-binding: t; -*- -;;; Commentary: -;;; Project related configuration. -;;; Code: - -(use-package project - :bind (("C-x p v" . vde-project-magit-status) - ("C-x p s" . vde-project-vterm) - ("C-x p X" . vde/run-in-project-vterm)) - :config - - (setq vde/project-local-identifier '(".project")) ;; "go.mod" - (setq project-switch-commands - '((?f "File" project-find-file) - (?g "Grep" project-find-regexp) - (?d "Dired" project-dired) - (?b "Buffer" project-switch-to-buffer) - (?q "Query replace" project-query-replace-regexp) - (?m "Magit" vde-project-magit-status) - (?e "Eshell" project-eshell) - (?s "Vterm" vde-project-vterm))) - - (defun vde/project-try-local (dir) - "Determine if DIR is a non-VC project." - (if-let ((root (if (listp vde/project-local-identifier) - (seq-some (lambda (n) - (locate-dominating-file dir n)) - vde/project-local-identifier) - (locate-dominating-file dir vde/project-local-identifier)))) - (cons 'local root))) - (cl-defmethod project-root ((project (head local))) - (cdr project)) - - (cl-defmethod project-root ((project (eql nil))) nil) - - (add-hook 'project-find-functions #'vde/project-try-local) - - :init - (setq-default project-compilation-buffer-name-function 'project-prefixed-buffer-name) - (defun vde-project--project-current () - "Return directory from `project-current' based on Emacs version." - (if (>= emacs-major-version 29) - (project-root (project-current)) - (cdr (project-current)))) - (defun vde-project-magit-status () - "Run `magit-status' on project." - (interactive) - (magit-status (vde-project--project-current))) - - (defun vde-project-vterm (&optional command) - "Run `vterm' on project. -If a buffer already exists for running a vterm shell in the project's root, -switch to it. Otherwise, create a new vterm shell." - (interactive) - (let* ((default-directory (vde-project--project-current)) - (default-project-vterm-name (project-prefixed-buffer-name "vterm")) - (vterm-buffer (get-buffer default-project-vterm-name))) - (if (and vterm-buffer (not current-prefix-arg)) - (pop-to-buffer-same-window vterm-buffer) - (let* ((cd-cmd (concat " cd " (shell-quote-argument default-directory)))) - (vterm default-project-vterm-name) - (with-current-buffer vterm-buffer - (vterm-send-string cd-cmd) - (vterm-send-return)))) - (when command - (vterm-send-string command) - (vterm-send-return)))) - (defun vde/run-in-project-vterm () - (interactive) - (let* ((default-directory (vde-project--project-current)) - (default-project-vterm-name (project-prefixed-buffer-name "vterm")) - (vterm-buffer (get-buffer default-project-vterm-name))) - (vde-project-vterm (read-string "Command: ")))) - ) - -(provide 'config-projects) -;;; config-projects.el ends here diff --git a/tools/emacs/old-config/config-search.el b/tools/emacs/old-config/config-search.el @@ -1,111 +0,0 @@ -;;; config-search.el --- -*- lexical-binding: t; -*- -;;; Commentary: -;;; Search related configuration -;;; Code: - -;; UseISearch -(use-package isearch - :unless noninteractive - :config - (setq-default search-whitespace-regexp ".*?" - isearch-lax-whitespace t - isearch-regexp-lax-whitespace nil) - (defun stribb/isearch-region (&optional not-regexp no-recursive-edit) - "If a region is active, make this the isearch default search -pattern." - (interactive "P\np") - (when (use-region-p) - (let ((search (buffer-substring-no-properties - (region-beginning) - (region-end)))) - (message "stribb/ir: %s %d %d" search (region-beginning) (region-end)) - (setq deactivate-mark t) - (isearch-yank-string search)))) - (advice-add 'isearch-forward-regexp :after 'stribb/isearch-region) - (advice-add 'isearch-forward :after 'stribb/isearch-region) - (advice-add 'isearch-backward-regexp :after 'stribb/isearch-region) - (advice-add 'isearch-backward :after 'stribb/isearch-region) - - (defun contrib/isearchp-remove-failed-part-or-last-char () - "Remove failed part of search string, or last char if successful. -Do nothing if search string is empty to start with." - (interactive) - (if (equal isearch-string "") - (isearch-update) - (if isearch-success - (isearch-delete-char) - (while (isearch-fail-pos) (isearch-pop-state))) - (isearch-update))) - - (defun contrib/isearch-done-opposite-end (&optional nopush edit) - "End current search in the opposite side of the match. -Particularly useful when the match does not fall within the -confines of word boundaries (e.g. multiple words)." - (interactive) - (funcall #'isearch-done nopush edit) - (when isearch-other-end (goto-char isearch-other-end))) - :bind (("M-s M-o" . multi-occur) - :map isearch-mode-map - ("DEL" . contrib/isearchp-remove-failed-part-or-last-char) - ("<C-return>" . contrib/isearch-done-opposite-end))) -;; -UseISearch - -;; UseGrep -(use-package grep - :commands (find-grep grep find-grep-dired find-name-dired) - :bind (("M-s n" . find-name-dired) - ("M-s F" . find-grep) - ("M-s G" . grep) - ("M-s d" . find-grep-dired)) - :hook ((hook-mode . toggle-truncate-lines)) - :config - (setq-default grep-template (string-join '("ugrep" - "--color=always" - "--ignore-binary" - "--ignore-case" - "--include=<F>" - "--line-number" - "--null" - "--recursive" - "--regexp=<R>") - " ")) - (add-to-list 'grep-find-ignored-directories "auto") - (add-to-list 'grep-find-ignored-directories "elpa")) -;; -UseGrep - -;; UseWgrep -(use-package wgrep - :unless noninteractive - :commands (wgrep-change-to-wgrep-mode) - :defer 2 - :custom - (wgrep-auto-save-buffer t) - (wgrep-change-readonly-file t)) -;; -UseWgrep - -;; UseRG -(use-package rg - :if *rg* - :commands (rg rg-project rg-dwim) - :bind (("M-s r r" . rg) - ("M-s r p" . rg-project) - ("M-s r s" . rg-dwim)) - :config - (setq rg-group-result t) - (setq rg-hide-command t) - (setq rg-show-columns nil) - (setq rg-show-header t) - (setq rg-default-alias-fallback "all") - (cl-pushnew '("tmpl" . "*.tmpl") rg-custom-type-aliases) - (cl-pushnew '("gotest" . "*_test.go") rg-custom-type-aliases) - (defun vde/rg-buffer-name () - "Generate a rg buffer name from projectile if bound" - (cond ((boundp 'projectile-project-name) (if (string-equal (projectile-project-name) "-") - "rg" - (format "rg: %s" (projectile-project-name)))) - (t "rg"))) - (setq rg-buffer-name #'vde/rg-buffer-name)) -;; -UseRG - -(provide 'config-search) -;;; config-search.el ends here diff --git a/tools/emacs/old-config/config-shells.el b/tools/emacs/old-config/config-shells.el @@ -1,401 +0,0 @@ -;;; config-shells.el --- -*- lexical-binding: t; -*- -;;; Commentary: -;;; Shell scripting -;;; Code: - -(use-package shell - :commands (shell) - :bind (("<f1>" . shell) - (:map shell-mode-map - ("<tab>" . completion-at-point))) - :config - (setq-default explicit-shell-file-name "zsh" - shell-file-name "zsh") - (unbind-key "C-c C-l" shell-mode-map) - (bind-key "C-c C-l" #'counsel-shell-history shell-mode-map)) - -;; TODO: understand and rework eshell completion -(use-package eshell - :commands (eshell eshell-here) - :bind* ("C-x m t" . eshell-here) - :config - (defun eshell-here () - "Open EShell in the directory associated with the current buffer's file. -The EShell is renamed to match that directory to make multiple windows easier." - (interactive) - (let* ((parent (if (buffer-file-name) - (file-name-directory (buffer-file-name)) - default-directory)) - (name (car (last (split-string parent "/" t))))) - (eshell "new") - (rename-buffer (concat "*eshell: " name "*")))) - - ;; Handy aliases - (defalias 'ff 'find-file) - (defalias 'emacs 'find-file) - (defalias 'e 'find-file) - (defalias 'ec 'find-file) - (defalias 'd 'dired) - - (defun eshell/gs (&rest args) - (magit-status (pop args) nil) - (eshell/echo)) ; The echo command suppresses output - - (defun eshell/cdg () - "Change directory to the project's root." - (eshell/cd (locate-dominating-file default-directory ".git"))) - - (defun eshell/extract (file) - "One universal command to extract FILE (for bz2, gz, rar, etc.)" - (eshell-command-result (format "%s %s" (cond ((string-match-p ".*\.tar.bz2" file) - "tar xzf") - ((string-match-p ".*\.tar.gz" file) - "tar xzf") - ((string-match-p ".*\.bz2" file) - "bunzip2") - ((string-match-p ".*\.rar" file) - "unrar x") - ((string-match-p ".*\.gz" file) - "gunzip") - ((string-match-p ".*\.tar" file) - "tar xf") - ((string-match-p ".*\.tbz2" file) - "tar xjf") - ((string-match-p ".*\.tgz" file) - "tar xzf") - ((string-match-p ".*\.zip" file) - "unzip") - ((string-match-p ".*\.jar" file) - "unzip") - ((string-match-p ".*\.Z" file) - "uncompress") - (t - (error "Don't know how to extract %s" file))) - file))) - - ;; From https://karthinks.com/software/jumping-directories-in-eshell/ - (defun eshell/j (&optional regexp) - "Navigate to a previously visited directory in eshell, or to -any directory proferred by `consult-dir'." - (let ((eshell-dirs (delete-dups - (mapcar 'abbreviate-file-name - (ring-elements eshell-last-dir-ring))))) - (cond - ((and (not regexp) (featurep 'consult-dir)) - (let* ((consult-dir--source-eshell `(:name "Eshell" - :narrow ?e - :category file - :face consult-file - :items ,eshell-dirs)) - (consult-dir-sources (cons consult-dir--source-eshell - consult-dir-sources))) - (eshell/cd (substring-no-properties - (consult-dir--pick "Switch directory: "))))) - (t (eshell/cd (if regexp (eshell-find-previous-directory regexp) - (completing-read "cd: " eshell-dirs))))))) - - (add-hook - 'eshell-mode-hook - (lambda () - (let ((ls (if (executable-find "exa") "exa" "ls"))) - (eshell/alias "ls" (concat ls " --color=always $*")) - (eshell/alias "ll" (concat ls " --color=always -l $*")) - (eshell/alias "l" (concat ls " --color=always -lah $*"))) - (eshell-smart-initialize) - (eshell-dirs-initialize) - (bind-keys :map eshell-mode-map - ("C-c C-l" . counsel-esh-history) - ([remap eshell-pcomplete] . completion-at-point) - ))) - - ;; Use system su/sudo - (with-eval-after-load "em-unix" - '(progn - (unintern 'eshell/su nil) - (unintern 'eshell/sudo nil))) - - (add-hook 'eshell-mode-hook #'with-editor-export-editor)) - -(use-package em-prompt - :after eshell - :config - (defun vde/eshell-quit-or-delete-char (arg) - "Use C-d to either delete forward char or exit EShell." - (interactive "p") - (if (and (eolp) (looking-back eshell-prompt-regexp nil nil)) - (progn - (eshell-life-is-too-much)) - (delete-char arg))) - - (add-hook 'eshell-mode-hook - (lambda () - (bind-key "C-d" - #'vde/eshell-quit-or-delete-char eshell-mode-map)))) - -(use-package esh-mode - :disabled - :after eshell - :bind (:map eshell-mode-map - ("<tab>" . vde/esh-mode-completion-at-point)) - :config - (setq-default eshell-scroll-to-bottom-on-input 'all) - (defun vde/esh-mode-completion-at-point () - "Same as `completion-at-point' except for some commands." - (interactive) - ;; unbinding pcomplete/make gives a chance to `bash-completion' - ;; to complete make rules. Bash-completion is indeed more - ;; powerfull than `pcomplete-make'. - (cl-letf (((symbol-function 'pcomplete/make) nil)) - (completion-at-point)))) - -(use-package em-smart - :after eshell) -(use-package em-dirs - :after eshell) - -(use-package em-cmpl - :after eshell - :hook (eshell-mode . eshell-cmpl-initialize) - :config - (defun my/eshell-bash-completion () - (let ((bash-completion-nospace t)) - (while (pcomplete-here - (nth 2 (bash-completion-dynamic-complete-nocomint - (save-excursion (eshell-bol) (point)) - (point))))))) - (when (require 'bash-completion nil t) - (setq eshell-default-completion-function #'my/eshell-bash-completion)) - - (add-to-list 'eshell-command-completions-alist - '("gunzip" "gz\\'")) - (add-to-list 'eshell-command-completions-alist - '("tar" "\\(\\.tar|\\.tgz\\|\\.tar\\.gz\\)\\'"))) - -(use-package em-hist - :after eshell - :config (setq eshell-hist-ignoredups t)) - -(use-package em-tramp - :after eshell) - -(use-package em-term - :after eshell - :config - (add-to-list 'eshell-visual-commands "ssh") - (add-to-list 'eshell-visual-commands "htop") - (add-to-list 'eshell-visual-commands "top") - (add-to-list 'eshell-visual-commands "tail") - (add-to-list 'eshell-visual-commands "npm") - (add-to-list 'eshell-visual-commands "ncdu")) - -(use-package em-banner - :after eshell - :config - (setq eshell-banner-message " - Welcome to the Emacs - - _/ _/ _/ - _/_/ _/_/_/ _/_/_/ _/_/ _/ _/ - _/_/_/_/ _/_/ _/ _/ _/_/_/_/ _/ _/ - _/ _/_/ _/ _/ _/ _/ _/ - _/_/_/ _/_/_/ _/ _/ _/_/_/ _/ _/ - -")) - -(use-package eshell-prompt-extras - :after eshell - :custom - (eshell-highlight-prompt nil) - (eshell-prompt-function 'vde-theme-lambda) - :config - (defun vde-kubernetes-current-context () - "Return the current context" - (if (not (string-empty-p (getenv "KUBECONFIG"))) - (epe-trim-newline (shell-command-to-string (concat - "env KUBECONFIG=" - (getenv "KUBECONFIG") - " kubectl config current-context"))) - (epe-trim-newline (shell-command-to-string "kubectl config current-context")))) - (defun vde-kubernetes-p () - "If you have kubectl install and a config set, -using either KUBECONFIG or ~/.kube/config" - (and (eshell-search-path "kubectl") - (not (string-empty-p (vde-kubernetes-current-context))) - (not (string-match-p "error: current-context is not set" (vde-kubernetes-current-context))))) - ;; From epe-theme-lambda - (defun vde-theme-lambda () - "A eshell-prompt lambda theme." - (setq eshell-prompt-regexp "^[^#\nλ]*[#λ] ") - (concat - (when (epe-remote-p) - (epe-colorize-with-face - (concat (epe-remote-user) "@" (epe-remote-host) " ") - 'epe-remote-face)) - (when (and epe-show-python-info (bound-and-true-p venv-current-name)) - (epe-colorize-with-face (concat "(" venv-current-name ") ") 'epe-venv-face)) - (let ((f (cond ((eq epe-path-style 'fish) 'epe-fish-path) - ((eq epe-path-style 'single) 'epe-abbrev-dir-name) - ((eq epe-path-style 'full) 'abbreviate-file-name)))) - (epe-colorize-with-face (funcall f (eshell/pwd)) 'epe-dir-face)) - (when (epe-git-p) - (concat - (epe-colorize-with-face ":" 'epe-dir-face) - (epe-colorize-with-face - (concat (epe-git-branch) - (epe-git-dirty) - (epe-git-untracked) - (let ((unpushed (epe-git-unpushed-number))) - (unless (= unpushed 0) - (concat ":" (number-to-string unpushed))))) - 'epe-git-face))) - (when (vde-kubernetes-p) - (concat (epe-colorize-with-face " (" 'epe-dir-face) - (epe-colorize-with-face (vde-kubernetes-current-context) 'epe-dir-face) - (epe-colorize-with-face ")" 'epe-dir-face))) - (epe-colorize-with-face " λ" 'epe-symbol-face) - (epe-colorize-with-face (if (= (user-uid) 0) "#" "") 'epe-sudo-symbol-face) - " "))) - -(use-package esh-autosuggest - :after eshell - :hook (eshell-mode . esh-autosuggest-mode)) - -(use-package xterm-color - :after eshell - :init - ;; (setq comint-output-filter-functions - ;; (remove 'ansi-color-process-output comint-output-filter-functions)) - (add-hook 'shell-mode-hook - (lambda () - ;; Disable font-locking in this buffer to improve performance - (font-lock-mode -1) - ;; Prevent font-locking from being re-enabled in this buffer - (make-local-variable 'font-lock-function) - (setq font-lock-function (lambda (_) nil)) - (add-hook 'comint-preoutput-filter-functions 'xterm-color-filter nil t))) - (add-hook 'eshell-before-prompt-hook - (lambda () - (setenv "TERM" "xterm-256color") - (setq xterm-color-preserve-properties t))) - (add-to-list 'eshell-preoutput-filter-functions 'xterm-color-filter) - (setq eshell-output-filter-functions (remove 'eshell-handle-ansi-color eshell-output-filter-functions)) - (setq compilation-environment '("TERM=xterm-256color"))) - -(use-package vterm - :commands (vterm vde/vterm-toggle) - :bind (("C-c t v" . vde/vterm-toggle) - ("C-c t r" . vde/run-in-vterm)) - :custom - (vterm-kill-buffer-on-exit t) - :config - (defun vde/vterm-tramp-get-method-parameter (method param) - "Return the method parameter PARAM. -If the `tramp-methods' entry does not exist, return NIL." - (let ((entry (assoc param (assoc method tramp-methods)))) - (when entry (cadr entry)))) - (add-hook 'vterm-set-title-functions 'vterm--rename-buffer-as-title) - ;; TODO: hook into projectile-run-vterm instead - ;; Also, look into vterm-toggle way of doing things.. I thing it is trying to be too smart about it.. - ;; I prefer an easy projectile integration (or projects integration) - (defun vde/vterm () - "" - (interactive) - (let* ((dir (expand-file-name default-directory)) - cd-cmd cur-host vterm-dir vterm-host cur-user cur-port remote-p cur-method login-cmd) - (if (ignore-errors (file-remote-p dir)) - (with-parsed-tramp-file-name dir nil - (setq remote-p t) - (setq cur-host host) - (setq cur-method (tramp-find-method method user cur-host)) - (setq cur-user (or (tramp-find-user cur-method user cur-host) "")) - (setq cur-port (or port "")) - (setq dir localname)) - (setq cur-host (system-name))) - (setq login-cmd (vde/vterm-tramp-get-method-parameter cur-method 'tramp-login-program)) - (setq cd-cmd (concat " cd " (shell-quote-argument dir))) - (setq shell-buffer (format "vterm %s %s" cur-host dir)) - (if (buffer-live-p shell-buffer) - (switch-to-buffer shell-buffer) - (progn - (message (format "buffer '%s' doesn't exists" shell-buffer)) - (vterm shell-buffer) - (with-current-buffer shell-buffer - (message (format "%s" remote-p)) - (when remote-p - (let* ((method (if (string-equal login-cmd "ssh") "ssh" cur-method)) - (login-opts (vde/vterm-tramp-get-method-parameter method 'tramp-login-args)) - (login-shell (vde/vterm-tramp-get-method-parameter method 'tramp-remote-shell)) - (login-shell-args (tramp-get-sh-extra-args login-shell)) - ;; (vterm-toggle-tramp-get-method-parameter cur-method 'tramp-remote-shell) - (spec (format-spec-make - ?h cur-host ?u cur-user ?p cur-port ?c "" - ?l (concat login-shell " " login-shell-args))) - (cmd - (concat login-cmd " " - (mapconcat - (lambda (x) - (setq x (mapcar (lambda (y) (format-spec y spec)) x)) - (unless (member "" x) (string-join x " "))) - login-opts " ")))) - (vterm-send-string cmd) - (vterm-send-return))) - (vterm-send-string cd-cmd) - (vterm-send-return)))))) - (defun vde/vterm-toggle () - "Toggle between the main vterm buffer and the current buffer. -If you are in a vterm buffer, switch the window configuration -back to your code buffers. Otherwise, create at least one vterm -buffer if it doesn't exist already, and switch to it. On every -toggle, the current window configuration is saved in a register." - (interactive) - (if (eq major-mode 'vterm-mode) - (jump-to-register ?W) - ;; Save current window config and jump to shell - (window-configuration-to-register ?W) - (condition-case nil - (jump-to-register ?Z) - (error - (vterm) - (when (= (length (window-list)) 2) - (other-window 1) - (vterm 1) - (other-window 1)))) - (window-configuration-to-register ?Z))) - (buffer-name) - (defun vde/run-in-vterm () - (interactive) - (with-current-buffer "vterm" - (vterm-send-string (read-string "Command: ")) - (vterm-send-C-j)))) - -(use-package multi-vterm - :commands (multi-vterm multi-vterm-projectile multi-vterm-dedicated-toggle) - :bind (("C-c t t" . multi-vterm-dedicated-toggle) - ("C-c t p" . multi-vterm-prev) - ("C-c t n" . multi-vterm-next) - ("C-c t s" . multi-vterm))) -;; for fish in ansi-term -(add-hook 'term-mode-hook 'toggle-truncate-lines) - -(use-package tramp - :defer t - :config - (setq-default tramp-use-ssh-controlmaster-options nil ; Don't override SSH config. - tramp-default-method "ssh") ; ssh is faster than scp and supports ports. - (add-to-list 'tramp-remote-path "/run/current-system/sw/bin") - (add-to-list 'tramp-remote-path "/etc/profiles/per-user/root/bin/") - (add-to-list 'tramp-remote-path "/etc/profiles/per-user/vincent/bin/") - (add-to-list 'tramp-remote-path "~/.nix-profile/bin") - (add-to-list 'tramp-remote-path "~/bin") - (add-to-list 'tramp-remote-path 'tramp-own-remote-path)) - -(defun generic-term-init () - (visual-line-mode -1) - (setq-local global-hl-line-mode nil) - (setq-local scroll-margin 0)) - -(add-hook 'term-mode-hook #'generic-term-init) -(add-hook 'shell-mode-hook #'generic-term-init) -(add-hook 'eshell-mode-hook #'generic-term-init) - -(provide 'setup-shells) diff --git a/tools/emacs/old-config/config-vcs.el b/tools/emacs/old-config/config-vcs.el @@ -1,207 +0,0 @@ -;;; config-vcs.el --- -*- lexical-binding: t; -*- -;;; Commentary: -;;; Version control configuration -;;; Code: - -(use-package vc - :config - (setq-default vc-find-revision-no-save t - vc-follow-symlinks t) - :bind (("C-x v f" . vc-log-incoming) ; git fetch - ("C-x v F" . vc-update) - ("C-x v d" . vc-diff))) - -(use-package vc-dir - :config - (defun vde/vc-dir-project () - "Unconditionally display `vc-diff' for the current project." - (interactive) - (vc-dir (vc-root-dir))) - - (defun vde/vc-dir-jump () - "Jump to present directory in a `vc-dir' buffer." - (interactive) - (vc-dir default-directory)) - :bind (("C-x v p" . vde/vc-dir-project) - ("C-x v j" . vde/vc-dir-jump) ; similar to `dired-jump' - :map vc-dir-mode-map - ("f" . vc-log-incoming) ; replaces `vc-dir-find-file' (use RET) - ("F" . vc-update) ; symmetric with P: `vc-push' - ("d" . vc-diff) ; align with D: `vc-root-diff' - ("k" . vc-dir-clean-files))) - -(use-package vc-git - :config - (setq vc-git-diff-switches "--patch-with-stat") - (setq vc-git-print-log-follow t)) - -(use-package vc-annotate - :config - (setq vc-annotate-display-mode 'scale) - :bind (("C-x v a" . vc-annotate) - :map vc-annotate-mode-map - ("t" . vc-annotate-toggle-annotation-visibility))) - -(use-package ediff - :commands (ediff ediff-files ediff-merge ediff3 ediff-files3 ediff-merge3) - :config - (setq ediff-window-setup-function 'ediff-setup-windows-plain) - (setq ediff-split-window-function 'split-window-horizontally) - (setq ediff-diff-options "-w") - (add-hook 'ediff-after-quit-hook-internal 'winner-undo)) - -(use-package diff - :config - (setq diff-default-read-only nil) - (setq diff-advance-after-apply-hunk t) - (setq diff-update-on-the-fly t) - (setq diff-refine 'font-lock) - (setq diff-font-lock-prettify nil) - (setq diff-font-lock-syntax nil)) - -(use-package magit-popup) - -(use-package magit - :unless noninteractive - :commands (magit-status magit-clone magit-pull magit-blame magit-log-buffer-file magit-log) - :bind (("C-c v c" . magit-clone) - ("C-c v C" . magit-checkout) - ("C-c v b" . magit-branch) - ("C-c v d" . magit-dispatch) - ("C-c v f" . magit-fetch) - ("C-c v g" . magit-blame) - ("C-c v l" . magit-log-buffer-file) - ("C-c v p" . magit-pull) - ("C-c v P" . magit-push) - ("C-c v r" . magit-rebase) - ("C-c v v" . magit-status)) - :config - (setq-default magit-save-repository-buffers 'dontask - magit-refs-show-commit-count 'all - magit-branch-prefer-remote-upstream '("main") - magit-display-buffer-function #'magit-display-buffer-traditional) - - (magit-define-popup-option 'magit-rebase-popup - ?S "Sign using gpg" "--gpg-sign=" #'magit-read-gpg-secret-key) - (magit-define-popup-switch 'magit-log-popup - ?m "Omit merge commits" "--no-merges") - ;; cargo-culted from https://github.com/magit/magit/issues/3717#issuecomment-734798341 - ;; valid gitlab options are defined in https://docs.gitlab.com/ee/user/project/push_options.html - ;; - ;; the second argument to transient-append-suffix is where to append - ;; to, not sure what -u is, but this works - (transient-append-suffix 'magit-push "-u" - '(1 "=s" "Skip gitlab pipeline" "--push-option=ci.skip")) - (transient-append-suffix 'magit-push "=s" - '(1 "=m" "Create gitlab merge-request" "--push-option=merge_request.create")) - (transient-append-suffix 'magit-push "=m" - '(1 "=o" "Set push option" "--push-option=")) ;; Will prompt, can only set one extra - - (defun vde/fetch-and-rebase-from-upstream () - "" - (interactive) - (magit-fetch-all "--quiet") - (magit-git-rebase (concat "upstream/" (vc-git--symbolic-ref (buffer-file-name))) "-sS")) - - ;; Hide "Recent Commits" - (magit-add-section-hook 'magit-status-sections-hook - 'magit-insert-modules - 'magit-insert-unpushed-to-upstream - 'magit-insert-unpulled-from-upstream) - ;; No need for tag in the status header - (remove-hook 'magit-status-sections-hook 'magit-insert-tags-header) - (setq-default magit-module-sections-nested nil) - - ;; Show refined hunks during diffs - (set-default 'magit-diff-refine-hunk t) - - ;; Refresh `magit-status' after saving a buffer - (add-hook 'after-save-hook #'magit-after-save-refresh-status)) - -(use-package magit-annex - :unless noninteractive - :after magit) - -(use-package git-annex - :after dired - :defer t) - -(use-package git-commit - :after magit - :commands (git-commit-mode) - :hook (git-commit-mode . vde/git-commit-mode-hook) - :config - (defun vde/git-commit-mode-hook () - "git-commit mode hook") - (setq-default git-commit-summary-max-length 50 - git-commit-known-pseudo-headers - '("Signed-off-by" - "Acked-by" - "Modified-by" - "Cc" - "Suggested-by" - "Reported-by" - "Tested-by" - "Reviewed-by") - git-commit-style-convention-checks - '(non-empty-second-line - overlong-summary-line))) - -(use-package gitconfig-mode - :commands (gitconfig-mode) - :mode (("/\\.gitconfig\\'" . gitconfig-mode) - ("/\\.git/config\\'" . gitconfig-mode) - ("/git/config\\'" . gitconfig-mode) - ("/\\.gitmodules\\'" . gitconfig-mode))) - -(use-package gitignore-mode - :commands (gitignore-mode) - :mode (("/\\.gitignore\\'" . gitignore-mode) - ("/\\.git/info/exclude\\'" . gitignore-mode) - ("/git/ignore\\'" . gitignore-mode))) - -(use-package gitattributes-mode - :commands (gitattributes-mode) - :mode (("/\\.gitattributes" . gitattributes-mode))) - -(use-package dired-git-info - :disabled - :bind (:map dired-mode-map - (")" . dired-git-info-mode)) - :defer 2) - -(defun git-blame-line () - "Runs `git blame` on the current line and - adds the commit id to the kill ring" - (interactive) - (let* ((line-number (save-excursion - (goto-char (point-at-bol)) - (+ 1 (count-lines 1 (point))))) - (line-arg (format "%d,%d" line-number line-number)) - (commit-buf (generate-new-buffer "*git-blame-line-commit*"))) - (call-process "git" nil commit-buf nil - "blame" (buffer-file-name) "-L" line-arg) - (let* ((commit-id (with-current-buffer commit-buf - (buffer-substring 1 9))) - (log-buf (generate-new-buffer "*git-blame-line-log*"))) - (kill-new commit-id) - (call-process "git" nil log-buf nil - "log" "-1" "--pretty=%h %an %s" commit-id) - (with-current-buffer log-buf - (message "Line %d: %s" line-number (buffer-string))) - (kill-buffer log-buf)) - (kill-buffer commit-buf))) - -(use-package git-gutter - :hook (prog-mode . git-gutter-mode) - :config - (setq git-gutter:update-interval 0.2)) - -(use-package git-gutter-fringe - :config - (define-fringe-bitmap 'git-gutter-fr:added [224] nil nil '(center repeated)) - (define-fringe-bitmap 'git-gutter-fr:modified [224] nil nil '(center repeated)) - (define-fringe-bitmap 'git-gutter-fr:deleted [128 192 224 240] nil nil 'bottom)) - -(provide 'config-vcs) -;;; config-vcs.el ends here diff --git a/tools/emacs/old-config/config-web.el b/tools/emacs/old-config/config-web.el @@ -1,87 +0,0 @@ -;;; config-web.el --- -*- lexical-binding: t; -*- -;;; Commentary: -;;; Web related configuration, notably the built-in web browser. -;;; Code: - -(use-package shr - :config - (setq shr-use-fonts nil) - (setq shr-use-colors nil) - (setq shr-bullet "• ") - (setq shr-folding-mode t) - - (setq shr-max-image-proportion 0.7) - (setq shr-image-animate nil) - (setq shr-width (current-fill-column))) - -(use-package shr-tag-pre-highlight - :after shr - :config - (add-to-list 'shr-external-rendering-functions - '(pre . shr-tag-pre-highlight)) - (when (version< emacs-version "26") - (with-eval-after-load 'eww - (advice-add 'eww-display-html :around - 'eww-display-html--override-shr-external-rendering-functions)))) - -(use-package eww - :commands (eww - eww-browse-url - eww-search-words - eww-open-in-new-buffer - eww-open-file - vde/eww-visit-history) - :config - (setq eww-restore-desktop nil) - (setq eww-desktop-remove-duplicates t) - (setq eww-header-line-format "%u") - (setq eww-search-prefix "https://duckduckgo.com/html/?q=") - (setq url-privacy-level '(email agent cookies lastloc)) - (setq eww-download-directory "~/desktop/downloads/") - (setq eww-suggest-uris - '(eww-links-at-point - thing-at-point-url-at-point)) - (setq eww-bookmarks-directory "~/.emacs.d/eww-bookmarks/") - (setq eww-history-limit 150) - (setq eww-use-external-browser-for-content-type - "\\`\\(video/\\|audio/\\|application/pdf\\)") - (setq eww-browse-url-new-window-is-tab nil) - (setq eww-form-checkbox-selected-symbol "[X]") - (setq eww-form-checkbox-symbol "[ ]") - - ;; eww-view-source - - (defvar vde/eww-mode-global-map - (let ((map (make-sparse-keymap))) - (define-key map "s" 'eww-search-words) - (define-key map "o" 'eww-open-in-new-buffer) - (define-key map "f" 'eww-open-file) - map) - "Key map to scope `eww' bindings for global usage. -The idea is to bind this to a prefix sequence, so that its -defined keys follow the pattern of <PREFIX> <KEY>.") - :bind-keymap ("C-x w" . vde/eww-mode-global-map) - :bind (:map eww-mode-map - ("n" . next-line) - ("p" . previous-line) - ("f" . forward-char) - ("b" . backward-char) - ("B" . eww-back-url) - ("N" . eww-next-url) - ("P" . eww-previous-url))) - -(use-package browse-url - :after eww - :config - (setq browse-url-generic-program "google-chrome-stable") - (setq browse-url-handlers '(("^https://gitlab.com.*" . browse-url-firefox) - ("^https://github.com.*" . browse-url-generic) - ("^https://issues.redhat.com.*" . browse-url-generic) - ("^https://.*redhat.com.*" . browse-url-generic) - ("^https://docs.jboss.org.*" . browse-url-generic) - (".*" . eww-browse-url))) - (setq browse-url-browser-function #'eww-browse-url) - ) - -(provide 'config-web) -;;; config-web.el ends here diff --git a/tools/emacs/old-config/config-windows.el b/tools/emacs/old-config/config-windows.el @@ -1,61 +0,0 @@ -;;; config-windows.el --- -*- lexical-binding: t; -*- -;; Commentary: -;;; Windows configuration -;; Code: - -(setq switch-to-buffer-obey-display-actions t) - -;; Winner -(use-package winner - :unless noninteractive - :defer 5 - :config - (winner-mode 1)) -;; -UseWinner - -;; UseAceWindow -(use-package ace-window - :unless noninteractive - :commands (ace-window ace-swap-window) - :bind (("C-x o" . ace-window) - ("C-c w w" . ace-window) - ("C-c w s" . ace-swap-window)) - :config - (setq-default aw-keys '(?a ?u ?i ?e ?, ?c ?t ?r ?m) - aw-scope 'frame - aw-dispatch-always t - aw-dispatch-alist - '((?s aw-swap-window "Swap Windows") - (?2 aw-split-window-vert "Split Window Vertically") - (?3 aw-split-window-horz "Split Window Horizontally") - (?? aw-show-dispatch-help)) - aw-minibuffer-flag t - aw-ignore-current nil - aw-display-mode-overlay t - aw-background t)) -;; -UseAceWindow - -;; UseWindmove -(use-package windmove - :unless noninteractive - :commands (windmove-left windmove-right windmove-down windmove-up) - :bind (("C-M-<up>" . windmove-up) - ("C-M-<right>" . windmove-right) - ("C-M-<down>" . windmove-down) - ("C-M-<left>" . windmove-left))) -;; -UseWindmove - -;; UseWindow -(use-package window - :unless noninteractive - :commands (shrink-window-horizontally shrink-window enlarge-window-horizontally enlarge-window) - :bind (("S-C-<left>" . shrink-window-horizontally) - ("S-C-<right>" . enlarge-window-horizontally) - ("S-C-<down>" . shrink-window) - ("S-C-<up>" . enlarge-window))) -;; -UseWindow - -;; TODO: Move display-buffer-alist here - -(provide 'config-windows) -;;; config-windows ends here diff --git a/tools/emacs/old-config/programming-config.el b/tools/emacs/old-config/programming-config.el @@ -1,18 +0,0 @@ -;;; programming-config.el --- -*- lexical-binding: t -*- -;;; Commentary: -;;; Configuration files mode configuration -;;; Code: - -(use-package yaml-mode - :mode "\\.ya?ml\\'" - :hook ((yaml-mode . highlight-indentation-mode) - (yaml-mode . highlight-indentation-current-column-mode))) - -(use-package conf-mode - :mode ("\\.to?ml\\'" . conf-toml-mode)) - -(use-package adoc-mode - :mode ("\\.adoc\\'" . conf-toml-mode)) - -(provide 'programming-config) -;;; programming-config.el ends here diff --git a/tools/emacs/old-config/programming-containers.el b/tools/emacs/old-config/programming-containers.el @@ -1,31 +0,0 @@ -;;; programming-containers.el --- -*- lexical-binding: t; -*- -;;; Commentary: -;;; Containers configuration -;;; Code: -(use-package dockerfile-mode - :mode ("Dockerfile\\'" . dockerfile-mode)) - -;; I have a bunch of different 'profiles' for kubernetes by different cluster so -;; i don't mess between things -;; This allow me to set the KUBECONFIG variable between those easily -;; TODO: add the current profile in modeline -(defun my-switch-kubeconfig-env (&optional kubeconfig) - "Set KUBECONFIG environment variable for the current session" - (interactive - (list - (completing-read - "Kubeconfig: " - (mapcar - (lambda (x) - (replace-regexp-in-string - "^config\." "" - (file-name-nondirectory(directory-file-name x)))) - (directory-files-recursively - (expand-file-name "~/.kube") "^config\.")) nil t ))) - (setq kubeconfig (expand-file-name (format "~/.kube/config.%s" kubeconfig))) - (if (file-exists-p kubeconfig) - (setenv "KUBECONFIG" kubeconfig) - (error "Cannot find kubeconfig: %s" kubeconfig))) - -(provide 'programming-containers) -;;; programming-containers.el ends here diff --git a/tools/emacs/old-config/programming-cue.el b/tools/emacs/old-config/programming-cue.el @@ -1,9 +0,0 @@ -;;; programming-cue.el --- -*- lexical-binding: t; -*- -;;; Commentary: -;;; Cue "data" language configuration -;;; Code: -(use-package cue-mode - :commands (cue-mode) - :mode "\\.cue$") - -(provide 'programming-cue) diff --git a/tools/emacs/old-config/programming-elisp.el b/tools/emacs/old-config/programming-elisp.el @@ -1,7 +0,0 @@ -;;; programming-elisp.el --- -*- lexical-binding: t -*- -;;; Commentary: -;;; Emacs Lisp configurations -;;; Code: - -(provide 'programming-elisp) -;;; programming-elisp.el ends here diff --git a/tools/emacs/old-config/programming-go.el b/tools/emacs/old-config/programming-go.el @@ -1,33 +0,0 @@ -;;; programming-go.el --- -*- lexical-binding: t; -*- -;;; Commentary: -;;; Go programming language configuration -;;; Code: -;; (use-package go-mode -;; :commands (go-mode) -;; :mode "\\.go$" -;; :interpreter "go" -;; :config -;; ;(setq gofmt-command "goimports") -;; (if (not (executable-find "goimports")) -;; (warn "go-mode: couldn't find goimports; no code formatting/fixed imports on save") -;; (add-hook 'before-save-hook 'gofmt-before-save)) -;; (if (not (string-match "go" compile-command)) ; set compile command default -;; (set (make-local-variable 'compile-command) -;; "go build -v && go test -v && go vet"))) -;; -;; (use-package gotest -;; :after go-mode) -;; -;; (use-package gotest-ui -;; :commands (gotest-ui-current-test gotest-ui-current-file gotest-ui-current-project) -;; :after (go-mode gotest) -;; :bind (:map go-mode-map -;; ("C-c t t" . gotest-ui-current-test) -;; ("C-c t f" . gotest-ui-current-file) -;; ("C-c t p" . gotest-ui-current-project))) -;; -;; (use-package go-stacktracer -;; :commands (go-stacktracer-region)) - -(provide 'programming-go) -;;; programming-go.el ends here diff --git a/tools/emacs/old-config/programming-lsp.el b/tools/emacs/old-config/programming-lsp.el @@ -1,44 +0,0 @@ -;;; programming-lsp.el --- -*- lexical-binding: t; -*- -;;; Commentary: -;;; LSP configuration -;;; Code: -;; (use-package lsp-mode -;; :commands (lsp lsp-deferred) -;; :hook ((python-mode . lsp) -;; (go-mode . lsp)) -;; :init -;; (setq lsp-keymap-prefix "C-c l") -;; :config -;; ;; (add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\vendor\\'") -;; :custom -;; ;; turn this on to capture client/server comms before -;; ;; submitting bug reports with `lsp-workspace-show-log` -;; (lsp-enable-file-watchers nil) -;; (lsp-completion-provider :none) -;; (lsp-log-io nil) -;; ;; (lsp-lens-enable t) -;; (lsp-eldoc-enable-hover t) -;; ;; (lsp-enable-indentation nil) -;; (lsp-prefer-flymake t) -;; (lsp-ui-sideline-enable nil) -;; (lsp-ui-doc-enable nil) -;; (lsp-ui-imenu-enable t) -;; (lsp-ui-sideline-ignore-duplicate t) -;; (lsp-enable-folding t) -;; (lsp-enable-dap-auto-configure nil) ; Don't try to auto-enable dap: this creates a lot of binding clashes -;; (lsp-headerline-breadcrumb-enable nil) -;; (lsp-modeline-code-actions-enable nil) -;; (lsp-modeline-diagnostics-enable nil) -;; (lsp-idle-delay .01) -;; (lsp-keymap-prefix nil) -;; (lsp-eldoc-render-all nil) -;; (lsp-file-watch-threshold 4000) -;; (lsp-gopls-complete-unimported t t) -;; (lsp-yaml-format-enable t) -;; (lsp-gopls-staticcheck t t)) -;; -;; (use-package consult-lsp -;; :after (lsp)) - -(provide 'programming-lsp) -;;; programming-lsp.el ends here diff --git a/tools/emacs/old-config/programming-nix.el b/tools/emacs/old-config/programming-nix.el @@ -1,27 +0,0 @@ -;;; programming-nix.el --- -*- lexical-binding: t; -*- -;;; Commentary: -;;; Nix configuration -;;; Code: -(use-package nix-mode - :if *nix* - :after (lsp) - :mode ("\\.nix\\'" "\\.nix.in\\'")) - -(use-package nix-drv-mode - :if *nix* - :after nix-mode - :mode "\\.drv\\'") - -(use-package nix-shell - :if *nix* - :after nix-mode - :commands (nix-shell-unpack nix-shell-configure nix-shell-build)) - -(use-package nixpkgs-fmt - :if *nix* - :after nix-mode - :config - (add-hook 'nix-mode-hook 'nixpkgs-fmt-on-save-mode)) - -(provide 'programming-nix) -;;; programming-nix.el ends here diff --git a/tools/emacs/old-config/programming-web.el b/tools/emacs/old-config/programming-web.el @@ -1,41 +0,0 @@ -;;; programming-web.el --- -*- lexical-binding: t -*- -;;; Commentary: -;;; Programming the Web related configuration -;;; Code: - -(use-package web-mode - :commands (web-mode) - :mode - ("\\.html\\'" . web-mode) - ("\\.phtml\\'" . web-mode) - ("\\.[agj]sp\\'" . web-mode) - ("\\.as[cp]x\\'" . web-mode) - ("\\.erb\\'" . web-mode) - ("\\.mustache\\'" . web-mode) - ("\\.djhtml\\'" . web-mode) - ("\\.jsp\\'" . web-mode) - ("\\.eex\\'" . web-mode) - ("\\.tsx\\'" . web-mode) - :config - (setq web-mode-attr-indent-offset 2) - (setq web-mode-code-indent-offset 2) - (setq web-mode-css-indent-offset 2) - (setq web-mode-indent-style 2) - (setq web-mode-markup-indent-offset 2) - (setq web-mode-sql-indent-offset 2) - (eval-after-load 'smartparens - (lambda () - (setq web-mode-enable-auto-pairing nil) - (sp-with-modes '(web-mode) - (sp-local-pair "%" "%" - :unless '(sp-in-string-p) - :post-handlers '(((lambda (&rest _ignored) - (just-one-space) - (save-excursion (insert " "))) - "SPC" "=" "#"))) - (sp-local-tag "%" "<% " " %>") - (sp-local-tag "=" "<%= " " %>") - (sp-local-tag "#" "<%# " " %>"))))) - -(provide 'programming-web) -;;; programming-web.el ends here diff --git a/tools/emacs/old-config/setup-style.el b/tools/emacs/old-config/setup-style.el @@ -1,44 +0,0 @@ -;;; setup-style.el --- -*- lexical-binding: t -*- -;;; Commentary: -;;; Setup of the style, from font faces to themes -;;; Code: - -(when nil - (progn - ;;; Interface - (use-package frame ; Frames - :bind ("C-c w f" . toggle-frame-fullscreen) - :init - ;; Kill `suspend-frame' - (unbind-key "C-x C-z") - :config (add-to-list 'initial-frame-alist '(fullscreen . maximized))) - - ;; Show buffer position percentage starting from top - - (use-package highlight-numbers - :hook (prog-mode . highlight-numbers-mode)) - - (use-package symbol-overlay - :defer 4 - :bind - ("M-s h ." . symbol-overlay-put) - ("M-s h n" . symbol-overlay-jump-next) - ("M-s h p" . symbol-overlay-jump-prev) - :hook (prog-mode . symbol-overlay-mode) - :config - (setq symbol-overlay-idle-time 0.2)) - - (use-package rainbow-delimiters - :hook (prog-mode . rainbow-delimiters-mode)) - - (use-package rainbow-mode - :commands rainbow-mode - :hook (prog-mode . rainbow-mode)) - - (use-package visual-fill-column - :commands visual-fill-column-mode) - ) - ) - -(provide 'setup-style) -;;; setup-style.el ends here diff --git a/tools/emacs/old-config/writing.el b/tools/emacs/old-config/writing.el @@ -1,30 +0,0 @@ -;;; writing.el --- -*- lexical-binding: t -*- -;;; Commentary: -;;; Writing modes configuration -;;; Code: - -(use-package markdown-mode - :mode ("\\.md\\'" . markdown-mode) - :config - (setq markdown-fontify-code-blocks-natively t) - - ;; Don't change font in code blocks - (set-face-attribute 'markdown-code-face nil - :inherit nil) - - ;; Process Markdown with Pandoc, using a custom stylesheet for nice output - (let ((stylesheet (expand-file-name - (locate-user-emacs-file "etc/pandoc.css")))) - (setq markdown-command - (mapconcat #'shell-quote-argument - `("pandoc" "--toc" "--section-divs" - "--css" ,(concat "file://" stylesheet) - "--standalone" "-f" "markdown" "-t" "html5") - " "))) - (add-hook 'markdown-mode-hook #'auto-fill-mode)) - -(use-package adoc-mode - :mode ("\\.adoc\\'" . adoc-mode)) - -(provide 'writing) -;;; writing.el ends here