Added org-xournalpp with some config tweaks

This commit is contained in:
Emmet 2024-04-13 19:07:10 -05:00
parent d2052d35b5
commit 58d3d160f5
5 changed files with 92 additions and 0 deletions

View file

@ -837,6 +837,22 @@
"type": "github"
}
},
"org-xournalpp": {
"flake": false,
"locked": {
"lastModified": 1625233179,
"narHash": "sha256-c0AYWMkBb7wdl7SWTffjWSXwXbq1PGov2vT8A1pdqpQ=",
"owner": "vherrmann",
"repo": "org-xournalpp",
"rev": "c09bd8b99d36c355d632b85ecbffb3b275802381",
"type": "gitlab"
},
"original": {
"owner": "vherrmann",
"repo": "org-xournalpp",
"type": "gitlab"
}
},
"org-yaap": {
"flake": false,
"locked": {
@ -936,6 +952,7 @@
"org-side-tree": "org-side-tree",
"org-sliced-images": "org-sliced-images",
"org-timeblock": "org-timeblock",
"org-xournalpp": "org-xournalpp",
"org-yaap": "org-yaap",
"phscroll": "phscroll",
"rust-overlay": "rust-overlay",

View file

@ -218,6 +218,10 @@
url = "github:librephoenix/org-krita";
flake = false;
};
org-xournalpp = {
url = "gitlab:vherrmann/org-xournalpp";
flake = false;
};
org-sliced-images = {
url = "github:jcfk/org-sliced-images";
flake = false;

View file

@ -440,6 +440,37 @@ same directory as the org-buffer and insert a link to this file."
(setq org-krita-extract-filename "preview.png")
(setq org-krita-scale 1)
(add-load-path! "~/.emacs.d/org-xournalpp")
(require 'org-xournalpp)
(add-hook 'org-mode-hook 'org-xournalpp-mode)
(setq org-xournalpp-template-getter
'(closure
(t)
nil
(file-truename "~/Templates/template.xopp") ; use my own template
)
)
;; override width to static 250 for now
;; so I don't have massive images in org mode (scrolling not fun)
(defun org-xournalpp--create-image (link refresh)
"Extract svg/png from given LINK and return image.
Regenerate the cached inline image, if REFRESH is true.
If the path from LINK does not exist, nil is returned."
(let ((width 250)
(xopp-path (f-expand (org-element-property :path link))))
(when (f-exists? xopp-path)
(if width
(create-image (org-xournalpp--get-image xopp-path refresh)
org-xournalpp-image-type
nil
:width width)
(create-image (org-xournalpp--get-image xopp-path refresh)
org-xournalpp-image-type
nil)))))
(defun org-copy-link-to-clipboard-at-point ()
"Copy current link at point into clipboard (useful for images and links)"
;; Remember to press C-g to kill this foreground process if it hangs!

View file

@ -101,6 +101,10 @@ in
source = "${inputs.org-krita}";
};
home.file.".emacs.d/org-xournalpp" = {
source = "${inputs.org-xournalpp}";
};
home.file.".emacs.d/org-sliced-images" = {
source = "${inputs.org-sliced-images}";
};

View file

@ -517,6 +517,38 @@ same directory as the org-buffer and insert a link to this file."
(setq org-krita-extract-filename "preview.png")
(setq org-krita-scale 1)
(add-load-path! "~/.emacs.d/org-xournalpp")
(require 'org-xournalpp)
(add-hook 'org-mode-hook 'org-xournalpp-mode)
(setq org-xournalpp-template-getter
'(closure
(t)
nil
(file-truename "~/Templates/template.xopp") ; use my own template
)
)
;; override width to static 250 for now
;; so I don't have massive images in org mode (scrolling not fun)
(defun org-xournalpp--create-image (link refresh)
"Extract svg/png from given LINK and return image.
Regenerate the cached inline image, if REFRESH is true.
If the path from LINK does not exist, nil is returned."
(let ((width 250)
(xopp-path (f-expand (org-element-property :path link))))
(when (f-exists? xopp-path)
(if width
(create-image (org-xournalpp--get-image xopp-path refresh)
org-xournalpp-image-type
nil
:width width)
(create-image (org-xournalpp--get-image xopp-path refresh)
org-xournalpp-image-type
nil)))))
#+END_SRC
*** Copy Links/Files into Clipboard
#+BEGIN_SRC emacs-lisp :tangle config.el
@ -2089,6 +2121,10 @@ in
source = "${inputs.org-krita}";
};
home.file.".emacs.d/org-xournalpp" = {
source = "${inputs.org-xournalpp}";
};
home.file.".emacs.d/org-sliced-images" = {
source = "${inputs.org-sliced-images}";
};