From eb7bf78ec408d7f692b9f948743484ddc00046bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Alvari=C3=B1o?= Date: Tue, 22 Mar 2022 14:53:33 +0100 Subject: [PATCH] Add orgmode configuration - Main org-mode functions works fine now --- myconfig.org | 240 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 238 insertions(+), 2 deletions(-) diff --git a/myconfig.org b/myconfig.org index 1a79eca..31253e7 100644 --- a/myconfig.org +++ b/myconfig.org @@ -408,13 +408,13 @@ Some notes about [[https://github.com/jwiegley/use-package][use-package]] #+begin_src emacs-lisp (use-package bufler ) - (defun sap/bufler-one-window (&optional force-refresh) + (defun slv/bufler-one-window (&optional force-refresh) (interactive "P") (bufler-list) (delete-other-windows) ) - (global-set-key (kbd "C-x C-b") 'sap/bufler-one-window) + (global-set-key (kbd "C-x C-b") 'slv/bufler-one-window) #+end_src ** Hydra @@ -672,6 +672,242 @@ This is only a defun for settings additional details in =org-mode= ) #+end_src +** org-mode (configuración) +References: +- [[https://orgmode.org/worg/org-tutorials/org-custom-agenda-commands.html][org-agenda custom commands]] +- [[https://orgmode.org/worg/org-tutorials/org-custom-agenda-commands.html][org-custom-agenda commands]] + +Configuring: +- =:hook= section: + - Sets =variable-pitch-mode= on + - Sets =visual-line-mode= on, when using this mode you should avoid using =M-q= (=org-fill-paragraph=). Just use =enter= to finish a paragraph. + - Call =slv/org-font-setup= function, this function, defined in the section above, sets the fonts for =org-mode=. +- =:custom= section: + - Sets a new =org-elipsis= symbol. This is the symbol to be used instead of =...= for folded sections + - Sets the org files directory (Dropbox for me) + - Sets a sound for =org-clock-sound= + - Sets the default notes file: =i.org= + - Disables =html postamble= + - Disables block execution confirmation for =org-babel= + - Enables default fontification, indenting and folding + - Sets the refile target file =refile=, so far only =Archive.org=, for finished tasks; but we could add more in the future. + - Sets apps for =.html= and =.pdf= (for =org-mode= exported files) + - Sets the **agenda** options + - Definimos los ficheros de entrada para la agenda + - Definimos vistas /custom/ para la agenda **en Revisión** + - =c= Vista simple de agenda (Próximos dias y vista de todas las taras =TODO=) + - Definimos /capture templates/ para la captura de entradas en los ficheros =.org= + - Fichero =i.org= o lo que es lo mismo: =org-default-notes-file= + - =p= captura de nuevo proyecto (básicamente una forma de agrupar tareas) + - =t= captura de tarea + - =m= tarea /enviar correo/ va a una sección especial + - =c= tarea compra, va a la sección de compras + - =l= enlace, si no hay tiempo se puede capturar aquí pero *tiene que ir a los blogs* + - =r= referencia, si no hay tiempo se puede capturar aquí pero *tiene que ir a los blogs* + - Fichero =notes.org= + - =n= añadir nota al fichero + - Fichero =b.org= , se supone que captura ideas para el blog público + - =b= añadir entrada al fichero + - Fichero =blog_privado.org=, captura de ideas para el blog privado + - Fichero =events.org= + - Fichero =historiales.org= +- Seccion =:config= + - Añadimos el módulo =org-habit= a la lista =org-modules=, este módulo habilita la visualización especial de los hábitos en las vistas de agenda + - Definimos un /advice/ para garantizar que se salvan todos los ficheros =.org= cada vez que hacemos una operación de /refile/ + - Definimos la función =make-capture-frame= y una serie de advices para modificarla. Esta función se define para poder asociar un atajo de teclado del sistema a la captura de tareas de Emacs, funciona pero **pendiente de revisión** + - Establecemos un factor de escala para la imágenes renderizadas a partir de código LaTeX en el org-mode. Por defecto son demasiado pequeñas + +#+begin_src emacs-lisp + (use-package org + :hook + (org-mode . variable-pitch-mode) + (org-mode . visual-line-mode) + (org-mode . slv/org-font-setup) + :custom + (org-ellipsis " ▾") + (org-directory "~/Dropbox/orgfiles") ;; De momento ficheros en Dropbox + (org-clock-sound (concat org-directory "/sound/news-ting.wav")) + (org-default-notes-file (concat org-directory "/i.org")) ;; Fichero de notas por defecto 'I' + (org-export-html-postamble nil) ;; No queremos volcar información en el postamble al exportar html + (org-confirm-babel-evaluate nil) + (org-src-fontify-natively t) + (org-indent-mode t) + (org-startup-indented t) + (org-startup-folded (quote overview)) + (org-refile-targets (quote(("~/Dropbox/orgfiles/Archive.org" :maxlevel . 1) + ))) + + ;; org applications for html and pdf files + (org-file-apps + (append '( + ("\\.pdf\\'" . "evince %s") + ("\\.x?html?\\'" . "/usr/bin/firefox %s") + ) org-file-apps ) + ) + + ;; Configurando org-agenda + (org-agenda-start-on-weekday nil) ;; La vista de agenda empieza en el dia de hoy + (org-agenda-files (list "~/Dropbox/orgfiles/i.org" ;; Los ficheros con entradas para la agenda + "~/Dropbox/orgfiles/b.org" + "~/Dropbox/orgfiles/notes.org" + "~/Dropbox/orgfiles/historiales.org" + "~/Dropbox/orgfiles/habits.org" + "~/work/repos/Personal/blog/comacero_priv/content-org/blog_privado.org" + ;; "~/share/Mob_orgzly/phone.org" + )) + ;;-------------------------------------------------- + ;; Vistas de la agenda + (org-agenda-custom-commands + '( + ("c" "Simple agenda view" + ((agenda "") + (alltodo ""))) + ("d" "Dashboard" + ((agenda "" ((org-deadline-warning-days 7))) + (todo "NEXT" + ((org-agenda-overriding-header "Next Tasks"))) + (todo "PROJ" ((org-agenda-overriding-header "Active Projects"))))) + ("n" "Next Tasks" + ((todo "NEXT" + ((org-agenda-overriding-header "Next Tasks")))) + ) + ("r" "Test queries" tags "errand" + ((org-agenda-files '("~/Dropbox/orgfiles/i.org")) + (org-agenda-sorting-strategy '(priority-up effort-down)) + ) + ) + ("w" "Workflow Status" + ((todo "WAIT" + ((org-agenda-overriding-header "Waiting on External") + (org-agenda-files org-agenda-files))) + (todo "REVIEW" + ((org-agenda-overriding-header "In Review") + (org-agenda-files org-agenda-files))) + (todo "PLAN" + ((org-agenda-overriding-header "In Planning") + (org-agenda-todo-list-sublevels nil) + (org-agenda-files org-agenda-files))) + (todo "BACKLOG" + ((org-agenda-overriding-header "Project Backlog") + (org-agenda-todo-list-sublevels nil) + (org-agenda-files org-agenda-files))) + (todo "READY" + ((org-agenda-overriding-header "Ready for Work") + (org-agenda-files org-agenda-files))) + (todo "ACTIVE" + ((org-agenda-overriding-header "Active Projects") + (org-agenda-files org-agenda-files))) + (todo "COMPLETED" + ((org-agenda-overriding-header "Completed Projects") + (org-agenda-files org-agenda-files)))) + ) + ) + ) + ;;-------------------------------------------------- + ;; org-capture-templates definitions + (org-capture-templates + '( + ;;-------------------- + ("p" "Proyecto" entry (file+headline org-default-notes-file "Proyectos") + "* %^{Descripcion} %^g\n%?" + :prepend t + :empty-lines 1) + ;;-------------------- + ("t" "Tarea" entry (file+headline org-default-notes-file "Tareas") + "* TODO %^u %^{Descripcion} %^g + :PROPERTIES: + :Effort: %^{effort|1:00|0:05|0:15|0:30|2:00|4:00} + :Beat: %^{beat|Now|ASAP|SDM} + :END:\n %?" + :prepend t) + ;;-------------------- + ("m" "Tarea Mail" entry (file+olp org-default-notes-file "Tareas" "Correos") + "* TODO %^{Descripcion}\n:PROPERTIES:\n:Plat: %^{plat|gmail|proton|tuta}\n:Effort: %^{effort|1:00|0:05|0:15|0:30|2:00|4:00}\n:END:\nCapturado %<%Y-%m-%d %H:%M>" + :prepend t) + ;;-------------------- + ("c" "Compra" entry (file+headline org-default-notes-file "Compras") + "* TODO %^{Descripcion} %?\n:PROPERTIES:\n:Plat: %^{plat|unk|aliexpress|amazon|ebay}\n:Precio: %^{precio|20|50|100|200|500}\n:END:\n%<%Y-%m-%d>" + :prepend t + :empty-lines 1) + ;;-------------------- + ("r" "Referencia" entry (file+headline org-default-notes-file "Referencias") + "* %^{Descripcion} %^g\n%?" + :prepend t + :empty-lines 1) + ;;-------------------- + ("l" "Enlace" entry (file+headline org-default-notes-file "Enlaces") + "* [[%^{link}][%^{Descripcion}]]" + :prepend t) + ;;-------------------- org-default-notes-file + ("n" "Nota" entry (file+headline "~/Dropbox/orgfiles/notes.org" "Notas") + "* %^{Descripcion} %u %^g\n%? " + :prepend t + :empty-lines 1) + ;;-------------------- + ("b" "Blog Publico" entry (file+headline "~/Dropbox/orgfiles/b.org" "Pendiente") + "* TODO %^{Tareas} %^g + :PROPERTIES: + :EXPORT_FILE_NAME: %^{mdFilename} + :EXPORT_HUGO_CUSTOM_FRONT_MATTER: :summary %^{summary} + :END: + Capturado %<%Y-%m-%d %H:%M>\n%^{cuerpo}" + :empty-lines 1) + ;;-------------------- + ("s" "Blog Privado" entry (file+headline "~/work/repos/Personal/blog/comacero_priv/content-org/blog_privado.org" "Pendiente") + "* TODO %^{Tareas} %^g + :PROPERTIES: + :EXPORT_FILE_NAME: %^{mdFilename} + :EXPORT_HUGO_CUSTOM_FRONT_MATTER: :summary %^{summary} + :END: + Capturado %<%Y-%m-%d %H:%M>\n%^{cuerpo}" + :empty-lines 1) + + )) + :config + ;; add modules to org-modules + (add-to-list 'org-modules 'org-habit t) ;; Add org-habit for habit visualization in agenda views + + (advice-add 'org-refile :after 'org-save-all-org-buffers) ;; save all org buffers after every refile operation + + ;;------------------------------------------ + ;; No tengo claro como funcionan exactamente los siguientes advices + ;; Creo que se añaden para redefinir el comportamiento de la + ;; captura de tareas definida en 'make-capture-frame' + (defadvice org-capture-finalize + (after delete-capture-frame activate) + "Advise capture-finalize to close the frame" + (if (equal "capture" (frame-parameter nil 'name)) + (delete-frame)) + ) + (defadvice org-capture-destroy + (after delete-capture-frame activate) + "Advise capture-destroy to close the frame" + (if (equal "capture" (frame-parameter nil 'name)) + (delete-frame)) + ) + (use-package noflet + :ensure t ) + ;;------------------------------ + ;; Define a global key on your system to emacsclient -ne "(make-capture-frame)" + (defun make-capture-frame () + "Create a new frame and run org-capture." + (interactive) + (make-frame '((name . "capture"))) + (select-frame-by-name "capture") + (delete-other-windows) + (noflet ((switch-to-buffer-other-window (buf) (switch-to-buffer buf))) + (org-capture)) + ) + ;;----------------------------- + ;; Scale up LaTeX rendered images + (plist-put org-format-latex-options :scale 4) + + :bind + ("\C-ca" . 'org-agenda) + ("\C-cc" . 'org-capture) + ) +#+end_src + * flycheck Syntax checking for programming languages