202412211734803879

This commit is contained in:
fz0x1 2024-12-21 18:57:59 +01:00
parent 55f8c30eab
commit 49797f54ce
5 changed files with 24 additions and 87 deletions

View file

@ -32,17 +32,16 @@
;; There are two ways to load a theme. Both assume the theme is installed and
;; available. You can either set `doom-theme' or manually load a theme with the
;; `load-theme' function. This is the default:
(setq doom-theme 'doom-one)
(setq doom-theme 'doom-one)
;; This determines the style of line numbers in effect. If set to `nil', line
;; numbers are disabled. For relative line numbers, set this to `relative'.
(setq display-line-numbers-type t)
(setq ispell-really-aspell nil)
;; If you use `org' and don't want your org files in the default location below,
;; change `org-directory'. It must be set before org loads!
(setq org-directory "~/org/")
;; (setq org-startup-with-inline-images t)
;; (add-hook 'org-mode-hook 'org-display-inline-images)
(setq ispell-program-name "hunspell")
(setq ispell-dictionary "en_US,ru_RU")
@ -76,68 +75,6 @@
(lambda ()
(set-layout prev-lang))) ;; Восстанавливаем предыдущую раскладку
(defun my/select-or-create-org-file ()
"Предложить пользователю выбрать файл для записи или создать новый."
(let* ((default-dir "~/org/braindump/") ; Укажите ваш каталог для org-файлов
(files (my/get-relative-org-files default-dir)) ; Список файлов с относительными путями
(file (completing-read "Select a file or create a new one: "
files nil nil)))
(unless (string-suffix-p ".org" file)
(setq file (concat file ".org")))
(let* ((full-path (expand-file-name file default-dir))
(dir (file-name-directory full-path))) ; Извлечь путь директории
;; Создаём недостающие директории
(unless (file-directory-p dir)
(make-directory dir t))
;; Создаём файл, если его нет, и добавляем заголовок
(unless (file-exists-p full-path)
(write-region (concat "#+TITLE: " (file-name-sans-extension file) "\n\n")
nil
full-path))
full-path))) ; Возвращает полный путь к выбранному или новому файлу
(defun my/get-relative-org-files (dir)
"Рекурсивно получить список org-файлов с путями, относительно DIR."
(let ((all-files (directory-files-recursively dir "\\.org$")))
(mapcar (lambda (file)
(file-relative-name file dir))
all-files)))
(defun my/get-location ()
"Вернуть точку сохранения записи в выбранный файл."
(let ((file (my/select-or-create-org-file)))
(set-buffer (find-file-noselect file)) ; Открывает файл в фоновом режиме
(goto-char (point-max)) ; Перемещается в конец файла
(list file))) ; Возвращает файл как место записи
(defun my-org-roam-refile ()
"Переместить текущую заметку под заголовок 'Links' в выбранный файл."
(interactive)
(let* ((node (org-roam-node-read nil nil nil 'require-match))
(file (org-roam-node-file node))
(heading "Links")
target-point)
;; Открываем целевой файл и ищем/создаём заголовок "Links"
(save-excursion
(find-file file)
(goto-char (point-min))
;; Ищем заголовок "Links"
(if (re-search-forward (format org-complex-heading-regexp-format heading) nil t)
(setq target-point (point))
;; Если заголовок не найден, создаём его
(goto-char (point-max))
(insert (concat "\n* " heading "\n"))
(setq target-point (point))))
;; Теперь выполняем перемещение
(let ((org-reverse-note-order t)) ;; Перемещать в конец целевого заголовка
(org-refile nil nil (list heading file nil target-point)))))
(setq org-startup-folded t)
(setq auto-save-default nil)
(setq org-attach-method 'cp) ;; copy file to an attachments dir.
(setq org-attach-id-dir "~/org/attachments/")
@ -148,14 +85,14 @@
(add-hook 'org-mode-hook
(lambda ()
(visual-line-mode 1)))
;;
(setq org-agenda-files '("~/org/grocery.org" "~/org/todos.org" "~/org/inbox.org" "~/org/priorities.org"))
(setq org-agenda-files
(append org-agenda-files
(directory-files-recursively "~/org/braindump/" "\\.org$")))
(use-package org-roam
:ensure nil
;; :ensure nil
:custom
(org-roam-directory "~/org/roam/")
(org-roam-capture-templates
@ -167,7 +104,7 @@
'((org-roam-link org-roam-link-current)
:foreground "#e24888" :underline t))
:config
(org-roam-db-autosync-mode)
;; (org-roam-db-autosync-mode)
(setq org-roam-completion-everywhere t)
(setq org-roam-database-connector 'sqlite-builtin)
(setq org-roam-db-node-include-function
@ -175,14 +112,6 @@
(not (member "ATTACH" (org-get-tags)))))
)
(defun my/org-capture-close-frame-for-specific-templates ()
"Close the capture window only for specific templates."
(let ((close-keys '("w" "L"))) ;; Список ключей шаблонов
(when (member (org-capture-get :key) close-keys) ;; Проверка, входит ли ключ в список
(delete-frame))))
(add-hook 'org-capture-after-finalize-hook 'my/org-capture-close-frame-for-specific-templates)
(setq org-capture-templates
'(
("p" "Private"
@ -197,8 +126,8 @@
("d" "Braindump"
entry
(function my/get-location)
"* [%<%Y-%m-%d>] %? \n:PROPERTIES:\n:ID: %(org-id-new)\n:END:\n"
(file+headline "~/org/inbox.org" "Inbox")
"* [%<%Y-%m-%d>] %? :inbox:\n:PROPERTIES:\n:ID: %(org-id-new)\n:END:\n"
:empty-lines 1)
("r" "Grocery list"
@ -226,14 +155,14 @@
("w" "Selected web capture"
entry
(function my/get-location)
"* [%<%Y-%m-%d>] [[%:link][%(transform-square-brackets-to-round-ones \"%:description\")]]\n:PROPERTIES:\n:ID: %(org-id-new)\n:END:\n Source: %:link\n #+BEGIN_QUOTE\n%i\n#+END_QUOTE\n%?"
(file+headline "~/org/inbox.org" "Selected web capture")
"* [%<%Y-%m-%d>] [[%:link][%(transform-square-brackets-to-round-ones \"%:description\")]] :inbox:\n:PROPERTIES:\n:ID: %(org-id-new)\n:END:\n Source: %:link\n #+BEGIN_QUOTE\n%i\n#+END_QUOTE\n%?"
:empty-lines 1)
("L" "Unselected web capture"
entry
(function my/get-location)
"* [%<%Y-%m-%d>] [[%:link][%(transform-square-brackets-to-round-ones \"%:description\")]]\n%?\n:PROPERTIES:\n:ID: %(org-id-new)\n:END:\n"
(file+headline "~/org/inbox.org" "Web links")
"* [%<%Y-%m-%d>] [[%:link][%(transform-square-brackets-to-round-ones \"%:description\")]]\n%? :inbox:\n:PROPERTIES:\n:ID: %(org-id-new)\n:END:\n"
:empty-lines 1)))
(setq org-todo-keywords

View file

@ -14,6 +14,8 @@
;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its
;; directory (for easy access to its source code).
(setq doom-disable-lazy-load t)
(doom! :input
;;bidi ; (tfel ot) thgir etirw uoy gnipleh
;;chinese
@ -49,7 +51,7 @@
(vc-gutter +pretty) ; vcs diff in the fringe
vi-tilde-fringe ; fringe tildes to mark beyond EOB
;;window-select ; visually switch windows
workspaces ; tab emulation, persistence & separate workspaces
;;workspaces ; tab emulation, persistence & separate workspaces
;;zen ; distraction-free coding or writing
:editor
@ -82,7 +84,7 @@
:checkers
syntax ; tasing you for every semicolon you forget
(spell +hunspell +everywhere +flyspell) ; tasing you for misspelling mispelling
(spell +hunspell +everywhere +flyspell) ; tasing you for misspelling misspelling
grammar ; tasing grammar mistake every you make
:tools
@ -152,7 +154,7 @@
;;nim ; python + lisp at the speed of c
;;nix ; I hereby declare "nix geht mehr!"
;;ocaml ; an objective camel
(org +roam2) ; organize your plain life in plain text
(org +roam2 +pretty) ; organize your plain life in plain text
;;php ; perl's insecure younger brother
;;plantuml ; diagrams for confusing people more
;;graphviz ; diagrams for confusing yourself even more

View file

@ -730,7 +730,7 @@ before packages are loaded."
'((org-roam-link org-roam-link-current)
:foreground "#e24888" :underline t))
:config
(org-roam-db-autosync-mode)
;; (org-roam-db-autosync-mode)
(setq org-roam-completion-everywhere t)
(setq org-roam-database-connector 'sqlite-builtin)
(setq org-roam-db-node-include-function

View file

@ -128,6 +128,10 @@ alias scrn="screenshot.sh"
alias rrmm="shred -n 7 -z -u"
## secure deletion files in directory
alias frmm="find . -type f -exec shred -n 7 -z -u {} +"
## doomemacs
alias resmacs="killall emacs &> /dev/null && emacs --daemon &> /dev/null"
alias em="emacsclient -c"
alias relmacs="doom sync"
# bindkeys
## autosuggest

View file

@ -49,6 +49,8 @@ floating_modifier $mod
# start a terminal
bindsym $mod+Return exec --no-startup-id alacritty
# start emacs
bindsym $mod+m exec --no-startup-id emacsclient -a '' -c
# kill focused window
bindsym $mod+Shift+q kill