This commit is contained in:
fz0x1 2024-12-14 22:33:46 +01:00
parent 8cff3739ad
commit c0e73aa4cf

View file

@ -68,7 +68,7 @@ This function should only modify configuration layer settings."
;; `dotspacemacs/user-config'. To use a local version of a package, use the
;; `:location' property: '(your-package :location "~/path/to/your-package/")
;; Also include the dependencies as they will not be resolved automatically.
dotspacemacs-additional-packages '(org-roam helm-org)
dotspacemacs-additional-packages '()
;; A list of packages that cannot be updated.
dotspacemacs-frozen-packages '()
@ -618,34 +618,6 @@ before packages are loaded."
(concat
(mapcar #'(lambda (c) (if (equal c ?\[) ?\( (if (equal c ?\]) ?\) c))) string-to-transform)))
;; (use-package org-roam-bibtex
;; :after org-roam
;; :config
;; (require 'org-ref)
;; (setq orb-note-actions-interface 'default)
;; (setq bibtex-completion-bibliography '("~/My Library.bib"))
;; (setq orb-preformat-keywords
;; '("title" "author" "year" "keywords"))
;; )
;; (with-eval-after-load 'ox-latex
;; ;; Подключение пакетов для Unicode
;; (add-to-list 'org-latex-packages-alist '("" "fontspec"))
;; (add-to-list 'org-latex-packages-alist '("" "polyglossia"))
;; ;; Установка классов документов
;; (setq org-latex-classes
;; '(("article"
;; "\\documentclass[11pt]{article}
;; \\usepackage{fontspec}
;; \\setmainfont{Times New Roman}
;; \\newfontfamily\\cyrillicfont{Times New Roman}
;; \\usepackage{polyglossia}
;; \\setdefaultlanguage{russian}
;; \\setotherlanguage{english}"
;; ("\\section{%s}" . "\\section*{%s}")
;; ("\\subsection{%s}" . "\\subsection*{%s}")
;; ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))))
(defun get-current-layout ()
"Получить текущую раскладку клавиатуры для текущего окна с помощью xkb-switch."
(string-trim (shell-command-to-string "xkb-switch")))
@ -668,6 +640,41 @@ before packages are loaded."
(with-eval-after-load 'org
(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)
@ -702,6 +709,10 @@ before packages are loaded."
(visual-line-mode 1)))
(setq org-agenda-files '("~/org/grocery.org" "~/org/todos.org" "~/org/inbox.org"))
(setq org-agenda-files
(append org-agenda-files
(directory-files-recursively "~/org/braindump/" "\\.org$")))
(use-package org-roam
:ensure nil
:custom
@ -726,25 +737,18 @@ before packages are loaded."
;; today capture
(spacemacs/set-leader-keys
;; "aow" #'my/org-refile-or-create-file
"aorR" 'my-org-roam-refile
"aordN" 'org-roam-dailies-capture-today)
(use-package org-roam-dailies
:after org-roam
:ensure nil
:custom
(org-roam-dailies-directory "journal/")
:config
(setq org-roam-dailies-capture-templates
'(("d" "default" entry "* %<%I:%M %p>: %?"
:if-new (file+head "daily/%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n")))))
;; (setq org-latex-pdf-process
;; '("xelatex -interaction nonstopmode -output-directory %o %f"
;; "biber %b"
;; "xelatex -interaction nonstopmode -output-directory %o %f"
;; "xelatex -interaction nonstopmode -output-directory %o %f"))
;; (use-package org-roam-dailies
;; :after org-roam
;; :ensure nil
;; :custom
;; (org-roam-dailies-directory "journal/")
;; :config
;; (setq org-roam-dailies-capture-templates
;; '(("d" "default" entry "* %<%I:%M %p>: %?"
;; :if-new (file+head "daily/%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n")))))
(defun my/org-capture-close-frame-for-specific-templates ()
"Close the capture window only for specific templates."
@ -761,10 +765,16 @@ before packages are loaded."
"* %?"
:empty-lines 0)
("i" "Inbox"
entry (file+headline "~/org/inbox.org" "Inbox")
"* [%<%Y-%m-%d>] %U %? :inbox: \n %:annotation\n %:link"
:empty-lines 0)
;; ("i" "Inbox"
;; entry (file+headline "~/org/inbox.org" "Inbox")
;; "* [%<%Y-%m-%d>] %U %? :inbox: \n %:annotation\n %:link"
;; :empty-lines 0)
("d" "Braindump"
entry
(function my/get-location)
"* [%<%Y-%m-%d>] %? \n:PROPERTIES:\n:ID: %(org-id-new)\n:END:\n"
:empty-lines 1)
("r" "Grocery list"
entry (file+headline "~/org/grocery.org" "Grocery list")
@ -789,15 +799,16 @@ before packages are loaded."
"* TODO [#C] %?\n:PROPERTIES:\n:Created: %T\n:END:\n%i\nProposed Solution:\n"
:empty-lines 0)
("w" "Selected web capture"
entry (file+headline "~/org/inbox.org" "Selected web capture")
"* [%<%Y-%m-%d>] %^{Title} :inbox:\nSource: %u, %:link\n #+BEGIN_QUOTE\n%i\n#+END_QUOTE\n\n\n%?"
entry
(function my/get-location)
"* [%<%Y-%m-%d>] %^{Title}\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 (file+headline "~/org/inbox.org" "Web links")
"* [%<%Y-%m-%d>] %(transform-square-brackets-to-round-ones \"%:description\")%? :inbox:\n- %:link\n"
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"
:empty-lines 1)))
(setq org-todo-keywords