config/doom: better slugs and wayland clipboard

This commit is contained in:
xeruf 2023-03-13 15:34:44 +01:00
parent 2dbc06047f
commit 3ecc4f89ad
1 changed files with 49 additions and 15 deletions

View File

@ -87,6 +87,7 @@ Version 2019-11-04 2021-02-16"
(with-eval-after-load 'outline (with-eval-after-load 'outline
(add-hook 'ediff-prepare-buffer-hook 'outline-show-all)) (add-hook 'ediff-prepare-buffer-hook 'outline-show-all))
(map! :n (map! :n
;; Buffer-local font resizing ;; Buffer-local font resizing
"M-C-+" 'text-scale-increase "M-C-+" 'text-scale-increase
@ -172,9 +173,35 @@ Version 2019-11-04 2021-02-16"
(setq buffer-file-coding-system 'utf-8) (setq buffer-file-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)) (setq default-buffer-file-coding-system 'utf-8))
;;; Clipboard
;; Checks if the session type is in fact for Wayland.
(if (string= (getenv "XDG_SESSION_TYPE") "wayland")
(progn
;; Clipboard from Terminal in Wayland: https://vernon-grant.com/emacs/tmux-emacs-and-the-system-clipboard-on-wayland/
(setq wl-copy-process nil)
(defun wl-copy (text)
(setq wl-copy-process (make-process :name "wl-copy"
:buffer nil
:command '("wl-copy" "-f" "-n")
:connection-type 'pipe
:noquery t))
(process-send-string wl-copy-process text)
(process-send-eof wl-copy-process))
(defun wl-paste ()
(if (and wl-copy-process (process-live-p wl-copy-process))
nil ; should return nil if we're the current paste owner
(shell-command-to-string "wl-paste -n | tr -d \r")))
(setq interprogram-cut-function 'wl-copy)
(setq interprogram-paste-function 'wl-paste)
)
;; Treat clipboard input as UTF-8 string first; compound text next, etc. ;; Treat clipboard input as UTF-8 string first; compound text next, etc.
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)) (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
(add-hook 'window-setup-hook #'xclip-mode) (add-hook 'window-setup-hook #'xclip-mode)
)
;;; Data Preservation ;;; Data Preservation
@ -262,7 +289,9 @@ Version 2019-11-04 2021-02-16"
:config :config
(defun xf/slugify (string) (downcase (s-replace-regexp "[^[:alnum:][:digit:]]\+" "-" string))) (defun xf/slugify (string)
(downcase (s-replace-regexp "[^[:alnum:][:digit:]]\+" "-"
(s-replace-regexp ".*://\\([^.]+\\)\\..*" "\\1" (substring-no-properties (org-sort-remove-invisible string))))))
; the value does not matter, see https://emacs.stackexchange.com/questions/71774/pass-default-value-to-org-set-property/71777#71777 ; the value does not matter, see https://emacs.stackexchange.com/questions/71774/pass-default-value-to-org-set-property/71777#71777
;(add-to-list 'org-global-properties-fixed '("ID_ALL" . "id")) ;(add-to-list 'org-global-properties-fixed '("ID_ALL" . "id"))
@ -313,6 +342,7 @@ Version 2019-11-04 2021-02-16"
(setq org-priority-faces '((65 . error) (66 . "DarkGoldenRod") (67 . warning) (68 . "bisque") (69 . "grey"))) (setq org-priority-faces '((65 . error) (66 . "DarkGoldenRod") (67 . warning) (68 . "bisque") (69 . "grey")))
(push "PERM(e)" (cdr (car org-todo-keywords))) (push "PERM(e)" (cdr (car org-todo-keywords)))
; #+TODO: IDEA(i!) PROMPT(p!) OUTLINE(o!) DRAFT(t!) | DONE(d!) REVIEWED(r!) ABANDON(a!)
;; Org startup - https://orgmode.org/manual/In_002dbuffer-Settings.html ;; Org startup - https://orgmode.org/manual/In_002dbuffer-Settings.html
(setq org-startup-folded 'show2levels (setq org-startup-folded 'show2levels
@ -527,7 +557,7 @@ Version 2019-11-04 2021-02-16"
) )
(defvar xf/auto-org-roam-db-sync--timer nil) (defvar xf/auto-org-roam-db-sync--timer nil)
(defvar xf/auto-org-roam-db-sync--timer-interval 10) (defvar xf/auto-org-roam-db-sync--timer-interval 40)
(define-minor-mode xf/auto-org-roam-db-sync-mode (define-minor-mode xf/auto-org-roam-db-sync-mode
"Toggle automatic `org-roam-db-sync' when Emacs is idle. "Toggle automatic `org-roam-db-sync' when Emacs is idle.
Reference: `auto-save-visited-mode'" Reference: `auto-save-visited-mode'"
@ -884,16 +914,19 @@ Version 2019-11-04 2021-02-16"
(add-to-list 'auto-mode-alist '("/journal/" . org-mode)) (add-to-list 'auto-mode-alist '("/journal/" . org-mode))
(add-to-list 'auto-mode-alist '("\\.jrnl\\'" . org-mode)) (add-to-list 'auto-mode-alist '("\\.jrnl\\'" . org-mode))
(add-to-list 'auto-mode-alist '("\\.el##" . emacs-lisp-mode)) ;(add-to-list 'auto-mode-alist '("\\.el##" . emacs-lisp-mode))
(add-to-list 'auto-mode-alist `(,(getenv "CONFIG_SHELLS") . sh-mode)) ;(add-to-list 'auto-mode-alist `(,(getenv "CONFIG_SHELLS") . sh-mode))
(add-to-list 'auto-mode-alist `(,(getenv "CONFIG_ZSH") . sh-mode)) ;(add-to-list 'auto-mode-alist `(,(getenv "CONFIG_ZSH") . sh-mode))
(add-to-list 'auto-mode-alist `("\\.local/bin" . sh-mode)) ;(add-to-list 'auto-mode-alist `("\\.local/bin" . sh-mode))
(add-to-list 'auto-mode-alist '("\\.twee\\'" . twee-chapbook-mode)) ;(add-to-list 'auto-mode-alist '("\\.twee\\'" . twee-chapbook-mode))
(add-hook 'twee-chapbook-mode-hook 'twee-mode) ;(add-hook 'twee-chapbook-mode-hook 'twee-mode)
;
;;(add-to-list 'auto-mode-alist `("\\.scss.erb\\'" . scss-mode))
;(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
(add-hook 'pdf-view-mode-hook 'auto-revert-mode)
;(add-to-list 'auto-mode-alist `("\\.scss.erb\\'" . scss-mode))
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
(use-package! web-mode (use-package! web-mode
:mode "\\.html\\'" :mode "\\.html\\'"
:mode "\\.phtml\\'" :mode "\\.phtml\\'"
@ -942,11 +975,12 @@ Version 2019-11-04 2021-02-16"
:init (add-to-list 'vc-handled-backends 'Fossil)) :init (add-to-list 'vc-handled-backends 'Fossil))
(use-package! chordpro-mode (use-package! chordpro-mode
:mode "\\.cho" :mode ("\\.cho\\'" . chordpro-mode)
:config :config
(set-file-template! 'chordpro-mode :mode 'chordpro-mode) ; TODO broken (set-file-template! 'chordpro-mode :mode 'chordpro-mode) ; TODO broken
(define-key chordpro-mode-map (kbd "C-c C-c") 'chordpro-insert-chord) (define-key chordpro-mode-map (kbd "C-c C-c") 'chordpro-insert-chord)
) )
(use-package! lilypond-mode (use-package! lilypond-mode
:mode ("\\.ly\\'" . LilyPond-mode) :mode ("\\.ly\\'" . LilyPond-mode)
:config :config