refactor org-babel
This commit is contained in:
parent
56c3071d55
commit
201af79a42
1 changed files with 111 additions and 125 deletions
236
init.org
236
init.org
|
@ -258,7 +258,7 @@ metadata and get the version number from the JSON.
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
: v1.2024.6
|
: v1.2025.0
|
||||||
|
|
||||||
* Integration with Environment
|
* Integration with Environment
|
||||||
|
|
||||||
|
@ -408,7 +408,6 @@ up, which a totally different can of worms). A function
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
: [nil 26383 36877 803383 nil elpaca-process-queues nil nil 768000 nil]
|
: [nil 26383 36877 803383 nil elpaca-process-queues nil nil 768000 nil]
|
||||||
|
|
||||||
|
|
||||||
* Editor Features
|
* Editor Features
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
@ -987,51 +986,44 @@ whether to put it under writing, comms or programming as it is equally
|
||||||
/useful(?)/ for either activity. So I promoted it to an Editor feature.
|
/useful(?)/ for either activity. So I promoted it to an Editor feature.
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package llm
|
(use-package llm :ensure t)
|
||||||
:ensure t
|
|
||||||
:commands (llm-chat llm-ask-about llm-ask-line llm-ask-selection make-llm-openai make-llm-gemini)
|
|
||||||
:custom
|
|
||||||
(llm-vertex-gcloud-region "europe-west3")
|
|
||||||
:config
|
|
||||||
(require 'llm-openai)
|
|
||||||
(require 'llm-vertex)
|
|
||||||
)
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
: [nil 26492 6451 233211 nil elpaca-process-queues nil nil 232000 nil]
|
: [nil 26497 15516 337719 nil elpaca-process-queues nil nil 495000 nil]
|
||||||
|
|
||||||
#+RESULTS:g
|
#+RESULTS:g
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package ellama
|
(use-package ellama
|
||||||
:ensure t
|
:ensure t
|
||||||
:requires (llm)
|
:defer t
|
||||||
:commands (ellama-chat ellama-ask-about ellama-ask-line ellama-ask-selection)
|
:requires (llm)
|
||||||
:custom
|
:config
|
||||||
(ellama-language "English")
|
(message "Ellama loaded")
|
||||||
(ellama-sessions-directory (expand-file-name "~/Nextcloud/ellama-sessions"))
|
(keymap-global-set "C-c e" 'ellama-transient-main-menu)
|
||||||
:bind-keymap
|
:custom
|
||||||
("C-c e" . ellama-command-map)
|
(ellama-language "English")
|
||||||
:init
|
(ellama-sessions-directory (expand-file-name "~/Nextcloud/ellama-sessions"))
|
||||||
(setopt ellama-providers
|
(ellama-providers
|
||||||
'(("openai" . (make-llm-openai
|
'(("openai" . (progn
|
||||||
:key (auth-source-pass-get 'secret "snamellit/openai-api-key")
|
(require 'llm-openai)
|
||||||
:chat-model "gpt-4o"))
|
(make-llm-openai
|
||||||
("unifylearn" . (make-llm-vertex
|
:key (auth-source-pass-get 'secret "snamellit/openai-api-key")
|
||||||
:project "com-melexis-prod-unifylearn")))))
|
:chat-model "gpt-4o"))))
|
||||||
|
))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
: [nil 26492 1502 118737 nil elpaca-process-queues nil nil 57000 nil]
|
: [nil 26497 19957 511863 nil elpaca-process-queues nil nil 742000 nil]
|
||||||
|
|
||||||
It seems the *gpt-4o* model provides better responses. I should
|
|
||||||
investigate local models more.
|
It seems the *gpt-4o* model provides better responses.
|
||||||
|
|
||||||
|
I should investigate local models more.
|
||||||
|
|
||||||
*** Use Gemini with ellama
|
*** Use Gemini with ellama
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
This is mostly for those who want to use Google Cloud specifically, most users should use Gemini instead, which is easier to set up.
|
This is mostly for those who want to use Google Cloud specifically, most users should use Gemini instead, which is easier to set up.
|
||||||
|
|
||||||
You can set up with make-llm-vertex, with the following parameters:
|
You can set up with make-llm-vertex, with the following parameters:
|
||||||
|
@ -1057,6 +1049,9 @@ gcloud beta services identity create --service=aiplatform.googleapis.com --proje
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
|
||||||
|
However this is not for the Gemini Code Assistant. It is unclear how
|
||||||
|
to use that backend. Gemini Code Assistant is part of the Google Cloud
|
||||||
|
Tools.
|
||||||
** Dired Configuration
|
** Dired Configuration
|
||||||
Enables an alternative file navigation behavior in Dired, Emacs' directory editor:
|
Enables an alternative file navigation behavior in Dired, Emacs' directory editor:
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
@ -1977,7 +1972,7 @@ Map the keymap consistently to the eglot mappings.
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package copilot
|
(use-package copilot
|
||||||
:ensure (:host github :repo "zerolfx/copilot.el"
|
:ensure (copilot :host github :repo "zerolfx/copilot.el"
|
||||||
:branch "main"
|
:branch "main"
|
||||||
:files ("dist" "*.el"))
|
:files ("dist" "*.el"))
|
||||||
:bind
|
:bind
|
||||||
|
@ -1996,12 +1991,13 @@ Map the keymap consistently to the eglot mappings.
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
: [nil 26482 40231 262145 nil elpaca-process-queues nil nil 167000 nil]
|
: [nil 26500 6758 925534 nil elpaca-process-queues nil nil 360000 nil]
|
||||||
|
|
||||||
*** TODO move scheme configuration to the scheme section
|
*** TODO move scheme configuration to the scheme section
|
||||||
or leave it here but move it to config, whatever makes most sense at
|
or leave it here but move it to config, whatever makes most sense at
|
||||||
the moment.
|
the moment.
|
||||||
|
|
||||||
|
|
||||||
** Gitlab Support
|
** Gitlab Support
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
@ -2044,7 +2040,6 @@ templates to be generated. By default it uses
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Org Mode
|
** Org Mode
|
||||||
|
|
||||||
*** Mixed Pitch Support by Default in Org
|
*** Mixed Pitch Support by Default in Org
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(defun pti-org-mode-config ()
|
(defun pti-org-mode-config ()
|
||||||
|
@ -2068,49 +2063,6 @@ templates to be generated. By default it uses
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
: [nil 26279 36119 854408 nil elpaca-process-queues nil nil 376000 nil]
|
: [nil 26279 36119 854408 nil elpaca-process-queues nil nil 376000 nil]
|
||||||
*** Org Configuration
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(use-package org
|
|
||||||
:ensure nil
|
|
||||||
:custom
|
|
||||||
(org-return-follows-link t)
|
|
||||||
(org-mouse-1-follows-link t)
|
|
||||||
(org-link-descriptive t)
|
|
||||||
(org-agenda-skip-scheduled-if-done t)
|
|
||||||
(org-agenda-skip-deadline-if-done t)
|
|
||||||
(org-hide-emphasis-markers t)
|
|
||||||
|
|
||||||
(line-spacing 0.1)
|
|
||||||
(left-margin-width 2)
|
|
||||||
(right-margin-width 2)
|
|
||||||
|
|
||||||
(org-todo-keywords '((sequence "TODO(t)" "NEXT(n)" "WAITING(w)" "SOMEDAY(s)" "PROJ(p)"
|
|
||||||
"|" "DONE(d)" "CANCELED(c)")))
|
|
||||||
(org-todo-keywords-for-agenda '((sequence "NEXT(n)" "TODO(t)" "WAITING(w)" "SOMEDAY(s)" "PROJ(p)" "|" "DONE(d)" "CANCELED(c)")))
|
|
||||||
(org-agenda-files (list "~/Nextcloud/org/" "~/org/snamellit/" "~/org/customer/" "~/org/personal/"))
|
|
||||||
(org-refile-targets '(
|
|
||||||
(org-agenda-files . (:level . 1))
|
|
||||||
("~/org/personal/bijen.org" . (:level . 1))
|
|
||||||
("~/org/personal/fitness.org" . (:level . 1))
|
|
||||||
))
|
|
||||||
:config
|
|
||||||
;; set files for agenda views
|
|
||||||
(setq +org-capture-todo-file "~/Nextcloud/org/inbox.org"
|
|
||||||
+org-capture-notes-file "~/Nextcloud/org/inbox.org"
|
|
||||||
+org-capture-journal-file "~/Nextcloud/org/journal.org"
|
|
||||||
+org-capture-projects-file "~/Nextcloud/org/projects.org")
|
|
||||||
:hook (
|
|
||||||
(org-mode . pti-org-mode-config)
|
|
||||||
(org-mode . org-indent-mode)
|
|
||||||
|
|
||||||
)
|
|
||||||
:bind (
|
|
||||||
("<leader> o a" . org-agenda)
|
|
||||||
("<leader> o s" . org-store-link)
|
|
||||||
))
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+RESULTS:
|
|
||||||
*** Org Appear
|
*** Org Appear
|
||||||
|
|
||||||
Hide the org markers when point is not on the element being decorated.
|
Hide the org markers when point is not on the element being decorated.
|
||||||
|
@ -2132,30 +2084,23 @@ Hide the org markers when point is not on the element being decorated.
|
||||||
I have a test file which has samples of babel features for easy
|
I have a test file which has samples of babel features for easy
|
||||||
testing in my [[file:~/org/snamellit/testfile.org::*User Journey Graph][org babel test file.]]
|
testing in my [[file:~/org/snamellit/testfile.org::*User Journey Graph][org babel test file.]]
|
||||||
|
|
||||||
**** Support REST calls in Babel Blocks
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
;; enable verb package to do REST calls
|
|
||||||
(use-package verb
|
|
||||||
:ensure t
|
|
||||||
:defer 3
|
|
||||||
:bind
|
|
||||||
(:map org-mode-map
|
|
||||||
("C-c C-r" . verb-command-map)))
|
|
||||||
|
|
||||||
(use-package ob-verb
|
|
||||||
:after verb
|
|
||||||
:defer 3)
|
|
||||||
#+END_SRC
|
|
||||||
**** Support Mermaid Diagrams in Babel Blocks
|
**** Support Mermaid Diagrams in Babel Blocks
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
;; enable mermaid for org-babel
|
;; enable mermaid for org-babel
|
||||||
(use-package ob-mermaid
|
(use-package ob-mermaid
|
||||||
:ensure t
|
:ensure t
|
||||||
:defer 3)
|
:demand t
|
||||||
|
:config
|
||||||
|
(message "configuring ob-mermaid")
|
||||||
|
(org-babel-do-load-languages
|
||||||
|
'org-babel-load-languages
|
||||||
|
(add-to-list 'org-babel-load-languages '(mermaid . t))))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
#+RESULTS:
|
||||||
|
: [nil 26499 60213 709442 nil elpaca-process-queues nil nil 672000 nil]
|
||||||
|
|
||||||
Mermaid needs support of the mermaid-cli which is a node package. It
|
Mermaid needs support of the mermaid-cli which is a node package. It
|
||||||
can be installed with
|
can be installed with
|
||||||
|
|
||||||
|
@ -2205,29 +2150,28 @@ interactive to manually install the latest version if needed.
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
: /home/pti/.config/emacs/plantuml.jar
|
: ~/.config/emacs/plantuml.jar
|
||||||
|
|
||||||
**** Configure Babel Languages
|
**** Configure Babel Languages
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp :tangle no
|
||||||
;; configure babel languages
|
;; configure babel languages
|
||||||
(use-package org-babel
|
(use-package org-babel
|
||||||
:no-require
|
:demand t
|
||||||
:after '(ob-verb ob-mermaid)
|
:custom
|
||||||
:config
|
(org-babel-load-languages '((emacs-lisp . t)
|
||||||
(org-babel-do-load-languages
|
(shell . t)
|
||||||
'org-babel-load-languages
|
(python . t)
|
||||||
'((emacs-lisp . t)
|
(latex . t)
|
||||||
(shell . t)
|
(scheme . t)
|
||||||
(python . t)
|
(plantuml . t)
|
||||||
(latex . t)
|
(dot . t)))
|
||||||
(verb . t)
|
:config
|
||||||
(scheme . t)
|
(message "Configuring org-babel languages")
|
||||||
(plantuml . t)
|
)
|
||||||
(mermaid . t)
|
|
||||||
(dot . t))))
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
|
: [nil 26499 54180 830807 nil elpaca-process-queues nil nil 413000 nil]
|
||||||
|
|
||||||
**** Temporary Patches for Org Babel
|
**** Temporary Patches for Org Babel
|
||||||
|
|
||||||
|
@ -2258,14 +2202,7 @@ interactive to manually install the latest version if needed.
|
||||||
Alternatively I might add a sample after each configured block to keep
|
Alternatively I might add a sample after each configured block to keep
|
||||||
it in the same context. Hmmm.... sounds even better.
|
it in the same context. Hmmm.... sounds even better.
|
||||||
|
|
||||||
|
|
||||||
*** Org Export
|
*** Org Export
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(use-package ox
|
|
||||||
:ensure nil)
|
|
||||||
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
**** Org Export to Markdown
|
**** Org Export to Markdown
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package ox-md
|
(use-package ox-md
|
||||||
|
@ -2391,7 +2328,7 @@ gicrisf has [[https://github.com/gicrisf/ox-zola][created a package]] to export
|
||||||
:after ox)
|
:after ox)
|
||||||
(use-package ox-zola
|
(use-package ox-zola
|
||||||
:ensure (ox-zola :host github :repo "gicrisf/ox-zola" :files (:defaults "*.el" "backend" "stylesheets"))
|
:ensure (ox-zola :host github :repo "gicrisf/ox-zola" :files (:defaults "*.el" "backend" "stylesheets"))
|
||||||
:after ox-hugo
|
:after (ox-hugo)
|
||||||
:config
|
:config
|
||||||
(require 'ox-hugo)
|
(require 'ox-hugo)
|
||||||
:general
|
:general
|
||||||
|
@ -2404,7 +2341,6 @@ It is a wrapper around ~ox-hugo~ to export org files to Zola. It
|
||||||
supports most features of it and directs the user to the [[https://ox-hugo.scripter.co/][the hugo
|
supports most features of it and directs the user to the [[https://ox-hugo.scripter.co/][the hugo
|
||||||
exporter manual.]]
|
exporter manual.]]
|
||||||
|
|
||||||
|
|
||||||
*** Org Capture Customization
|
*** Org Capture Customization
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package org-capture
|
(use-package org-capture
|
||||||
|
@ -2653,7 +2589,6 @@ projects:
|
||||||
- update issues in background when opening the project.
|
- update issues in background when opening the project.
|
||||||
- run custom JQL defined in the project iso globally.
|
- run custom JQL defined in the project iso globally.
|
||||||
|
|
||||||
|
|
||||||
*** Daviwil's Productivity Tools
|
*** Daviwil's Productivity Tools
|
||||||
|
|
||||||
@daviwil has a set of productivity tools which are very useful. I have
|
@daviwil has a set of productivity tools which are very useful. I have
|
||||||
|
@ -2758,7 +2693,58 @@ We can add a list of queries
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
| w | Weekly Review | ((agenda ((org-agenda-overriding-header Completed Tasks) (org-agenda-skip-function (org-agenda-skip-entry-if 'nottodo 'done)) (org-agenda-span 'week))) (agenda ((org-agenda-overriding-header Unfinished Scheduled Tasks) (org-agenda-skip-function (org-agenda-skip-entry-if 'todo 'done)) (org-agenda-span 'week)))) |
|
| w | Weekly Review | ((agenda ((org-agenda-overriding-header Completed Tasks) (org-agenda-skip-function (org-agenda-skip-entry-if 'nottodo 'done)) (org-agenda-span 'week))) (agenda ((org-agenda-overriding-header Unfinished Scheduled Tasks) (org-agenda-skip-function (org-agenda-skip-entry-if 'todo 'done)) (org-agenda-span 'week)))) |
|
||||||
|
|
||||||
|
*** Org Configuration
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package org
|
||||||
|
:ensure nil
|
||||||
|
:demand t
|
||||||
|
:custom
|
||||||
|
(org-return-follows-link t)
|
||||||
|
(org-mouse-1-follows-link t)
|
||||||
|
(org-link-descriptive t)
|
||||||
|
(org-agenda-skip-scheduled-if-done t)
|
||||||
|
(org-agenda-skip-deadline-if-done t)
|
||||||
|
(org-hide-emphasis-markers t)
|
||||||
|
|
||||||
|
(line-spacing 0.1)
|
||||||
|
(left-margin-width 2)
|
||||||
|
(right-margin-width 2)
|
||||||
|
|
||||||
|
(org-todo-keywords '((sequence "TODO(t)" "NEXT(n)" "WAITING(w)" "SOMEDAY(s)" "PROJ(p)"
|
||||||
|
"|" "DONE(d)" "CANCELED(c)")))
|
||||||
|
(org-todo-keywords-for-agenda '((sequence "NEXT(n)" "TODO(t)" "WAITING(w)" "SOMEDAY(s)" "PROJ(p)" "|" "DONE(d)" "CANCELED(c)")))
|
||||||
|
(org-agenda-files (list "~/Nextcloud/org/" "~/org/snamellit/" "~/org/customer/" "~/org/personal/"))
|
||||||
|
(org-refile-targets '(
|
||||||
|
(org-agenda-files . (:level . 1))
|
||||||
|
("~/org/personal/bijen.org" . (:level . 1))
|
||||||
|
("~/org/personal/fitness.org" . (:level . 1))
|
||||||
|
))
|
||||||
|
(org-babel-load-languages '((emacs-lisp . t)
|
||||||
|
(shell . t)
|
||||||
|
(python . t)
|
||||||
|
(latex . t)
|
||||||
|
(scheme . t)
|
||||||
|
(plantuml . t)
|
||||||
|
(dot . t)))
|
||||||
|
:config
|
||||||
|
(message "Configuring org mode")
|
||||||
|
;; set files for agenda views
|
||||||
|
(setq +org-capture-todo-file "~/Nextcloud/org/inbox.org"
|
||||||
|
+org-capture-notes-file "~/Nextcloud/org/inbox.org"
|
||||||
|
+org-capture-journal-file "~/Nextcloud/org/journal.org"
|
||||||
|
+org-capture-projects-file "~/Nextcloud/org/projects.org")
|
||||||
|
(org-babel-do-load-languages 'org-babel-load-languages org-babel-load-languages)
|
||||||
|
:hook (
|
||||||
|
(org-mode . pti-org-mode-config)
|
||||||
|
(org-mode . org-indent-mode)
|
||||||
|
)
|
||||||
|
:bind (
|
||||||
|
("<leader> o a" . org-agenda)
|
||||||
|
("<leader> o s" . org-store-link)
|
||||||
|
))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+RESULTS:
|
||||||
** Denote
|
** Denote
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
|
Loading…
Reference in a new issue