Re-enable org-mode

Use en_IE (English Ireland) in favour of de_CH where possible
This commit is contained in:
Andreas Zweili 2023-11-28 18:26:04 +01:00
parent 11e1269cef
commit 54c121dc41
8 changed files with 292 additions and 6 deletions

View File

@ -93,6 +93,8 @@ in
epkgs.smooth-scrolling
epkgs.solarized-theme
epkgs.string-inflection
epkgs.org-superstar
epkgs.ox-pandoc
epkgs.swiper
epkgs.system-packages
epkgs.treemacs

View File

@ -5,8 +5,8 @@
:commands (deft)
:config
(add-to-list 'evil-emacs-state-modes 'deft-mode)
(setq deft-extensions '("md")
deft-default-extension "md"
(setq deft-extensions '("md" "org" "txt")
deft-default-extension "org"
deft-markdown-mode-title-level 1
deft-auto-save-interval 300.0
deft-file-limit 50

View File

@ -38,6 +38,7 @@
(add-hook 'find-file-hook #'denote-link-buttonize-buffer)
(setq denote-rename-buffer-mode 1
denote-excluded-directories-regexp "99_archive"
denote-file-type "markdown-yaml"
denote-file-type "org"
denote-directory "~/nextcloud/10_documents/"
denote-org-front-matter "#+title: %s\n#+date: %s\n#+filetags: %s\n#+identifier: %s\n#+author: Andreas Zweili\n\n"
denote-yaml-front-matter "---\ntitle: %s\ndate: %s\ntags: %s\nidentifier: %S\n---\n\n")))

View File

