Config: add org-ql config, fix coding system of ripgrep

This commit is contained in:
trogloxene
2026-04-08 20:13:04 +08:00
parent f415371331
commit 73692fb225
7 changed files with 67 additions and 21 deletions

View File

@@ -4,12 +4,11 @@
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance. ;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
'(org-agenda-files nil)
'(package-selected-packages '(package-selected-packages
'(ace-window benchmark-init cape cnfonts corfu crux drag-stuff eglot '(ace-window benchmark-init cape cnfonts corfu crux drag-stuff eglot embark-consult everything
embark-consult everything exec-path-form-shell gcmh exec-path-form-shell gcmh hungry-delete marginalia multiple-cursors orderless
hungry-delete marginalia multiple-cursors orderless restart-emacs smart-mode-line solarized-theme vertico))
restart-emacs smart-mode-line solarized-theme vertico)) '(safe-local-variable-values '((org-use-tag-inheritance)))
'(warning-suppress-log-types '((initialization)))) '(warning-suppress-log-types '((initialization))))
(custom-set-faces (custom-set-faces
;; custom-set-faces was added by Custom. ;; custom-set-faces was added by Custom.

View File

@@ -22,8 +22,8 @@
(require 'init-window) (require 'init-window)
(require 'init-dired) (require 'init-dired)
(require 'init-workspace) (require 'init-workspace)
(require 'init-kbd)
(require 'init-ui) (require 'init-ui)
(require 'init-kbd)
(require 'init-segmentation) (require 'init-segmentation)
;;; init.el ends here ;;; init.el ends here

View File

@@ -24,8 +24,13 @@
(setq default-process-coding-system '(utf-8 . utf-8)) (setq default-process-coding-system '(utf-8 . utf-8))
;; 为特定程序设置编码 ;; 为特定程序设置编码
(add-to-list 'process-coding-system-alist '("rg" utf-8 . utf-8)) (if *is-windows*
(add-to-list 'process-coding-system-alist '("ripgrep" utf-8 . utf-8)) (progn
(add-to-list 'process-coding-system-alist '("rg" utf-8 . gbk))
(add-to-list 'process-coding-system-alist '("ripgrep" utf-8 . gbk)))
(progn
(add-to-list 'process-coding-system-alist '("rg" utf-8 . utf-8))
(add-to-list 'process-coding-system-alist '("ripgrep" utf-8 . utf-8))))
(add-to-list 'process-coding-system-alist '("grep" utf-8 . utf-8)) (add-to-list 'process-coding-system-alist '("grep" utf-8 . utf-8))
(add-to-list 'process-coding-system-alist '("find" utf-8 . utf-8)) (add-to-list 'process-coding-system-alist '("find" utf-8 . utf-8))
(add-to-list 'process-coding-system-alist '("fd" utf-8 . utf-8)) (add-to-list 'process-coding-system-alist '("fd" utf-8 . utf-8))

View File

@@ -305,7 +305,18 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
;; heading菜单 ;; heading菜单
(with-eval-after-load 'org (with-eval-after-load 'org
(define-key org-mode-map (kbd "C-c i") 'consult-org-heading)) (define-key org-mode-map (kbd "C-c i") 'consult-org-heading))
;; 用consult检索org-agenda-file标题
(global-set-key (kbd "C-c o s") 'consult-org-agenda)
;; 用ripgrep搜索org-agenda-file
(defun my/org-agenda-rifle (dirs-to-exclude)
"Jump to org agenda files use consult-ripgrep."
(interactive)
(consult-ripgrep org-agenda-files)
(global-set-key (kbd "C-c o g") 'my/org-agenda-rifle)
;; 存储一个链接 ;; 存储一个链接
(global-set-key (kbd "C-c l") 'org-store-link) (global-set-key (kbd "C-c l") 'org-store-link)
@@ -319,6 +330,10 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
'(define-key calendar-mode-map (kbd "j o") 'org-journal-open-entry-for-editing) '(define-key calendar-mode-map (kbd "j o") 'org-journal-open-entry-for-editing)
'(define-key calendar-mode-map (kbd "<RET>") 'org-journal-open-entry-for-editing))) '(define-key calendar-mode-map (kbd "<RET>") 'org-journal-open-entry-for-editing)))
;; org-ql
(global-set-key (kbd "C-c q s") 'org-ql-search)
(global-set-key (kbd "C-c q v") 'org-ql-view)
;; 日记 ;; 日记
(defun org-journal-open-current-journal-file-delete-other-window() (defun org-journal-open-current-journal-file-delete-other-window()
"Call org-journal-open-current-journal-file and delete other window." "Call org-journal-open-current-journal-file and delete other window."

View File

@@ -155,10 +155,9 @@
(global-set-key (kbd "C-c a") 'org-agenda) (global-set-key (kbd "C-c a") 'org-agenda)
(when *is-windows* (when *is-windows*
(with-eval-after-load 'org (setq org-agenda-files '("h:/emacs/hugo/this-is-my-blog/all-blog.org"
(setq org-agenda-files '("h:/emacs/hugo/this-is-my-blog/all-blog.org" "h:/emacs/my-org-daily/"
"h:/emacs/my-org-daily/" "h:/emacs/my-org-note/")))
"h:/emacs/my-org-note/"))))
(when *is-mac* (when *is-mac*
(with-eval-after-load 'org (with-eval-after-load 'org
(setq org-agenda-files '("~/org/my-org-daily")))) (setq org-agenda-files '("~/org/my-org-daily"))))
@@ -173,6 +172,25 @@
;; org-ql ;; org-ql
(use-package org-ql) (use-package org-ql)
(setq org-ql-views
'(("tags: emacs category:note"
:buffers-files org-agenda-files
:query (and (tags "emacs") (category "note"))
:sort date)
("tags: org"
:buffers-files org-agenda-files
:query (tags "org"))
("all important todos"
:buffers-files org-agenda-files
:query (and (not (done)) (todo))
:super-groups
((:name "priority = A" :priority "A")
(:name "priority = B" :priority "B")
(:name "started" :todo "STARTED")
(:name "someday" :todo "SOMEDAY")))))
;; org-super-agenda 配置 ;; org-super-agenda 配置
(use-package org-super-agenda (use-package org-super-agenda
:config :config
@@ -214,6 +232,7 @@
(setq org-tag-alist '( (setq org-tag-alist '(
("scheme" . ?s) ("scheme" . ?s)
("emacs" . ?e) ("emacs" . ?e)
("org" . ?o)
("linux" . ?l) ("linux" . ?l)
("computer-stuff" . ?c) ("computer-stuff" . ?c)
("philosophy" . ?p) ("philosophy" . ?p)
@@ -221,6 +240,8 @@
("gamestudies" . ?G) ("gamestudies" . ?G)
)) ))
;; (setq org-tags-exclude-from-inheritance '())
;; capture模板 ;; capture模板
(when *is-windows* (when *is-windows*
(defvar my-org-capture-temp-title "" "Temporarily store the org-capture filename.") (defvar my-org-capture-temp-title "" "Temporarily store the org-capture filename.")
@@ -233,15 +254,20 @@
(format-time-string "%Y%m%d") (format-time-string "%Y%m%d")
my-org-capture-temp-title)))) my-org-capture-temp-title))))
"#+title: %(symbol-value 'my-org-capture-temp-title) "#+title: %(symbol-value 'my-org-capture-temp-title)
#+created: %U #+date: %U
#+category: %^{Category|none|plan|book|article|note|insight} #+category: %^{Category|none|plan|book|article|note|insight}
#+filetags: %^g
* %(symbol-value 'my-org-capture-temp-title) * %(symbol-value 'my-org-capture-temp-title) %^g
%U
:PROPERTIES: :PROPERTIES:
:END: :END:
%? %?
# Local Variables:
# org-use-tag-inheritance: nil
# End:
" "
:jump-to-captured t)))) :jump-to-captured t))))

