From 3d2013ce7b933d912291935f3ea59ce2ef42b944 Mon Sep 17 00:00:00 2001 From: Raj Patil Date: Wed, 27 Sep 2023 12:42:10 +0530 Subject: [PATCH 1/2] org-mode basics noted --- Content/20230925114200-org_mode.org | 56 ++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/Content/20230925114200-org_mode.org b/Content/20230925114200-org_mode.org index b472591..e645d1d 100644 --- a/Content/20230925114200-org_mode.org +++ b/Content/20230925114200-org_mode.org @@ -2,7 +2,7 @@ :ID: be1c795a-add6-4122-add5-ead5f45fbab2 :END: #+title: Org-mode -#+filetags: :wip:skills:tools: +#+filetags: :skills:tools: An org-mode manual pass condensing the important shortcuts and custom configurations for quick future reviews. @@ -14,6 +14,8 @@ I refrain from using timestamps in the latter but do so in the former for the or [[id:20230812T200515.697950][Literate programming]] is another powerful concept conveniently realizable via org-mode that is essential for any pedagogical content creator. +I'm covering a pretty minimal subset of all the capabilities of org-mode that I use frequently (exclusive to org-roam) + * Basics Some functionality that I use with high frequency @@ -28,17 +30,18 @@ Some functionality that I use with high frequency my GTD-oriented capture templates are as follows: #+begin_src elisp - (setq org-capture-templates - '(("n" "Next Action" entry (file+headline "f:/personal/GTD/GTD_HQ.org" "NA") - "* TODO %?\n %i\n %a") - ("e" "Event" entry (file+headline "f:/personal/GTD/GTD_HQ.org" "Events") - "* %?\nSCHEDULED: %T\n %i") - ("i" "IN" entry (file+headline "f:/personal/GTD/GTD_HQ.org" "INQ") - "* %?\nEntered on %U\n %i\n %a") - ("c" "consolidate" entry (file+headline "f:/personal/GTD/GTD_HQ.org" "Consolidate") - "* %?\nEntered on %U\n %i\n %a") - ("t" "Tickler" entry (file+headline "f:/personal/GTD/GTD_HQ.org" "Tickler") - "* %?\nDEFER THOUGHT TO: %T\n %i"))) + (let ((base-gtd-path "")) + (setq org-capture-templates + '(("n" "Next Action" entry (file+headline base-gtd-path "NA") + "* TODO %?\n %i\n %a") + ("e" "Event" entry (file+headline base-gtd-path "Events") + "* %?\nSCHEDULED: %T\n %i") + ("i" "IN" entry (file+headline base-gtd-path "INQ") + "* %?\nEntered on %U\n %i\n %a") + ("c" "consolidate" entry (file+headline base-gtd-path "Consolidate") + "* %?\nEntered on %U\n %i\n %a") + ("t" "Tickler" entry (file+headline base-gtd-path "Tickler") + "* %?\nDEFER THOUGHT TO: %T\n %i")))) #+end_src Given the hierarchical structure of org files, folding, narrowing and widening is a staple way to manage your attention when navigating a file. @@ -46,3 +49,32 @@ Given the hierarchical structure of org files, folding, narrowing and widening i Folding a subtree is bound to be toggled by ~~ and a global fold/unfold toggle can be triggered by ~-~. Narrowing is disabled by default to avoid confusion for beginners and can be activated by placing ~(put 'narrow-to-region 'disabled nil)~ in your ~init.el~ + +I use evil emacs and to narrow the buffer to a particular region, simply select region via visual mode (or complete subtree with a ~~ when collapsed) and stroke out ~C-x C-n C-n~. To widen the buffer to the original contents, stroke out ~C-x C-n C-w~. + +Leave out not more than one line between consecutive subtrees so that the tree's neat when collapsed. + + +* Agenda + +I find ~C-c a n~ to be sufficient for my [[id:20230925T094832.763061][GTD setup]]. I also use org-clock to monitor the time dedicated to particular tasks and a simple ~~ in the respective agenda line leads you to the exact place of description of that task. + +#+begin_src elisp + (general-define-key + :prefix "C-c" + "C-x C-i" #'org-clock-in + "C-x C-o" #'org-clock-out + "C-x C-g" #'org-clock-goto) +#+end_src + +Org-calendar and timing is feature explored in its own subtree. + +Controlling other aspects of your GTD setup within the agenda buffer is convenient: + - ~-~ : helps reschedule items a day before or after + - ~-~ : helps change priorities for tasks quickly + - hitting ~t~ (I use evil bindings) over a task toggles its ~TODO~ status + +One can set deadlines and schedules for a task subtree in a buffer convenienly with ~C-c C-d~ and ~C-c C-s~ : this pops up a calendar buffer for a date to be chosen. Inserting inactive timestamps is also possible via ~C-c C-!~. Once inserted, timestamps and ranges can be manipulated intuitively with ~~ + Arrow keys. + +Setting recurring events can be done by suffixing the timestamp with ~+~ (~+1w/d/m~ for instance). More complicated frequencies can be captured programatically as one liners : to capture recurrence on weekdays, one would use ~<%%(memq (calendar-day-of-week date) '(1 2 3 4 5))>~ + From 64723fe2cefb9afadb232a6b86407d642db3c83c Mon Sep 17 00:00:00 2001 From: Raj Patil Date: Wed, 27 Sep 2023 17:57:00 +0530 Subject: [PATCH 2/2] evening 0x2164 --- Content/20230809095308-init_el.org | 1265 +++++++++-------- Content/20230911172534-be_a_sneaky_reader.org | 3 - 2 files changed, 635 insertions(+), 633 deletions(-) diff --git a/Content/20230809095308-init_el.org b/Content/20230809095308-init_el.org index 94a3274..59d4e9e 100644 --- a/Content/20230809095308-init_el.org +++ b/Content/20230809095308-init_el.org @@ -6,674 +6,679 @@ Documenting my init.el :- will annotate soon, just dumping as of now #+begin_src elisp - (require 'server) - (unless (server-running-p) - (server-start)) + (require 'server) + (unless (server-running-p) + (server-start)) - (set-frame-font "CaskaydiaCove NF" nil t) + (set-frame-font "CaskaydiaCove NF" nil t) - ;;no, thank you - (menu-bar-mode -1) - (tool-bar-mode -1) - (scroll-bar-mode -1) + ;;no, thank you + (menu-bar-mode -1) + (tool-bar-mode -1) + (scroll-bar-mode -1) - ;ERROR handling + ;ERROR handling - (setq byte-compile-warnings '(cl-functions)) - (setq ring-bell-function 'ignore) - (setq visible-bell t) + (setq byte-compile-warnings '(cl-functions)) + (setq ring-bell-function 'ignore) + (setq visible-bell t) - ;BOOTSTRAPPING STRAIGHT.EL (defvar bootstrap-version) - (let ((bootstrap-file - (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) - (bootstrap-version 5)) - (unless (file-exists-p bootstrap-file) - (with-current-buffer - (url-retrieve-synchronously - "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" - 'silent 'inhibit-cookies) - (goto-char (point-max)) - (eval-print-last-sexp))) - (load bootstrap-file nil 'nomessage)) + ;BOOTSTRAPPING STRAIGHT.EL (defvar bootstrap-version) + (let ((bootstrap-file + (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) + (bootstrap-version 5)) + (unless (file-exists-p bootstrap-file) + (with-current-buffer + (url-retrieve-synchronously + "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" + 'silent 'inhibit-cookies) + (goto-char (point-max)) + (eval-print-last-sexp))) + (load bootstrap-file nil 'nomessage)) - (straight-use-package 'use-package) - (setq straight-path "~/.emacs.d/straight/") + (straight-use-package 'use-package) + (setq straight-path "~/.emacs.d/straight/") - ;GENERAL + binding free ups + ;GENERAL + binding free ups - (use-package general - :straight t - :config - (general-unbind - "C-M-o" ; free up for org-roam *Notes* - "C-M-r" ; free up for remote ops)) - "C-s" ; for super bindings)) - )) + (use-package general + :straight t + :config + (general-unbind + "C-M-o" ; free up for org-roam *Notes* + "C-M-r" ; free up for remote ops)) + "C-s" ; for super bindings)) + )) - ;DASHBOARD + ;DASHBOARD - (use-package dashboard - :straight t - :config - (dashboard-setup-startup-hook) - (general-define-key - "C-c h" (lambda () (interactive)(view-buffer "*dashboard*"))) - (setq - initial-buffer-choice (lambda () (get-buffer "*dashboard*")) - dashboard-center-content t - dashboard-startup-banner 'logo - )) - - ;EVIL ENV - - (use-package evil - :straight t - :init - (use-package undo-fu + (use-package dashboard :straight t :config + (dashboard-setup-startup-hook) (general-define-key - :states 'normal - "u" #'undo-fu-only-undo - "\C-r" #'undo-fu-only-redo) - (setq evil-undo-system 'undo-fu)) - (setq - evil-want-keybinding nil - evil-want-integration t) - :config - (evil-mode 1)) - - - (use-package evil-collection - :straight t - :after evil - :config - (evil-collection-init)) - - (use-package evil-org - :straight t - :after org - :config - (general-add-hook 'org-mode - (list #'evil-org-mode)) - (require 'evil-org-agenda) - (evil-org-agenda-set-keys)) - - - (use-package evil-surround - :straight t - :config - (global-evil-surround-mode 1)) - - ;HELM - - (use-package helm - :straight t - :config - (general-define-key - "M-x" #'helm-M-x - "C-h a" #'helm-apropos - "C-/" #'helm-occur - "C-x C-f" #'helm-find-files) - (helm-mode 1)) - - ;PROJECTILE - (use-package projectile - :init - :straight t - :config - (projectile-mode 1) - (use-package helm-projectile + "C-c h" (lambda () (interactive)(view-buffer "*dashboard*"))) + (setq + initial-buffer-choice (lambda () (get-buffer "*dashboard*")) + dashboard-center-content t + dashboard-startup-banner 'logo + )) + + ;EVIL ENV + + (use-package evil + :straight t + :init + (use-package undo-fu + :straight t + :config + (general-define-key + :states 'normal + "u" #'undo-fu-only-undo + "\C-r" #'undo-fu-only-redo) + (setq evil-undo-system 'undo-fu)) + (setq + evil-want-keybinding nil + evil-want-integration t) + :config + (evil-mode 1)) + + + (use-package evil-collection + :straight t + :after evil + :config + (evil-collection-init)) + + (use-package evil-org + :straight t + :after org + :config + (general-add-hook 'org-mode + (list #'evil-org-mode)) + (require 'evil-org-agenda) + (evil-org-agenda-set-keys)) + + + (use-package evil-surround + :straight t + :config + (global-evil-surround-mode 1)) + + ;HELM + + (use-package helm :straight t :config (general-define-key - :prefix "C-c p" - "f f" #'helm-projectile-find-file - "f d" #'helm-projectile-find-dir - "a" #'helm-projectile-ack))) - - - ;FILE MANAGEMENT : DIRED-X - - (setq find-file-visit-truename t) - (general-add-hook 'dired-load-hook - (list (lambda () - (load "dired-x") - ;; Set dired-x global variables here. For example: - ;; (setq dired-guess-shell-gnutar "gtar") - ;; (setq dired-x-hands-off-my-keys nil) - ))) - - ;AESTHETICS - - (use-package doom-themes - :straight t) - (use-package darkroom - :straight t) - (use-package nimbus-theme - :straight t - :config - (load-theme 'nimbus t)) - (use-package beacon - :straight t - :init - (setq beacon-size 60 - beacon-blink-when-focused t - beacon-blink-when-point-moves-vertically 5 - beacon-blink-when-window-changes t - beacon-color "#4444bb" - beacon-blink-delay 0.2 - beacon-blink-duration 0.2) - :config - (beacon-mode 1)) - - ;MODELINE AND ICONS - ;;(use-package mini-modeline - ;; :straight t - ;; :init - ;; (mini-modeline-mode t)) - - (use-package doom-modeline - :straight t - :init - (use-package all-the-icons :straight t) - (use-package minions :straight t) - :config - (setq doom-modeline-height 30) - (setq doom-modeline-bar-width 3) - (setq doom-modeline-window-width-limit fill-column) - (setq doom-modeline-icon (display-graphic-p)) - (setq doom-modeline-major-mode-icon t) - (setq doom-modeline-continuous-word-count-modes '(org-mode)) - (setq doom-modeline-modal-icon t) - (setq doom-modeline-mu4e t) - (setq doom-modeline-minor-modes (featurep 'minions)) - (general-add-hook 'after-init-hook - (list #'doom-modeline-mode - #'minions-mode))) - - - (use-package nlinum-relative - :straight t - :config - (nlinum-relative-setup-evil) - (general-add-hook 'prog-mode-hook - (list #'nlinum-relative-mode)) - (setq nlinum-relative-redisplay-delay 0) - (setq nlinum-relative-current-symbol "->") - (setq nlinum-relative-offset 0)) - - ;QUICK CONFIG - - (defun edit-init () - (interactive) - (message (concat "editing user-init-file @ " user-init-file)) - (find-file user-init-file)) - - (defun open-scratch-space () - (interactive) - (message (concat "opening scratch space @ /mnt/c/Users/Raj Patil/source/scratch" )) - (find-file "/mnt/c/Users/Raj Patil/source/scratch")) - - (general-define-key - :prefix "C-c" - "e" #'edit-init - "s" #'open-scratch-space) - - ;Window management - - (use-package window-purpose - :straight t - :config - ;;(add-to-list 'purpose-user-mode-purposes '( . )) - ;;(add-to-list 'purpose-user-name-purposes '( . )) - ;;(add-to-list 'purpose-user-regexp-purposes '( . )) - ;;(purpose-compile-user-configuration)) - ;;(purpose-mode 1)) - (purpose-compile-user-configuration) - (general-define-key - :prefix "C-c ," - "d" #'(lambda () - (interactive) - (message "dedicating current window") - (set-window-dedicated-p (selected-window) t)) - "u" #'(lambda () - (interactive) - (message "undedicating current window") - (set-window-dedicated-p (selected-window) nil)))) + "M-x" #'helm-M-x + "C-h a" #'helm-apropos + "C-/" #'helm-occur + "C-x C-f" #'helm-find-files) + (helm-mode 1)) + + ;PROJECTILE + (use-package projectile + :init + :straight t + :config + (projectile-mode 1) + (use-package helm-projectile + :straight t + :config + (general-define-key + :prefix "C-c p" + "f f" #'helm-projectile-find-file + "f d" #'helm-projectile-find-dir + "a" #'helm-projectile-ack))) + + + ;FILE MANAGEMENT : DIRED-X + + (setq find-file-visit-truename t) + (general-add-hook 'dired-load-hook + (list (lambda () + (load "dired-x") + ;; Set dired-x global variables here. For example: + ;; (setq dired-guess-shell-gnutar "gtar") + ;; (setq dired-x-hands-off-my-keys nil) + ))) + + ;AESTHETICS + + (use-package doom-themes + :straight t) + (use-package darkroom + :straight t) + (use-package nimbus-theme + :straight t + :config + (load-theme 'nimbus t)) + (use-package beacon + :straight t + :init + (setq beacon-size 60 + beacon-blink-when-focused t + beacon-blink-when-point-moves-vertically 5 + beacon-blink-when-window-changes t + beacon-color "#4444bb" + beacon-blink-delay 0.2 + beacon-blink-duration 0.2) + :config + (beacon-mode 1)) - ;Tabs - (use-package eyebrowse - :straight t - :config - (eyebrowse-mode t)) + ;MODELINE AND ICONS + ;;(use-package mini-modeline + ;; :straight t + ;; :init + ;; (mini-modeline-mode t)) - ;buffer managment - (general-define-key "C-c i" #'ibuffer) + (use-package doom-modeline + :straight t + :init + (use-package all-the-icons :straight t) + (use-package minions :straight t) + :config + (setq doom-modeline-height 30) + (setq doom-modeline-bar-width 3) + (setq doom-modeline-window-width-limit fill-column) + (setq doom-modeline-icon (display-graphic-p)) + (setq doom-modeline-major-mode-icon t) + (setq doom-modeline-continuous-word-count-modes '(org-mode)) + (setq doom-modeline-modal-icon t) + (setq doom-modeline-mu4e t) + (setq doom-modeline-minor-modes (featurep 'minions)) + (general-add-hook 'after-init-hook + (list #'doom-modeline-mode + #'minions-mode))) + + + (use-package nlinum-relative + :straight t + :config + (nlinum-relative-setup-evil) + (general-add-hook 'prog-mode-hook + (list #'nlinum-relative-mode)) + (setq nlinum-relative-redisplay-delay 0) + (setq nlinum-relative-current-symbol "->") + (setq nlinum-relative-offset 0)) + ;QUICK CONFIG - ;WHICH-KEY + (defun edit-init () + (interactive) + (message (concat "editing user-init-file @ " user-init-file)) + (find-file user-init-file)) - (use-package which-key - :straight t - :config - (which-key-mode) - (general-define-key "C-h C-k" #'which-key-show-top-level) - (which-key-setup-side-window-bottom)) + (defun open-scratch-space () + (interactive) + (message (concat "opening scratch space @ /mnt/c/Users/Raj Patil/source/scratch" )) + (find-file "/mnt/c/Users/Raj Patil/source/scratch")) - ;BROWSING + (general-define-key + :prefix "C-c" + "e" #'edit-init + "s" #'open-scratch-space) - (setq browse-url-browser-function 'eww-browse-url) - (setq shr-max-image-proportion 0.6) - (general-define-key - "C-c C-e C-c" #'eww-copy-page-url - "C-c t" #'toggle-truncate-lines) + ;Window management - ;PDF INTEROP + (use-package window-purpose + :straight t + :config + ;;(add-to-list 'purpose-user-mode-purposes '( . )) + ;;(add-to-list 'purpose-user-name-purposes '( . )) + ;;(add-to-list 'purpose-user-regexp-purposes '( . )) + ;;(purpose-compile-user-configuration)) + ;;(purpose-mode 1)) + (purpose-compile-user-configuration) + (general-define-key + :prefix "C-c ," + "d" #'(lambda () + (interactive) + (message "dedicating current window") + (set-window-dedicated-p (selected-window) t)) + "u" #'(lambda () + (interactive) + (message "undedicating current window") + (set-window-dedicated-p (selected-window) nil)))) + + ;Tabs + (use-package eyebrowse + :straight t + :config + (eyebrowse-mode t)) - (use-package pdf-tools - :straight (pdf-tools :host github - :repo "vedang/pdf-tools") - :config - (pdf-loader-install)) + ;buffer managment + (general-define-key "C-c i" #'ibuffer) - ;MAGIT + ;WHICH-KEY - (use-package magit :straight t) + (use-package which-key + :straight t + :config + (which-key-mode) + (general-define-key "C-h C-k" #'which-key-show-top-level) + (which-key-setup-side-window-bottom)) - ;ORG-OPS + ;BROWSING - (put 'narrow-to-region 'disabled nil) - (use-package org - :straight t - :config + (setq browse-url-browser-function 'eww-browse-url) + (setq shr-max-image-proportion 0.6) (general-define-key - :prefix "C-c" - "l" #'org-store-link - "a" #'org-agenda - "c" #'org-capture - "!" #'org-time-stamp-inactive) - (setq org-directory (file-truename "~/source/org/") - org-default-notes-file (concat org-directory "/gtd/GTD_HQ.org") - org-startup-with-inline-images t - org-startup-truncated nil) - (general-add-hook 'org-mode-hook - (list #'toggle-word-wrap - #'flyspell-mode - #'nlinum-relative-mode)) - (defun update-org-latex-fragments () - (org-latex-preview '(64)) - (plist-put org-format-latex-options :scale (* 2 text-scale-mode-amount)) - (org-latex-preview '(16))) - (general-add-hook 'text-scale-mode-hook - (list #'update-org-latex-fragments)) - (setq org-latex-packages-alist '(("margin=2cm" "geometry"))) - (setq org-clock-persist 'history) - (org-clock-persistence-insinuate) - (general-define-key - :prefix "C-c" - "r" #'org-refile - "C-x C-g" #'org-clock-goto)) - - ;ORG-BABEL - ;;(org-babel-do-load-languages - ;; 'org-babel-load-languages - ;; '((python . t))) - ;;(mermaid . t))) - - ;(setq org-babel-python-command "/home/rajp152k/miniconda3/bin/python") - - ;;(use-package ob-mermaid - ;; :straight t - ;; :config - ;; (setq ob-mermaid-cli-path "/home/rajp152k/node_modules/.bin/mmdc")) - - (use-package org-bullets - :straight t - :config - (general-add-hook - 'org-mode-hook (lambda () (org-bullets-mode 1)))) - - (defun +org/opened-buffer-files () - "Return the list of files currently opened in emacs" - (delq nil - (mapcar (lambda (x) - (if (and (buffer-file-name x) - (string-match "\\.org$" - (buffer-file-name x))) - (buffer-file-name x))) - (buffer-list)))) - - (setq org-refile-targets '((+org/opened-buffer-files :maxlevel . 5))) - - (setq org-capture-templates - '(("n" "Next Action" entry (file+headline "~/links/source/org/gtd/GTD_HQ.org" "NA") - "* TODO %?\n %i\n %a") - ("e" "Event" entry (file+headline "~/links/source/org/gtd/GTD_HQ.org" "Events") - "* %?\nSCHEDULED: %T\n %i") - ("i" "IN" entry (file+headline "~/links/source/org/gtd/GTD_HQ.org" "INQ") - "* %?\nEntered on %U\n %i\n %a") - ("c" "consolidate" entry (file+headline "~/links/source/org/gtd/GTD_HQ.org" "Consolidate") - "* %?\nEntered on %U\n %i\n %a") - ("t" "Tickler" entry (file+headline "~/links/source/org/gtd/GTD_HQ.org" "Tickler") - "* %?\nDEFER THOUGHT TO: %T\n %i"))) - - ;GTD - - ;;(defun gtd() - ;; "open the GTD workspace" - ;; (interactive) - ;; (let ((gtd-dir (concat org-directory "/gtd/GTD_HQ.org"))) - ;; (message (concat "opening GTD workspace @ " gtd-dir)) - ;; (find-file gtd-dir) - ;; (flyspell-mode-off))) - ;; - ;;(general-define-key - ;; :prefix "C-c" - ;; "g" #'gtd) - ;; - ;ORG-ROAM - - (use-package org-roam - :straight (org-roam :host github - :repo "org-roam/org-roam") - :config - (setq org-id-method 'ts) - (setq org-roam-directory (file-truename "/mnt/c/Users/Raj Patil/source/org/braindump/Content/")) - (setq org-roam-file-extensions '("org")) - (org-roam-db-autosync-mode) - (defun org-roam-tag-list () - (interactive) - (let ((tag-list (org-roam-db-query - [:select :distinct [tag] - :from tags]))) - (switch-to-buffer "*scratch*") - (dolist (tag tag-list) - (insert (concat (car tag) "\n"))))) - (general-define-key - :prefix "C-M-o" - "f" #'org-roam-node-find - "i" #'org-roam-node-insert - "c" #'org-roam-capture - "h" #'(lambda () - (interactive) - (find-file (concat org-roam-directory "index.org"))) - "d s" #'org-roam-db-sync - "t a" #'org-roam-tag-add - "t d" #'org-roam-tag-remove - "t l" #'org-roam-tag-list - "r" #'org-roam-buffer-toggle - "o c" #'org-id-get-create - "o s" #'org-id-store-link - "a a" #'org-roam-alias-add - "a d" #'org-roam-alias-remove) - (add-to-list 'display-buffer-alist - '(; org-roam buffer toggle config - (".org-roam.*" - (display-buffer-in-side-window) - (window-width . 0.25) - (side . left) - (slot 0))))) - - (use-package websocket - :straight t - :after org-roam) - - (use-package org-roam-ui - :straight (:host github - :repo "org-roam/org-roam-ui" - :files ("*.el" "out")) - :after org-roam - :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)) - - ;COMPANY - - (use-package company - :straight t - :config - (setq company-idle-delay 0.2) - (setq company-minimum-prefix-length 2) - (add-to-list 'company-backends 'company-capf) - (setq company-ignore-case t) - (global-company-mode 1)) - - (use-package company-box - :straight t - :config - (general-add-hook 'company-mode-hook - (list 'company-box-mode))) - - (use-package company-lsp - :straight t - :requires company - :config - (push 'company-lsp company-backends) - ;;disable client side cache as LSP does is better - (setq company-transformers nil - company-lsp-async t - company-lsp-cache-candidates nil)) - - ;PYTHON - ;;(use-package pyvenv - ;; :straight t - ;; :config - ;; (setenv "WORKON_HOME" "/home/rajp152k/miniconda3/envs/") - ;; (pyvenv-mode 1) - ;; (pyvenv-workon "emacs")) - - ;;(when (executable-find "ipython") - ;; (setq python-shell-interpreter "ipython")) - - ;YAML - (use-package yaml-mode - :straight t - :config - (add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode))) - - - - - ; LSP - - ;;(use-package lsp-mode - ;; :straight t - ;; :config - ;; (setq lsp-prefer-flymake nil) - ;; (general-define-key "C-M-l" (general-simulate-key "s-l")) ;; no super key - ;; (general-add-hook - ;; (list 'c++-mode-hook - ;; 'python-mode-hook - ;; 'racket-mode-hook) - ;; (list #'lsp)) - ;; (general-add-hook - ;; 'lsp-mode-hook - ;; (list #'lsp-enable-which-key-integration)) - ;; (setq lsp-clients-clangd-args '("-j=4" "-background-index" ) - ;; lsp-clients-clangd-executable "clangd")) - ;; - ;;;;c++ compile_flags.txt auto place - ;; - ;;(defun clangd-lsp-setup () - ;; (interactive) - ;; ;;check if database already exists - ;; (let* ((dir default-directory) - ;; (include-path-1 "/usr/include/c++/") - ;; (include-path-2 "/usr/include/x86_64-linux-gnu/c++/") - ;; (ver (caddr (directory-files include-path-1))) - ;; (includes-str (concat "-I" (concat include-path-1 ver) "/\n" - ;; "-I" (concat include-path-2 ver) "/\n")) - ;; (compilation-db (concat dir "compile_flags.txt"))) - ;; (if (file-exists-p compilation-db) - ;; (message "compilation database already exists") - ;; (progn (message "placing a new compilation database") - ;; (write-region includes-str nil compilation-db))))) - ;; - ;;(general-add-hook 'c++-mode-hook - ;; (list#'clangd-lsp-setup)) - - ;;(use-package lsp-pyright - ;; :straight t - ;; :config - ;; (general-add-hook 'python-mode #'(lambda () (lsp)) )) - - ;;(use-package lsp-racket - ;; :straight 'lsp-racket) - ;;:type git - ;;:host github - ;;:repo "mullikine/lsp-racket-el")) - - ;;(use-package dap-mode - ;; :straight t) - ;; - ;;(use-package lsp-ui - ;; :straight t - ;; :requires lsp-mode flycheck - ;; :config - ;; (setq lsp-ui-doc-enable t - ;; lsp-ui-doc-use-childframe t - ;; lsp-ui-doc-position 'top - ;; lsp-ui-doc-include-signature t - ;; lsp-ui-sidline-enable t - ;; lsp-ui-flycheck-list-position 'right - ;; lsp-ui-flycheck-live-reporting t - ;; lsp-ui-peek-enable t - ;; lsp-ui-peek-list-width 60 - ;; lsp-ui-peek-peek-height 40) - ;; (general-add-hook 'lsp-mode-hook (list 'lsp-ui-mode))) - - ; remote ops - - ;;(defun remote-shell-specifics () - ;; (when (and (fboundp 'company-mode) - ;; (file-remote-p default-directory)) - ;; (company-mode -1))) - ;;(general-add-hook 'shell-mode-hook #'remote-shell-specifics) - - ;LISP ADD ONS - - (use-package smartparens - :straight t - :config - (smartparens-global-mode t)) - - (use-package rainbow-delimiters - :straight t - :config - (general-add-hook #'lisp-mode-hook - '(rainbow-delimiters-mode-enable))) - - - ;SLIME - (use-package slime - :straight t - :config - (setq inferior-lisp-program "sbcl")) - - - ;RACKET - - ;;(use-package racket-mode - ;; :straight t - ;; :config - ;; (setq racket-documentation-search-location 'local - ;; racket-images-inline t) - ;; (general-add-hook (list 'racket-mode-hook 'racket-repl-mode-hook) - ;; (list #'rainbow-delimiters-mode))) - - - ;ELISP - - (general-add-hook 'emacs-lisp-mode-hook - (list 'smartparens-mode ;;use (kbd `C-q '`) for single quoting - 'rainbow-delimiters-mode)) - - ;BLOG - - (use-package easy-hugo - :straight t - :config - (setq easy-hugo-basedir "/mnt/c/Users/Raj Patil/source/rajpatil.dev/") - (setq easy-hugo-url "https://rajpatil.dev") - (setq easy-hugo-root "/usr/local/bin") - (defun blog () - "Open blogging workspace" - (interactive) - (let ((blog-dir "~/links/source/rajpatil.dev")) - (message (concat "opening blogging workspace @ " blog-dir)) - (find-file blog-dir))) - (defun life-hex-count () - "number of days I've been alive" - (interactive) - (let* ((birth (date-to-time "2000-05-01 19:30 IST")) - (today (date-to-time (format-time-string "%Y-%m-%d %H:%M:%S %Z" (current-time)) )) - (diff (float-time (time-subtract today birth)))) - (insert (format "0x%X" (/ diff 86400))))) - (defun hex-ops () - "hexify decimal number at point, invoke life hex at count if nil" - (interactive) - (defun delete-word-at-point () - (kill-word 1) - (backward-kill-word 1)) - (defun valid-number-p (str) - "Check if a string is a valid number." - (string-match-p "^[+-]?[0-9]*\\.?[0-9]+\\(?:[eE][+-]?[0-9]+\\)?$" str)) - (let ((dec-days (word-at-point))) - (cond ((null dec-days) (life-hex-count)) - ((valid-number-p dec-days) (progn - (delete-word-at-point) - (insert (format " 0x%X " (string-to-number dec-days)))) ) - (t (message "invalid request; ignoring ..."))))) - (general-define-key - :prefix "C-c C-h" - "b" #'easy-hugo-newpost - "C-b" #'blog - "C-t" #'hex-ops)) + "C-c C-e C-c" #'eww-copy-page-url + "C-c t" #'toggle-truncate-lines) + + ;PDF INTEROP + + (use-package pdf-tools + :straight (pdf-tools :host github + :repo "vedang/pdf-tools") + :config + (pdf-loader-install)) + + + ;MAGIT + + (use-package magit :straight t) + + ;ORG-OPS + + (put 'narrow-to-region 'disabled nil) + (use-package org + :straight t + :config + (general-define-key + :prefix "C-c" + "l" #'org-store-link + "a" #'org-agenda + "c" #'org-capture + "!" #'org-time-stamp-inactive) + (setq org-directory (file-truename "~/source/org/") + org-default-notes-file (concat org-directory "/gtd/GTD_HQ.org") + org-startup-with-inline-images t + org-startup-truncated nil) + (general-add-hook 'org-mode-hook + (list #'toggle-word-wrap + #'flyspell-mode + #'nlinum-relative-mode)) + (defun update-org-latex-fragments () + (org-latex-preview '(64)) + (plist-put org-format-latex-options :scale (* 2 text-scale-mode-amount)) + (org-latex-preview '(16))) + (general-add-hook 'text-scale-mode-hook + (list #'update-org-latex-fragments)) + (setq org-latex-packages-alist '(("margin=2cm" "geometry"))) + (setq org-clock-persist 'history) + (org-clock-persistence-insinuate) + (general-define-key + :prefix "C-c" + "r" #'org-refile + "C-x C-g" #'org-clock-goto)) + + ;ORG-BABEL + ;;(org-babel-do-load-languages + ;; 'org-babel-load-languages + ;; '((python . t))) + ;;(mermaid . t))) + ;(setq org-babel-python-command "/home/rajp152k/miniconda3/bin/python") + ;;(use-package ob-mermaid + ;; :straight t + ;; :config + ;; (setq ob-mermaid-cli-path "/home/rajp152k/node_modules/.bin/mmdc")) + + (use-package org-bullets + :straight t + :config + (general-add-hook + 'org-mode-hook (lambda () (org-bullets-mode 1)))) + + (defun +org/opened-buffer-files () + "Return the list of files currently opened in emacs" + (delq nil + (mapcar (lambda (x) + (if (and (buffer-file-name x) + (string-match "\\.org$" + (buffer-file-name x))) + (buffer-file-name x))) + (buffer-list)))) + + (setq org-refile-targets '((+org/opened-buffer-files :maxlevel . 5))) + + (setq org-capture-templates + '(("n" "Next Action" entry (file+headline "~/links/source/org/gtd/GTD_HQ.org" "NA") + "* TODO %?\n %i\n %a") + ("e" "Event" entry (file+headline "~/links/source/org/gtd/GTD_HQ.org" "Events") + "* %?\nSCHEDULED: %T\n %i") + ("i" "IN" entry (file+headline "~/links/source/org/gtd/GTD_HQ.org" "INQ") + "* %?\nEntered on %U\n %i\n %a") + ("c" "consolidate" entry (file+headline "~/links/source/org/gtd/GTD_HQ.org" "Consolidate") + "* %?\nEntered on %U\n %i\n %a") + ("t" "Tickler" entry (file+headline "~/links/source/org/gtd/GTD_HQ.org" "Tickler") + "* %?\nDEFER THOUGHT TO: %T\n %i"))) + + ;GTD + + (defun gtd() + "open the GTD workspace" + (interactive) + (let ((gtd-dir (concat org-directory "/gtd/GTD_HQ.org"))) + (message (concat "opening GTD workspace @ " gtd-dir)) + (find-file gtd-dir) + (flyspell-mode-off))) - ;DICTIONARY - (use-package define-word - :straight t - :config (general-define-key :prefix "C-c" - "d" #'define-word-at-point - "D" #'define-word)) - - ;LATEX - - ;;install auctex from package-list-packages - ;;don't use the github mirror via straight - ;;(setq TeX-auto-save t - ;; TeX-parse-self t - ;; TeX-view-program-selection '((output-pdf "PDF Tools")) - ;; TeX-source-correlate-start-server t) - ;;(general-add-hook 'TeX-after-compilation-finished-functions - ;; #'TeX-revert-document-buffer) - ;; - ;;(setq-default TeX-master nil) - ;;(general-add-hook 'Latex-mode-hook - ;; (list #'LaTeX-math-mode - ;; #'turn-on-reftex - ;; #'flyspell-mode)) - ;; - ;MARKDOWN - - (use-package markdown-mode - :straight t - :config - (set-fill-column 40) - (general-add-hook 'markdown-mode-hook - (list #'nlinum-relative-mode - #'auto-fill-mode - #'flyspell-mode))) + "g" #'gtd) + + ;ORG-AI + + + + + ;ORG-ROAM + + (use-package org-roam + :straight (org-roam :host github + :repo "org-roam/org-roam") + :config + (setq org-id-method 'ts) + (setq org-roam-directory (file-truename "/mnt/c/Users/Raj Patil/source/org/braindump/Content/")) + (setq org-roam-file-extensions '("org")) + (org-roam-db-autosync-mode) + (defun org-roam-tag-list () + (interactive) + (let ((tag-list (org-roam-db-query + [:select :distinct [tag] + :from tags]))) + (switch-to-buffer "*scratch*") + (dolist (tag tag-list) + (insert (concat (car tag) "\n"))))) + (general-define-key + :prefix "C-M-o" + "f" #'org-roam-node-find + "i" #'org-roam-node-insert + "c" #'org-roam-capture + "h" #'(lambda () + (interactive) + (find-file (concat org-roam-directory "index.org"))) + "d s" #'org-roam-db-sync + "t a" #'org-roam-tag-add + "t d" #'org-roam-tag-remove + "t l" #'org-roam-tag-list + "r" #'org-roam-buffer-toggle + "o c" #'org-id-get-create + "o s" #'org-id-store-link + "a a" #'org-roam-alias-add + "a d" #'org-roam-alias-remove) + (add-to-list 'display-buffer-alist + '(; org-roam buffer toggle config + (".org-roam.*" + (display-buffer-in-side-window) + (window-width . 0.25) + (side . left) + (slot 0))))) + + (use-package websocket + :straight t + :after org-roam) + + (use-package org-roam-ui + :straight (:host github + :repo "org-roam/org-roam-ui" + :files ("*.el" "out")) + :after org-roam + :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)) + + ;COMPANY + + (use-package company + :straight t + :config + (setq company-idle-delay 0.2) + (setq company-minimum-prefix-length 2) + (add-to-list 'company-backends 'company-capf) + (setq company-ignore-case t) + (global-company-mode 1)) + + (use-package company-box + :straight t + :config + (general-add-hook 'company-mode-hook + (list 'company-box-mode))) + + (use-package company-lsp + :straight t + :requires company + :config + (push 'company-lsp company-backends) + ;;disable client side cache as LSP does is better + (setq company-transformers nil + company-lsp-async t + company-lsp-cache-candidates nil)) + + ;PYTHON + ;;(use-package pyvenv + ;; :straight t + ;; :config + ;; (setenv "WORKON_HOME" "/home/rajp152k/miniconda3/envs/") + ;; (pyvenv-mode 1) + ;; (pyvenv-workon "emacs")) + + ;;(when (executable-find "ipython") + ;; (setq python-shell-interpreter "ipython")) + + ;YAML + (use-package yaml-mode + :straight t + :config + (add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode))) + + + + + ; LSP + + ;;(use-package lsp-mode + ;; :straight t + ;; :config + ;; (setq lsp-prefer-flymake nil) + ;; (general-define-key "C-M-l" (general-simulate-key "s-l")) ;; no super key + ;; (general-add-hook + ;; (list 'c++-mode-hook + ;; 'python-mode-hook + ;; 'racket-mode-hook) + ;; (list #'lsp)) + ;; (general-add-hook + ;; 'lsp-mode-hook + ;; (list #'lsp-enable-which-key-integration)) + ;; (setq lsp-clients-clangd-args '("-j=4" "-background-index" ) + ;; lsp-clients-clangd-executable "clangd")) + ;; + ;;;;c++ compile_flags.txt auto place + ;; + ;;(defun clangd-lsp-setup () + ;; (interactive) + ;; ;;check if database already exists + ;; (let* ((dir default-directory) + ;; (include-path-1 "/usr/include/c++/") + ;; (include-path-2 "/usr/include/x86_64-linux-gnu/c++/") + ;; (ver (caddr (directory-files include-path-1))) + ;; (includes-str (concat "-I" (concat include-path-1 ver) "/\n" + ;; "-I" (concat include-path-2 ver) "/\n")) + ;; (compilation-db (concat dir "compile_flags.txt"))) + ;; (if (file-exists-p compilation-db) + ;; (message "compilation database already exists") + ;; (progn (message "placing a new compilation database") + ;; (write-region includes-str nil compilation-db))))) + ;; + ;;(general-add-hook 'c++-mode-hook + ;; (list#'clangd-lsp-setup)) + + ;;(use-package lsp-pyright + ;; :straight t + ;; :config + ;; (general-add-hook 'python-mode #'(lambda () (lsp)) )) + + ;;(use-package lsp-racket + ;; :straight 'lsp-racket) + ;;:type git + ;;:host github + ;;:repo "mullikine/lsp-racket-el")) + + ;;(use-package dap-mode + ;; :straight t) + ;; + ;;(use-package lsp-ui + ;; :straight t + ;; :requires lsp-mode flycheck + ;; :config + ;; (setq lsp-ui-doc-enable t + ;; lsp-ui-doc-use-childframe t + ;; lsp-ui-doc-position 'top + ;; lsp-ui-doc-include-signature t + ;; lsp-ui-sidline-enable t + ;; lsp-ui-flycheck-list-position 'right + ;; lsp-ui-flycheck-live-reporting t + ;; lsp-ui-peek-enable t + ;; lsp-ui-peek-list-width 60 + ;; lsp-ui-peek-peek-height 40) + ;; (general-add-hook 'lsp-mode-hook (list 'lsp-ui-mode))) + + ; remote ops + + ;;(defun remote-shell-specifics () + ;; (when (and (fboundp 'company-mode) + ;; (file-remote-p default-directory)) + ;; (company-mode -1))) + ;;(general-add-hook 'shell-mode-hook #'remote-shell-specifics) + + ;LISP ADD ONS + + (use-package smartparens + :straight t + :config + (smartparens-global-mode t)) + + (use-package rainbow-delimiters + :straight t + :config + (general-add-hook #'lisp-mode-hook + '(rainbow-delimiters-mode-enable))) + + + ;SLIME + (use-package slime + :straight t + :config + (setq inferior-lisp-program "sbcl")) + + + ;RACKET + + ;;(use-package racket-mode + ;; :straight t + ;; :config + ;; (setq racket-documentation-search-location 'local + ;; racket-images-inline t) + ;; (general-add-hook (list 'racket-mode-hook 'racket-repl-mode-hook) + ;; (list #'rainbow-delimiters-mode))) + + + ;ELISP + + (general-add-hook 'emacs-lisp-mode-hook + (list 'smartparens-mode ;;use (kbd `C-q '`) for single quoting + 'rainbow-delimiters-mode)) + + ;BLOG + + (use-package easy-hugo + :straight t + :config + (setq easy-hugo-basedir "/mnt/c/Users/Raj Patil/source/rajpatil.dev/") + (setq easy-hugo-url "https://rajpatil.dev") + (setq easy-hugo-root "/usr/local/bin") + (defun blog () + "Open blogging workspace" + (interactive) + (let ((blog-dir "~/links/source/rajpatil.dev")) + (message (concat "opening blogging workspace @ " blog-dir)) + (find-file blog-dir))) + (defun life-hex-count () + "number of days I've been alive" + (interactive) + (let* ((birth (date-to-time "2000-05-01 19:30 IST")) + (today (date-to-time (format-time-string "%Y-%m-%d %H:%M:%S %Z" (current-time)) )) + (diff (float-time (time-subtract today birth)))) + (insert (format "0x%X" (/ diff 86400))))) + (defun hex-ops () + "hexify decimal number at point, invoke life hex at count if nil" + (interactive) + (defun delete-word-at-point () + (kill-word 1) + (backward-kill-word 1)) + (defun valid-number-p (str) + "Check if a string is a valid number." + (string-match-p "^[+-]?[0-9]*\\.?[0-9]+\\(?:[eE][+-]?[0-9]+\\)?$" str)) + (let ((dec-days (word-at-point))) + (cond ((null dec-days) (life-hex-count)) + ((valid-number-p dec-days) (progn + (delete-word-at-point) + (insert (format " 0x%X " (string-to-number dec-days)))) ) + (t (message "invalid request; ignoring ..."))))) + (general-define-key + :prefix "C-c C-h" + "b" #'easy-hugo-newpost + "C-b" #'blog + "C-t" #'hex-ops)) + + + + ;DICTIONARY + (use-package define-word + :straight t + :config + (general-define-key + :prefix "C-c" + "d" #'define-word-at-point + "D" #'define-word)) + + ;LATEX + + ;;install auctex from package-list-packages + ;;don't use the github mirror via straight + ;;(setq TeX-auto-save t + ;; TeX-parse-self t + ;; TeX-view-program-selection '((output-pdf "PDF Tools")) + ;; TeX-source-correlate-start-server t) + ;;(general-add-hook 'TeX-after-compilation-finished-functions + ;; #'TeX-revert-document-buffer) + ;; + ;;(setq-default TeX-master nil) + ;;(general-add-hook 'Latex-mode-hook + ;; (list #'LaTeX-math-mode + ;; #'turn-on-reftex + ;; #'flyspell-mode)) + ;; + ;MARKDOWN + + (use-package markdown-mode + :straight t + :config + (set-fill-column 40) + (general-add-hook 'markdown-mode-hook + (list #'nlinum-relative-mode + #'auto-fill-mode + #'flyspell-mode))) #+end_src diff --git a/Content/20230911172534-be_a_sneaky_reader.org b/Content/20230911172534-be_a_sneaky_reader.org index 60c7983..d618727 100644 --- a/Content/20230911172534-be_a_sneaky_reader.org +++ b/Content/20230911172534-be_a_sneaky_reader.org @@ -7,12 +7,9 @@ In association with [[id:20230827T153308.339339][The Definitive Guide to Books]] * Assumptions - - you've decided you want to read a lot - you lead a busy life with several phases to your day - you're open to reading variedly and aren't attached to the idea of completing a book - * Plan - - reading several books at a time - dependent on the phase you're in in your day