2022-11-19 04:33:22 +01:00
|
|
|
|
;;; init-config.el --- Configuración de org-mode -*- lexical-binding: t -*-
|
2022-04-21 19:45:31 +02:00
|
|
|
|
|
|
|
|
|
;; Author: kj <webmaster@outcontrol.net>
|
|
|
|
|
;; URL: https://git.kj2.me/kj/confi-emacs-actual
|
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
2023-04-14 18:39:19 +02:00
|
|
|
|
;; Aquí se encuentran todas las configuraciones relacionadas a org-mode.
|
|
|
|
|
;;
|
|
|
|
|
;; org-mode es un de los reclamos más potentes de Emacs. Aunque solo es
|
|
|
|
|
;; un formato de texto enrriquecido, básicamente algo similar a
|
|
|
|
|
;; markdown, Emacs es el que lo ha llevado muy bien y probalemente el que
|
|
|
|
|
;; mejor lo soporta.
|
|
|
|
|
;;
|
|
|
|
|
;; Cabe mencionar que este modo es también el predefinido para todo un
|
|
|
|
|
;; ecosistema dentro de Emacs, como es el caso de la agenda o la base de
|
|
|
|
|
;; conocimientos org-roam.
|
|
|
|
|
|
2022-04-21 19:45:31 +02:00
|
|
|
|
;;; Code:
|
|
|
|
|
(defun kj/org-hook ()
|
|
|
|
|
"Configuración para el hook de 'org-mode'."
|
2022-05-04 05:23:46 +02:00
|
|
|
|
|
2022-04-21 19:45:31 +02:00
|
|
|
|
(display-line-numbers-mode 0)
|
2023-09-30 23:44:13 +02:00
|
|
|
|
;; (variable-pitch-mode 1)
|
2022-04-21 19:45:31 +02:00
|
|
|
|
(visual-line-mode 1)
|
|
|
|
|
(visual-fill-column-mode 1)
|
|
|
|
|
|
2022-05-04 05:23:46 +02:00
|
|
|
|
;; Configuración de fonts
|
2022-05-05 07:59:45 +02:00
|
|
|
|
;; (set-face-attribute (car face) nil :font "Cantarell" :weight 'regular :height (cdr face))
|
2022-05-04 05:23:46 +02:00
|
|
|
|
|
|
|
|
|
;; Ensure that anything that should be fixed-pitch in Org files appears that way
|
2023-04-14 02:39:58 +02:00
|
|
|
|
;; (set-face-attribute 'org-hide nil :inherit 'fixed-pitch)
|
|
|
|
|
;; (set-face-attribute 'org-block nil :foreground 'unspecified :inherit 'fixed-pitch)
|
|
|
|
|
;; (set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch))
|
2023-09-25 03:34:06 +02:00
|
|
|
|
(setq org-fontify-quote-and-verse-blocks t) ;; Permitir configuración de bloques quote y verse.
|
2023-10-15 17:56:32 +02:00
|
|
|
|
;; (set-face-attribute 'org-block nil :underline nil :foreground nil :background "#282a36")
|
2023-09-25 03:34:06 +02:00
|
|
|
|
;; (set-face-attribute 'org-block-begin-line nil :underline nil :foreground nil :background "#1e1f28")
|
|
|
|
|
;; (set-face-attribute 'org-block-end-line nil :underline nil :foreground nil :background nil)
|
2023-09-30 23:45:42 +02:00
|
|
|
|
;; (set-face-attribute 'org-block-end-line nil :background 'unspecified)
|
2022-05-04 05:23:46 +02:00
|
|
|
|
(set-face-attribute 'org-table nil :inherit '(shadow fixed-pitch))
|
|
|
|
|
(set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
|
|
|
|
|
(set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
|
|
|
|
|
(set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch))
|
|
|
|
|
(set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch)
|
|
|
|
|
|
2023-09-30 23:45:42 +02:00
|
|
|
|
;; (set-face-attribute 'org-block nil :background
|
|
|
|
|
;; (color-darken-name
|
|
|
|
|
;; (face-attribute 'default :background) 3))
|
|
|
|
|
|
|
|
|
|
;; (setq org-src-block-faces '(("emacs-lisp" (:background "#EEE2FF"))
|
|
|
|
|
;; ("python" (:background "#E5FFB8"))))
|
|
|
|
|
|
2022-05-04 05:23:46 +02:00
|
|
|
|
;; Tachar los elementos "DONE"
|
|
|
|
|
(set-face-attribute 'org-done nil :strike-through t)
|
|
|
|
|
(set-face-attribute 'org-headline-done nil
|
|
|
|
|
:strike-through t
|
|
|
|
|
:foreground "light gray")
|
|
|
|
|
|
2023-09-24 22:08:26 +02:00
|
|
|
|
;; Embellecer las prioridades
|
|
|
|
|
(setq org-highest-priority ?A
|
|
|
|
|
org-default-priority ?B
|
|
|
|
|
org-lowest-priority ?D) ;; Cambiar prioridades de A,B,C a A,B,C,D
|
|
|
|
|
(push '("[#A]" . "⚡" ) prettify-symbols-alist)
|
|
|
|
|
(push '("[#B]" . "🔥" ) prettify-symbols-alist)
|
|
|
|
|
(push '("[#C]" . "🐢" ) prettify-symbols-alist)
|
|
|
|
|
(push '("[#D]" . "☕" ) prettify-symbols-alist)
|
2023-09-30 23:46:46 +02:00
|
|
|
|
;; (push '("#+begin_quote" . "❝" ) prettify-symbols-alist)
|
|
|
|
|
;; (push '("#+end_quote" . "❞" ) prettify-symbols-alist)
|
|
|
|
|
;; (push '("#+begin_export" . "📤" ) prettify-symbols-alist)
|
|
|
|
|
;; (push '("#+end_export" . "⎯" ) prettify-symbols-alist)
|
|
|
|
|
;; (push '("#+begin_comment" . "📝" ) prettify-symbols-alist)
|
|
|
|
|
;; (push '("#+end_comment" . "⎯" ) prettify-symbols-alist)
|
|
|
|
|
;; (push '("#+begin_src" . "❯" ) prettify-symbols-alist)
|
|
|
|
|
;; (push '("#+end_src" . "⎯" ) prettify-symbols-alist)
|
|
|
|
|
;; (push '("#+begin_example" . "🦉" ) prettify-symbols-alist)
|
|
|
|
|
;; (push '("#+end_example" . "⎯" ) prettify-symbols-alist)
|
2023-09-24 22:08:26 +02:00
|
|
|
|
(prettify-symbols-mode)
|
2024-04-22 01:20:54 +02:00
|
|
|
|
|
|
|
|
|
;; Habilitar evaluación de lenguajes en org-mode (babel)
|
|
|
|
|
(org-babel-do-load-languages 'org-babel-load-languages
|
|
|
|
|
(append org-babel-load-languages
|
|
|
|
|
'(
|
|
|
|
|
(C . t)
|
|
|
|
|
(R . t)
|
|
|
|
|
(awk . t)
|
2024-04-22 02:18:42 +02:00
|
|
|
|
(calc . t)
|
2024-04-22 01:20:54 +02:00
|
|
|
|
(clojure . t)
|
|
|
|
|
(go . t)
|
|
|
|
|
(haskell . t)
|
|
|
|
|
(java . t)
|
|
|
|
|
(js . t)
|
|
|
|
|
(php . t)
|
|
|
|
|
(python . t)
|
|
|
|
|
(rust . t)
|
|
|
|
|
(translate . t)
|
2024-04-22 02:19:33 +02:00
|
|
|
|
(shell . t)
|
2024-04-22 01:20:54 +02:00
|
|
|
|
)))
|
2024-04-22 02:20:16 +02:00
|
|
|
|
;; No solicitar confirmación para evaluar
|
|
|
|
|
(setq org-confirm-babel-evaluate nil)
|
2022-05-05 07:59:45 +02:00
|
|
|
|
)
|
2022-04-21 19:45:31 +02:00
|
|
|
|
|
2023-04-13 11:11:39 +02:00
|
|
|
|
;; org-mode
|
2022-04-21 19:45:31 +02:00
|
|
|
|
(use-package org
|
|
|
|
|
:defer t
|
2024-04-04 00:40:00 +02:00
|
|
|
|
:ensure nil
|
2022-06-01 15:18:06 +02:00
|
|
|
|
:bind (("C-c a" . org-agenda)
|
2022-12-16 06:15:05 +01:00
|
|
|
|
("C-c c" . org-capture))
|
2022-04-21 19:45:31 +02:00
|
|
|
|
:hook
|
|
|
|
|
(org-mode . kj/org-hook)
|
|
|
|
|
:config
|
|
|
|
|
(setq org-ellipsis " ▾")
|
|
|
|
|
(setq org-hide-emphasis-markers t)
|
2022-08-11 18:15:30 +02:00
|
|
|
|
;;(setq org-startup-folded 'content)
|
2022-04-21 19:45:31 +02:00
|
|
|
|
|
|
|
|
|
(setq org-agenda-start-with-log-mode t)
|
|
|
|
|
(setq org-log-done 'time)
|
|
|
|
|
(setq org-log-into-drawer t)
|
2022-07-17 22:12:43 +02:00
|
|
|
|
(setq org-cycle-separator-lines -1)
|
2022-04-21 19:45:31 +02:00
|
|
|
|
|
2022-05-04 05:23:46 +02:00
|
|
|
|
;; Identación
|
2022-05-05 07:59:45 +02:00
|
|
|
|
(setq org-startup-indented t)
|
|
|
|
|
(setq org-src-preserve-indentation nil)
|
|
|
|
|
(setq org-edit-src-content-indentation 0)
|
|
|
|
|
(setq org-src-tab-acts-natively t)
|
2022-04-21 19:45:31 +02:00
|
|
|
|
|
|
|
|
|
;; Palabras claves del To Do de org-mode
|
|
|
|
|
(setq org-todo-keywords
|
|
|
|
|
;;'((sequence "☐" "✔" "⌛" "❌")))
|
|
|
|
|
'((sequence "TODO(t)" "DOING(n)" "WAITING(w)" "|" "DONE(d!)" "CANCELED(c!)")))
|
|
|
|
|
(setq org-todo-keyword-faces
|
|
|
|
|
'(("TODO" . "#ff6464")
|
|
|
|
|
("DOING" . "yellow")
|
|
|
|
|
("DONE" . "green")
|
2024-04-22 06:19:26 +02:00
|
|
|
|
("HOLD" . "orange")
|
2022-04-21 19:45:31 +02:00
|
|
|
|
("CANCELED" . "#aaa"))
|
|
|
|
|
)
|
|
|
|
|
|
2022-05-04 05:23:46 +02:00
|
|
|
|
;; Tachar los checkbox marcados como terminados
|
|
|
|
|
(defface org-checkbox-done-text
|
|
|
|
|
'((t (:foreground "#71696A" :strike-through t)))
|
|
|
|
|
"Face for the text part of a checked org-mode checkbox.")
|
|
|
|
|
|
|
|
|
|
(font-lock-add-keywords
|
|
|
|
|
'org-mode
|
|
|
|
|
`(("^[ \t]*\\(?:[-+*]\\|[0-9]+[).]\\)[ \t]+\\(\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\[\\(?:X\\|\\([0-9]+\\)/\\2\\)\\][^\n]*\n\\)"
|
|
|
|
|
1 'org-checkbox-done-text prepend))
|
|
|
|
|
'append)
|
|
|
|
|
|
2022-04-21 19:45:31 +02:00
|
|
|
|
;; Archivos a usarse en org-agenda
|
|
|
|
|
(setq org-agenda-files
|
2022-09-10 22:32:50 +02:00
|
|
|
|
'("~/Documentos/ORG/Agenda/Tareas.org")
|
2022-04-21 19:45:31 +02:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;; Archivos entre los que se moverán las tareas
|
|
|
|
|
(setq org-refile-targets
|
|
|
|
|
'(("Archivo.org" :maxlevel . 1)
|
|
|
|
|
("Tareas.org" :maxlevel . 1)))
|
|
|
|
|
|
|
|
|
|
;; Guardar los archivos cuando se muevan tareas entre ellos
|
|
|
|
|
(advice-add 'org-refile :after 'org-save-all-org-buffers)
|
|
|
|
|
|
|
|
|
|
(setq org-capture-templates
|
2022-06-27 22:00:04 +02:00
|
|
|
|
`(("t" "Tareas")
|
2022-05-10 02:28:50 +02:00
|
|
|
|
("tt" "Tareas" entry (file+olp "~/Documentos/ORG/Agenda/Tareas.org")
|
2022-06-07 09:08:03 +02:00
|
|
|
|
"* TODO %? \n %a\n %i" :empty-lines 1)
|
2022-04-21 19:45:31 +02:00
|
|
|
|
)
|
|
|
|
|
)
|
2022-09-07 03:57:18 +02:00
|
|
|
|
|
|
|
|
|
;; Configuración de imágenes
|
|
|
|
|
(setq org-startup-with-inline-images t) ;; Mostrar por defecto las imágenes
|
|
|
|
|
(setq org-display-remote-inline-images 'cache) ;; Mostrar imágenes remotas
|
|
|
|
|
(setq org-image-actual-width 512)
|
2023-09-30 23:47:50 +02:00
|
|
|
|
)
|
2022-09-07 03:57:18 +02:00
|
|
|
|
|
2023-09-30 23:47:50 +02:00
|
|
|
|
;; Org-yt para soportar embebidos.
|
|
|
|
|
(use-package org-yt
|
2024-04-26 08:20:53 +02:00
|
|
|
|
:after org
|
2024-04-04 00:40:00 +02:00
|
|
|
|
:ensure (:host github :repo "TobiasZawada/org-yt")
|
2023-09-30 23:47:50 +02:00
|
|
|
|
:config
|
2022-09-07 03:57:18 +02:00
|
|
|
|
(defun org-http-image-data-fn (protocol link _description)
|
|
|
|
|
"Interpret LINK as an URL to an image file."
|
|
|
|
|
(when (and (image-type-from-file-name link)
|
|
|
|
|
(not (eq org-display-remote-inline-images 'skip)))
|
|
|
|
|
(if-let (buf (url-retrieve-synchronously (concat protocol ":" link)))
|
|
|
|
|
(with-current-buffer buf
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(re-search-forward "\r?\n\r?\n" nil t)
|
|
|
|
|
(buffer-substring-no-properties (point) (point-max)))
|
|
|
|
|
(message "Download of image \"%s\" failed" link)
|
|
|
|
|
nil)))
|
|
|
|
|
(org-link-set-parameters "http" :image-data-fun #'org-http-image-data-fn)
|
|
|
|
|
(org-link-set-parameters "https" :image-data-fun #'org-http-image-data-fn)
|
2022-04-21 19:45:31 +02:00
|
|
|
|
)
|
|
|
|
|
|
2023-04-13 11:11:39 +02:00
|
|
|
|
;; Los head "*" se ven como puntos
|
2024-04-22 03:18:20 +02:00
|
|
|
|
(use-package org-bullets
|
|
|
|
|
:defer t
|
|
|
|
|
:hook
|
|
|
|
|
(org-mode . org-bullets-mode)
|
|
|
|
|
:config
|
|
|
|
|
(setq org-bullets-bullet-list '("◉"
|
|
|
|
|
"○"
|
|
|
|
|
"●"
|
|
|
|
|
"◈"
|
|
|
|
|
"◇"
|
|
|
|
|
"◆"
|
|
|
|
|
"✸"
|
|
|
|
|
"✳"))
|
|
|
|
|
)
|
2024-04-22 03:00:06 +02:00
|
|
|
|
|
|
|
|
|
;; Mejora visualmente varias cosas de org
|
|
|
|
|
(use-package org-modern
|
2022-05-05 07:59:45 +02:00
|
|
|
|
:defer t
|
2024-04-22 03:00:06 +02:00
|
|
|
|
:ensure t
|
2024-04-22 03:17:31 +02:00
|
|
|
|
:hook ((org-mode . org-modern-mode)
|
|
|
|
|
(org-agenda . org-modern-mode))
|
2024-04-22 02:20:52 +02:00
|
|
|
|
:config
|
2024-04-22 03:00:06 +02:00
|
|
|
|
;; Me gustan varias cosas por defecto, así que desactivo aquí varias de las "mejoras"
|
|
|
|
|
(setq org-modern-table nil ;; Mejora visual de las tablas
|
|
|
|
|
org-modern-table-vertical 1 ;; Grosor de las líneas verticales de las tablas
|
|
|
|
|
org-modern-table-horizontal 0.2 ;; Grosor de las líneas horizontales de las tablas
|
|
|
|
|
org-modern-priority nil ;; Mejora de las prioridades (Arriba ya las puse bonitas con prettyfy-symbols, así que mejor está desactivado)
|
|
|
|
|
org-modern-todo nil ;; Mejora visual a las lista de tareas
|
|
|
|
|
org-modern-statistics nil ;; Mejora visual a las estadísticas de completado de uan tarea (ej: [50%] o [5/9])
|
|
|
|
|
org-modern-checkbox nil ;; Mejora de los checkboxes (a mi parecer se ven más feos, los por defecto ya están bonitos).
|
|
|
|
|
org-modern-keyword nil ;; Oculta el "#+" en los keywords de org
|
|
|
|
|
org-modern-block-name nil ;; Mejora visual para los org blocks (bloques de código, ejemplo, citas, etc.)
|
2024-04-22 03:18:20 +02:00
|
|
|
|
org-modern-star nil ;; Lista de bullets a usar en los headers (falla si se activa junto a org-bullets).
|
2024-04-26 23:41:00 +02:00
|
|
|
|
org-modern-list nil)
|
2024-04-22 02:20:52 +02:00
|
|
|
|
)
|
2022-04-21 19:45:31 +02:00
|
|
|
|
|
|
|
|
|
(use-package visual-fill-column
|
2023-04-14 00:31:51 +02:00
|
|
|
|
:defer t
|
|
|
|
|
:after (org)
|
2022-04-21 19:45:31 +02:00
|
|
|
|
:config
|
|
|
|
|
;; Tamaño de la columna
|
2022-05-05 07:59:45 +02:00
|
|
|
|
(setq-default visual-fill-column-width 150)
|
2022-04-21 19:45:31 +02:00
|
|
|
|
;; Centrar el texto
|
2023-04-14 00:31:51 +02:00
|
|
|
|
(setq-default visual-fill-column-center-text t
|
|
|
|
|
visual-fill-column-adjust-for-text-scale nil
|
|
|
|
|
visual-fill-column-enable-sensible-window-split t)
|
2022-04-21 19:45:31 +02:00
|
|
|
|
)
|
|
|
|
|
|
2023-04-13 11:11:39 +02:00
|
|
|
|
;; Segundo cerebro: Base de conocimientos en formato Zettelkasten
|
2022-05-06 02:04:23 +02:00
|
|
|
|
(use-package org-roam
|
|
|
|
|
:defer t
|
|
|
|
|
:ensure t
|
2022-06-01 15:18:06 +02:00
|
|
|
|
:bind (("<f4>" . org-roam-node-insert)
|
|
|
|
|
("<f3>" . org-roam-node-find))
|
2022-05-06 02:04:23 +02:00
|
|
|
|
:init
|
|
|
|
|
(setq org-roam-v2-ack t)
|
|
|
|
|
(setq org-roam-completion-system 'ivy)
|
|
|
|
|
:custom
|
2022-05-10 02:28:50 +02:00
|
|
|
|
(org-roam-directory "~/Documentos/ORG/Notas")
|
2022-05-06 02:04:23 +02:00
|
|
|
|
(org-roam-completion-everywhere t)
|
|
|
|
|
:config
|
|
|
|
|
(org-roam-setup))
|
|
|
|
|
|
2023-04-13 11:11:39 +02:00
|
|
|
|
;; Interface web para navegar en mi base de conocimientos.
|
2022-05-09 01:00:07 +02:00
|
|
|
|
(use-package org-roam-ui
|
|
|
|
|
:defer t
|
|
|
|
|
:ensure t
|
|
|
|
|
: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))
|
|
|
|
|
|
2023-04-13 11:11:39 +02:00
|
|
|
|
;; Continúa el formato de la lista cuando presionas enter.
|
2022-06-27 22:00:04 +02:00
|
|
|
|
(use-package org-autolist
|
2024-04-26 08:20:53 +02:00
|
|
|
|
:defer t
|
2022-06-27 22:00:04 +02:00
|
|
|
|
:ensure t
|
|
|
|
|
:hook (org-mode . org-autolist-mode))
|
|
|
|
|
|
2024-04-22 01:20:54 +02:00
|
|
|
|
;; Org babel para PHP
|
|
|
|
|
(use-package ob-php
|
|
|
|
|
:defer t
|
|
|
|
|
:ensure t)
|
|
|
|
|
|
|
|
|
|
;; Org babel para GO
|
|
|
|
|
(use-package ob-go
|
|
|
|
|
:defer t
|
|
|
|
|
:ensure t)
|
|
|
|
|
|
|
|
|
|
;; Org babel para Rust
|
|
|
|
|
(use-package ob-rust
|
|
|
|
|
:defer t
|
|
|
|
|
:ensure t)
|
|
|
|
|
|
|
|
|
|
;; Org babel para traducciones (mediante google translate)
|
|
|
|
|
(use-package ob-translate
|
|
|
|
|
:defer t
|
|
|
|
|
:ensure t)
|
|
|
|
|
|
2023-04-14 00:31:51 +02:00
|
|
|
|
;; Org mode en modo presentación
|
|
|
|
|
(use-package org-present
|
|
|
|
|
:defer t
|
|
|
|
|
:after (org)
|
|
|
|
|
:config
|
|
|
|
|
(add-hook 'org-present-mode-hook
|
|
|
|
|
(lambda ()
|
|
|
|
|
(org-display-inline-images)
|
|
|
|
|
(org-present-hide-cursor)
|
|
|
|
|
(org-present-read-only)
|
|
|
|
|
))
|
|
|
|
|
(add-hook 'org-present-mode-quit-hook
|
|
|
|
|
(lambda ()
|
|
|
|
|
;; (org-remove-inline-images)
|
|
|
|
|
(org-present-show-cursor)
|
|
|
|
|
(org-present-read-write)))
|
|
|
|
|
|
|
|
|
|
(add-hook 'org-present-after-navigate-functions
|
|
|
|
|
(lambda ()
|
|
|
|
|
;; Show only top-level headlines
|
|
|
|
|
(org-overview)
|
|
|
|
|
;; Unfold the current entry
|
|
|
|
|
(org-show-entry)
|
|
|
|
|
;; Show only direct subheadings of the slide but don't expand them
|
|
|
|
|
(org-show-children)
|
|
|
|
|
))
|
|
|
|
|
)
|
|
|
|
|
|
2023-09-25 03:33:16 +02:00
|
|
|
|
;; Mostrar los caracteres ocultos de org mode al pasar con el cursor.
|
|
|
|
|
(use-package org-appear
|
|
|
|
|
:defer t
|
2024-04-22 02:24:28 +02:00
|
|
|
|
;; :hook (org-mode . org-appear-mode)
|
|
|
|
|
)
|
2023-09-25 03:33:16 +02:00
|
|
|
|
|
|
|
|
|
;; Polymode para org-mode
|
2024-04-25 22:54:11 +02:00
|
|
|
|
;; (use-package poly-org)
|
2023-09-25 03:33:16 +02:00
|
|
|
|
|
2022-11-19 04:33:22 +01:00
|
|
|
|
(provide 'init-org)
|
|
|
|
|
;;; init-org.el ends here
|