@ -0,0 +1,180 @@
(when (boundp 'enable-org)
;; Enable pretty bullets in org mode
(use-package org-superstar
:config
(add-hook 'org-mode-hook (lambda ()
(org-superstar-mode 1))))
(use-package ox-pandoc
:after org)
(use-package org
:config
;; enable org-mode keys
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-cb" 'org-iswitchb)
;; disable line split with M-RET
(setq org-M-RET-may-split-line (quote ((default))))
;; enable the correct intdentation for source code blocks
(setq org-edit-src-content-indentation 0)
(setq org-src-tab-acts-natively t)
(setq org-src-preserve-indentation t)
;; enable todo and checkbox depencies
(setq org-enforce-todo-dependencies t)
(setq org-enforce-todo-checkbox-dependencies t)
;; quick access for todo states
(setq org-todo-keywords
'((sequence "TODO(t)" "NEXT(n)" "WAITING(w!)" "PROJECT(p)" "|" "DONE(d)")
(sequence "|" "CANCELLED(c)")))
(setq org-log-done 'time)
(setq org-log-into-drawer t)
;; enable org-indent
(setq org-startup-indented t)
;; capture templates
(defun az-org-capture-read-file-name ()
(concat (expand-file-name (read-file-name "PROMPT: " "~/nextcloud/10_documents/01_inbox/")) ".org"))
(setq org-capture-templates
(quote
(("n" "Add note" plain (file az-org-capture-read-file-name)
(file "~/nextcloud/10_documents/99_archive/0000/settings/templates/temp_note.txt"))
)))
;; org-refile options
(setq org-refile-allow-creating-parent-nodes (quote confirm))
(setq org-refile-use-outline-path 'file
org-outline-path-complete-in-steps nil)
(defun az-org-files-list ()
(delq nil
(mapcar (lambda (buffer)
(buffer-file-name buffer))
(org-buffer-list 'files t))))
(setq org-refile-targets '((az-org-files-list :maxlevel . 6)))
(setq org-src-fontify-natively t)
(setq org-highlight-latex-and-related '(latex))
(setq org-image-actual-width (quote (500)))
(setq org-startup-with-inline-images t)
(setq org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id
org-clone-delete-id t)
(setq org-blank-before-new-entry
(quote ((heading . t)
(plain-list-item . auto))))
(setq org-footnote-section "Resources")
(setq org-attach-directory "~/nextcloud/10_documents/99_archive/2023/resources/")
(setq org-todo-keyword-faces
`(("WAITING" :foreground "#0087ff" :weight bold)
("TODO" :foreground "#d75f00" :weight bold)
("PROJECT" :foreground "#626262" :weight bold)
("NEXT" :foreground "#d70000" :weight bold)))
(set-face-attribute 'org-agenda-structure nil :inherit 'default :height 1.00)
(set-face-attribute 'org-agenda-date-weekend nil :height 1.00 :weight 'medium)
(set-face-attribute 'org-agenda-calendar-event nil :weight 'medium)
(set-face-attribute 'org-agenda-date nil :inherit 'default :height 1.00 :weight 'bold)
(set-face-attribute 'org-agenda-date-today nil :slant 'normal :weight 'bold :height 1.00)
(set-face-attribute 'org-done nil :foreground "#5f8700" :weight 'bold)
(set-face-attribute 'org-link nil :foreground "#0087ff" :underline t)
(set-face-attribute 'org-scheduled nil :foreground "#5f8700" :slant 'italic :weight 'normal)
(set-face-attribute 'org-scheduled-previously nil :foreground "#d70000" :weight 'normal)
(set-face-attribute 'org-scheduled-today nil :foreground "#5f8700" :slant 'italic :weight 'normal)
(set-face-attribute 'org-todo nil :background "nil" :foreground "#d70000" :weight 'bold)
(set-face-attribute 'org-upcoming-deadline nil :foreground "#d70000" :weight 'normal)
(set-face-attribute 'org-warning nil :foreground "#d70000" :weight 'normal)
(setq org-startup-shrink-all-tables t)
;; org-export formats
(setq org-export-backends (quote (beamer html latex md odt reveal)))
(setq org-html-html5-fancy t
org-html-doctype "html5")
;; disable the Todo keywords in the export
(setq org-export-with-todo-keywords nil)
;; disable the tags in the export
(setq org-export-with-tags nil)
(setq org-latex-caption-above nil)
(setq org-export-with-sub-superscripts nil)
(setq org-export-with-smart-quotes t)
(setq org-export-headline-levels 5)
;; options for beamer exports
(setq org-beamer-frame-level 2)
(setq org-beamer-outline-frame-options "")
(setq org-beamer-outline-frame-title "Inhalt")
(setq org-beamer-theme "metropolis")
;; options for latex exports
(setq org-latex-classes
(quote
(("beamer" "\\documentclass{beamer}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
("article" "\\documentclass{article}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("report" "\\documentclass[11pt]{report}"
("\\part{%s}" . "\\part*{%s}")
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
("book" "\\documentclass[11pt]{book}"
("\\part{%s}" . "\\part*{%s}")
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")))))
(setq org-latex-default-packages-alist nil)
(setq org-latex-listings 'listings)
(setq org-latex-title-command "\\maketitle\\newpage")
(setq org-latex-toc-command "\\tableofcontents
\\newpage
")
(add-hook 'org-mode-hook
(lambda ()
(add-hook 'before-save-hook 'org-update-cookies-after-save nil 'make-it-local)))
(defun org-summary-todo (n-done n-not-done)
"Switch entry to DONE when all subentries are done, to TODO otherwise."
(let (org-log-done org-log-states) ; turn off logging
(org-todo (if (= n-not-done 0) "DONE" "TODO"))))
(add-hook 'org-mode-hook
(defun az-org-editing ()
"My settings for message composition."
(setq whitespace-line-column 500)
(olivetti-mode)
(turn-off-auto-fill)
(flyspell-mode)))
(add-hook 'org-after-todo-statistics-hook 'org-summary-todo)))

View File

@ -0,0 +1,100 @@
(when (boundp 'enable-org)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; add image from conference phone upload ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; use case is taking a photo of a slide in a conference and uploading
;; it to google drive or dropbox or whatever to get it on your
;; computer. You then want to embed it in an org-mode document by
;; moving it to the same folder and renaming according to the current
;; section of the org file, avoiding name clashes
;; required libraries
(use-package dash
:defer t)
(use-package swiper
:defer t)
(use-package s
:defer t)
(require 'dash)
(require 'swiper)
(require 's)
(load-library "find-lisp")
(global-set-key (kbd "C-c i") 'org-insert-image)
;; start directory
(defvar bjm/conference-image-dir (expand-file-name "~/nextcloud/21_auto_uploads/"))
(defun org-insert-image ()
"Insert image from conference directory, rename and add link in current file.
The file is taken from a start directory set by
`bjm/conference-image-dir' and moved to the current directory, renamed
and embedded at the point as an org-mode link. The user is presented
with a list of files in the start directory, from which to select the
file to move, sorted by most recent first."
(interactive)
(let (file-list target-dir file-list-sorted start-file start-file-full file-ext end-file end-file-base end-file-full file-number)
;; clean directories from list but keep times
(setq file-list
(-remove (lambda (x) (nth 1 x))
(directory-files-and-attributes bjm/conference-image-dir)))
;; get target directory
(setq target-dir (concat (file-name-directory buffer-file-name) "_resources/"))
(unless (file-exists-p target-dir)
(make-directory target-dir))
;; sort list by most recent
;; http://stackoverflow.com/questions/26514437/emacs-sort-list-of-directories-files-by-modification-date
(setq file-list-sorted
(mapcar #'car
(sort file-list
#'(lambda (x y) (time-less-p (nth 6 y) (nth 6 x))))))
;; use ivy to select start-file
(setq start-file (ivy-read
(concat "Move selected file to " target-dir ":")
file-list-sorted
:re-builder #'ivy--regex
:sort nil
:initial-input nil))
;; add full path to start file and end-file
(setq start-file-full
(expand-file-name start-file bjm/conference-image-dir))
;; generate target file name from current org section
(setq file-ext
(file-name-extension start-file t))
;; get section heading and clean it up
(setq end-file-base (s-downcase (s-dashed-words (nth 4 (org-heading-components)))))
;; shorten to first 40 chars to avoid long file names
(setq end-file-base (s-left 40 end-file-base))
;; number to append to ensure unique name
(setq file-number 1)
(setq end-file (concat
end-file-base
(format "-%s" file-number)
file-ext))
;; increment number at end of name if file exists
(while (file-exists-p (concat "_resources/" end-file))
;; increment
(setq file-number (+ file-number 1))
(setq end-file (concat
end-file-base
(format "-%s" file-number)
file-ext)))
;; final file name including path
(setq end-file-full
(expand-file-name end-file target-dir))
;; rename file
(rename-file start-file-full end-file-full)
(message "moved %s to _resources/%s" start-file-full end-file)
;; insert link
(insert (org-make-link-string (format "file:_resources/%s" end-file)))
;; display image
(org-display-inline-images t t))))

View File

@ -23,6 +23,8 @@
(load-file (modules-path "az_markdown.el"))
(load-file (modules-path "az_move_text.el"))
(load-file (modules-path "az_olivetti.el"))
(load-file (modules-path "az_org.el"))
(load-file (modules-path "az_org_insert.el"))
(load-file (modules-path "az_pdf_tools.el"))
(load-file (modules-path "az_spellcheck.el"))

View File

@ -5,5 +5,6 @@
;;(setq enable-font t)
;;(setq enable-lantool t)
;;(setq enable-notes t)
;;(setq enable-org t)
;;(setq enable-pdf-tools t)
;;(setq enable-scroll-bar t)

View File

@ -52,11 +52,11 @@
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {
LC_NUMERIC = "de_CH.UTF-8";
LC_TIME = "de_CH.UTF-8";
LC_TIME = "en_IE.UTF-8";
LC_MONETARY = "de_CH.UTF-8";
LC_PAPER = "de_CH.UTF-8";
LC_PAPER = "en_IE.UTF-8";
LC_TELEPHONE = "de_CH.UTF-8";
LC_MEASUREMENT = "de_CH.UTF-8";
LC_MEASUREMENT = "en_IE.UTF-8";
};
};
console = {