Added org-analyzer

This commit is contained in:
Emmet 2024-08-09 17:10:51 -05:00
parent fa80a8102c
commit 8da5702d9b
5 changed files with 107 additions and 2 deletions

View file

@ -276,7 +276,6 @@
`(org-agenda-date-weekend-today :inherit 'unspecified :foreground ,(nth 1 (nth 15 doom-themes--colors)) :weight bold :height 1.1)
)
(after! org (org-eldoc-load))
(with-eval-after-load 'org (global-org-modern-mode))
@ -691,6 +690,44 @@ If the path from LINK does not exist, nil is returned."
"u" #'crdt-list-users
)
(require 'org-analyzer)
(setq org-analyzer-wrapper-command "org-analyzer")
(setq org-analyzer-jar-file-name "~/.nix-profile/bin/org-analyzer.jar")
(setq org-analyzer-java-program "~/.nix-profile/bin/org-analyzer") ;; Is not actually java, buta wrapper shell script
(defun org-analyzer-start-process (org-dir)
"Start the org analyzer process .
Argument ORG-DIR is where the org-files are located."
(org-analyzer-cleanup-process-state)
(unless (file-exists-p org-dir)
(warn "org-analyzer was started with org-directory set to
\"%s\"\nbut this directory does not exist.
Please set the variable `org-directory' to the location where you keep your org files."
org-directory))
(let* ((name (format " *org-analyzer [org-dir:%s]*" org-dir))
(proc-buffer (generate-new-buffer name))
(proc nil))
(setq org-analyzer-process-buffer proc-buffer)
(with-current-buffer proc-buffer
(setq default-directory (if (file-exists-p org-dir)
org-dir default-directory)
proc (condition-case err
(let ((process-connection-type nil)
(process-environment process-environment))
(start-process name
(current-buffer)
org-analyzer-wrapper-command
"--port"
(format "%d" org-analyzer-http-port)
"--started-from-emacs"
(if (file-exists-p org-dir) org-dir "")))
(error
(concat "Can't start org-analyzer (%s: %s)"
(car err) (cadr err)))))
(set-process-query-on-exit-flag proc nil)
(set-process-filter proc #'org-analyzer-process-filter))
proc-buffer))
;;;------ Org roam configuration ------;;;
(require 'org-roam)
(require 'org-roam-dailies)

View file

@ -58,6 +58,7 @@ in
hledger
hunspell hunspellDicts.en_US-large
(pkgs-emacs.mu.override { emacs = emacs29-pgtk; })
(pkgs.callPackage ./pkgs/org-analyzer.nix {})
emacsPackages.mu4e
isync
msmtp

View file

@ -346,7 +346,6 @@ Doom Emacs is traditionally installed by cloning the repository ([[https://githu
`(org-agenda-date-weekend-today :inherit 'unspecified :foreground ,(nth 1 (nth 15 doom-themes--colors)) :weight bold :height 1.1)
)
(after! org (org-eldoc-load))
(with-eval-after-load 'org (global-org-modern-mode))
@ -824,6 +823,47 @@ exit
"u" #'crdt-list-users
)
#+end_src
*** Org Analyzer
#+begin_src emacs-lisp :tangle config.el
(require 'org-analyzer)
(setq org-analyzer-wrapper-command "org-analyzer")
(setq org-analyzer-jar-file-name "~/.nix-profile/bin/org-analyzer.jar")
(setq org-analyzer-java-program "~/.nix-profile/bin/org-analyzer") ;; Is not actually java, buta wrapper shell script
(defun org-analyzer-start-process (org-dir)
"Start the org analyzer process .
Argument ORG-DIR is where the org-files are located."
(org-analyzer-cleanup-process-state)
(unless (file-exists-p org-dir)
(warn "org-analyzer was started with org-directory set to
\"%s\"\nbut this directory does not exist.
Please set the variable `org-directory' to the location where you keep your org files."
org-directory))
(let* ((name (format " *org-analyzer [org-dir:%s]*" org-dir))
(proc-buffer (generate-new-buffer name))
(proc nil))
(setq org-analyzer-process-buffer proc-buffer)
(with-current-buffer proc-buffer
(setq default-directory (if (file-exists-p org-dir)
org-dir default-directory)
proc (condition-case err
(let ((process-connection-type nil)
(process-environment process-environment))
(start-process name
(current-buffer)
org-analyzer-wrapper-command
"--port"
(format "%d" org-analyzer-http-port)
"--started-from-emacs"
(if (file-exists-p org-dir) org-dir "")))
(error
(concat "Can't start org-analyzer (%s: %s)"
(car err) (cadr err)))))
(set-process-query-on-exit-flag proc nil)
(set-process-filter proc #'org-analyzer-process-filter))
proc-buffer))
#+end_src
** Org Roam Configuration
*** Standard Org Roam Configuration
@ -2083,6 +2123,7 @@ Any git package can be configured for a particular commit or branch:
- =(unpin! pinned-package another-pinned-package)= to get bleeding edge instead of Doom's stability
#+BEGIN_SRC emacs-lisp :tangle packages.el
(package! org-analyzer :pin "0908eea")
(package! embark :pin "0908eea")
(package! dashboard)
(package! direnv)
@ -2183,6 +2224,7 @@ in
hledger
hunspell hunspellDicts.en_US-large
(pkgs-emacs.mu.override { emacs = emacs29-pgtk; })
(pkgs.callPackage ./pkgs/org-analyzer.nix {})
emacsPackages.mu4e
isync
msmtp

View file

@ -1,3 +1,4 @@
(package! org-analyzer :pin "0908eea")
(package! embark :pin "0908eea")
(package! dashboard)
(package! direnv)

View file

@ -0,0 +1,24 @@
{ stdenv, fetchFromGitHub, pkgs, ... }:
let name = "clj-org-analyzer";
version = "1.0.2";
in stdenv.mkDerivation
{
inherit name version;
src = builtins.fetchurl {
url = "https://github.com/rksm/clj-org-analyzer/releases/download/1.0.2/org-analyzer-1.0.2.jar";
sha256 = "sha256:1j5c688yg6f5y6n86rf6vkwd1csn1y4dc716d5bczmyr2sgi9c67";
};
dontUnpack = true;
installPhase = ''
mkdir $out $out/bin;
cp $src $out/bin/org-analyzer.jar;
echo "#!/bin/sh
${pkgs.jdk}/bin/java -jar $out/bin/org-analyzer.jar $@" > $out/bin/org-analyzer
chmod +x $out/bin/org-analyzer.jar
chmod +x $out/bin/org-analyzer
'';
}