Edgaras1 / .doom.d

Doom Emacs orgmode config

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doom Emacs config

Constants

(setq doom-theme 'doom-vibrant)

;;Directories
(setq
      org-directory "~/Dropbox/ORG"
      org-agenda-files '("~/Dropbox/ORG") )

Custom menu bar entries

https://www.gnu.org/software/emacs/manual/html_node/elisp/Menu-Bar.html Adds entries left side, use define-key-after to put at the back

;;(menu-bar-mode t) ;;-1/t enable/disable top menu
;;(define-key global-map [menu-bar words]
;;  (cons "Words" (make-sparse-keymap "Words")))

;; Define specific subcommands in this menu.
;;(define-key global-map
;;  [menu-bar words forward]
;;  '("Forward word" . forward-word))

;;(define-key global-map
;;  [menu-bar words backward]
;;  '("Backward word" . backward-word))

;;Surpress/hide/remove existing menu item. this example removes 'Edit'
;;(define-key global-map [menu-bar edit] 'undefined)

Custom tool bar entries

https://www.gnu.org/software/emacs/manual/html_node/elisp/Tool-Bar.html

(tool-bar-mode -1)

(defun org-agenda-show-custom (&optional arg)
  (interactive "P")
  (org-agenda arg "g"))

(tool-bar-add-item "spell" 'org-agenda-show-custom
                'Agenda
                :help    "Show agenda")

(tool-bar-add-item "spell" 'org-toggle-narrow-to-subtree
                'un-narrow
                :help    "(Un)Narrow to subtree")


(tool-bar-add-item "spell" 'org-pomodoro
                'Pomodoro
                :help    "Start stop pomodoro")

(setq tool-bar-button-margin 0) ;;set margin of toolbar

Misc Utilities / Keybinds

(defun tangle-and-reload ()
  "Run `org-babel-tangle` and `doom/reload' in sequence."
  (interactive)
  (org-babel-tangle)
  (doom/reload))

(global-set-key (kbd "C-c t r") 'tangle-and-reload)

;autosave org-buffers
(defun my-org-mode-autosave-settings ()
        (add-hook 'auto-save-hook 'org-save-all-org-buffers nil nil))
        (add-hook 'org-mode-hook 'my-org-mode-autosave-settings)

Org-mode

(after! org
  (define-key global-map (kbd "C-c c") 'org-capture)

  (defun log-todo-next-creation-date (&rest ignore)
    "Log NEXT creation time in the property drawer under the key 'ACTIVATED'"
    (when (and (string= (org-get-todo-state) "NEXT")
               (not (org-entry-get nil "ACTIVATED")))
      (org-entry-put nil "ACTIVATED" (format-time-string "[%Y-%m-%d]"))))
  (add-hook 'org-after-todo-state-change-hook #'log-todo-next-creation-date)


  (defun org-capture-inbox ()
    (interactive)
    (call-interactively 'org-store-link)
    (org-capture nil "i"))
  (define-key global-map (kbd "C-c i") 'org-capture-inbox)

  (setq
        org-hide-block-startup t
        org-agenda-skip-scheduled-if-done t
        org-log-done t
        org-log-into-drawer t
        org-todo-keywords
                '((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
                  (sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)"))

        org-refile-targets '(("projects.org" :regexp . "\\(?:\\(?:Note\\|Task\\)s\\)"))
        org-refile-use-outline-path 'file
        org-outline-path-complete-in-steps nil))

Agenda

(use-package! org-super-agenda
  :after org-agenda
  :config

  (setq org-agenda-hide-tags-regexp "."
        org-agenda-block-separator nil)

  (setq org-agenda-custom-commands
        '(("g" "My agenda"(
                           (agenda "" (
                                       (org-agenda-start-day "1d")
                                       (org-agenda-start-on-weekday nil)
                                       (org-agenda-span 1)                      ;; S%2d:
                                       (org-agenda-scheduled-leaders (quote ("" ""))) ;; replace 'Scheduled:'
                                       (org-super-agenda-groups'(

                                                                 (:name none :deadline t :order 0)
                                                                 (:name none :time-grid t :order 1)

                                                                 (:name "Daily medicine" :and (:scheduled t :tag "medicine") :order 2)
                                                                 (:name "Other" :and (:scheduled t :tag "other") :order 3)
                                                                 (:name "Misc" :order 4 :scheduled t )
                                                                 (:discard (:anything))))
                                       ))
                           (todo "NEXT"
                                 ((org-agenda-skip-function
                                   '(org-agenda-skip-entry-if 'deadline))
                                  (org-agenda-prefix-format "  %i %-12:c [%e] ")
                                  (org-agenda-overriding-header "\nTasks\n")))
                           (tags-todo "inbox"
                                      ((org-agenda-prefix-format "  %?-12t% s")
                                       (org-agenda-overriding-header "\nInbox\n")))
                           (tags "CLOSED>=\"<today>\""
                                 ((org-agenda-overriding-header "\nCompleted today\n")))))))(org-super-agenda-mode))

Packages

(package! org-super-agenda)
(package! org-ql)
(package! org-edna)
(package! org-web-tools)
(package! dashboard)

;Org-Roam-Ui
(unpin! org-roam)
(package! websocket)
(package! org-roam-ui :recipe (:host github :repo "org-roam/org-roam-ui" :files ("*.el" "out")))
(package! orgmdb :recipe (:host github :repo "isamert/orgmdb.el"))

Init

;;; init.el -*- lexical-binding: t; -*-

;; This file controls what Doom modules are enabled and what order they load
;; in. Remember to run 'doom sync' after modifying it!

;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's
;;      documentation. There you'll find a "Module Index" link where you'll find
;;      a comprehensive list of Doom's modules and what flags they support.

;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or
;;      'C-c c k' for non-vim users) to view its documentation. This works on
;;      flags as well (those symbols that start with a plus).
;;
;;      Alternatively, press 'gd' (or 'C-c c d') on a module to browse its
;;      directory (for easy access to its source code).

(doom! :input
       ;;chinese
       ;;japanese
       ;;layout            ; auie,ctsrnm is the superior home row

       :completion
       company           ; the ultimate code completion backend
       ;;helm              ; the *other* search engine for love and life
       ;;ido               ; the other *other* search engine...
       ivy               ; a search engine for love and life

       :ui
       ;;deft              ; notational velocity for Emacs
       doom              ; what makes DOOM look the way it does
       ;;doom-dashboard    ; a nifty splash screen for Emacs
       ;;doom-quit         ; DOOM quit-message prompts when you quit Emacs
       ;;fill-column       ; a `fill-column' indicator
       hl-todo           ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
       ;;hydra
       ;;indent-guides     ; highlighted indent columns
       ligatures         ; ligatures and symbols to make your code pretty again
       ;;minimap           ; show a map of the code on the side
       modeline          ; snazzy, Atom-inspired modeline, plus API
       ;;nav-flash         ; blink cursor line after big motions
       ;;neotree           ; a project drawer, like NERDTree for vim
       ophints           ; highlight the region an operation acts on
       (popup +defaults)   ; tame sudden yet inevitable temporary windows
       ;;tabs              ; a tab bar for Emacs
       ;;treemacs          ; a project drawer, like neotree but cooler
       ;;unicode           ; extended unicode support for various languages
       vc-gutter         ; vcs diff in the fringe
       vi-tilde-fringe   ; fringe tildes to mark beyond EOB
       ;;window-select     ; visually switch windows
       workspaces        ; tab emulation, persistence & separate workspaces
       zen               ; distraction-free coding or writing

       :editor
       (evil +everywhere); come to the dark side, we have cookies
       file-templates    ; auto-snippets for empty files
       fold              ; (nigh) universal code folding
       (format +onsave)  ; automated prettiness
       ;;god               ; run Emacs commands without modifier keys
       ;;lispy             ; vim for lisp, for people who don't like vim
       ;;multiple-cursors  ; editing in many places at once
       ;;objed             ; text object editing for the innocent
       ;;parinfer          ; turn lisp into python, sort of
       ;;rotate-text       ; cycle region at point between text candidates
       snippets          ; my elves. They type so I don't have to
       ;;word-wrap         ; soft wrapping with language-aware indent

       :emacs
       dired             ; making dired pretty [functional]
       electric          ; smarter, keyword-based electric-indent
       ;;ibuffer         ; interactive buffer management
       undo              ; persistent, smarter undo for your inevitable mistakes
       vc                ; version-control and Emacs, sitting in a tree

       :term
       ;;eshell            ; the elisp shell that works everywhere
       ;;shell             ; simple shell REPL for Emacs
       ;;term              ; basic terminal emulator for Emacs
       ;;vterm             ; the best terminal emulation in Emacs

       :checkers
       syntax              ; tasing you for every semicolon you forget
       ;;spell             ; tasing you for misspelling mispelling
       ;;grammar           ; tasing grammar mistake every you make

       :tools
       ;;ansible
       ;;debugger          ; FIXME stepping through code, to help you add bugs
       ;;direnv
       ;;docker
       ;;editorconfig      ; let someone else argue about tabs vs spaces
       ;;ein               ; tame Jupyter notebooks with emacs
       (eval +overlay)     ; run code, run (also, repls)
       ;;gist              ; interacting with github gists
       lookup              ; navigate your code and its documentation
       ;;lsp
       magit             ; a git porcelain for Emacs
       ;;make              ; run make tasks from Emacs
       ;;pass              ; password manager for nerds
       ;;pdf               ; pdf enhancements
       ;;prodigy           ; FIXME managing external services & code builders
       ;;rgb               ; creating color strings
       ;;taskrunner        ; taskrunner for all your projects
       ;;terraform         ; infrastructure as code
       ;;tmux              ; an API for interacting with tmux
       ;;upload            ; map local to remote projects via ssh/ftp

       :os
       (:if IS-MAC macos)  ; improve compatibility with macOS
       ;;tty               ; improve the terminal Emacs experience

       :lang
       ;;agda              ; types of types of types of types...
       ;;cc                ; C/C++/Obj-C madness
       ;;clojure           ; java with a lisp
       ;;common-lisp       ; if you've seen one lisp, you've seen them all
       ;;coq               ; proofs-as-programs
       ;;crystal           ; ruby at the speed of c
       ;;csharp            ; unity, .NET, and mono shenanigans
       ;;data              ; config/data formats
       ;;(dart +flutter)   ; paint ui and not much else
       ;;elixir            ; erlang done right
       ;;elm               ; care for a cup of TEA?
       emacs-lisp        ; drown in parentheses
       ;;erlang            ; an elegant language for a more civilized age
       ;;ess               ; emacs speaks statistics
       ;;faust             ; dsp, but you get to keep your soul
       ;;fsharp            ; ML stands for Microsoft's Language
       ;;fstar             ; (dependent) types and (monadic) effects and Z3
       ;;gdscript          ; the language you waited for
       ;;(go +lsp)         ; the hipster dialect
       ;;(haskell +dante)  ; a language that's lazier than I am
       ;;hy                ; readability of scheme w/ speed of python
       ;;idris             ;
       ;;json              ; At least it ain't XML
       ;;(java +meghanada) ; the poster child for carpal tunnel syndrome
       javascript        ; all(hope(abandon(ye(who(enter(here))))))
       ;;julia             ; a better, faster MATLAB
       ;;kotlin            ; a better, slicker Java(Script)
       ;;latex             ; writing papers in Emacs has never been so fun
       ;;lean
       ;;factor
       ;;ledger            ; an accounting system in Emacs
       ;;lua               ; one-based indices? one-based indices
       markdown          ; writing docs for people to ignore
       ;;nim               ; python + lisp at the speed of c
       nix               ; I hereby declare "nix geht mehr!"
       ;;ocaml             ; an objective camel
       (org +pretty +dragndrop +pomodoro +roam2) ; organize your plain life in plain text
       ;;php               ; perl's insecure younger brother
       ;;plantuml          ; diagrams for confusing people more
       ;;purescript        ; javascript, but functional
       ;;python            ; beautiful is better than ugly
       ;;qt                ; the 'cutest' gui framework ever
       ;;racket            ; a DSL for DSLs
       ;;raku              ; the artist formerly known as perl6
       ;;rest              ; Emacs as a REST client
       ;;rst               ; ReST in peace
       ;;(ruby +rails)     ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
       ;;rust              ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
       ;;scala             ; java, but good
       ;;scheme            ; a fully conniving family of lisps
       sh                ; she sells {ba,z,fi}sh shells on the C xor
       ;;sml
       ;;solidity          ; do you need a blockchain? No.
       ;;swift             ; who asked for emoji variables?
       ;;terra             ; Earth and Moon in alignment for performance.
       web               ; the tubes
       ;;yaml              ; JSON, but readable

       :email
       ;;(mu4e +gmail)
       ;;notmuch
       ;;(wanderlust +gmail)

       :app
       ;;calendar
       ;;irc               ; how neckbeards socialize
       ;;(rss +org)        ; emacs as an RSS reader https://github.com/hlissner/doom-emacs/blob/develop/modules/app/rss/README.org
       ;;twitter           ; twitter client https://twitter.com/vnought
       ;;everywhere  ;edit selected text with emacs (spawns emacs window)  ;On Linux xclip, xdotool, xprop, and xwininfo are needed. call with doom everywhere https://github.com/hlissner/doom-emacs/blob/develop/modules/app/everywhere/README.org

       :config
       ;;literate
       (default +bindings +smartparens))

Pomodoro

 (use-package org-pomodoro
   :config
   (setq org-pomodoro-length 25
         org-pomodoro-short-break-length 5
         org-pomodoro-long-break-length 30
         org-pomodoro-manual-break t
         org-pomodoro-clock-break nil
         org-pomodoro-play-sounds nil
         org-pomodoro-keep-killed-pomodoro-time t)

   (defun ed/toggle-music(action)
       (let ((command (concat "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player." action)))
       (shell-command command)))

   (add-hook 'org-pomodoro-tick-hook
         '(lambda ()
               (shell-command "polybar-msg hook pomodoro_emacs 1" )
          ))

   (add-hook 'org-pomodoro-started-hook
	      (apply-partially #'ed/toggle-music "Play"))

   (add-hook 'org-pomodoro-killed-hook
         '(lambda ()
           (ed/toggle-music "Pause")
            (shell-command "polybar-msg hook pomodoro_emacs 1" )
           ))

   (add-hook 'org-pomodoro-overtime-hook
	      (apply-partially #'ed/toggle-music "Pause"))

   (add-hook 'org-pomodoro-finished-hook
	      (apply-partially #'ed/toggle-music "Pause"))
   )


(defun my/org-pomodoro-time ()
 "Return the remaining pomodoro time"
 (if (org-pomodoro-active-p)
     (cl-case org-pomodoro-state
       (:pomodoro      (format "%d: %s - %s | %%{A1:emacsclient -e '(org-pomodoro-kill)':} Kill %%{A}" org-pomodoro-count (org-pomodoro-format-seconds) (substring-no-properties org-clock-heading) ))
       (:short-break   (format " Short break time: %s" (org-pomodoro-format-seconds)))
       (:long-break    (format " Long break time: %s" (org-pomodoro-format-seconds)))
       (:overtime      (format " Overtime! %s | %%{A1:emacsclient -e '(org-pomodoro-finished)':} Finish %%{A}" (org-pomodoro-format-seconds))))
                       " Get some work done | %{A1:emacsclient -e '(org-pomodoro `(16))':} Resume %{A} "  ))

Org-roam

Org-roam is a plain-text knowledge management system. It brings some of Roam’s more powerful features into the Org-mode ecosystem. Org-roam borrows principles from the Zettelkasten method, providing a solution for non-hierarchical note-taking. It should also work as a plug-and-play solution for anyone already using Org-mode for their personal wiki. https://github.com/org-roam/org-roam/wiki/Hitchhiker’s-Rough-Guide-to-Org-roam-V2
(use-package org-roam
  :ensure t
  :init
  (setq org-roam-v2-ack t)
  :custom
  (org-roam-directory (file-truename "~/Dropbox/ORG/roam"))
  :bind (("C-c n l" . org-roam-buffer-toggle)
         ("C-c n f" . org-roam-node-find)
         ("C-c n g" . org-roam-graph)
         ("C-c n i" . org-roam-node-insert)
         ("C-c n c" . org-roam-capture)
         ;; Dailies
         ("C-c n j" . org-roam-dailies-capture-today))
  :config
  (org-roam-db-autosync-mode)

)

Dashboard

https://github.com/emacs-dashboard/emacs-dashboard

(use-package dashboard
  :ensure t
  :config
  (setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
  (setq dashboard-banner-logo-title "The perils of overwork are slight compared with the dangers of inactivity.")
  (setq dashboard-center-content t)
  (setq dashboard-set-heading-icons t)
  (setq dashboard-set-file-icons t)
  (setq dashboard-set-navigator t)
  (setq dashboard-set-init-info t)

  (dashboard-setup-startup-hook))

Org-Capture

(use-package org-contacts
  :after org
  :custom (org-contacts-files '("~/Dropbox/ORG/Contacts.org")))

(use-package org-capture
  :after org
  :preface
  (defvar my/org-contacts-template "* %(org-contacts-template-name)
        :PROPERTIES:
        :ADDRESS: %^{Street, City, Country}
        :BIRTHDAY: %^{yyyy-mm-dd}
        :EMAIL: %(org-contacts-template-email)
        :NOTE: %^{NOTE}
        :END:" "Template for org-contacts.")

  :custom
  (org-capture-templates
   `(("c" "Contact" entry (file "~/Dropbox/ORG/Contact.org"), my/org-contacts-template :empty-lines 1)
     ("i" "Inbox" entry  (file "~/Dropbox/ORG/inbox.org") ,(concat "* TODO %?\n" "/Entered on/ %U")))
                ))

Org Roam UI

(use-package! websocket
    :after org-roam)

(use-package! org-roam-ui
    :after org-roam ;; or :after org
;;         normally we'd recommend hooking orui after org-roam, but since org-roam does not have
;;         a hookable mode anymore, you're advised to pick something yourself
;;         if you don't care about startup time, use
;;  :hook (after-init . org-roam-ui-mode)
    :config
    (setq org-roam-ui-sync-theme t
          org-roam-ui-follow t
          org-roam-ui-update-on-save t
          org-roam-ui-open-on-start t))

Experimental

;hide markers
(setq org-hide-emphasis-markers t)
;https://github.com/awth13/org-appear

(setq orgmdb-omdb-apikey "36cd72f5")



About

Doom Emacs orgmode config


Languages

Language:Emacs Lisp 100.0%