From 703e16ee78c3efab7121664e3ca6bc2b8e4db4d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Alvari=C3=B1o?= Date: Tue, 22 Mar 2022 16:47:53 +0100 Subject: [PATCH] Add full configuration for org-mode --- myconfig.org | 345 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 345 insertions(+) diff --git a/myconfig.org b/myconfig.org index 31253e7..d1d1b07 100644 --- a/myconfig.org +++ b/myconfig.org @@ -908,6 +908,150 @@ Configuring: ) #+end_src +** org-wild-notifier +Notifications + +#+begin_src emacs-lisp + (use-package org-wild-notifier + :ensure t + :after org + :custom + (org-wild-notifier-notification-title "Org Wild Reminder") + (org-wild-notifier-alert-time (quote(1 10 30))) + (alert-default-style 'libnotify) + :config + (org-wild-notifier-mode 1) + ) +#+end_src + +** Hydra for some org-mode stuff +#+begin_src emacs-lisp + (global-set-key + (kbd " o") + (defhydra hydra-global-org (:color blue + :hint nil) + " + ^Timer^ ^Tasks Time^ ^Capture^ + ------------------ ---------------- ------------------ + _t_: Start _w_: Clock-In _c_: Capture + _s_: Stop _o_: Clock-Out _l_: Last Capture + _r_: Countdown _j_: Clock-goto + _p_: Insert Count + + _q_: quit + " + ("t" org-timer-start) + ("s" org-timer-stop) + ("r" org-timer-set-timer) ; This one requires you be in an orgmode doc, as it sets the timer for the header + ("p" org-timer) ; output timer value to buffer + ("w" (org-clock-in)) ; used with (org-clock-persistence-insinuate) (setq org-clock-persist t) + ("o" org-clock-out) ; you might also want (setq org-log-note-clock-out t) + ("j" org-clock-goto) ; global visit the clocked task + ("c" org-capture) ; Don't forget to define the captures you want http://orgmode.org/manual/Capture.html + ("l" org-capture-goto-last-stored) + ("q" nil)) + ) +#+end_src + +** org-babel +#+begin_src emacs-lisp + (org-babel-do-load-languages + 'org-babel-load-languages + '((python . t) + (emacs-lisp . t) + (shell . t) + (C . t) + (js . t) + (ditaa . t) + (dot . t) + (org . t) + (latex . t ) + ) + ) +#+end_src + +** ox-reveal (reveal.js) +See doc in [[https://github.com/yjwen/org-reveal/][org-reveal github]] +Tenemos dos opciones para el =reveal.js=: +- Podemos descargarlo en nuestro sistema y acceder a la copia local + =git clone https://github.com/yjwen/org-reveal.git= + =(setq org-reveal-root "file:///d:/reveal.js")= +- Podemos hacer referencia a la versión online + =(setq org-reveal-root "https://cdn.jsdelivr.net/reveal.js/3.6.0/")= +#+begin_src emacs-lisp + (use-package ox-reveal + :ensure t) + + ;(setq org-reveal-root "https://cdn.jsdelivr.net/npm/reveal.js") + (setq org-reveal-root "https://cdn.jsdelivr.net/reveal.js/3.6.0/") + (setq org-reveal-mathjax t) + + (use-package htmlize + :ensure t) +#+end_src + +** ox-hugo +#+begin_src emacs-lisp + (use-package ox-hugo + :after ox) +#+end_src + +** org-roam +Zettelkästen on emacs (It’s a roam translation into org-mode) Remember +you must have graphviz and sqlite3 installed in your system, dot +command and sqlite3 must be available +- [[https://www.orgroam.com/manual.html#Top][org-roam user manual]] +- [[https://github.com/org-roam/org-roam/wiki/Hitchhiker's-Rough-Guide-to-Org-roam-V2][Hitchhiker's Rough Guide to Org roam V2]] + +#+begin_src emacs-lisp + (use-package org-roam + :after org + :init + (setq org-roam-v2-ack t) + :custom + (org-roam-directory (concat org-directory "/roam")) + (org-roam-capture-templates + '(("m" "main" plain + "%?" + :if-new (file+head "main/${slug}.org" + "#+title: ${title}\n") + :immediate-finish t + :unnarrowed t) + ("r" "reference" plain "%?" + :if-new + (file+head "reference/${title}.org" "#+title: ${title}\n") + :immediate-finish t + :unnarrowed t) + ("a" "article" plain "%?" + :if-new + (file+head "articles/${title}.org" "#+title: ${title}\n#+filetags: :article:\n") + :immediate-finish t + :unnarrowed t))) + :config + (org-roam-setup) + (cl-defmethod org-roam-node-type ((node org-roam-node)) + "Return the TYPE of NODE." + (condition-case nil + (file-name-nondirectory + (directory-file-name + (file-name-directory + (file-relative-name (org-roam-node-file node) org-roam-directory)))) + (error ""))) + (setq org-roam-node-display-template + (concat "${type:15} ${title:*}" + (propertize "${tags:10}" 'face 'org-tag))) + :bind (("C-c n f" . org-roam-node-find) + ("C-c n g" . org-roam-graph) + ("C-c n r" . org-roam-node-random) + (:map org-mode-map + (("C-c n i" . org-roam-node-insert) + ("C-c n o" . org-id-get-create) + ("C-c n t" . org-roam-tag-add) + ("C-c n a" . org-roam-alias-add) + ("C-c n l" . org-roam-buffer-toggle)))) + ) +#+end_src + * flycheck Syntax checking for programming languages @@ -1272,6 +1416,207 @@ You *must* have R installed in your system, otherwise this package is useless. :init (require 'ess-site)) #+end_src +* misc packages +** Expand region + #+begin_src emacs-lisp + (global-hl-line-mode t) + + (use-package expand-region + :config + (global-set-key (kbd "C-=") 'er/expand-region) + ) + #+end_src + +** EasyPG and org-crypt +Ver [[https://orgmode.org/worg/org-tutorials/encrypting-files.html][referencia en org-mode manual]] y [[http://www.clintonboys.com/gpg/][notas de Clintonboys]] +#+begin_src emacs-lisp + ;; (use-package epa-file + ;; :config + ;; (setq epa-file-encrypt-to '("salvari@protonmail.com")) + ;; :custom + ;; (epa-file-select-keys 'silent)) + ;; + ;; (use-package org-crypt + ;; ;; :ensure nil ;; included with org-mode + ;; :after org + ;; :config + ;; (org-crypt-use-before-save-magic) + ;; (setq org-tags-exclude-from-inheritance (quote ("crypt"))) + ;; :custom + ;; (org-crypt-key "salvari@protonmail.com")) +#+end_src + +** Olivetti: distraction-free writing enviroment +#+begin_src emacs-lisp + (use-package olivetti + :init + (setq olivetti-body-width .67) + :config + (defun slv/distraction-free () + "Distraction-free writing environment" + (interactive) + (if (equal olivetti-mode nil) + (progn + (window-configuration-to-register 1) + (delete-other-windows) + (text-scale-increase 2) + (olivetti-mode t)) + (progn + (jump-to-register 1) + (olivetti-mode 0) + (text-scale-decrease 2)))) + :bind + (("" . slv/distraction-free))) +#+end_src +* elfeed +#+begin_src emacs-lisp + (use-package elfeed + :config + (setq elfeed-db-directory "~/Dropbox/elfeeddb" + elfeed-show-entry-switch 'display-buffer) + :bind + ("C-x w" . elfeed ) + ) + (use-package elfeed-org + :config + (elfeed-org) + (setq rmh-elfeed-org-files (list "~/Dropbox/orgfiles/elfeed.org")) + ) + ;; (use-package elfeed-goodies + ;; :ensure t + ;; :config + ;; (elfeed-goodies/setup) + ;; ) + ;; + + ;; :bind (:map elfeed-search-mode-map + ;; ("q" . bjm/elfeed-save-db-and-bury) + ;; ("Q" . bjm/elfeed-save-db-and-bury) + ;; ("m" . elfeed-toggle-star) + ;; ("M" . elfeed-toggle-star) + ;; ("j" . mz/make-and-run-elfeed-hydra) + ;; ("J" . mz/make-and-run-elfeed-hydra) + ;; ("b" . mz/elfeed-browse-url) + ;; ("B" . elfeed-search-browse-url) + ;; ) + ;; :config + ;; (defalias 'elfeed-toggle-star + ;; (elfeed-expose #'elfeed-search-toggle-all 'star)) + ;; + ;; ) + + ;;(use-package elfeed-goodies + ;; :ensure t + ;; :config + ;; (elfeed-goodies/setup)) + ;; + ;; + ;; + ;; + ;; (defun mz/elfeed-browse-url (&optional use-generic-p) + ;; "Visit the current entry in your browser using `browse-url'. + ;; If there is a prefix argument, visit the current entry in the + ;; browser defined by `browse-url-generic-program'." + ;; (interactive "P") + ;; (let ((entries (elfeed-search-selected))) + ;; (cl-loop for entry in entries + ;; do (if use-generic-p + ;; (browse-url-generic (elfeed-entry-link entry)) + ;; (browse-url (elfeed-entry-link entry)))) + ;; (mapc #'elfeed-search-update-entry entries) + ;; (unless (or elfeed-search-remain-on-entry (use-region-p)) + ;; ;;(forward-line) + ;; ))) + ;; + ;; + ;; + ;; (defun elfeed-mark-all-as-read () + ;; (interactive) + ;; (mark-whole-buffer) + ;; (elfeed-search-untag-all-unread)) + ;; + ;; + ;; ;;functions to support syncing .elfeed between machines + ;; ;;makes sure elfeed reads index from disk before launching + ;; (defun bjm/elfeed-load-db-and-open () + ;; "Wrapper to load the elfeed db from disk before opening" + ;; (interactive) + ;; (elfeed-db-load) + ;; (elfeed) + ;; (elfeed-search-update--force)) + ;; + ;; ;;write to disk when quiting + ;; (defun bjm/elfeed-save-db-and-bury () + ;; "Wrapper to save the elfeed db to disk before burying buffer" + ;; (interactive) + ;; (elfeed-db-save) + ;; (quit-window)) + + ;;(defun z/hasCap (s) "" + ;; (let ((case-fold-search nil)) + ;; (string-match-p "[[:upper:]]" s) + ;; )) + ;; + ;; + ;;(defun z/get-hydra-option-key (s) + ;; "returns single upper case letter (converted to lower) or first" + ;; (interactive) + ;; (let ( (loc (z/hasCap s))) + ;; (if loc + ;; (downcase (substring s loc (+ loc 1))) + ;; (substring s 0 1) + ;; ))) + ;; + ;;;; (active blogs cs eDucation emacs local misc sports star tech unread webcomics) + ;;(defun mz/make-elfeed-cats (tags) + ;; "Returns a list of lists. Each one is line for the hydra configuratio in the form + ;; (c function hint)" + ;; (interactive) + ;; (mapcar (lambda (tag) + ;; (let* ( + ;; (tagstring (symbol-name tag)) + ;; (c (z/get-hydra-option-key tagstring)) + ;; ) + ;; (list c (append '(elfeed-search-set-filter) (list (format "@6-months-ago +%s" tagstring) ))tagstring ))) + ;; tags)) + ;; + ;; + ;; + ;; + ;; + ;;(defmacro mz/make-elfeed-hydra () + ;; `(defhydra mz/hydra-elfeed () + ;; "filter" + ;; ,@(mz/make-elfeed-cats (elfeed-db-get-all-tags)) + ;; ("*" (elfeed-search-set-filter "@6-months-ago +star") "Starred") + ;; ("M" elfeed-toggle-star "Mark") + ;; ("A" (elfeed-search-set-filter "@6-months-ago") "All") + ;; ("T" (elfeed-search-set-filter "@1-day-ago") "Today") + ;; ("Q" bjm/elfeed-save-db-and-bury "Quit Elfeed" :color blue) + ;; ("q" nil "quit" :color blue) + ;; )) + ;; + ;; + ;; + ;; + ;;(defun mz/make-and-run-elfeed-hydra () + ;; "" + ;; (interactive) + ;; (mz/make-elfeed-hydra) + ;; (mz/hydra-elfeed/body)) + ;; + ;; + ;;(defun my-elfeed-tag-sort (a b) + ;; (let* ((a-tags (format "%s" (elfeed-entry-tags a))) + ;; (b-tags (format "%s" (elfeed-entry-tags b)))) + ;; (if (string= a-tags b-tags) + ;; (< (elfeed-entry-date b) (elfeed-entry-date a))) + ;; (string< a-tags b-tags))) + ;; + ;; + ;;(setf elfeed-search-sort-function #'my-elfeed-tag-sort) + ;; +#+end_src * next #+begin_src emacs-lisp