Skip to content

Instantly share code, notes, and snippets.

View cxa's full-sized avatar
🦥

realazy cxa

🦥
View GitHub Profile
@cxa
cxa / fonts.el
Last active December 1, 2022 06:56
(setq cxa/font-pairs
'((default
:heading (:family "TheFutureFZYouHei" :weight bold :slant normal)
:body (:family "WCaslonZZMC" :height 270)
:code (:family "PitchFZ" :height 200))
(brill
:heading (:family "TheFutureFZYouHei" :weight bold :slant normal)
:body (:family "Brill" :height 270)
:code (:family "PitchSansOPPO" :height 200))
(questa
@cxa
cxa / org-babel-C-execute-filter-args.el
Last active October 3, 2023 12:23
Support `:stdin` for `ob-C` for org-mode
(advice-add 'org-babel-C-execute
:filter-args
(defun sloth/org-babel-C-execute/filter-args (args)
(when-let* ((params (cadr args))
(stdin (cdr (assoc :stdin params)))
(res (org-babel-ref-resolve stdin))
(stdin (org-babel-temp-file "c-stdin-")))
(with-temp-file stdin (insert res))
(let* ((cmdline (assoc :cmdline params))
(cmdline-val (or (cdr cmdline) "")))
@cxa
cxa / org-edit-src-code-before.el
Last active October 4, 2023 07:47
Enable `eglot` for org babel code editor
(require 'eglot) ;; avoid `eglot--lookup-mode' being void
(defun sloth/org-babel-edit-prep (info)
(setq buffer-file-name (or (alist-get :file (caddr info))
"org-src-babel.tmp"))
(eglot-ensure))
(advice-add 'org-edit-src-code
:before (defun sloth/org-edit-src-code/before (&rest args)
(when-let* ((element (org-element-at-point))
@cxa
cxa / orderless.org
Created November 7, 2023 01:04
My orderless config

Orderless

Orderless is a robust improvement to the Emacs completion system, offering high adaptability through the configuration of dispatchers.

Dispatchers

I often utilize the following completion style:

  • For strings that contain ` (regardless of position), treat them as \`regex:
#!/usr/bin/env bash
#shellcheck disable=SC2016
#shellcheck disable=SC2059
DASUNG_SCREEN_WIDTH=900
NOTCH_SCREEN_HEIGHT_1=1169
NOTCH_SCREEN_HEIGHT_2=982
displays_except_dasung=$(yabai -m query --displays | \