2024-05-13    2024-05-13    395 字  1 分钟

logseq 使用笔记 logseq

安装

  • macos
1
brew install logseq

logseqemacs 一起工作

在 logseq 中使用 emacs 编辑文件 emacslogseq

需要使用插件ksqsf/logseq-open-in-emacs , 直接在 logseq 中插件管理下搜索 “emacs” 就可以看到

  • emacs 下的配置
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
(use-package org-protocol
  :ensure org
  :config
  (add-to-list 'org-protocol-protocol-alist
               '("org-find-file" :protocol "find-file" :function org-protocol-find-file :kill-client nil))

  (defun org-protocol-find-file-fix-wsl-path (path)
    "If inside WSL, change Windows-style paths to WSL-style paths."
    (if (not (string-match-p "-[Mm]icrosoft" operating-system-release))
        path
      (save-match-data
        (if (/= 0 (string-match "^\\([a-zA-Z]\\):\\(/.*\\)" path))
            path
          (let ((volume (match-string-no-properties 1 path))
                (abspath (match-string-no-properties 2 path)))
            (format "/mnt/%s%s" (downcase volume) abspath))))))

  (defun org-protocol-find-file (fname)
    "Process org-protocol://find-file?path= style URL."
    (let* ((parsed (org-protocol-parse-parameters fname nil '(:path :anchor)))
           (f (plist-get parsed :path))
           (anchor (plist-get parsed :anchor))
           (anchor-re (and anchor (concat "\\(-\\|\\*\\) " (regexp-quote anchor)))))
      (find-file (org-protocol-find-file-fix-wsl-path f))
      (raise-frame)
      (select-frame-set-input-focus (selected-frame))
      (unhighlight-regexp t)
      (highlight-regexp anchor-re)
      (when anchor
        (or (re-search-forward anchor-re nil t 1)
            (re-search-backward anchor-re nil t 1))))))
  • 默认快捷按键为 mod+o

logseq 和 org-roam 一起使用 :org-org:logseq:

参考: Taking org-roam everywhere with logseq • Core Dumped

使用 doomemacs 安装方法

1
(package! org-roam-logseq :recipe (:host github :repo "idanov/org-roam-logseq.el"))
  • 一些配置代码
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
(setopt org-roam-directory "logseq文件存放路径"
        org-roam-dailies-directory "journals/"
        org-roam-file-exclude-regexp "\\.st[^/]*\\|logseq/.*$")

;; 其中文件名的格式 %<%Y_%m_%d> 需要对应 logseq 配置中 :journal/page-title-format "yyyy_MM_dd"
;; 其中标题的格式 #+title: %<%Y-%m-%d> 需要和 logseq 配置中 :journal/file-name-format "yyyy-MM-dd" 对应
(setq org-roam-dailies-capture-templates
      '(("d" "default" entry
         "* %?"
         :target (file+head "%<%Y_%m_%d>.org" "#+tile: %<%Y-%m-%d>\n"))))

(setq org-roam-capture-templates
      `(("d" "default" platin "%?"
         :target (file+head "pages/${slug}.org" "#+title: ${title}\n")
         :unnarrowed t)))