View File

@@ -98,10 +98,12 @@
(default-directory "~/")) (default-directory "~/"))
(consult-fd))) (consult-fd)))
(if *is-windows* (when *is-windows*
(progn
(setq consult-locate-args (encode-coding-string "es.exe -i -p -r" 'gbk)) (setq consult-locate-args (encode-coding-string "es.exe -i -p -r" 'gbk))
(add-to-list 'process-coding-system-alist '("es" gbk . gbk)))) (setq consult-ripgrep-args (encode-coding-string
"rg --null --line-buffered --color=never --max-columns=1000 --path-separator / --smart-case --no-heading --line-number"
'gbk))
(add-to-list 'process-coding-system-alist '("es" gbk . gbk)))
(when *is-mac* (when *is-mac*
(setopt consult-locate-args "mdfind -name"))) (setopt consult-locate-args "mdfind -name")))

View File

@@ -18,8 +18,7 @@
(add-to-list 'consult-buffer-sources persp-consult-source)) (add-to-list 'consult-buffer-sources persp-consult-source))
(setq switch-to-prev-buffer-skip (setq switch-to-prev-buffer-skip
(lambda (win buff bury-or-kill) (lambda (win buff bury-or-kill)
(not (persp-is-current-buffer buff)))) (not (persp-is-current-buffer buff)))))
)
(provide 'init-workspace) (provide 'init-workspace)