window.MathJax = { tex: { ams: { multlineWidth: '85%' }, tags: 'ams', tagSide: 'right', tagIndent: '.8em' }, chtml: { scale: 1.0, displayAlign: 'center', displayIndent: '0em' }, svg: { scale: 1.0, displayAlign: 'center', displayIndent: '0em' }, output: { font: 'mathjax-modern', displayOverflow: 'overflow' } };

Emacs
Einstellungen mit Org-Mode
Plus zusätzlicher Funktionen, Tricks und Tipps

Inhaltsverzeichnis

1. Einleitung

Einstellungen für mein Emacs innerhalb einer org-mode Datei. Der Aufruf erfolgt in der .emacs Datei mit:

(org-babel-load-file (expand-file-name "/home/ankr/projects/emacs/init/init.org"))

2. Content of .emacs

;; Added by Package.el.  This must come before configurations of
;; installed packages.  Don't delete this line.  If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
;; (package-initialize)

;; Damit die "Package cl is deprecated" Warnung nicht mehr kommt.
(setq byte-compile-warnings '(cl-functions))

;; load my init.el file which includes the non-automatic saved setings
(org-babel-load-file (expand-file-name "/home/ankr/projects/emacs/init/init.org"))

3. Globale Pfade

Hier werden die Pfade und Applikationene definiert, die allerortens genutzt werden.

Anscheinend ist es nicht möglich, beim #+INCLUDE eine Variabel als Pfad anzugeben. Daher sind dort, wenn möglich, die relativen Pfade genutzt worden.

(defvar *browser-path*
  "opera"
  "Path to browser.")

(defvar *pdf-reader-path*
  "okular"
  "Path to PDF reader.")

(defvar *word-path*
  "libreoffice"
  "Path to word processor.")

(defvar *mail-path*
  "kmail"
  "Path to kmail application.")

(defvar *email-outlook-path*
  "c:/Program Files (x86)/Microsoft Office/Office16/OUTLOOK.EXE"
  "Path to email application.
Note: Useful at OS Windows, only.")

(defvar *home-path*
  "/home/ankr/"
  "Path to home folder.")

(defvar *dot-emacs-d-path*
  (concat *home-path* ".emacs.d/")
  "Path to .emacs.d folder.")

(defvar *projects-path*
  ;; "/mnt/nvme0n1p7/projects/"
  (concat *home-path* "projects/")
  "Path to projects folder.")

(defvar *project-emacs-init-path*
  (concat *projects-path* "emacs/init/")
  "Path to init folder.")

(defvar *project-emacs-init-akl-path*
  (concat *project-emacs-init-path* "akl/")
  "Path to init akl folder.")

(defvar *akl/file-list-of-names-n-properties*
  (concat *project-emacs-init-akl-path* "akl-namen.org")
  "The path and filename of the org mode file.
File file contains the data available via
\"*akl/list-of-names-properties*\".")

(defvar *org-notes-path*
  (concat *home-path* "orgnotes/")
  "Path to the org notes folder.")

(defvar *org-notes-journal-path*
  (concat *org-notes-path* "journal/")
  "Path to the org journal folder.")

(defvar *org-notes-roam-path*
  (concat *org-notes-path* "roam/")
  "Path to the org roam folder.")

(defvar *export-publish-destination-path*
  (concat *home-path* "Downloads/")
  "Path to the export destination folder.")

4. Emacs start settings

4.1. Startup Performance

Make startup faster by reducing the frequency of garbage collection and then use a hook to measure Emacs startup time.

Also, turn on lexical-binding for the init file!

;; The default is 800 kilobytes.  Measured in bytes.
(setq gc-cons-threshold (* 50 1000 1000))

;; Profile emacs startup
(add-hook 'emacs-startup-hook
          (lambda ()
            (message "*** Emacs loaded in %s seconds with %d garbage collections."
                     (emacs-init-time "%.2f")
                     gcs-done)))

4.2. Server Mode

Start the Emacs server from this instance so that all emacsclient calls are routed here.

(server-start)

4.3. Custom settings

Die Custom Settings sollen in einer separaten Datei verschwinden.

(setq custom-file (concat *project-emacs-init-path* "custom.el"))
(load custom-file 'noerror)

4.4. Startup message

Disable the start up splash screen.

(setq inhibit-startup-message t)

4.5. Initial Buffer

Switched off because of using the package Dashboard

;; (setq initial-buffer-choice "~/orgnotes/aufgaben.org")

But shall be opened with F8.

(defun akl/open-start-org-file ()
  "Opens the aufgaben.org buffer."
  (interactive)
  (switch-to-buffer (find-file-noselect (concat *org-notes-path* "aufgaben.org")))
)

(global-set-key (kbd "<f8>") 'akl/open-start-org-file)

4.6. Yes or No

Make all "yes or no" prompts show "y or n" instead.

(fset 'yes-or-no-p 'y-or-n-p)

4.7. Fenstermaße beim Start setzen

;; Start maximised (cross-platf)
;; (add-hook 'window-setup-hook 'toggle-frame-maximized t)

(setq initial-frame-alist
      '((top . 0)
        (left . 0)
        (width . 210) ; character
        (height . 65) ; lines
        ))

;; default/subsequent window
(setq default-frame-alist
      '(
        (width . 160) ; character
        (height . 52) ; lines
        ))

4.8. Statusleiste

Uhrzeit und Datum in der unteren Statusleiste.

(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(display-time)

4.9. Tool Bar off

Die Toolbar abschalten.

(if window-system
    (tool-bar-mode -1)
)

4.10. Piep Ton

Schaltet den Pip-Ton ab.

(defun jbn-no-beep())
(setq ring-bell-function 'jbn-no-beep)

4.11. UTF-8

Das Encoding UTF-8 als Standard.

(set-language-environment "UTF-8")
(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(when (display-graphic-p)
   (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)))

Specify font for all unicode characters.

To insert an unicode emoji use the command M-x insert-char (C-x 8 RET) and choose the name in the helm list or insert the hex code.

Sign Name Hex
WHITE SMILING FACE 263a
😀 GRINNING FACE 1F600
😓 FACE WITH COLD SWEAT  
ALARM CLOCK 23f0
LEFTWARDS ARROW 2190
RIGHTWARDS ARROW 2192
WARNING SIGN 26a0
WHITE MEDIUM STAR 2b50
CROSS MARK 274c
NEGATIVE SQUARED CROSS MARK 274e
🔴 LARGE RED CIRCLE 1f534
🔵 LARGE BLUE CIRCLE 1f535
WHITE QUESTION MARK ORNAMENT 2754
CHECK MARK 2713
HEAVY BALLOT X 2718
HEAVY EXCLAMATION MARK ORNAMENT 2762
BLACK RIGHT-POINTING POINTER 25ba
👉 WHITE RIGHT POINTING BACKHAND INDEX  
👈 WHITE LEFT POINTING BACKHAND INDEX  

utf8-latex-fonts.png

Abbildung 1: Original view in Emacs with Org-Mode.

🐄 Beim PDF LaTeX Export funktioniert das leider nicht so einfach. Da ist es dann notwendig zu tricksen. Siehe als Beispiel in der Datei akl-org-exporter.el die Funktion akl/export-to-pdf.

Die Zeichen LEFTWARDS ARROW und RIGHTWARDS ARROW können im Org-Mode auch einfach – LaTeX-üblich – mit <Backslash>name erzeugt werden.

Zeichen Name
rightarrow
Rightarrow
leftarrow
Leftarrow
(when (member "Symbola" (font-family-list))
  (set-fontset-font t 'unicode "Symbola" nil 'prepend))

4.12. Markierter Text bei Eingabe

Ausgewählten Text bei Eingabe löschen.

(delete-selection-mode 1)

4.13. Autoload file

Wenn eine Datei außerhalb von Emacs verändert wurde, soll Emacs das merken und anpassen.

(global-auto-revert-mode t)

4.14. Abkürzungsmodus

Keymapping für dabbrev (default ist M-/) angepasst.

(setq-default abbrev-mode t)
(setq save-abbrevs 'silent) ;; save abbrevs when files are saved

(global-set-key (kbd "<C-S-iso-lefttab>") 'dabbrev-expand)
(define-key minibuffer-local-map (kbd "<C-S-iso-lefttab>") 'dabbrev-expand)

4.15. Holidays Einstellungen

Feiertage ausschalten, die ich nicht benötige.

;; (setq holiday-bahai-holidays nil)
;; (setq holiday-hebrew-holidays nil)
;; (setq holiday-islamic-holidays nil)
(setq calendar-week-start-day 1)
(setq european-calendar-style t)
(setq calendar-time-display-form
      '(24-hours ":" minutes (and time-zone (concat " (" time-zone ")"))))

(setq calendar-abbrev-length 2)

(setq calendar-week-start-day 1
     calendar-day-name-array
     ["Sonntag" "Montag" "Dienstag" "Mittwoch" "Donnerstag" "Freitag" "Samstag"]
     calendar-month-name-array
     ["Januar" "Februar" "März" "April" "Mai" "Juni" "Juli" "August" "September" "Oktober" "November" "Dezember"])


(setq general-holidays
      '((holiday-fixed 1 1 "Neujahr")
        (holiday-fixed 5 1 "1. Mai")
        (holiday-fixed 10 3 "Tag der Deutschen Einheit")))

(setq christian-holidays
      '(
        (holiday-float 12 0 -4 "1. Advent" 24)
        (holiday-float 12 0 -3 "2. Advent" 24)
        (holiday-float 12 0 -2 "3. Advent" 24)
        (holiday-float 12 0 -1 "4. Advent" 24)
        (holiday-fixed 12 25 "1. Weihnachtstag")
        (holiday-fixed 12 26 "2. Weihnachtstag")
        (holiday-fixed 1 6 "Heilige Drei Könige")
        ;; Date of Easter calculation taken from holidays.el.
        (let* ((century (1+ (/ displayed-year 100)))
               (shifted-epact (% (+ 14 (* 11 (% displayed-year 19))
                                    (- (/ (* 3 century) 4))
                                    (/ (+ 5 (* 8 century)) 25)
                                    (* 30 century))
                                 30))
               (adjusted-epact (if (or (= shifted-epact 0)
                                       (and (= shifted-epact 1)
                                            (< 10 (% displayed-year 19))))
                                   (1+ shifted-epact)
                                 shifted-epact))
               (paschal-moon (- (calendar-absolute-from-gregorian
                                 (list 4 19 displayed-year))
                                adjusted-epact))
               (easter (calendar-dayname-on-or-before 0 (+ paschal-moon 7))))
          (filter-visible-calendar-holidays
           (mapcar
            (lambda (l)
              (list (calendar-gregorian-from-absolute (+ easter (car l)))
                    (nth 1 l)))
            '(
              (-48 "Rosenmontag")
              ( -2 "Karfreitag")
              (  0 "Ostersonntag")
              ( +1 "Ostermontag")
              (+39 "Christi Himmelfahrt")
              (+49 "Pfingstsonntag")
              (+50 "Pfingstmontag")
              (+60 "Fronleichnam")
              ))))
        (holiday-fixed 8 15 "Mariä Himmelfahrt")
        (holiday-fixed 11 1 "Allerheiligen")
        (holiday-float 11 3 1 "Buß- und Bettag" 16)
        (holiday-float 11 0 1 "Totensonntag" 20)))

(setq calendar-holidays
      (append holiday-general-holidays 
              holiday-local-holidays 
              holiday-other-holidays
              holiday-christian-holidays 
              holiday-solar-holidays))

4.16. Highlight aktuelle Zeile

Die Farbe wird nach dem Laden des Themes gesetzt (s.u.).

(global-hl-line-mode 1)

4.17. Persistente Highlights

(setq hi-lock-file-patterns-policy #'(lambda (dummy) t)) 

4.18. Scrollen Perfomance erhöhen

(setq
 scroll-conservatively 1000                     ;; only 'jump' when moving this far
 scroll-margin 4                                ;; scroll N lines to screen edge
 scroll-step 1                                  ;; keyboard scroll one line at a time
 mouse-wheel-scroll-amount '(6 ((shift) . 1))   ;; mouse scroll N lines
 mouse-wheel-progressive-speed nil              ;; don't accelerate scrolling

 redisplay-dont-pause t                         ;; don't pause display on input

 ;; Always redraw immediately when scrolling,
 ;; more responsive and doesn't hang!
 fast-but-imprecise-scrolling nil
 jit-lock-defer-time 0
 )

4.19. Tabulator

Default to an indentation size of 2 spaces since it’s the norm for pretty much every language I use.

(setq-default tab-width 2)

Use spaces instead of tabs for indentation

(setq-default indent-tabs-mode nil)

4.20. History Duplicates

(setq history-delete-duplicates t)

4.21. GnuPG-Verschlüsselung

Die folgenden Zeilen sorgen dafür, dass der Emacs alle Dateien mit der Endung .gpg verschlüsselt speichert. Beim Öffnen werden sie direkt wieder entschlüsselt.

(require 'epa-file)
(epa-file-enable)

4.22. Misc

(put 'narrow-to-region 'disabled nil)
(put 'set-goal-column 'disabled nil)
(put 'scroll-left 'disabled nil)

5. Load Funktion

Eine Funktion, die kontrolliert ob die zu ladende Datei auch existiert.

(defun load-if-file-exist (f)
  "Load file F, if exists."
  (if (file-exists-p f)
      (progn
        (load f)
        (message "File %s does exist." f))
    (progn
      (message "File %s does not exist." f))))

6. Paketquellen

(require 'package)
(setq package-enable-at-startup nil)
(setq package-archives
    '(("elpa"   . "http://elpa.gnu.org/packages/")
      ("melpa" . "https://melpa.org/packages/")
      ;; ("marmalade" . "http://marmalade-repo.org/packages/")
      ;; wird ab Org Version 9.6 nicht mehr unterstützt ("org"   . "http://orgmode.org/elpa/")
))

6.1. Pakete initialisieren

Seit Emacs Version 27.1 nicht mehr notwendig.

;; (package-initialize)

6.2. Use-Package

Die Pakete werden mit Hilfe des Pakets use-package aufgerufen.

Initial müssen einige Pakete über den normalen Weg instaliert werden. Danach macht es dann normalerweise keine Probleme mehr.

(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

(use-package auto-package-update
  :config
  (setq auto-package-update-delete-old-versions t)
  (setq auto-package-update-hide-results t)
  (auto-package-update-maybe))

7. org-mode

Da org-mode ein wirklich mächtiges und wichtiges Paket ist, bei dem ich eine Menge Einstellungen vorgenommen habe, hat es ein eigenes Kapitel verdient.

org-mode-unicorn-logo.png

7.1. Main

(with-eval-after-load 'org
  (use-package org
    :ensure t
    :init
    :config
    :bind
    (("\C-cl" . org-store-link)
     ("\C-ca" . org-agenda)
     ("\C-cc" . org-capture)
     ;; Neue Keystrokes um in Org Mode Dateien eine Sprungmarke zu setzen,
     ;; und sie anzspringen.
     ("\C-c C-+" . org-mark-ring-push)
     ("\C-c C-#" . org-mark-ring-goto)
     ;; Keystrokes zum hin und her springen zu den Links.
     ("C-S-N" . org-next-link)
     ("C-S-P" . org-previous-link)))

  ;; fontify code in code blocks
  (setq org-src-fontify-natively t)

  (setq-default fill-column 80)
  (setq auto-fill-mode 1)
  (setq visual-line-mode 1)

  ;; set collapsed sections marker
  ;; (setq org-ellipsis " ▾")

  ;; not needed when global-font-lock-mode is on
  (add-hook 'org-mode-hook 'turn-on-font-lock)
  ;; only one visible star at headlines
  (setq org-hide-leading-stars 'hidestars)
  ;; follow links by RET
  (setq org-return-follows-link t)
  
  ;; Targets include this file and any file contributing to the agenda - up to 9 levels deep
  (setq org-refile-targets (quote ((nil :maxlevel . 3) (org-agenda-files :maxlevel . 3))))

(setq org-agenda-span 15) ;; number of days for agenda
;; This stuff is now within the file akl-main.el in the function
;; akl/org-agenda-custom-views.
;; 
;; (setq org-agenda-custom-commands
;;       '(("n"
;;          "Agenda and TODOs"
;;          ((agenda)
;;           (todo "TODO\|STARTED\|WAITING")) ;; \|Cyclic
;;          ((org-agenda-span 9))
;;          ((concat *org-notes-path* "agenda.html")))))
;; org-agenda export with C-c a e

  ;; Ein "!" bedeutet Zeitstempel
  ;; Ein "@" bedeutet Notiz
  ;; org-log-drawer to write the timestamps into a drawer
(setq org-todo-keywords
      '((sequence "TODO(t!)"
                  "STARTED(s!)"
                  "WAITING(w!)"
                  "Cyclic(c)"
                  "Note(n)"
                  "|"
                  "DONE(d!)"
                  "DELEGATED(D@)"
                  "CANCELLED(C@)")))
  
;; Farben anpassen
(setq org-todo-keyword-faces
      '(("TODO"        . (:foreground "#b70101" :weight bold))
        ("STARTED"     . (:foreground "yellow" :weight bold))
        ("WAITING"     . (:foreground "sienna" :weight bold))
        ("Note"        . (:foreground "orange" :weight bold))
        ("DONE"        . (:foreground "forestgreen" :weight bold))
        ("DELEGATED"   . (:foreground "forestgreen" :weight bold))
        ("CANCELLED"   . shadow)
        ("Cyclic"      . (:foreground "sienna" :background "DarkGray" :weight bold))))

;; Fast TODO Selection
(setq org-use-fast-todo-selection t)

;; deutsch as export language
(setq org-export-default-language "de")

;; Write ~/org.ics, a icalendar file of combined agenda files. ;;
;; Do this each time the file will be saved.                   ;;
;; (global-set-key (kbd "C-c F") 'org-icalendar-combine-agenda-files)

;;(add-hook 'after-save-hook
;;       (lambda ()
;;         (if (equal "aufgaben.org" (file-name-nondirectory buffer-file-name))
;;           (org-icalendar-combine-agenda-files)
;;         nil)))
  
  ;; bullets in utf8 instead of stars in org-mode ;;
  ;; (require 'org-bullets)
  (use-package org-bullets
    :ensure t
    :init
    :config
    (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
    )

  (setq org-babel-load-languages
  (quote
   ((emacs-lisp . t)
    (ditaa . t)
    (latex . t)
    (gnuplot . t)
    (awk . t)
    (shell . t)
    (perl . t)
    (python . t))))
  (setq org-closed-keep-when-no-todo t)
  (setq org-directory *org-notes-path*)
  (setq org-ditaa-jar-path "/usr/bin/ditaa")
  (setq org-emphasis-alist (quote
                            (("*" bold)
                             ("/" italic)
                             ("_" underline)
                             ("=" org-verbatim verbatim)
                             ("~" org-code verbatim)
                             ("+" (:strike-through t)))))
  (setq org-export-backends (quote (ascii beamer html latex odt)))
  (setq org-file-apps
  (quote
   ((auto-mode . emacs)
    ("\\.mm\\'" . default)
    ("\\.x?html?\\'" . system)
    ("\\.pdf\\'" . "okular %s"))))
  (setq org-html-html5-fancy t)
  (setq org-icalendar-include-todo (quote all))
  (setq org-icalendar-use-deadline (quote (event-if-todo)))
  (setq org-icalendar-use-scheduled (quote (event-if-todo todo-start)))
  (setq org-image-actual-width nil)
  (setq org-latex-classes
  (quote
   (("beamer" "\\documentclass[11pt]{beamer}"
     ("\\section{%s}" . "\\section*{%s}")
     ("\\subsection{%s}" . "\\subsection*{%s}")
     ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
    ("scrreprt" "\\documentclass[DIV=11, 10pt]{scrreprt}"
     ("\\chapter{%s}" . "\\chapter*{%s}")
     ("\\section{%s}" . "\\section*{%s}")
     ("\\subsection{%s}" . "\\subsection*{%s}")
     ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
     ("\\paragraph{%s}" . "\\paragraph*{%s}")
     ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
    ("scrartcl" "\\documentclass[DIV=11, 10pt]{scrartcl}"
     ("\\section{%s}" . "\\section*{%s}")
     ("\\subsection{%s}" . "\\subsection*{%s}")
     ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
     ("\\paragraph{%s}" . "\\paragraph*{%s}")
     ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
    ("article" "\\documentclass[11pt]{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}"))
    ("aklreport"
     "\\input{/mnt/nvme0n1p7/projects/emacs/init/akl/akl-report-header.tex}"
     ("\\chapter{%s}" . "\\chapter*{%s}")
     ("\\section{%s}" . "\\section*{%s}")
     ("\\subsection{%s}" . "\\subsection*{%s}")
     ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
     ("\\fourthsection{%s}" . "\\fourthsection*{%s}")
     ("\\fifthsection{%s}" . "\\fifthsection*{%s}")
     )
    )))
  (setq org-latex-default-class "aklreport")
  (setq org-latex-default-packages-alist nil)
  ;; Auskommentiert, da schon Teil in der akl-report-header.tex.
  ;; (quote
  ;;  (("utf8" "inputenc" t)
  ;;   ("T1" "fontenc" t)
  ;;   ("" "fixltx2e" nil)
  ;;   ("" "graphicx" t)
  ;;   ("" "grffile" t)
  ;;   ("" "longtable" t)
  ;;   ("" "wrapfig" nil)
  ;;   ("" "rotating" nil)
  ;;   ("normalem" "ulem" t)
  ;;   ("" "amsmath" t)
  ;;   ("" "textcomp" t)
  ;;   ("" "amssymb" t)
  ;;   ("" "capt-of" nil)
  ;;   ("" "hyperref" t)
  ;;   ("" "xcolor" t)
  ;;   ("" "listings" t))))
  (setq org-latex-inputenc-alist nil)
  (setq org-latex-listings t)
  (setq org-latex-listings-langs
      (quote
       ((calc "clean")
        (ditaa "clean")
        (org "clean")
        (emacs-lisp "elisp")
        (lisp "Lisp")
        (clojure "Lisp")
        (c "C")
        (cc "C++")
        (fortran "fortran")
        (perl "Perl")
        (cperl "Perl")
        (python "Python")
        (ruby "Ruby")
        (css "HTML")
        (html "HTML")
        (xml "XML")
        (tex "TeX")
        (latex "[LaTeX]TeX")
        (shell-script "bash")
        (gnuplot "Gnuplot")
        (ocaml "Caml")
        (caml "Caml")
        (sql "SQL")
        (sqlite "sql")
        (makefile "make"))))
  (setq org-latex-listings-options
   (quote
     (("basicstyle" "\\footnotesize\\ttfamily")
      ("keywordstyle" "\\color{blue}\\bfseries")
      ("commentstyle" "\\footnotesize\\color{akrgreen}\\rmfamily")
      ("stringstyle" "\\footnotesize\\color{darkgray}\\ttfamily")
      ("breaklines" "true")
      ("showspaces" "false")
      ("numberstyle" "\\scriptsize")
      ("postbreak" "\\space")
      ("frame" "single")
      ("keepspaces" "true")
      ("numbers" "left")
      ("numbersep" "5pt")
      ("numberstyle" "\\tiny\\color{akrgray}")
      ("rulecolor" "\\color{black}")
      ("showspaces" "false")
      ("showstringspaces" "false")
      ("showtabs" "false")
      ("stepnumber" "1")
      ("tabsize" "2")
      ("title" "\\lstname")
      )))
  (setq org-latex-default-table-environment (quote "longtable"))

  ;; Wenn dies gesetzt ist, werden " nicht richtig übernommen.
  ;; (setq org-latex-packages-alist (quote (("german" "babel" t))))
  (setq org-latex-packages-alist nil)

(setq org-latex-pdf-process
      (list "%latex -interaction nonstopmode -output-directory %o %f"
            "%latex -interaction nonstopmode -output-directory %o %f"
            "%latex -interaction nonstopmode -output-directory %o %f"))
  (setq org-modules
  (quote
   (org-bbdb org-bibtex org-docview org-gnus org-info org-irc org-mhe org-rmail org-w3m org-bookmark org-checklist org-choose org-elisp-symbol)))
  ;; (setq org-reveal-root "~/.emacs.d/packages/reveal/")
  ;; (setq org-reveal-single-file t)
  (setq org-reverse-note-order t)

  (setq org-edit-src-content-indentation 0)
  (setq org-src-tab-acts-natively t)
  (setq org-src-preserve-indentation t)
  (setq org-src-window-setup 'current-window)
  
  ;; re-bind org-tree-to-indirect-buffer
  (global-set-key (kbd "C-c l") 'org-tree-to-indirect-buffer)

(setq org-html-validation-link nil)
) ;; END OF with-eval-after-load 'org

7.2. Default Setup for org-mode files

#+OPTIONS: H:4 email:t tags:nil title:t toc:t ^:nil e:t
#+MACRO: color @@html:<span style="color: $1">$2</span>@@@@latex:\textcolor{$1}{$2}@@
#+MACRO: mark @@html:<span style="color: black; background-color: #99ccff">$1</span>@@@@latex:\colorbox{lime}{$1}@@
#+MACRO: skipnoindent @@html:<br><br>@@@@latex:\par\medskip\noindent @@
#+MACRO: newpage @@html:@@@@latex:\newpage @@
#+MACRO: landscape @@html:@@@@latex:\setpagelandscape @@
#+MACRO: portrait @@html:@@@@latex:\setpageportrait @@
#+HTML_HEAD_EXTRA:
#+HTML_LINK_HOME: http://www.kruse-lathen.de/blog/
#+HTML_CONTAINER: div
#+HTML_DOCTYPE: xhtml-strict
#+HTML_HEAD: <style>
#+HTML_HEAD: html {
#+HTML_HEAD:     font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
#+HTML_HEAD:     color: #f2f3e6;
#+HTML_HEAD:     font-size: 110%;
#+HTML_HEAD:     max-width: 1200px;
#+HTML_HEAD:     margin: 20px;
#+HTML_HEAD:     background-color: #363636;
#+HTML_HEAD:     background-image: url(./images/emacs_gnu_logo.png)
#+HTML_HEAD: }
#+HTML_HEAD:
#+HTML_HEAD: pre {
#+HTML_HEAD:   border: 1px solid #e6e6e6;
#+HTML_HEAD:   border-radius: 3px;
#+HTML_HEAD:   background-color: #8b4513;
#+HTML_HEAD:   padding: 8pt;
#+HTML_HEAD:   font-family: monospace;
#+HTML_HEAD:   overflow: auto;
#+HTML_HEAD:   margin: 1.2em;
#+HTML_HEAD: }
#+HTML_HEAD:
#+HTML_HEAD: a:link {
#+HTML_HEAD:     color:#00b0b0;
#+HTML_HEAD: }
#+HTML_HEAD: a:visited {
#+HTML_HEAD:     color:#00b0b0;
#+HTML_HEAD: }
#+HTML_HEAD: a:active {
#+HTML_HEAD:     color:#00b0b0;
#+HTML_HEAD: }
#+HTML_HEAD: 
#+HTML_HEAD: .title {
#+HTML_HEAD:     text-align: left;
#+HTML_HEAD:     font-size: 150%;
#+HTML_HEAD:     margin-top: 20px;
#+HTML_HEAD:     padding-bottom: 0.5em;
#+HTML_HEAD:     border-bottom: 1px solid;
#+HTML_HEAD:     color: #0174DF;
#+HTML_HEAD: }
#+HTML_HEAD: h2 {
#+HTML_HEAD:     font-size: 140%;
#+HTML_HEAD:     color: #0174DF;
#+HTML_HEAD: }
#+HTML_HEAD: h3 {
#+HTML_HEAD:     font-size: 130%;
#+HTML_HEAD:     color: #0174DF;
#+HTML_HEAD: }
#+HTML_HEAD: 
#+HTML_HEAD: h4 {
#+HTML_HEAD:     font-size: 120%;
#+HTML_HEAD:     color: #0174DF;
#+HTML_HEAD: }
#+HTML_HEAD: 
#+HTML_HEAD: h5 {
#+HTML_HEAD:     font-size: 110%;
#+HTML_HEAD:     color: #0174DF;
#+HTML_HEAD: }
#+HTML_HEAD: 
#+HTML_HEAD: #table-of-contents {
#+HTML_HEAD:     font-size: 9pt;
#+HTML_HEAD:     position: fixed;
#+HTML_HEAD:     right: 0em;
#+HTML_HEAD:     top: 0em;
#+HTML_HEAD:     background: #363636;
#+HTML_HEAD:     -webkit-box-shadow: 0 0 1em #777777;
#+HTML_HEAD:     -moz-box-shadow: 0 0 1em #777777;
#+HTML_HEAD:     -webkit-border-bottom-left-radius: 5px;
#+HTML_HEAD:     -moz-border-radius-bottomleft: 5px;
#+HTML_HEAD:     text-align: right;
#+HTML_HEAD:     /* ensure doesn't flow off the screen when expanded */
#+HTML_HEAD:     max-height: 80%;
#+HTML_HEAD:     overflow: auto;
#+HTML_HEAD:     z-index: 200;
#+HTML_HEAD: }
#+HTML_HEAD: 
#+HTML_HEAD: #table-of-contents h2 {
#+HTML_HEAD:     font-size: 9pt;
#+HTML_HEAD:     max-width: 8em;
#+HTML_HEAD:     font-weight: normal;
#+HTML_HEAD:     padding-left: 0.5em;
#+HTML_HEAD:     padding-top: 0.05em;
#+HTML_HEAD:     padding-bottom: 0.05em;
#+HTML_HEAD: }
#+HTML_HEAD: 
#+HTML_HEAD: #table-of-contents ul {
#+HTML_HEAD:     margin-left: 14pt;
#+HTML_HEAD:     margin-bottom: 10pt;
#+HTML_HEAD:     padding: 0
#+HTML_HEAD: }
#+HTML_HEAD: 
#+HTML_HEAD: #table-of-contents li {
#+HTML_HEAD:     padding: 0;
#+HTML_HEAD:     margin: 1px;
#+HTML_HEAD:     list-style: none;
#+HTML_HEAD: }
#+HTML_HEAD: 
#+HTML_HEAD: #table-of-contents ul>:first-child {
#+HTML_HEAD:     color: blue;
#+HTML_HEAD: }
#+HTML_HEAD: 
#+HTML_HEAD: #table-of-contents #text-table-of-contents {
#+HTML_HEAD:     display: none;
#+HTML_HEAD:     text-align: left;
#+HTML_HEAD: }
#+HTML_HEAD: 
#+HTML_HEAD: #table-of-contents:hover #text-table-of-contents {
#+HTML_HEAD:     display: block;
#+HTML_HEAD:     padding: 0.5em;
#+HTML_HEAD:     margin-top: -1.5em;
#+HTML_HEAD: }
#+HTML_HEAD: 
#+HTML_HEAD: div.figure {
#+HTML_HEAD:     padding: 0.5em;
#+HTML_HEAD: }
#+HTML_HEAD: div.figure p {
#+HTML_HEAD:     text-align: center;
#+HTML_HEAD:     font-style: italic;
#+HTML_HEAD: }
#+HTML_HEAD: #postamble {
#+HTML_HEAD:     font-size: 90%;
#+HTML_HEAD:     border-top: 1px solid;
#+HTML_HEAD:     margin-top: 20px;
#+HTML_HEAD: }
#+HTML_HEAD: </style>

7.3. org structure code blocks

Mit C-c C-, können Source Blöcke in Org-Mode eingefügt werden. Ich habe einige zusätzlich zur Auswahl eingefügt.

(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp
"))
(add-to-list 'org-structure-template-alist '("eo" . "src emacs-lisp -n :eval never-export :exports both :results output drawer
"))
(add-to-list 'org-structure-template-alist '("py" . "src python -n :eval never-export :exports both :results output drawer
"))

7.4. org-ref

  (use-package org-ref
    :ensure t
    :init
    :config
  )
(setq reftex-default-bibliography '("/home/ankr/orgnotes/bibliography/references.bib"))

;; see org-ref for use of these variables
(setq org-ref-bibliography-notes "/home/ankr/orgnotes/bibliography/notes.org"
      org-ref-default-bibliography '("/home/ankr/orgnotes/bibliography/references.bib")
      org-ref-pdf-directory "/home/ankr/orgnotes/bibliography/bibtex-pdfs/")

(setq bibtex-completion-bibliography "/home/ankr/orgnotes/bibliography/references.bib"
      bibtex-completion-library-path "/home/ankr/orgnotes/bibliography/bibtex-pdfs"
      bibtex-completion-notes-path "/home/ankr/orgnotes/bibliography/helm-bibtex-notes")

;; open pdf with system pdf viewer (works on mac)
;; (setq bibtex-completion-pdf-open-function
;;   (lambda (fpath)
;;     (start-process "open" "*open*" "open" fpath)))

;; alternative
;; (setq bibtex-completion-pdf-open-function 'org-open-file)

7.5. ob-async

  (use-package ob-async
    :ensure t
    :init
    ;; (add-to-list 'org-ctrl-c-ctrl-c-hook 'ob-async-org-babel-execute-src-block)
    :config
  )

7.6. org-ac   inactive

Auto-complete ist durch company ersetzt worden.

;; (use-package org-ac
;;   :ensure t
;;   :init
;;   :config
;;   (org-ac/config-default)
;;   :bind
;;   ()
;; )

7.7. org-sticky-header

Wenn im org-mode der Text eines Abschnitts größer ist, wird der Titel in der ersten Zeile festgehalten.

(use-package org-sticky-header
  :ensure t
  :init
  :config
)

;; (add-hook 'org-mode-hook 'org-sticky-header-mode)

7.8. org journal

Mit Org Capture (C-c c) erzeugt man jetzt eine neue Journal Datei. Meine Journal Dateien finden sich unter "~/orgnotes/journal/". In Verbindung mit TODO Einträgen und org-agenda Views funktioniert das schon mal ganz gut.

7.8.1. Basic Usage

  1. Bindings available in org-journal-mode:
    C-c C-f
    go to the next journal file.
    C-c C-b
    go to the previous journal file.
    C-c C-j
    insert a new entry into the current journal file (creates the file if not present).
    C-c C-s
    search the journal for a string.
  2. All journal entries are registered in the Emacs Calendar.

    To see available journal entries do M-x calendar. Bindings available in the calendar-mode:

    j
    view an entry in a new buffer.
    C-j
    view an entry but do not switch to it.
    i j
    add a new entry into the day’s file (creates the file if not present).
    f w
    search in all entries of the current week.
    f m
    search in all entries of the current month.
    f y
    search in all entries of the current year.
    f f
    search in all entries of all time.
    f F
    search in all entries in the future.
    [
    go to previous day with journal entries.
    ]
    go to next day with journal entries.

7.8.2. use package

(use-package org-journal
  :ensure t
  :defer t
  :custom
  (org-journal-enable-agenda-integration t)
  (org-journal-dir *org-notes-journal-path*)
  (org-journal-date-format "%A, %d %B %Y")
  (org-journal-file-format "%Y%m%d.org")
  (org-journal-file-type (quote weekly))
  (org-journal-find-file 'find-file)
  :bind
  (
   ;; ("C-c j" . org-journal-new-entry)
  )
)

(use-package org-journal-list
  :ensure t
  :init
  :config
  (setq org-journal-list-default-directory *org-notes-journal-path*)
  (setq org-journal-list-default-suffix ".org")
  (setq org-journal-list-create-temp-buffer nil)
)


(defun org-journal-find-location ()
  ;; Open today's journal, but specify a non-nil prefix argument in order to
  ;; inhibit inserting the heading; org-capture will insert the heading.
  (org-journal-new-entry t)
  (unless (eq org-journal-file-type 'daily)
    (org-narrow-to-subtree))
  (goto-char (point-max)))

(defun org-journal-date-location (&optional scheduled-time)
  (let ((scheduled-time (or scheduled-time (org-read-date nil nil nil "Date:"))))
    (setq org-journal--date-location-scheduled-time scheduled-time)
    (org-journal-new-entry t (org-time-string-to-time scheduled-time))
    (unless (eq org-journal-file-type 'daily)
      (org-narrow-to-subtree))
    (goto-char (point-max))))

(defvar org-journal--date-location-scheduled-time nil)

;; wo die Todo Einträge landen sollen
(progn
  (setq org-capture-templates
        '(("t" "Aufgabe" plain (function org-journal-date-location)
           "** TODO %^{Title}\n <%(princ org-journal--date-location-scheduled-time)>\n%?"
           :jump-to-captured t :empty-lines-after 1)
          ("j" "Journal entry" plain (function org-journal-date-location)
           "** %(format-time-string org-journal-time-format)%^{Title}\n%i%?"
           :jump-to-captured t :immediate-finish t))
        ))

7.9. org download

(use-package org-download
  :ensure t
  :init
  (progn
    ;; Drag-and-drop to `dired`
    (add-hook 'dired-mode-hook 'org-download-enable))
  :config
)

7.10. Beautify org links   inactive

;; (use-package org-link-beautify
;;   :ensure t
;;   :init
;;   (progn
;;     (org-link-beautify-mode 1))
;;   :config
;; )

7.11. mysql-to-org

Minor mode to output the results of mysql queries to org tables.

  • C-c C-m e will output the query inside the active region or current line to an org table.
  • C-c C-m p will output the query defined by the string at point to an org table.
  • C-c C-m s will open a mysql to org scratch buffer.
(use-package mysql-to-org
  :ensure t
  :init
  :config
)

7.12. Org to OneNote

(use-package org-onenote
  :ensure t
  :init
  :config
) 

7.13. Org Jira

(use-package org-jira
  :ensure t
)
(use-package helm-jira
  :ensure t
)
  • https://github.com/stig/ox-jira.el
    Usage
    In an Org buffer, hit C-c C-e j j to bring up Org Export Dispatcher and export it as a JIRA buffer. You can then use C-x h to mark the whole buffer, then M-w to save it to the kill ring (and global pasteboard) for pasting into JIRA issues.
(use-package ox-jira
  :ensure t)

7.14. Org Json

(use-package ox-json
  :ensure t)

8. Org-Mode Tricks und Tipps

In Org-Mode Notizen und Texte zu schreiben funktioniert out of the box schon mal super. Aber einige Besonderheiten sond dann doch zu beachten. Damit ich, wenn ich diesen Tricks benötige, auch schnell wieder finde, notiere ich sie mir hier.

In den Kapiteln

habe ich einige Einstellungen und Notizen die in dieses Kapitel ebenso gut gepasst hätten.

8.1. Source Block Verbatim exportieren

Um einen Source Block so zu exportieren, wie er ist, kann er einfach in ein Source Block ala org-mode eingebettet werden. Dafür müssen dann die #+ mit einem Komma auskommentiert werden.

#+begin_src org
,#+ATTR_LATEX: :options style=akl-elisp
#+BEGIN_SRC emacs-lisp
;; Dieser Source Block wird nicht ausgeführt,
;; sondern ist als Text in einem Org-Mode Source Block
;; eingebettet.
,#+end_src
#+end_src

8.2. Eigenschaften für den Export

Einer Tabelle oder einem Bild kann kann mit #+CAPTION: Was Auch Immer eine Überschrift zugeordnet werden. Bestimmte Eigenschaften für den LaTeX/PDF Export können der Tabelle zugeordnet werden, in dem man ihr Attribute über #+ATTR_LATEX: voranstellt.

#+CAPTION: Eine kleine Beispiel Tabelle
#+ATTR_LATEX: :font \small
#+ATTR_LATEX: :environment longtable :align l|l|p{0.3 \textwidth}
| Spalte 1 | Spalte 2 | Spalte 3 |
|----------+----------+----------|
|        3 |       12 |       42 |
|        2 |       24 |       54 |
#+TBLFM: $3=$-2*$-1+6

Eigenschaften für den HTML Export gibt man mit #+ATTR_HTML an. Für ein Bild kann das dann so aussehen.

#+CAPTION: Ziege
#+ATTR_HTML: :alt Ziege :title Ziege :align center
#+ATTR_HTML: :width 234
#+ATTR_LATEX: :width 0.5 \textwidth :center t
file:images/ziege.jpg

Ziege

Abbildung 2: Ziege

Für Tabellen sehen die Parameter natürlich etwas anders aus.

#+CAPTION: Beispiel Tabelle
#+ATTR_HTML: :bMacrosorder 2 :rules all :frame border :align center
#+ATTR_LATEX: :environment longtable :align l|p{0.2 \textwidth}|r
| Spalte 1 | Spalte 2 | Spalte 3 |
|----------+----------+----------|
|        5 |        2 |       16 |
|        1 |      124 |      130 |
#+TBLFM: $3=$-2*$-1+6

Hier mal zwei Beispieltabellen, einmal ohne Attribute,

Spalte 1 Spalte 2 Spalte 3
5 2 16
1 124 130

und einmal mit den Attributen.

Tabelle 1 Beispiel Tabelle
Spalte 1 Spalte 2 Spalte 3
5 2 16
1 124 130

8.3. Schriftfarben und so

Bestimmte Wörter und Muster sollen in einer Org-Mode Datei besonders hervorgehoben werden. Dafür habe ich einige Muster für den Org-Mode erweitert. Siehe hier: Content of akl-faces.el

Um eine Region einzufärben habe ich etwas eigenes erstellt. Die Beschreibung dazu findet sich unter Region Colorizing.

8.4. Export HTML

Leider funktioniert das font-lock-add-keywords mit den Checkboxen und HTML Export nicht. Daher füge ich an den Anfang einer Org-Mode Datei diese Hi-Lock Zeilen ein.

# Hi-lock: ((" \\[ \\]" (0 'akl-check-open-face prepend)))
# Hi-lock: ((" \\[-\\]" (0 'akl-check-tripple-face prepend)))
# Hi-lock: ((" \\[X\\]" (0 'akl-check-done-face prepend)))

Um die Checkboxen mit Symbolen zu tauschen, würde dieser Code helfen. Mir persönlich gefällt diese Lösung aber nicht so sehr, da ich die farbliche Hervorhebung am meisten wünsche.

;; (add-hook 'org-mode-hook (lambda ()
;;    "Beautify Org Checkbox Symbol"
;;    (push '("[ ]" . "☐") prettify-symbols-alist)
;;    (push '("[X]" . "☑" ) prettify-symbols-alist)
;;    (push '("[-]" . "❍" ) prettify-symbols-alist)
;;    (prettify-symbols-mode)))
  • rot
  • blau
  • grün

8.5. Export \LaTeX{} PDF

Für den Export nach PDF nutze ich eine LaTeX Datei (akl-report-header.tex), die am Anfang eingebunden wird. Dieser kann man einige Einstellungen mitgeben, die am Anfang einer Org-Mode Datei angegeben werden können. Diese Eingaben haben keinen Einfluss auf die Titelseite.

Beispiel:

#+begin_export latex
\setauthor{Setzt den Author.}
\setauthoraddress{Setzt die Adresse.}
\setauthortel{Setzt die Telefonnummer.}
\setauthormobile{Setzt die Mobilnummer.}
\setauthoremail{Setzt die E-Mail.}
\setauthorurl{Setzt die Homepage.}
\setlefthead{Wird oben links gesetzt.}
\setcenterlefthead{Wird oben zentriert gesetzt.}
\setrightlefthead{Wird oben rechts gesetzt.}
\setleftfoot{Wird unten links gesetzt.  Voreingestellt ist \footnotesize{\akrauthor}.}
\setcenterfoot{Wird unten zentriert gesetzt.}
\setrightfoot{Wird unten rechts gesetzt. Voreingestellt ist \pagemark.}
#+end_export

In dieser Datei wurde das folgende eingefügt.

#+begin_export latex
\setlefthead{Emacs - Einstellungen mit Org-Mode}
#+end_export

8.5.1. Leerzeilen

Zwei oder mehr Leerzeilen werden beim LaTeX Export durch \par\medskip\noindent ersetzt.

Dadurch kann ich mit zwei Leerzeilen einfach solch einen Absatzabstand setzen.

8.5.2. Source Block mit eigenem listings style

Die Einstellungen für den Export von Source Blöcken nach LaTeX - PDF funktioniert in den Grundeinstellungen für org-latex-listings, org-latex-listings-langs und org-latex-listings-options soweit, so gut. Falls man einen eigenen listings style nutzen möchte, bedarf es eines Tricks. Vor dem Source Block kann man bsw. die folgende Zeile einfügen, um den gewünschten listings style zu aktivieren.

#+ATTR_LATEX: :options style=akl-elisp

In meiner LaTeX Header Datei sieht das dann für emacs-lisp folgendermaßen aus. Das das listing für elisp irgendwie nicht vollständig zu sein scheint, habe ich einige Keyowrds hinzugefügt. Ansonsten wird die Basiseinstellung aus org-latex-listings-options übernommen.

% http://texdoc.net/texmf-dist/doc/latex/listings/listings.pdf
\lstdefinestyle{akl-elisp}{
  language=elisp,
  morekeywords={
    concat, cadr,
    defadvice. defconst, defun, defvar, defface, defcustom, dolist, dotimes,
    if, insert, interactive,
    let,
    nil,
    progn,
    setq, setq-local, setq-default, 
    while, 
    },
  emph={[2]add-to-list, add-hook, auto-save-default, auto-mode-alist,
    bind-keys, buffer-file-name, buffer-substring-no-properties, buffer-string, buffer-list,
    beginning-of-line, buffer-size, buffer-narrowed-p, buffer-read-only, buffer-modified-p,
    current-column, count-windows, current-buffer, current-prefix-arg,
    delete-and-extract-region, deactivate-mark, directory-files, delete-file, delete-other-windows,
    define-key, date-to-time, directory-files-recursively,
    expand-file-name, exchange-point-and-mark, 
    find-file-noselect, file-name-base, file-attributes, file-name-nondirectory, font-lock-add-keywords,
    format-time-string, forward-line, file-exists-p, file-name-directory, face-attribute,
    filter-buffer-substring,
    goto-char, get-buffer, global-set-key,
    indent-according-to-mode,
    kill-append, kill-new, kill-buffer, kill-local-variable,
    load,
    match-string, match-end, message, move-beginning-of-line, mapconcat, move-end-of-line, make-variable-buffer-local,
    mark-active, mark, move-to-column, make-directory, make-local-variable, mode-line-format,
    match-beginning,
    newline, next-window,
    other-window,
    point, point-min, point-max, point-at-eol, point-at-bol, process-file,
    re-search-forward, re-search-backward, read-string, replace-regexp-in-string, replace-match,
    region-active-p, region-beginning, region-end,
    save-buffer, save-excursion, save-restriction, selected-window, splitter, split-window-horizontally,
    split-window-vertically, set-window-buffer, select-window, set-face-attribute,
    string-trim, switch-to-buffer, split-string, save-window-excursion, shell-command-on-region, string-match-p,
    set-buffer-file-coding-system, set-mark, start-process-shell-command, symbol-value, sensitive-mode,
    selected, substring-no-properties, 
    transient-mark-mode, transpose-lines, time-less-p,
    use-package, use-region-p,
    with-current-buffer, with-temp-buffer, window-buffer, window-edges, with-temp-buffer,
    with-temp-file,
    },
  emphstyle={[2]\color{royalblue}\ttfamily},
  emph={[3]auto-save-mode,
    copy-file,
    find-file,
    highlight-regexp,
    line-number-mode,
    moccur-search-files,
    org-mode, occur-by-moccur,
    package-list-packages,
    rainbow-mode,
    swiper,
  },
  emphstyle={[3]\color{royalblue}\underline},
}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

8.5.3. | [text] | vs. | [text] |

In Org-Mode Tabellen sorgen die [] mit eingeschlossenem Text beim PDF Export für ein sonderbares Verhalten. Dies kann mit = oder ~ umgangen werden.


[Ohne] Tabellenumgebung.

#+CAPTION: vorher
| []     |
| [text]    |

#+CAPTION: nachher mit ~
| ~[]~      |
| ~[text]~     |

#+CAPTION: nachher mit =
| =[]=  |
| =[text]= |

[Ohne] Tabellenumgebung.

Tabelle 2 vorher
[]
[text]
Tabelle 3 nachher mit ~
[]
[text]
Tabelle 4 nachher mit =
[]
[text]

8.6. Mein Header in Org-Mode Dateien

Mit Yasnippet habe ich mir ein Schnipsel erstellt, mit dem ich einfach den Header einer Org-Mode Datei einfügen kann.

# -*- mode: snippet -*-
# name: org-start-header
# key: orgheader
# --
:ORGOPTIONS:
#+TITLE: $1
#+SUBTITLE: $2
#+KEYWORDS: 
#+AUTHOR: Andreas Kruse
#+EMAIL: leak@online.ms
#+DATE: {{{modification-time(%d.%m.%Y)}}}
#+STARTUP: indent showall hidestars hideblocks inlineimages entitiespretty
#+SETUPFILE: ~/orgnotes/akl-org-options.org
# Hi-lock: ((" \\\\[ \\\\]" (0 'akl-check-open-face prepend)))
# Hi-lock: ((" \\\\[-\\\\]" (0 'akl-check-tripple-face prepend)))
# Hi-lock: ((" \\\\[X\\\\]" (0 'akl-check-done-face prepend)))
:END:
#+begin_export latex
\\setauthor{Andreas Kruse}
\\setauthoraddress{}
\\setauthortel{}
\\setauthormobile{}
\\setauthoremail{leak@online.ms}
\\setauthorurl{}
\\setlefthead{$1}
\\setcenterlefthead{}
\\setrightlefthead{}
\\setleftfoot{\\footnotesize{\\akrauthor}}
\\setcenterfoot{}
\\setrightfoot{\\pagemark}
#+end_export

* $0

* Lokale Variabeln                                         :ARCHIVE:noexport:

# Local Variables:
# coding: utf-8
# End:

8.7. LaTeX Mathe Beispiele

Der Export nach LaTeX und HTML funktioniert identisch. Daher braucht man für HTML keine eigenen Verenkungen machen. ☺

Um zu sehen, wie der Mathe LaTeX Code am Ende aussieht, ohne das gesamte Dokument zu generieren, kann man auch org-latex-preview nutzen. Damit eine Formel dann wieder editierbar wird, mit dem Cursor auf dem Bild den Befehl einfach wiederholen. Für die Skalierung der Vorschau siehe 8.8 Bilder org-latex-preview skalieren .

Mit der Umgebung equation wird eine abgesetzte Mathe Umgebung definiert, bei der die Formel auch nummeriert wird.

\begin{equation}
  (a+b)^{2} = a^{2} + 2 \cdot a \cdot b + b^{2}
\end{equation}
\begin{equation} (a+b)^{2} = a^{2} + 2 \cdot a \cdot b + b^{2} \end{equation}

Bei mehreren Formeln nimmt man dann eqnarray.

\begin{eqnarray}
  (a+b)^{2}   = a^{2} + 2 \cdot a \cdot b + b^{2} \\
  (a-b)^{2}   = a^{2} - 2 \cdot a \cdot b + b^{2} \\
  a^{2}-b^{2} = (a+b) \cdot (a-b)
\end{eqnarray}
\begin{eqnarray} (a+b)^{2} = a^{2} + 2 \cdot a \cdot b + b^{2} \\ (a-b)^{2} = a^{2} - 2 \cdot a \cdot b + b^{2} \\ a^{2}-b^{2} = (a+b) \cdot (a-b) \end{eqnarray}

Wenn die Umgebung in \[ und \] eingeschlossen wird, die die Formel abgesetzt, aber nicht nummeriert.

\[
  A = \pi \cdot \left(\frac{d^2}{4}\right)
\]

\[ A = \pi \cdot \left(\frac{d^2}{4}\right) \]

Um in der Zeile die Formel zu setzen wird die Umgebung mit \( und \) gesetzt.

Hier die Formel \(
A = \pi \cdot \frac{d^2}{4}
\) innerhalb eines Textes.

Hier die Formel \( A = \pi \cdot \frac{d^2}{4} \) innerhalb eines Satzes.

Damit Formeln richtig ausgerichtet werden, bietet sich align an.

\begin{align}
(a+b)^{2}  & = a^{2} + 2 \cdot a \cdot b + b^{2} \\ \nonumber
(a-b)^{2}  & = a^{2} - 2 \cdot a \cdot b + b^{2} \\ \nonumber
a^{2}-b^{2} & = (a+b) \cdot (a-b)
\end{align}

\begin{align}
    f(u) & =sum_{j=1}^{n} x_jf(u_j)\\ \nonumber
         & =\sum_{j=1}^{n} x_j \sum_{i=1}^{m} a_{ij}v_i\\ \nonumber
         & =\sum_{j=1}^{n} \sum_{i=1}^{m} a_{ij}x_jv_i
\end{align}
\begin{align} (a+b)^{2} & = a^{2} + 2 \cdot a \cdot b + b^{2} \\ \nonumber (a-b)^{2} & = a^{2} - 2 \cdot a \cdot b + b^{2} \\ \nonumber a^{2}-b^{2} & = (a+b) \cdot (a-b) \end{align} \begin{align} f(u) & =sum_{j=1}^{n} x_jf(u_j)\\ \nonumber & =\sum_{j=1}^{n} x_j \sum_{i=1}^{m} a_{ij}v_i\\ \nonumber & =\sum_{j=1}^{n} \sum_{i=1}^{m} a_{ij}x_jv_i \end{align}

Hier noch eine kleine Spielerei, um Text in Fraktal Schrift darzustellen.

\( \mathfrak{Andreas\ Kruse} \)

\( \mathfrak{Andreas\ Kruse} \)

8.8. Bilder org-latex-preview skalieren

Die Skalierung der Bilder aus org-latex-preview gefiel mir nicht. Aber ich habe im Netz Abhilfe finden können. ;-

(setq my-org-latex-preview-scale 1.4)   ; depends on the font used in emacs or just on user preference
(defun akl/org-latex-preview-advice (orig-func &rest args)
  "Scale org-latex-preview images."
  (let ((old-val (copy-tree org-format-latex-options)))     ; plist-put is maybe-destructive, weird. So, we have to restore old value ourselves
    (setq org-format-latex-options (plist-put org-format-latex-options
                                              :scale
                                              (* my-org-latex-preview-scale (expt text-scale-mode-step text-scale-mode-amount))))
    (apply orig-func args)
    (setq org-format-latex-options old-val)))
(advice-add 'org-latex-preview :around #'akl/org-latex-preview-advice)

8.9. TODO Duedate und Agreed

DEADLINE: <2037-12-11 Fr>

Das händeln von TODOs und DONE ist in Org-Mode schon eines der Killer Applikationen. Für meine Arbeit hat sich aber heraus gestellt, dass ich noch einige zusätzliche Fähigkeiten in Org-Mode Dateien haben möchte. Dazu gehört, dass es ein Eintrag zu erledigen mit Datum und Erledigt bräuchte. Dies habe ich mit den Funktionen in Content of akl-duedate.el meinen Bedürfnissen entsprechend umgesetzt.

Wenn ein duedate in der Zukunft liegt, wird es blau eingefärbt. Ist der Zeitpunkt heute, oder in der Vergangenheit, wird er rot eingefärbt. Beim Export nach PDF werden diese Einträge als

  • Out of date: <Datum>

und

  • Due date: <Datum>

in das Inhaltsverzeichnis eingefügt.
❢15.11.2020 So Das Ende ist nah.
❢29.11.2032 Mo Das dauert noch eine Weile.
❢13.12.2008 Sa Ganz was altes.


Um ein agreed darzustellen wird es dann grün hinterlegt.
✓29.11.2020 So Vorbei ist vorbei.

Beim Arbeiten mit Duedate werden die DEADLINE: Zeilen für TODOs ebenfalls entsprechend dem Datum eingefärbt.

Beim Export (Content of akl-org-exporter.el) funktioniert das dann allerdings nur mit den Funktionen von mir. Beim normalen Export werden die Farben nicht mit übernommen.

Als Keystrokes habe ich mir folgendes erstellt.

M-s M-d akl/duedate-date-insert
M-s M-a akl/agreed-date-insert
M-s M-s akl/subst-duedate-agreed-date-insert
M-s M-u akl/subst-duedate-duedate-date-insert
M-s d akl/list-all-duedate-in-current-buffer
M-s l akl/list-all-out-duedate-in-current-buffer
M-s M-l akl/helm-list-all-over-date-currbuf
M-s t akl/list-all-todos-in-current-buffer
M-s M-t akl/helm-list-all-todo-dead-due-currbuf
M-s T akl/list-all-todos-in-org-files
M-s u akl/check-highlight-duedate-date
M-s f akl/jump-to-next-duedate
M-s b akl/jump-to-previous-duedate
M-s F akl/jump-to-next-duedate
M-s B akl/jump-to-previous-duedate

8.10. Tabellen berechnen

Bei Org-Tabellen kann man die Werte an einen Source Block weiterleiten und dann das Ergebnis in die Tabelle zurückführen.

Als erstes benötigen wir einen Source Block, der tolle Berechnungen durchführt.

#+NAME: PY-SRC-TBL-CALC
#+begin_src python -n :eval never-export :var a=1 b=10
return ((((a*a)+(b*b))/2)*1.1415)
#+end_src

Nun wird eine Tabelle mit den benötigten Werten für den Source Block angelegt.

Tabelle 5 PY-SRC-TBL-CALC
a b φ
1 7 28.537
3 5 19.405
5 3 19.405
9 4 55.363
7 5 42.236

Unter der Tabelle steht der Verweis auf den Source Block, und welche Spaltenwerte für die Berechnung übernommen werden sollen.

#+TBLFM: $3='(org-sbe "PY-SRC-TBL-CALC" (a $1) (b $2));%.3f

In den Tabellenformeln kann auch elisp-Code direkt ausgeführt werden.

Tabelle 6 Lisp in TBLFM
q w β
9 1 9.00000
6 2 36.00000
3 5 243.00000
85 0.8 34.95708
21 0.9 15.48807
47 0.02 1.08005
#+TBLFM: $3='(expt (string-to-number $1) (string-to-number $2));%.5f

8.11. Interne Links

8.11.1. Erste Ansätze

Beim Exportieren gibt es Unterschiede zwischen benamsten Verweisen und den Verweisen direkt auf die Überschriftennamen. Unter dieser Überschrift habe ich den Label <<sec:uilinks>> gesetzt. Wenn das Label hinter der Überschrift gesetzt wird, macht der Export Probleme, sobald der direkte Verweis auf eine Überschrift genutzt wurde.

8.11.2. Zusätzliches Setup

Damit beim Export nach PDF die Seitenzahl auch angegeben wird, ist es nötig die folgende Einstellung zu setzen.

(setq org-latex-prefer-user-labels t)

8.11.3. LaTeX Hyperref Kommandos

Die folgenden Befehle funktionieren allerdings nur auf benamste Verweise, und nur beim Export nach LaTeX PDF.

- \ref{sec:uilinks}
- \nameref{sec:uilinks}
- \pageref{sec:uilinks}

8.11.4. Funktionierender Ansatz

Damit das also beim HTML und beim PDF Export sauber aussieht, baut man sich das ganze dann so zusammen.

- sec:uilinks Interne Links
@@latex: on page~\pageref{sec:uilinks}@@

8.11.5. Mit Macro

Das ganze kann man dann noch in ein Macro verpacken. Dabei ist der erste Parameter das Label, und der zweite Parameter die Beschreibung - üblicherweise die Überschrift.

#+MACRO: inref $1 $2 @@latex:on page~\pageref{$1}@@

- {{{inref(sec:uilinks,Interne Links)}}}

8.11.6. Mit Macro, aber klickbar im Org-Mode

Damit ein im Org-Mode klickbarer Verweis bestehen bleibt, wäre dieses Macro eventuell besser.

#+MACRO: pageref @@latex:on page~\pageref{$1}@@

- sec:uilinks Interne Links {{{pageref(sec:uilinks)}}}

8.11.7. Ohne Macro

Das LaTeX Komamndo \pageref kann auch direkt in der Org-Mode Datei eingegeben werden. Dann wird das aber alles auch in die HTML Datei exportiert.

- sec:uilinks Interne Links on page \pageref{sec:uilinks}

8.11.8. Lösung und Funktion interne Links einfügen

Am Ende habe ich mich für die Version Mit Macro, aber klickbar im Org-Mode entschieden. Dafür habe ich dann auch die Funktion akl/insert-named-intern-link-ref (C-c C-x C-l) (Content of akl-main.el) geschrieben.

  • Wenn der Cursor auf einer Überschrift steht, wird ein Label unter die Überschrift eingefügt.
  • Wenn der Cursor nicht auf einer Überschrift steht, wird gefragt, ob ein Link auf eine Überschrift (headline), ein Label (label) oder auf eine Referenz (bibitem) gesetzt werden soll.
    • Wenn headline (default) ausgewählt wurde, dann wird am Ende ein Link in der kurzen Form (s.u.) eingefügt.
    • Wenn label ausgewählt wurde, dann wird am Ende ein Link in der langen Form (s.u.) eingefügt.
    • Wenn bibitem ausgewählt wird, wird ein Zitat (Bibliographie / Referenzen) eingefügt.
  • Interne Links
- sec:internlinksol Lösung und Funktion @@latex: on page~\pageref{sec:internlinksol}@@
- sec:uilinks Interne Links @@latex: on page~\pageref{sec:uilinks}@@

8.12. Bibliographie / Referenzen

Um eine Bibliographie in Org-Mode anzulegen, habe ich mich für eine tabellarische Form entschieden. Dabei enthält eine Spalte das sichtbare Label, eine weitere Spalte das unsichtbare Label, und eine dritte Spalte dann den Eintrag. Im Export bleibt die Spalte mit dem Label dann unsichtbar. Ein unsichtbares Label beginnt immer mit bibitem: plus sichtbares Label.

Damit die Zeilenabstände beim PDF Export in der Tabelle etwas größer sind, setze ich einfach am Ende, nur für LaTeX, \vspace{1.5ex}.

#+ATTR_LATEX: :center nil :environment longtable :align lp{0.8 \textwidth}l
| R001 | https://www.gnu.org/software/emacs/ | <<bibitem:R001>> @@latex: \vspace{1.5ex}@@ |
R001 https://www.gnu.org/software/emacs/
R002 https://orgmode.org
R003 Ein längerer Eintrag einer Referenz, um zu zeigen, was bei einem Zeilenumbruch geschieht.
R004 Ein gute Nacht Geschichte.
R005 Eben dieses Pamphlet http://www.kruse-lathen.de/blog/orgnotes/init-readtheorg.html

Den Link, das Zitieren, sieht bei mir dann so aus, dass ein der Linkbeschreibung nur das sichtbare Label erscheint. Im Gegensatz zum üblichen Link wird hier das ganze in [ ] eingeschlossen.

- [R001]
- [R002]

Einfacher geht das Zitieren dann mit akl/insert-named-intern-link-ref.🔖

8.13. Region Colorizing

Um in einer markierte Region die Schriftfarbe zu setzen, habe ich die Funktionen in akl-colorize.el geschrieben. Mit der Funktion akl/toggle-colorize–color-region🔖 kann ich jetzt eine der Grundfarben als Schriftfarbe im markierten Bereich setzen, oder zurücksetzten. Dabei werden auch, versteckt, Kommandos für den LaTeX und HTML Export gesetzt.

Was die Farben für die verschiedenen Formate betrifft, müsste ich das noch weiter optimieren. Aber als Ansatz funktioniert das schon mal ganz gut.

Hier mal ein Beispiel, was dabei rauskommt.

  1. Ein Test Text, damit man was zum Spielen hat. C-c C-x C-c als keystroke zum toggeln.
  2. Ein Test Text, damit man was zum Spielen hat. C-c C-x C-c als keystroke zum toggeln.
  3. Ein Test Text, damit man was zum Spielen hat. C-c C-x C-c als keystroke zum toggeln.
  4. Ein Test Text, damit man was zum Spielen hat. C-c C-x C-c als keystroke zum toggeln.
  5. Ein Test Text, damit man was zum Spielen hat. C-c C-x C-c als keystroke zum toggeln.
  6. Ein Test Text, damit man was zum Spielen hat. C-c C-x C-c als keystroke zum toggeln.
  7. Ein Test Text, damit man was zum Spielen hat. C-c C-x C-c als keystroke zum toggeln.
  8. Ein Test Text, damit man was zum Spielen hat. C-c C-x C-c als keystroke zum toggeln.

Veröffentlicht habe ich es unter:

Viel gelernt und abgekupfert habe ich von diesen Seiten.

8.14. Tooltip Notiz

Mit der Funktion akl/toggle-tooltip–org-annotate aus akl-org-annotate.el wird ein Tooltip hinterlegt. Falls eine Region markiert ist, wird diese blau eingefärbt und unterstrichen, ist keine Region markiert, wird ein Fähnchen 🔖 gesetzt. Die Notiz ist dann als Tooltip beim Rüberfahren mit der Maus zu sehen.

  • Beim Export nach LaTeX PDF wird es als Randnotiz gesetzt. Das Fähnchen wird hier nicht gesetzt, da LaTeX dieses Zeichen nicht kennt. Dafür nutze ich das Kommando, welches ich in meiner Header Datei definiert habe.
    \newcommand{\margin}[1]{\marginline{{\footnotesize #1}}}
  • Beim Export nach HTML wird es als Tooltip, ähnlich wie im Org-Mode, gesetzt.

Hinweis: Es sollten keine wirklich langen Texte hinterlegt werden, eher so etwas wie kurze Erklärungen oder Übersetzungen.

Wenn man in einer Tooltip Region das Kommando ausführt, kann man den vorhandenen Tooltip anpassen. Ein leerer Tooltip entfernt diesen. Beim Fähnchen ist es i.d.R. einfacher, das Fähnchen zu löschen, und neu zu beginnen.

Die einzelnen Bestandteile der Steuerzeichen, der Notiz (NOTE) und des markierten Textes, respektive des Fähnchens (MARK), setzen sich wie folgt zusammen.

Org-Mode
@@org:aklann1@@NOTE@@org:aklann2@@MARK@@org:aklannend@@
LaTeX
@@latex:\margin{@@NOTE@@latex:}\textcolor{darkblue}{\uline{@@MARK@@latex:}}@@
HTML
@@html:<abbr title="@@NOTE@@html">@@MARK@@html:</abbr>@@

Zusammen dann

@@org:aklann1@@@@latex:\margin{@@@@html:<abbr title="@@
NOTE
@@org:aklann2@@@@latex:}\textcolor{darkblue}{\uline{@@@@html:">@@
MARK
@@org:aklannend@@@@latex:}}@@@@html:</abbr>@@

Hier mal ein Tooltip. Aber wenn man keine Region markiert hat, wird statt dessen das Icon🔖 eingefügt. Nur beim LaTeX PDF Export nicht, dort erscheint nur ein Leerzeichen und die Randnotiz, da das Icon nicht ausgewertet wird.

Viel gelernt und abgekupfert habe ich von diesen Seiten.

8.15. TIKZ Bilder

Mit TIKZ lassen sich Bilder für \LaTeX{} Dokumente erstellen, die sich bestens in das Dokument einfügen. Hier erst einmal ein Beispiel, um eine entsprechende PGF Datei zu erzeugen.

 1: import numpy as np
 2: import matplotlib.pyplot as plt
 3: 
 4: # Fixing random state for reproducibility
 5: np.random.seed(19680801)
 6: 
 7: dt = 0.01
 8: t = np.arange(0, 30, dt)
 9: nse1 = np.random.randn(len(t)) # white noise 1
10: nse2 = np.random.randn(len(t)) # white noise 2
11: 
12: # Two signals with a coherent part at 10Hz and a random part
13: s1 = np.sin(2 * np.pi * 10 * t) + nse1
14: s2 = np.sin(2 * np.pi * 10 * t) + nse2
15: 
16: fig, axs = plt.subplots(2, 1)
17: axs[0].plot(t, s1, t, s2)
18: axs[0].set_xlim(0, 2)
19: axs[0].set_xlabel('time')
20: axs[0].set_ylabel('s1 and s2')
21: axs[0].grid(True)
22: 
23: cxy, f = axs[1].cohere(s1, s2, 256, 1. / dt)
24: axs[1].set_ylabel('coherence')
25: 
26: fig.tight_layout()
27: # plt.show()
28: plt.savefig("./images/tikz-beispiel.pgf")
29: plt.savefig("./images/tikz-beispiel.pdf")
30: plt.savefig("./images/tikz-beispiel.png")

Für den Export nach \LaTeX{} PDF funktioniert das mit PGF schon mal wunderbar. Leider jedoch kann HTML damit nichts anfangen, daher habe ich den PGF Teil in eine \LaTeX{} Umgebung eingebettet.

#+begin_export latex
\begin{figure}[htbp]
  \centering
  \scalebox{0.7}{
    \input{./images/tikz-beispiel.pgf}
  }
  \caption{TIKZ Beispiel PGF}
\end{figure}
#+end_export


#+CAPTION: TIKZ Beispiel PNG
#+ATTR_HTML: :alt TIKZ Beispiel PNG :title TIKZ Beispiel PNG :align center
#+ATTR_HTML: :width 400
#+ATTR_LATEX: :width 0.7 \textwidth :center t
file:images/tikz-beispiel.png


#+CAPTION: TIKZ Beispiel PDF
#+ATTR_HTML: :alt TIKZ Beispiel PDF :title TIKZ Beispiel PDF :align center
#+ATTR_HTML: :width 400
#+ATTR_LATEX: :width 0.7 \textwidth :center t
file:images/tikz-beispiel.pdf

TIKZ Beispiel PNG

Abbildung 3: TIKZ Beispiel PNG

images/tikz-beispiel.pdf

8.16. TODO Vorlage für Briefe

[2021-12-29 Mi]

9. Org Roam

(use-package org-roam
  :ensure t
  :init
  (setq org-roam-v2-ack t)
  :custom
  (org-roam-directory *org-notes-roam-path*)
  (org-roam-completion-everywhere t)
  (org-roam-node-display-template` "${title}  ${tags}")
   ;; default is "${title:*} ${tags:10}"

  (org-roam-capture-templates
   '(("d" "default" plain
      "%?"
      :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+STARTUP: indent showall hidestars hideblocks inlineimages entitiespretty\n#+title: ${title}\n#+filetags: \"${title}\"\n#+category: \"${title}\"\n")
      :unnarrowed t)))

  ;; Not used because of differences to org-publish which will lead to ugly behaviour.
  ;; #+SETUPFILE: /home/ankr/projects/emacs/init/akl/akl-org-options.org\n
  
  (org-roam-dailies-directory "journal/")
  (org-roam-dailies-capture-templates
    '(("d" "default" entry "* %<%H:%M %p>: %?"
       :if-new (file+head "%<%Y-%m-%d>.org" "#+STARTUP: indent showall hidestars hideblocks inlineimages entitiespretty\n#+title: %<%Y-%m-%d>\n"))))

  (add-to-list 'display-buffer-alist
               '("\\*org-roam\\*"
                 (display-buffer-in-direction)
                 (direction . right)
                 (window-width . 0.33)
                 (window-height . fit-window-to-buffer)))

  :bind (("C-c n l" . org-roam-buffer-toggle)
         ("C-c n f" . org-roam-node-find)
         ("C-c n i" . org-roam-node-insert)
         ("C-c n j" . org-roam-dailies-goto-today)
         ("C-c n s" . akl/org-roam-ag-regexp)
         ("C-c n g" . akl/org-roam-phi-grep)
         ("C-c n A" . akl/org-roam-acronyms)
         :map org-mode-map
            ("C-c n t" . org-roam-tag-add)
            ("C-c n a" . org-roam-alias-add)
            ("C-c n r" . akl/org-roam-ref-add)
            ("C-c n p" . org-id-get-create)
            ("C-M-i"   . completion-at-point)
         :map org-roam-dailies-map
         ("Y" . org-roam-dailies-capture-yesterday)
         ("T" . org-roam-dailies-capture-tomorrow))
  :bind-keymap
  ("C-c n d" . org-roam-dailies-map)
  :config
  (require 'org-roam-dailies) ;; Ensure the keymap is available
  (org-roam-db-autosync-mode)
)

(defun akl/org-roam-ref-add (ref)
  "Add REF with prefix ref:: to org roam node at point."
  (interactive "sRef: ")
  (let ((node (org-roam-node-at-point 'assert)))
    (save-excursion
      (goto-char (org-roam-node-point node))
      (org-roam-add-property (concat "ref::" ref) "ROAM_REFS"))))

(defun akl/org-roam-ag-regexp ()
  "Search in org roam directory for pattern in files."
  (interactive)
  (save-excursion
    (helm-ag *org-notes-roam-path*
             (read-string "regexp: " (thing-at-point 'word)))))

(defun akl/org-roam-phi-grep ()
  "Search in org roam directory for pattern in files."
  (interactive)
  (save-excursion
    (phi-grep-in-directory *org-notes-roam-path*
                           (read-string "regexp: " (thing-at-point 'word))
                           "\\.org")))

(defvar *org-notes-roam-acronyms*
  (concat *org-notes-roam-path* "20211007144047-acronyms.org")
  "Path to the org roam file for acronyms.")

(defun akl/org-roam-acronyms ()
  "Search for pattern in org roam file acronyms."
  (interactive)
  (save-excursion
    (phi-grep-in-file *org-notes-roam-acronyms*
                      (read-string "regexp: " (thing-at-point 'word)))))

(add-to-list 'display-buffer-alist
             '("\\*org-roam\\*"
               (display-buffer-in-direction)
               (direction . right)
               (window-width . 0.40)
               (window-height . fit-window-to-buffer)))

(setq completion-ignore-case t)

(use-package org-roam-timestamps
  :ensure t
)
 
(use-package org-roam-ui
  :ensure t
)

9.1. Unter Windows

Die Datei emacsql-sqlite.exe von c:\apps\sqlite\emacsql-sqlite.exe nach c:\apps\emacs\elpa\emacsql-sqlite-XXXX\sqlite\ kopieren.

Die Datei kommt von https://github.com/nobiot/emacsql-sqlite.exe/blob/main/emacsql-sqlite.exe.

;; (setq org-roam-graph-executable "c:/apps/graphviz/bin/dot.exe") ;; neato.exe
;; (setq org-roam-graph-viewer "c:/Program Files (x86)/Google/Chrome/Application/chrome.exe")
;; 
;; (defun akl/cp-sqlite-to-emacssql ()
;;   "Copy emacsql-sqlite.exe to emacssql package.  Necessary for
;; org-roam."
;;   ;; (interactive)
;;   (setq dirs (directory-files (concat *dot-emacs-d-path* "/elpa/")
;;                                t
;;                                "emacsql-sqlite-[0-9]+\.[0-9]+"))
;;   (dolist (elem dirs)
;;     (progn
;;       (message elem)
;;       (if (not (file-exists-p (concat elem "/sqlite/emacsql-sqlite.exe")))
;;           (copy-file "c:/apps/sqlite/emacsql-sqlite.exe" (concat elen "/sqlite/emacsql-sqlite.exe"))))))
;; 
;; (akl/cp-sqlite-to-emacssql)

9.2. Deft

(use-package deft
  :ensure t
  :config
    (setq deft-directory *org-notes-roam-path*
          deft-extension "org"
          deft-extensions '("org")
          deft-default-extension "org"
          deft-text-mode 'org-mode
          deft-recursive t
          deft-strip-summary-regexp (concat "\\("
                                            ":PROPERTIES:\n\\(.+\n\\)+:END:\n"
                                            "\\|#\\+title: "
                                            "\\|#\\+category:.*\n"
                                            "\\|#\\+filetags:.*\n"
                                            "\\)")
          deft-use-filename-as-title t)
    :bind
      ("C-c d" . deft))

10. Org Publish

(setq org-publish-project-alist
    '(("org-roam-nodes"
       :base-directory "/home/ankr/orgnotes/roam/" ;; *org-notes-roam-path*
       :publishing-function org-html-publish-to-html
       :publishing-directory "/home/ankr/orgnotes/roam/public_html" ;; *org-notes-roam-path*
       :section-numbers nil
       :with-toc t
       :with-emphasize t
       :with-creator t
       :with-author t
       :with-fixed-width t
       :html-preamble t
       :recursive t
       :auto-sitemap t
       :html-link-home "sitemap.html"
       )
      ("org-roam-images"
       :base-directory "/home/ankr/orgnotes/roam/" ;; *org-notes-roam-path*
       :base-extension "jpg\\|gif\\|png"
       :publishing-directory "/home/ankr/orgnotes/roam/public_html" ;; *org-notes-roam-path*
       :publishing-function org-publish-attachment)
      ("org-roam-all" :components ("org-roam-nodes" "org-roam-images"))
      )
    )

11. Org Transclusion

(use-package org-transclusion
  :ensure t
  :config
  :bind
)

Dieses Paket bringt den Inhalt anderer Dateien in die Org-Mode Datei, ohne sie wirklich einzufügen. Dafür muss vor dem Link zu der Datei nur #+transclude: stehen. Wenn der org-transclusion-mode aktiv ist, kann mit org-transclusion-add der Inhalt der Datei direkt an die Stelle gespiegelt werden.

Beim Export wird nur der Inhalt mit exportiert, der zum Zeitpunkt des Exports sichtbar ist. Es mag somit nötig sein, den Befehl org-transclusion-add-all oder org-transclusion-remove-all, je nachdem, ob es exportiert werden soll, vorher auszuführen.

#+transclude: [[file:.gitignore][Git Ignore file as example.]] 

11.1. org-transclusion-map

key binding
C-c Prefix Command
TAB org-cycle
D org-transclusion-demote-subtree
O org-transclusion-move-to-source
P org-transclusion-promote-subtree
d org-transclusion-remove
e org-transclusion-live-sync-start
g org-transclusion-refresh
o org-transclusion-open-source
   
C-c C-c org-ctrl-c-ctrl-c

12. Allgemeine Tricks und Tipps

Hier allgemeine Tricks und Tipps, die nicht Org-Mode spezifisch sind.

12.1. Newline im Minibuffer

  • C-o
  • C-q C-j
  • C-q 12 (12 is the octal value of newline)
  • C-x o to the main window, kill a newline with C-k, then C-x o back to the minibuffer, yank it with C-y.

13. Pakete

Erst zusätzliche Pakete machen Emacs wertvoll.

13.1. Theme

(use-package material-theme
  :ensure t
  :init 
  :config
  (load-theme 'material t)
  )

;; (use-package shanty-themes
;;   :ensure t
;;   :init 
;;   :config
;;   (load-theme 'shanty-themes-dark t)
;;   )

13.1.1. Farbe Highlight aktuelle Zeile

(set-face-background 'hl-line "#330")

13.2. Projektverwaltung

13.2.1. Projectile

Falls ein Ordner ohne Versionskontrolle wie Git (o.ä.) von Projectile anerkannt werden soll, muss dieser Ordner eine (leere) Datei .projectile enthalten. Um beim "Suchen" im Projekt bestimmte Dateien auszuschließen, können diese in der .projectile Datei gelistet werden. Dies entspricht dem, was Projectile in Projekten mit Git in der .gitignore Datei ausliest.

Innerhalb der .projectile sieht das dann bsw. so aus.

(use-package projectile
  :ensure t
  :init
  :config
  ;; (projectile-mode +1)
  (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
  )


(use-package helm-projectile
  :ensure t
  :init
  :config
  )

(projectile-global-mode)
(setq projectile-project-search-path '("/home/ankr/projects/"))
(setq projectile-completion-system 'helm)
(helm-projectile-on)
(setq projectile-switch-project-action 'helm-projectile-find-file)
(setq projectile-switch-project-action 'helm-projectile)
Tabelle 7 Projectile Helm Kommandos
Keystroke Command Description
C-c p h helm-projectile Helm interface to projectile
C-c p p helm-projectile-switch-project Switches to another projectile project
C-c p f helm-projectile-find-file Lists all files in a project
C-u C-c p f   Re-cache projectile project
C-c p F helm-projectile-find-file-in-known-projects Find file in all known projects
C-c p g helm-projectile-find-file-dwim Find file based on context at point
C-c p d helm-projectile-find-dir Lists available directories in current project
C-c p e helm-projectile-recentf Lists recently opened files in current project
C-c p a helm-projectile-find-other-file Switch between files with same name but different extensions
C-c p i projectile-invalidate-cache Invalidate cache
C-c p z projectile-cache-current-file Add the file of current selected buffer to cache
C-c p b helm-projectile-switch-to-buffer List all open buffers in current project
C-c p s g helm-projectile-grep Searches for symbol starting from project root
C-c p s a helm-projectile-ack Same as above but using ack
C-c p s s helm-projectile-ag Same as above but using ag

Damit die Suchfunktionen auch funktionieren, müssen zum Einen die entsprechenden Programme, und zum Anderen die Pakete aus Searching with ag or ripgrep installiert sein.

13.3. Helm

Das Helm Paket ist mit das beste was es gibt.

(use-package helm
  :ensure t
  :init 
  :config
  (progn
    (setq helm-projectile-sources-list '(helm-source-projectile-projects
                                         helm-source-projectile-files-list))
    (setq projectile-switch-project-action 'helm-projectile-find-file)
    (setq projectile-switch-project-action 'helm-projectile))
  :bind (("M-x"     . helm-M-x)
         ("C-c h b" . helm-bookmarks)
         ("M-y"     . helm-show-kill-ring)
         ("C-x b"   . helm-mini)
         ("C-x C-f" . helm-find-files)
         ("C-c h o" . helm-occur)
         ("C-h SPC" . helm-all-mark-rings)
         ("C-c h x" . helm-register)
         ;; ("C-:"     . ac-complete-with-helm)
         ("C-x C-h" . helm-register)
         ("C-c y"   . helm-yas-complete)
         ;; ("C-c C-j" . helm-imenu)
         :map helm-map
         ("<tab>" . helm-execute-persistent-action)
         ("C-i"   . helm-execute-persistent-action)
         ("C-z"   . helm-select-action)))

(use-package helm-org
  :ensure t
  :init
  :config
  :bind
  ("C-c j" . helm-org-in-buffer-headings)
  )

(use-package helm-c-yasnippet
  :ensure t
  :init
  :config
  )

(use-package helm-flyspell
  :ensure t
  :init
  :config
  (define-key flyspell-mode-map (kbd "C-;") 'helm-flyspell-correct)
  )

(use-package helm-unicode
  :ensure t
  :init
  :config
  )

13.4. Helm-Color

Zeigt die Farben an. Sie können dann auch eingefügt werden.

[f1] or C-c N Copy Name Copy color name into kill-ring
[f2] or C-c R Copy RGB Copy hex value into kill-ring
[f3] or C-c n Insert Name Insert color name into current buffer
[f4] or C-c r Insert RGB Insert hex value into current buffer

13.5. helm-swoop

List the all lines to another buffer, which is able to squeeze by any words you input. At the same time, the original buffer's cursor is jumping line to line according to moving up and down the list.

(use-package helm-swoop
  :ensure t
  :init
  :config
  (setq helm-swoop-speed-or-color nil)
  :bind
  (("C-c h s" . helm-swoop)
   ("C-c h m" . helm-multi-swoop)
   )
  )

13.5.1. Example config

  • Change keybinds to whatever you like :
    • (global-set-key (kbd "M-i") 'helm-swoop)
    • (global-set-key (kbd "M-I") 'helm-swoop-back-to-last-point)
    • (global-set-key (kbd "C-c M-i") 'helm-multi-swoop)
    • (global-set-key (kbd "C-x M-i") 'helm-multi-swoop-all)
  • When doing isearch, hand the word over to helm-swoop
    • (define-key isearch-mode-map (kbd "M-i") 'helm-swoop-from-isearch)
    • (define-key helm-swoop-map (kbd "M-i") 'helm-multi-swoop-all-from-helm-swoop)
  • Save buffer when helm-multi-swoop-edit complete
    • (setq helm-multi-swoop-edit-save t)
  • If this value is t, split window inside the current window
    • (setq helm-swoop-split-with-multiple-windows nil)
  • Split direction. 'split-window-vertically or 'split-window-horizontally
    • (setq helm-swoop-split-direction 'split-window-vertically)
  • If nil, you can slightly boost invoke speed in exchange for text color
    • (setq helm-swoop-speed-or-color nil)
  • Go to the opposite side of line from the end or beginning of line
    • (setq helm-swoop-move-to-line-cycle t)
  • Optional face for line numbers. Face name is `helm-swoop-line-number-face`.
    • (setq helm-swoop-use-line-number-face t)

13.5.2. Commands

  • `M-x helm-swoop` when region active
  • `M-x helm-swoop` when the cursor is at any symbol
  • `M-x helm-swoop` when the cursor is not at any symbol
  • `M-3 M-x helm-swoop` or `C-u 5 M-x helm-swoop` multi separated line culling
  • `M-x helm-multi-swoop` multi-occur like feature
  • `M-x helm-multi-swoop-all` apply all buffers
  • `C-u M-x helm-multi-swoop` apply last selected buffers from the second time
  • `M-x helm-swoop-same-face-at-point` list lines have the same face at the cursor is on
  • During isearch `M-i` to hand the word over to helm-swoop
  • During helm-swoop `M-i` to hand the word over to helm-multi-swoop-all
  • While doing `helm-swoop` press `C-c C-e` to edit mode, apply changes to original buffer by `C-x C-s`

13.5.3. Helm Swoop Edit

While doing helm-swoop, press keybind [C-c C-e] to move to edit buffer. Edit the list and apply by [C-x C-s]. If you'd like to cancel, [C-c C-g]

13.6. Helm SVN

By calling helm-ls-svn-ls in any buffer that is a part of a svn repo, you will be presented with a corresponding helm buffer containing a list of all the buffers/files currently in that same repository,

(use-package helm-ls-svn
  :ensure t
  :init
  )

13.7. unipoint

A simple way to insert unicode characters by TeX name. The shortcut is C-\.

(use-package unipoint
  :ensure t
  :init
  :config
  )
Tabelle 8 Beispiele unicode
alpha α Alpha Α rightarrow
lambda λ Lambda Λ Leftarrow
theta θ Theta Θ leftrightarrow
omega ω Omega Ω downarrow

13.9. Register-list

Listet nicht nur die benutzten Register auf.

(use-package register-list
  :ensure t
  :init
  :config
  :bind (("C-x C-l" . register-list)
         ("C-x C-p" . point-to-register)
         ("C-x C-j" . jump-to-register)
         ("C-x C-r" . copy-to-register)
         ("C-x C-i" . insert-register)))

13.10. Yasnippet

(use-package yasnippet
  :ensure t
  :hook
    (prog-mode . yas-minor-mode)
    (org-mode . yas-minor-mode)
  :init
  ;; (yas-global-mode 1)
  :config
  (yas-reload-all)
  )

(use-package yasnippet-snippets
  :ensure t
  :init
  :config
  )

13.11. auto-yasnippet

(use-package auto-yasnippet
  :ensure t
  :init
  :config
  :bind
  (("M-C-w" . aya-create)
   ("M-C-y" . aya-expand)))

13.12. clipmon

M-x clipmon-autoinsert-toggle ausführen, und mit Strg-C kopieren und automatisch in Emacs einfügen.

(use-package clipmon 
  :ensure t
  :init
  :config
  )

13.13. multiple-cursors

(use-package multiple-cursors
  :ensure t
  :init
  :config
  :bind (("C-S-c C-S-c" . mc/edit-lines)
         ("C->"         . mc/mark-next-like-this)
         ("C-<"         . mc/mark-previous-like-this)
         ("C-S-c C->"   . mc/mark-all-like-this)))

13.14. visible mark

(use-package visible-mark
  :ensure t
  :init
  (global-visible-mark-mode 1)
  :config
  )

13.15. goto changes

(use-package goto-chg
  :ensure t
  :init
  :config
  :bind
  (([(control ?.)] . goto-last-change)
   ([(control ?,)] . goto-last-change-reverse))
  )

13.16. highlight thing at point

(use-package highlight-thing
  :ensure t
  :init
  :config
  )

13.17. google translation

(use-package google-translate
  :ensure t
  :init
  :config
  :bind
  (("\C-ct" . google-translate-at-point)
   ("\C-cT" . google-translate-query-translate))
  )

13.18. phi-search

(use-package phi-search
  :ensure t
  :init
  :config
  :bind
  (("C-s" . phi-search)
   ("C-r" . phi-search-backward)
   ("M-%" . phi-replace-query)
   :map phi-search-default-map
   ("<" . phi-search-again-or-previous)
   (">" . phi-search-again-or-next))
  )

13.19. phi-search-dired

(use-package phi-search-dired
  :ensure t
  :init
  :config
  )

13.20. phi-autopair

(use-package paredit
  :ensure t
  )

(use-package phi-autopair
  :ensure t
  :init
  :config
  (phi-autopair-global-mode)
  )

13.21. phi-grep

(use-package phi-grep
  :ensure t
  :init
  :config
  )

13.22. phi-rectangle

(use-package phi-rectangle
  :ensure t
  :init
  :config
  )

13.23. phi-search-mc

(use-package phi-search-mc
  :ensure t
  :init
  :config
  (phi-search-mc/setup-keys)
  )

13.24. zoom window

(use-package zoom-window
  :ensure t
  :init
  :config
  (setq zoom-window-mode-line-color "Cyan")
  :bind
  (("C-x C-z" . zoom-window-zoom))
  )

13.25. evil numbers

Decrease/increase number under cursorline.

(use-package evil-numbers
  :ensure t
  :init
  :config
  :bind
  (("C-+" . evil-numbers/inc-at-pt)
   ("C--" . evil-numbers/dec-at-pt))
  )

13.26. Zwischen Fenstern wechseln

13.26.1. wn mode

To switch to other windows via M-1 … M-0 and M-#.

(use-package wn-mode
  :ensure t
  :init
  :config
  (wn-mode)
  )

13.26.2. switch-window

Set to keystroke M-s M-w.

(use-package switch-window
  :ensure t
  :init
  :config
  :bind
  (("M-s M-w" . switch-window))
  )

13.27. comment dwim 2 (do what i mean)

(use-package comment-dwim-2
  :ensure t
  :init
  :config
  :bind
  (("M-;" . comment-dwim-2))
  )

13.28. poporg

Editing program comments or strings with Org mode or other text modes.

(use-package poporg
  :ensure t
  :init
  :config
  )

13.29. bm-bookmarks, visible bookmarks

(use-package bm
  :ensure t
  :demand t
  :init
  ;; restore on load (even before you require bm)
  (setq bm-restore-repository-on-load t)
  :config
  ;; Allow cross-buffer 'next'
  (setq bm-cycle-all-buffers t)
  
  ;; where to store persistant files
  (setq bm-repository-file (concat *dot-emacs-d-path* "bm-repository"))
  
  ;; save bookmarks
  (setq-default bm-buffer-persistence t)
  
  ;; Loading the repository from file when on start up.
  (add-hook' after-init-hook 'bm-repository-load)

  ;; Restoring bookmarks when on file find.
  (add-hook 'find-file-hooks 'bm-buffer-restore)

  ;; Saving bookmarks
  (add-hook 'kill-buffer-hook #'bm-buffer-save)

  ;; Saving the repository to file when on exit.
  ;; kill-buffer-hook is not called when Emacs is killed, so we
  ;; must save all bookmarks first.
  (add-hook 'kill-emacs-hook #'(lambda nil
                                 (bm-buffer-save-all)
                                 (bm-repository-save)))

  ;; The `after-save-hook' is not necessary to use to achieve persistence,
  ;; but it makes the bookmark data in repository more in sync with the file
  ;; state.
  (add-hook 'after-save-hook #'bm-buffer-save)

  ;; Restoring bookmarks
  (add-hook 'find-file-hooks   #'bm-buffer-restore)
  (add-hook 'after-revert-hook #'bm-buffer-restore)

  ;; The `after-revert-hook' is not necessary to use to achieve persistence,
  ;; but it makes the bookmark data in repository more in sync with the file
  ;; state. This hook might cause trouble when using packages
  ;; that automatically reverts the buffer (like vc after a check-in).
  ;; This can easily be avoided if the package provides a hook that is
  ;; called before the buffer is reverted (like `vc-before-checkin-hook').
  ;; Then new bookmarks can be saved before the buffer is reverted.
  ;; Make sure bookmarks is saved before check-in (and revert-buffer)
  (add-hook 'vc-before-checkin-hook #'bm-buffer-save)

  ;; (progn
  ;;             (setq bm-restore-repository-on-load t)
  ;;   (add-hook' after-init-hook 'bm-repository-load)
  ;;   (add-hook 'find-file-hooks 'bm-buffer-restore)
  ;;   (add-hook 'kill-buffer-hook 'bm-buffer-save)
  ;;   (add-hook 'kill-emacs-hook '(lambda nil
  ;;                                   (bm-buffer-save-all)
  ;;                                   (bm-repository-save)))
  ;;   (add-hook 'after-save-hook 'bm-buffer-save)
  ;;   (add-hook 'after-revert-hook 'bm-buffer-restore))

  :bind
  (("<C-f2>" . bm-toggle)
   ("<f2>" . bm-next)
   ("<S-f2>" . bm-previous)
   ("<left-fringe> <mouse-5>" . bm-next-mouse)
   ("<left-fringe> <mouse-4>" . bm-previous-mouse)
   ("<left-fringe> <mouse-1>" . bm-toggle-mouse)
   ("C-c b" . helm-bm)
   )
  )

(use-package helm-bm
  :ensure t
  :init
  :config
  )

13.30. mwim - move where I mean

(use-package mwim
  :ensure t
  :init
  :config
  (progn
    (autoload 'mwim-beginning-of-code-or-line "mwim" nil t)
    (autoload 'mwim-beginning-of-line-or-code "mwim" nil t)
    (autoload 'mwim-end-of-code-or-line "mwim" nil t)
    (autoload 'mwim-end-of-line-or-code "mwim" nil t))
  :bind
  (("C-a" . mwim-beginning-of-code-or-line)
   ("C-e" . mwim-end-of-code-or-line))
  )

13.31. smooth-scrolling

(use-package smooth-scrolling
  :ensure t
  :init
  :config
  (smooth-scrolling-mode 1)
  )

13.32. csv-mode

(use-package csv-mode
  :ensure t
  :init
  :config
  )

13.33. imenu-list

(use-package imenu-list
  :ensure t
  :init
  :config
  :bind
  (("<f9>" . imenu-list))
  )

13.34. swiper-helm

(use-package swiper
  :ensure t
  :init
  :config
  )

(use-package swiper-helm
  :commands (swiper
             swiper-helm
             swiper-helm-at-point
             swiper-helm-from-isearch)
  :bind (;; ("s-s" . swiper-helm-at-point)
         ("C-c s" . swiper-helm)
         ;; ("C-c s" . swiper)
         )
  :bind (:map isearch-mode-map
              ("s-s" . swiper-helm-from-isearch))
  ;; Configuration
  :config
  ;; Newly defined
  (defun swiper-helm-at-point ()
    "Custom function to pick up a thing at a point for swiper-helm

  If there is a symbol at the current point, its textual representation is
  searched for by swiper-helm. If there is no symbol, empty search box is
  started."
    (interactive)
    (swiper-helm (cond
                  ;; If there is selection use it
                  ((and transient-mark-mode mark-active (not (eq (mark) (point))))
                   (buffer-substring-no-properties (mark) (point)))
                  ;; Otherwise, use symbol at point or empty
                  (t (format "%s"
                             (or (thing-at-point 'symbol)
                                 ""))))))
  )

13.35. german-holidays

(use-package german-holidays
  :ensure t
  :init
  :config
  (setq holiday-other-holidays holiday-german-holidays)
  )

13.36. cycle-resize

Default values are 80 – 50 – 20 – 50. For other settings use (setq cycle-resize-steps '(80 50 20 50)).

(use-package cycle-resize
  :ensure t
  :init
  :config
  :bind
  (("C-M-v" . cycle-resize-window-vertically)
   ("C-M-h" . cycle-resize-window-horizontally))
  )

13.37. yankpad

https://github.com/Kungsgeten/yankpad

(use-package yankpad  
  :ensure t
  :defer 10
  :init
  (setq yankpad-file (concat *org-notes-path* "yankpad.org"))
  :config
  (bind-key "C-x C-y C-y" 'yankpad-insert)
  (bind-key "C-x C-y C-c" 'yankpad-set-category)
  (bind-key "C-x C-y C-m" 'yankpad-map)
  (bind-key "C-x C-y C-e" 'yankpad-expand)
  ;; (add-to-list 'company-backends 'company-yankpad)
  )

13.38. helm org rifle

https://github.com/alphapapa/helm-org-rifle

helm-org-rifle
Shows results from all open Org buffers
helm-org-rifle-current-buffer
Shows results from current buffer
helm-org-rifle-directories
Shows results from selected directories; with prefix, recursively.
helm-org-rifle-files
Shows results from selected files.
(use-package helm-org-rifle
  :ensure t
  :init
  :config
  :bind
  (("C-c r r" . helm-org-rifle)
   ("C-c r b" . helm-org-rifle-current-buffer)
   ("C-c r d" . helm-org-rifle-directories)
   ("C-c r f" . helm-org-rifle-files))
  )

13.39. zop-to-char

A replacement of zap-to-char M-z <char>.

(use-package zop-to-char
  :ensure t
  :init
  :config
  :bind
  (([remap zap-to-char] . zop-to-char))
  )

13.40. neotree

(use-package neotree
  :ensure t
  :init
  :config
  :bind
  (("<f12>" . neotree-toggle))
  )

13.41. dot-mode

  • dot-mode vi like

Wenn M-x dot-mode aktiviert wurde, wiederholt der Befehl C-. die letzten Eingaben/Kommandos. Goto-chg funktioniert dann nicht, da ich den selben keystroke benutze.

(use-package dot-mode
  :ensure t
  :init
  :config
  ;; (add-hook 'find-file-hooks 'dot-mode-on) 
  )

13.42. expand-region

Wenn der Cursor innerhalb eines Bereichs liegt, bsw. durch Klammern eingegrenzt, kann mit dem Kommando er/expand-region die Markierung auf den Bereich erweitert werden. Wird das Kommando wiederholt, vergrößert sich der markierte Bereich. Mit er/contract-region setzt man die Markierung schrittweise wieder zurück.

(use-package expand-region
  :ensure t
  :init
  :config
  :bind
  (("C-;"   . er/expand-region)
   ("C-M-;" . er/contract-region))
  )

13.43. embrace

There are three commands: `embrace-add', `embrace-change' and `embrace-delete' that can add, change, and delete surrounding pairs respectively. You can bind these commands to your favorite key bindings.

There is also a dispatch command `embrace-commander'. After invoking `embrace-commander', you can hit:

  • `a' for `embrace-add'
  • `c' for `embrace-change'
  • `d' for `embrace-delete'
(use-package embrace
  :ensure t
  :init
  :config
  :bind
  (("C-(" . embrace-commander))
  )

13.44. emojify

To enable emojify mode globally use `global-emojify-mode'.

:- ;- :D
(use-package emojify
  :ensure t
  :init
  (global-emojify-mode 1)
  :config
)

13.45. engine-mode

To start search in browser out of emacs. I have comment out the line (engine/set-keymap-prefix (kbd "C-c /")) because of I need the keystroke to sparse the org-agenda.

(use-package engine-mode
  :ensure t
  :init
  :config
)

(require 'engine-mode)
(engine-mode t)
;; use Emacs' built-in eww browser:
(setq engine/browser-function 'eww-browse-url)

(engine/set-keymap-prefix (kbd "C-c e"))

(defengine duckduckgo
  "https://duckduckgo.com/?q=%s"
  :keybinding "d")

(defengine google
  "http://www.google.de/search?ie=utf-8&oe=utf-8&q=%s"
  :keybinding "g")

(defengine wikipedia
  "http://www.wikipedia.org/search-redirect.php?language=de&go=Go&search=%s"
  :keybinding "w"
  :docstring "Searchin' the wikis.")

(defengine youtube
  "https://www.youtube.com/results?search_query=%s"
  :keybinding "y")

(defengine dict.cc
  "https://www.dict.cc/?s=%s"
  :keybinding "t")

13.46. flycheck

Den Syntaxcheck global aktivieren.

(use-package flycheck
 :ensure t
 :init
 (global-flycheck-mode t)
)

13.47. flylisp

(use-package flylisp
 :ensure t
 :init
)

13.48. which-key

Zeigt die möglichen Tastenkombinationen an.

(use-package which-key
  :ensure t
  :config
  (which-key-mode)
)

13.49. nlinum

;; (use-package linum
;;   :ensure t
;;   :init
;;   :config
;;   (global-linum-mode t)
;; )

(use-package nlinum
  :ensure t
  :init
  :config
  (global-nlinum-mode t)
)

13.50. Emacs Image Manipulation Package — eimp

(use-package eimp
  :ensure t
  :init
  :config
)

13.51. hydra

(use-package hydra
  :ensure t
  :init
  :config
)

(use-package pretty-hydra
  :ensure t
  :init
  :config
)

(use-package major-mode-hydra
  :ensure t
  :init
  :config
  :bind
  ("<C-escape>" . major-mode-hydra)
)

;; (major-mode-hydra-bind org-mode "Tbl"
;;   ("r" org-table-insert-row "insert row")
;;   ("c" org-table-insert-column "insert column")
;; )

13.52. vdiff

Starten mit M-x vdiff. Nach der Auswahl der Dateien bietet es sich an als nächstes M-x vdiff/hydra-body auszuführen.

(use-package vdiff
  :ensure t
  :init
  :config
  )

13.53. dictcc

Sucht in dict.cc nach dem Wort unter dem Cursor. Aufruf mit M-x dictcc-at-point.

(use-package dictcc
:ensure t
:init
)

13.54. Eshell

(use-package eshell
  :ensure t
  :config
  (eshell-git-prompt-use-theme 'powerline)
  :bind (("M-h" . helm-eshell-history))
  )

(use-package eshell-syntax-highlighting
  :after esh-mode
  :demand t ;; Install if not already installed.
  :config
  ;; Enable in all Eshell buffers.
  (eshell-syntax-highlighting-global-mode +1))

(use-package eshell-toggle
  :ensure t
  :init
  :config
  :custom
    ;; size as fraction of, 3 is 1/3, 2 is 1/2
    (eshell-toggle-size-fraction 2) 
    ;;; (eshell-toggle-use-projectile-root t)
    (eshell-toggle-run-command nil)
    ;;; (eshell-toggle-init-function #'eshell-toggle-init-ansi-term)
    ;;; :quelpa
    ;;; (eshell-toggle :repo "4DA/eshell-toggle" :fetcher github :version original)
  :bind
    ("C-<f12>" . eshell-toggle))

13.55. Fast Scroll

Ever run into scrolling issues that drive you crazy? (pauses and lag when trying to run through the buffer)

If you have a fair amount of packages and customizations (particularly if they are mode-line / font-lock heavy) then this is the package to help alleviate that a bit for you.

It works by temporarily disabling font-lock and switching to a barebones mode-line, until you stop scrolling (at which point it re-enables).

In your init file add something such as it will wrap some common scroll commands.

(use-package fast-scroll
:ensure t
:init
:config
  ;; If you would like to turn on/off other modes, like flycheck, add
  ;; your own hooks.
  (add-hook 'fast-scroll-start-hook (lambda () (flycheck-mode -1)))
  (add-hook 'fast-scroll-end-hook (lambda () (flycheck-mode 1)))
  (fast-scroll-config)
  (fast-scroll-mode 1)
  ;; You can adjust the 'throttle' rate (how fast subsequent 
  ;; scroll commands must come in bound) as such:
  (setq fast-scroll-throttle 0.5)
)

13.56. Align Text

(use-package ialign
  :ensure t
  :init
  :config
)

13.57. color-moccur

(use-package color-moccur
  :ensure t
  :init
  :config
)

13.58. Dashboard

(use-package dashboard
  :ensure t
  :init
  (progn
    (setq dashboard-items '((recents  . 6)
                            (projects . 4)
                            (bookmarks . 26)))
    (setq dashboard-banner-logo-title
"  [F8] - Aufgaben    [S-F8] - *Dashboard*    \"C-c f\" - TODOs    \"C-c a n\" - Agenda and TODOs    \"C-c a e\" - HTML Export Agenda and TODOs")
    (setq dashboard-startup-banner "~/Bilder/2006-05-03_SommertagBeiDuettmann/ich_mit_Hut_hackergotchi.png")
    (setq dashboard-set-navigator t)

    (setq dashboard-navigator-buttons
          `((;; line 1
             (,""
              "Aufgaben"
              "Open aufgaben.org"
              (lambda (&rest _) (find-file (concat *org-notes-path* "aufgaben.org"))))
             (,""
              "XKCD"
              "Open XKCD"
              (lambda (&rest _) (xkcd)))
             )
            (;; line 2
             (,""
              ".emacs"
              ".emacs"
              (lambda (&rest _) (find-file "~/.emacs")))
             (,""
              "init.org"
              "init.org"
              (lambda (&rest _) (find-file (concat *project-emacs-init-path* "init.org"))))
             )
            ))
    :config
    (dashboard-setup-startup-hook)))


(defun akl/open-dashboard-buffer ()
  "Opens the *dashboard* buffer."
  (interactive)
  (switch-to-buffer "*dashboard*"))

(global-set-key (kbd "<S-f8>") 'akl/open-dashboard-buffer)

13.59. calfw - Calendar View

(use-package calfw
  :ensure t
  :init
  :config
)

(use-package calfw-org
  :ensure t
  :init
  :config
)

13.60. XKCD

Hol das letzte XKCD Comic mit M-x xkcd.

(use-package xkcd
  :ensure t
  :init
  :config
)

13.61. JSON

(use-package json-mode
  :ensure t
  :init
  :config
  )

(use-package json-reformat
  :ensure t
  :init
  :config
  )

;; (require 'hierarchy)
;; (use-package json-navigator
;;   :ensure t
;;   :init
;;   :config
;;   )

13.62. helpful

(use-package helpful
  :ensure t
  :init
  :config
)

;; Note that the built-in `describe-function' includes both functions
;; and macros. `helpful-function' is functions only, so we provide
;; `helpful-callable' as a drop-in replacement.
(global-set-key (kbd "C-h f") #'helpful-callable)

(global-set-key (kbd "C-h v") #'helpful-variable)
(global-set-key (kbd "C-h k") #'helpful-key)

;; Lookup the current symbol at point. C-c C-d is a common keybinding
;; for this in lisp modes.
;; (global-set-key (kbd "C-c C-d") #'helpful-at-point)

;; Look up *F*unctions (excludes macros).
;;
;; By default, C-h F is bound to `Info-goto-emacs-command-node'. Helpful
;; already links to the manual, if a function is referenced there.
(global-set-key (kbd "C-h F") #'helpful-function)

;; Look up *C*ommands.
;;
;; By default, C-h C is bound to describe `describe-coding-system'. I
;; don't find this very useful, but it's frequently useful to only
;; look at interactive functions.
(global-set-key (kbd "C-h C") #'helpful-command)

(setq counsel-describe-function-function #'helpful-callable)
(setq counsel-describe-variable-function #'helpful-variable)

13.63. Searching with ag or ripgrep

Diese Pakete laufen für sich alleine schon mal sehr schnell und schön. Im Zusammenhang mit Projectile ist es dann sehr praktisch.

(use-package ag
  :ensure t)

(use-package helm-ag
  :ensure t)

(use-package helm-rg
  :ensure t)

(use-package projectile-ripgrep
  :ensure t)

(use-package ripgrep
  :ensure t)

(use-package rg
  :ensure t)

13.64. Rainbow Mode

(use-package rainbow-mode
  :ensure t)

13.65. load-theme-buffer-local

Leider funktioniert die Version auf Melpa nicht, und Marmalade lässt sich z.Z. nicht nutzen. Daher habe ich den Code von den Quellen kopiert und manuell eingebunden.

(load-if-file-exist  (concat *dot-emacs-d-path* "other-packages/color-theme-buffer-local-master/load-theme-buffer-local.el"))

13.66. diredc

Midnight Commander like dired. Quit with C-q.

(use-package diredc
  :ensure t)

Keystrokes in diredc frame.

C-q diredc-exit ; defalias diredc-quit
q diredc-do-not-quit-window
\t diredc-other-window
<backtab> diredc-other-window ; No directionality
[remap dired-find-file] diredc-hist-find-file
[remap dired-find-alternate-file] diredc-hist-find-alternate-file
<RET> diredc-hist-find-alternate-file
o diredc-hist-find-file-other-window
/ diredc-hist-change-directory
^ diredc-hist-up-directory
C-<up> diredc-hist-up-directory
C-<left> diredc-hist-previous-directory
C-<right> diredc-hist-next-directory
= diredc-hist-duplicate
C-x q diredc-browse-mode
M-t diredc-display-toggle
C-c ? diredc-show-more-file-info
C-c + a diredc-bookmark-add
C-c + j diredc-bookmark-jump
C-c + e diredc-bookmark-edit
E wdired-change-to-wdired-mode
e wdired-change-to-wdired-mode
' diredc-shell
C-c ! diredc-shell
C-k diredc-trash-quick-delete
C-<delete> ? diredc-trash-assistant
C-<delete> SPC diredc-trash-toggle
C-<delete> <insertchar> diredc-trash-toggle
C-<delete> j diredc-trash-view ; jump to files-dir
C-<delete> v diredc-trash-view ; jump to files-dir
C-<delete> i diredc-trash-info ; report trash size
C-<delete> C-<delete> diredc-trash-empty
C-<delete> x diredc-trash-empty
C-<delete> r diredc-trash-restore

13.67. gnuplot

(use-package gnuplot
  :ensure t)

(use-package gnuplot-mode
  :ensure t)

13.68. matlab mode

;;(use-package matlab-mode
;;  :ensure t)

13.69. Plant UML

A major mode for plantuml, see: http://plantuml.sourceforge.net/ Plantuml is an open-source tool in java that allows to quickly write :

  • sequence diagram,
  • use case diagram,
  • class diagram,
  • activity diagram,
  • component diagram,
  • state diagram
  • object diagram
(use-package plantuml-mode
  :ensure t)

13.70. Graphviz

An emacs mode for DOT language, used by graphviz (www.graphviz.org and att).

(use-package graphviz-dot-mode
  :ensure t)

14. Private Einstellungen

Einstellungen die sowas wie Passwörter enthalten habe ich in eine eigene init Datei ausgelagert.

  • org2blog settings
  • sunshine, weather forecast
(load-if-file-exist "/home/ankr/projects/emacs/init/init-private.el")

15. Lisp

15.1. Lisp Mode

(use-package lisp-mode
  :init
  (defconst lisp--prettify-symbols-alist
    '(("lambda"  . ?λ)                  ; Shrink this
      ("."       . ?•)))                ; Enlarge this

  :bind (("C-c e i" . ielm))

  :config
  (add-hook 'emacs-lisp-mode-hook 'global-prettify-symbols-mode)
  (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
  ;; (add-hook 'emacs-lisp-mode-hook 'activate-aggressive-indent)

  ;; Bind some prefixes to a couple of mode maps:
  (bind-keys :map emacs-lisp-mode-map
             :prefix-map lisp-find-map
             :prefix "C-h e"
             ("e" . view-echo-area-messages)
             ("f" . find-function)
             ("k" . find-function-on-key)
             ("l" . find-library)
             ("v" . find-variable)
             ("V" . apropos-value))

  (dolist (m (list emacs-lisp-mode-map lisp-interaction-mode-map))
    (bind-keys :map m
               :prefix-map lisp-evaluation-map
               :prefix "C-c e"
               ("b" . eval-buffer)
               ("r" . eval-region)
               ("c" . eval-and-comment-output) ;; Defined below
               ("o" . eval-and-comment-output)
               ("d" . toggle-debug-on-error)
               ("f" . emacs-lisp-byte-compile-and-load))))

15.2. IELM

Inferior Emacs Lisp Mode (IELM), add the eldoc feature to it:

(use-package ielm
  :init
  (add-hook 'ielm-mode-hook 'turn-on-eldoc-mode))

15.3. Eros

Instead of displaying the results in a separate buffer (like the above code does), The EROS project displays the results temporarily in the buffer in an overlay. No need to do anything special:

(use-package eros
  :ensure t
  :init
  (add-hook 'emacs-lisp-mode-hook (lambda () (eros-mode 1))))

15.4. Debugging

Debugging is built into Emacs. Simply prepend a C-u before you evaluate a function, and when it is run, it will drop you into the debugger.

Remember the following key-bindings once started:

SPC
To stop at the next stop point
b
Set a breakpoint and q to execute until that breakpoint
q
quit the debugger (other commands, hit ? to see what is available) Unfamiliar? Check out this introduction (or see the Info).

16. Python

(use-package python
  :ensure t
  :defer t
  :delight "Py"
  :config
      ;; Remove guess indent python message
      (setq python-indent-guess-indent-offset-verbose nil)
  :bind (:map python-mode-map
      (("C-c C-j" . helm-imenu)
       ("C-c j" . helm-imenu)
       ("C-c t" . treemacs))
  )
)

16.1. Disable Flycheck

(with-eval-after-load 'flycheck
  (setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc
                                             python-flake8
                                             python-pylint
                                             python-pycompile
                                             python-pyright
                                             python-mypy
                                             lsp)))

Lokal kann auch in einer Datei das folgende eingetragen werden.

;; Local Variables:
;; flycheck-disabled-checkers: (emacs-lisp-checkdoc python-flake8 python-pylint python-pycompile python-pyright python-mypy)
;; End:

16.2. Hide modeline

Hide the modeline for inferior python processes (as well as R)

(use-package inferior-python-mode
  :ensure nil
  :hook (inferior-python-mode . hide-mode-line-mode))

(use-package hide-mode-line
  :ensure t
  :defer t)

16.3. poetry

(use-package poetry
  :ensure t
  :defer t
  :config
  (setq poetry-tracking-strategy 'switch-buffer)
  (setenv "WORKON_HOME" "~/.cache/pypoetry/virtualenvs")) ;; keeping track of virtualenvs available

16.4. Company

Next up are packages which are not strictly Python related and apply for lots of languages, YMMV but it's a good idea to use company for completion and some form of language server interface (lsp-mode or eglot), this file uses lsp-mode.

(use-package company
  :ensure t
  :defer t
  :diminish ""
  :custom
  (company-dabbrev-other-buffers t)
  (company-dabbrev-code-other-buffers t)
  ;; M-<num> to select an option according to its number.
  (company-show-numbers t)
  ;; Only 2 letters required for completion to activate.
  (company-minimum-prefix-length 3)
  ;; Do not downcase completions by default.
  (company-dabbrev-downcase nil)
  ;; Even if I write something with the wrong case,
  ;; provide the correct casing.
  (company-dabbrev-ignore-case t)
  ;; Don't wait before completion.
  (company-idle-delay 0)
  ;; No company-mode in shell & eshell
  (company-global-modes '(not eshell-mode shell-mode))
    :hook ((text-mode . company-mode)
           (prog-mode . company-mode)))

(use-package helm-company
  :ensure t
  :init
  :config
  ;; (add-to-list 'company-backends #'helm-company)
  )

(eval-after-load 'company
  '(progn
     (define-key company-mode-map (kbd "C-:") 'helm-company)
     (define-key company-active-map (kbd "C-:") 'helm-company)))

16.5. tree-sitter

(use-package tree-sitter
  :demand t
  :config
  (global-tree-sitter-mode))

(add-hook 'python-mode-hook #'tree-sitter-mode)
(add-hook 'tree-sitter-after-on-hook #'tree-sitter-mode)

16.6. lsp-mode

  • `lsp-mode` proper
  • The config should be relatively agnostic up to here
(use-package lsp-mode
  :ensure t
  :defer t
  :delight " LSP"
  :defines (lsp-keymap-prefix lsp-mode-map)
  :init
  (setq lsp-keymap-prefix "C-c l")
  :custom
  (lsp-keep-workspace-alive nil)
  (lsp-auto-guess-root nil)
  (lsp-eldoc-enable-hover nil)
  (lsp-signature-auto-activate nil)
  (lsp-completion-enable t)
  :hook (lsp-mode-hook . lsp-enable-which-key-integration)
  :commands (lsp lsp-deferred)
  :bind (:map lsp-mode-map
        ("M-<RET>" . lsp-execute-code-action)))

;; ;; https://emacs-lsp.github.io/lsp-mode/page/performance/
(setq gc-cons-threshold 100000000)
(setq read-process-output-max (* 1024 1024 4)) ;; 4 MB
(setq lsp-completion-provider :capf)
(setq lsp-idle-delay 0.500)

16.7. helm-lsp

(use-package helm-lsp
  :ensure t
  :init
  :config
)
(define-key lsp-mode-map [remap xref-find-apropos] #'helm-lsp-workspace-symbol)

16.8. Debugger DAP

(use-package dap-mode
  :ensure t
  :defer t
  :after lsp-mode
  :config
  (dap-auto-configure-mode))

16.9. PDB - Python Debug Buffer

Emacs settings for PDB.

;; PDB command line
(defun akl/user-python-debug-buffer ()
  "Run python debugger on current buffer."
  (interactive)
  (setq command (format "python -u -m pdb %s " (file-name-nondirectory buffer-file-name)))
  (let ((command-with-args (read-string "Debug command: " command nil nil nil)))
    (pdb command-with-args)))

16.10. lsp-pyright

See https://emacs-lsp.github.io/lsp-mode/ for more info

(use-package lsp-pyright
  :ensure t
  :defer t
  :custom
  (lsp-pyright-disable-language-service nil)
  (lsp-pyright-disable-organize-imports nil)
  (lsp-pyright-auto-import-completions t)
  (lsp-pyright-use-library-code-for-types t)
  (lsp-completion-enable t)
  :hook ((python-mode . (lambda ()
             (poetry-tracking-mode)
             (require 'lsp-pyright)
             (lsp-deferred)))))

16.11. highlight-indent-guides

(use-package highlight-indent-guides
  :ensure t
  :config
  ;; (setq highlight-indent-guides-method 'column)
  (setq highlight-indent-guides-method 'character)
  :hook (python-mode . highlight-indent-guides-mode)
)

17. \LaTeX{}

17.1. \LaTeX{} AUCTeX reftex

;; This will not work, therefore the line below.
;; (use-package auctex
;;   :ensure t
;;   :init
;;   :config
;; )
(use-package tex :ensure auctex)

;; (use-package auctex-latexmk
;;   :ensure t
;;   :init
;;   :config
;; )

(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
;;  (require 'tex-site)
;;  (require 'auctex-latexmk)
;;  (auctex-latexmk-setup)
(add-hook 'LaTeX-mode-hook 'visual-line-mode)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-auctex t)
(setq TeX-PDF-mode t)

17.2. cdlatex

(use-package cdlatex
  :ensure t
  :init
  :config
)

(add-hook 'LaTeX-mode-hook 'turn-on-cdlatex)   ; with AUCTeX LaTeX mode
(add-hook 'org-mode-hook 'turn-on-org-cdlatex)

17.3. latex-extra

  • Vollständiges Kompilieren mit C-c C-a.
  • Mit TAB Kapitel wie im org-mode auf- und zuklappen.
  • Eine Umgebung mit C-c C-q aufräumen.
(use-package latex-extra
  :ensure t
  :init
  :config (
     ;; (add-hook 'LaTeX-mode-hook #'latex-extra-mode)
     )
)

17.4. Magic LaTeX Buffer

(use-package magic-latex-buffer
 :ensure t
 :init
 :config (
    ;; (add-hook 'latex-mode-hook 'magic-latex-buffer)
    )
)

17.5. xenops

Xenops is a LaTeX editing environment for mathematical documents in Emacs.

(use-package xenops
 :ensure t
 :init
 :config
)

;; (add-hook 'latex-mode-hook #'xenops-mode)
;; (add-hook 'LaTeX-mode-hook #'xenops-mode)

18. Eigene Funktionen

18.1. Ausgelagert in andere Dateien

Funktionen die ich selbst geschrieben/geklaut habe liegen in den Dateien:

  1. akl-main-defs.el
  2. akl-main.el
  3. akl-faces.el → Setzt Faces für verschiedene Modie. Für den Export siehe akl-org-exporter.el.
    • akl-namen.org → Enthält die Texte und Eigenschaften für verschiedene Funktionen und Farbgebungen beim Exportieren. Die Datei wird in der akl-faces.el eingelesen und genutzt, um bestimmten Mustern für die Ausgabe im Org-Mode, und beim Exportieren nach HTML und PDF, die Schriftfarben zu setzen. Die Liste der Daten wird auch in der akl-namen.el gelesen, um die Ausgabe bei der Funktion akl/choose-n-insert-names (C-c n) zu setzen.
  4. akl-namen.el
  5. akl-duedate.el
  6. akl-org-exporter.el
  7. akl-python.el
  8. akl-hydra-menus.el
  9. akl-org-tree-slide.org
  10. akl-colorize.el
  11. akl-org-annotate.el

Um sicher zu stellen, dass eventuell notwenige Einstellungen gesetzt, und Pakete schon geladen sind, wird dies hier ganz am Ende aufgerufen.

(load-if-file-exist (concat *project-emacs-init-akl-path* "akl-main-defs.el"))
(load-if-file-exist (concat *project-emacs-init-akl-path* "akl-main.el"))
(load-if-file-exist (concat *project-emacs-init-akl-path* "akl-faces.el"))
(load-if-file-exist (concat *project-emacs-init-akl-path* "akl-namen.el"))
(load-if-file-exist (concat *project-emacs-init-akl-path* "akl-duedate.el"))
(load-if-file-exist (concat *project-emacs-init-akl-path* "akl-colorize.el"))
(load-if-file-exist (concat *project-emacs-init-akl-path* "akl-org-annotate.el"))
(load-if-file-exist (concat *project-emacs-init-akl-path* "akl-org-exporter.el"))
(load-if-file-exist (concat *project-emacs-init-akl-path* "akl-python.el"))
(load-if-file-exist (concat *project-emacs-init-akl-path* "akl-hydra-menus.el"))
(org-babel-load-file (expand-file-name (concat *project-emacs-init-akl-path* "akl-org-tree-slide.org")))

18.1.1. Content of akl-main-defs.el

;;; package --- akl-main-defs -*- coding: utf-8 -*-
;;; Commentary:
;; Variables which can be adapted depending on system or user.
;; Variables used in other files.
;;
;;; Code:

(require 'ox)

(defvar *akl/list-of-names-n-properties* '()
  "List of names and some setting used in other functions.
Entries are:
| text  | tags  | pattern | org-mode-color | latex-color | html-color |
| nth 1 | nth 2 | nth 3   | nth 4          | nth 5       | nth 6      |")

(defvar *akl/list-of-names* '()
    "List of names used in \"akl/choose-n-insert-names\".
\"List entry\" . \"Output\"

Get the values from \"*akl/list-of-names-n-properties*\", but only
if second column for tags is not empty.")


(defface font-duedate-agreed
  '((t (:background "dark green")))
  "Used in org-mode for ✓<date>"
  :group 'akl-face-mode)


(defface font-duedate-duedate-past
  '((t (:background "firebrick3")))
  "Used in org-mode for past ❢<date>"
  :group 'akl-face-mode)

(defface font-duedate-duedate-future
  '((t (:background "royal blue")))
  "Used in org-mode for future ❢<date>"
  :group 'akl-face-mode)

(defface akl-check-open-face
  '((t (:foreground "#FF0000")))
  "firebrick3 foreground face"
  :group 'akl-face-mode)

(defface akl-check-done-face
  '((t (:foreground "#3ADF00")))
  "dark green foreground face"
  :group 'akl-face-mode)

(defface akl-check-tripple-face
  '((t (:foreground "#0174DF")))
  "royal blue foreground face"
  :group 'akl-face-mode)

(defface akl-names-face
  '((t (:foreground "#FF8000")))
  "Face used for names in org-mode."
  :group 'akl-face-mode)

(defface akl-font-bg-blue
  '((t (:background "#2E64FE")))
  "Background color blue."
  :group 'akl-face-mode)

(defface akl-font-fg-blue
  '((t (:foreground "#2E64FE")))
  "Foreground color blue."
  :group 'akl-face-mode)

(defface akl-font-bg-darkgreen
  '((t (:background "green3")))
  "Background color dark green."
  :group 'akl-face-mode)

(defface akl-font-fg-darkgreen
  '((t (:foreground "green3")))
  "Foreground color dark green."
  :group 'akl-face-mode)


(provide 'akl-main-defs)
;;; akl-main-defs ends here

18.1.2. Content of akl-main.el

;;; package --- init-def  -*- coding: utf-8 -*-
;;; Commentary:
;; Functions written by myself
;;
;;; Code:


(defun akl/list-all-links-to-open ()
  "List all org mode links in current buffer.
Open choosen link."
  (interactive)
  (let* ((links nil)
         (linkstr "")
         (some-helm-source nil))

    (save-excursion
      (goto-char (point-min))
      (while (re-search-forward "\\[\\[.*?\\]\\]" nil t nil)
        (progn
          (setq linkstr (match-string 0))
          (if (or (string-match "\\[\\[.*?\\]\\[\\(.*?\\)\\]\\]" linkstr)
                  (string-match "\\[\\[\\(.*?\\)\\]\\]" linkstr))
              (progn
                (push (cons (substring-no-properties (match-string 1 linkstr))
                            (point))
                      links)))))

      (setq links (reverse links))

      (setq some-helm-source
            `((name . "Choose a link to open.")
              (candidates . ,links)
              (action . (lambda (candidate)
                          (helm-marked-candidates)))))

      (goto-char (- (car (helm :sources '(some-helm-source))) 1))
      (org-open-at-point))))


;; Copy current Org-Mode headline as link in kill-ring.
;; Cursor has to be in headline line.
(defun akl/copy-current-headline-as-link ()
  "Copy current Org-Mode headline as link in kill-ring.
Cursor has to be in headline line."
  (interactive)
  (save-excursion
  (let ((currhead (buffer-substring-no-properties (point-at-bol) (point-at-eol))))
    (move-beginning-of-line 1)
    (if (not (re-search-forward "^\\*+? " (point-at-eol) t))
      (progn
      (message "Cursor is not on a headline!"))
    (progn
     (setq currhead (replace-regexp-in-string "\\*" "" currhead))
     (setq currhead (replace-regexp-in-string "DONE" "" currhead))
     (setq currhead (replace-regexp-in-string "TODO" "" currhead))
     (setq currhead (replace-regexp-in-string "Note" "" currhead))
     (setq currhead (replace-regexp-in-string "Delegated" "" currhead))
     (setq currhead (replace-regexp-in-string "Canceled" "" currhead))
     (setq currhead (replace-regexp-in-string "STARTED" "" currhead))
     (setq currhead (replace-regexp-in-string "WAITING" "" currhead))
     (string-trim currhead)
     ;; (setq currhead (replace-regexp-in-string "^ +" "" currhead))
     ;; (setq currhead (replace-regexp-in-string " +$" "" currhead))
     (kill-new "" nil)
     (kill-append (concat "- [ ] [[" buffer-file-name "::" currhead "][" (file-name-base buffer-file-name) " / " currhead  "]]\n") nil))))))

;; Executes org-archive-subtree-default after the headline is copied.
;; Saves the headline in special form into the kill-ring.
(defun akl/org-archive-subtree ()
  "Execute org-archive-subtree-default after the headline is copied.
Cursor has to be on the headline line.
Saves the headline in special form into the kill ring.  As include
and as link to the archive file entry.

#+INCLUDE: \"./<buffer-file-name>_archive::<headline>\"
[[file+emacs:./<buffer-file-name>_archive::<headline>]]"
  (interactive)
  (save-excursion
  (let (( currhead (buffer-substring-no-properties (point-at-bol) (point-at-eol))))
    (move-beginning-of-line 1)
    (if (not (re-search-forward "^\\*+? " (point-at-eol) t))
      (progn
      (message "Cursor is not on a headline!"))
    (progn
      (setq currhead (replace-regexp-in-string "\\*" "" currhead))
      (setq currhead (replace-regexp-in-string "DONE" "" currhead))
      (setq currhead (replace-regexp-in-string "TODO" "" currhead))
      (setq currhead (replace-regexp-in-string "Note" "" currhead))
      (setq currhead (replace-regexp-in-string "Delegated" "" currhead))
      (setq currhead (replace-regexp-in-string "Canceled" "" currhead))
      (setq currhead (replace-regexp-in-string "STARTED" "" currhead))
      (setq currhead (replace-regexp-in-string "WAITING" "" currhead))
      ;; (setq currhead (replace-regexp-in-string "^ +" "" currhead))
      ;; (setq currhead (replace-regexp-in-string " +$" "" currhead))
      (setq currhead (string-trim currhead))

      (org-archive-subtree-default)

      (kill-new "" nil)
      (kill-append (concat "#+INCLUDE: \"./" (file-name-base buffer-file-name) ".org_archive::" currhead "\"\n[[file+emacs:./" (file-name-base buffer-file-name) ".org_archive::" currhead "]]") nil)
  )))))


(defun akl/org-find-broken-links ()
  "Insert comment for broken links in org-mode buffer."
  (interactive)
  (save-excursion
  (goto-char (point-min))
  (while (re-search-forward "\\[file\\+sys:\\(.*?\\)\\]" nil t)
    (progn
      (setq filepath (match-string 1))
      (setq filepath (replace-regexp-in-string "%20" " " filepath))
      (setq filepath (replace-regexp-in-string "%C3%9C" "Ü" filepath))
      
    (if (not (file-attributes filepath))
      (progn
        (message "BROKEN LINK: %s" filepath)
        (move-beginning-of-line 1)
        (insert " *--> BROKEN LINK -->*")
        (goto-char (match-end 0)))))))
  (swiper "--> BROKEN LINK -->"))


;; * Link to visit a file and run occur 
;; Add the following bit of code to your startup (after loading org), and you
;; can then use links like occur:my-file.txt#regex to open a file and run occur
;; with the regex on it.
;; Copied from: https://orgmode.org/worg/org-hacks.html
(defun akl/org-occur-open (uri)
"Visit the file specified by URI, and run `occur' on the fragment
\(anything after the first '#') in the uri."
  (let ((list (split-string uri "#")))
    (org-open-file (car list) t)
    (occur (mapconcat 'identity (cdr list) "#"))))
(org-add-link-type "occur" 'akl/org-occur-open)


;; search in current file for internal links and list all found items
;; "Local variable to list found internal links in current file."
(make-variable-buffer-local
  (defvar *internallinks* '()
    "List of internal links."))

(defun akl/org-internal-links-find ()
"Find all internal links in current file."
  (save-excursion
    (goto-char (point-min))
        (while (re-search-forward "<<\\(.*?\\)>>" nil t)
              (add-to-list '*internallinks* (match-string 1)))))

(defun akl/org-internal-links ()
  "Find all internal links in current file and list them.
Write the choosen internal link in current buffer at point."
  ;; (interactive)
  (akl/org-internal-links-find)
  (insert "[[" (yas-choose-value *internallinks*) "]]"))

(defun akl/org-internal-links-description ()
  "Find all internal links in current file and list them.
Write the choosen internal link in current buffer at point.
Description will be inserted by writer."
  (interactive)
  (akl/org-internal-links-find)
  (setq strabbr (yas-choose-value *internallinks*))
  (insert "[[" strabbr "][" (read-string "Type in description: " nil nil strabbr) "]] "))


(make-variable-buffer-local
 (defconst *internallinks-helm*
   nil
   "List of named internal links for helm :source."))

(make-variable-buffer-local
 (defconst *all-orgheaders-helm*
   nil
   "List of all org-mode headers for helm :source."))

(make-variable-buffer-local
 (defconst *all-bibitems-helm*
   nil
   "List of all bibitems for helm :source."))

(defun akl/main--list-internallinks-helm ()
  "Find all named internal links in buffer."
  (save-excursion
    (goto-char (point-min))
    (let ((found nil))
      (while (re-search-forward "<<sec:\\(.*?\\)>>" nil t nil)
        (push (cons (substring-no-properties (match-string 0))
                    (substring-no-properties (match-string 1)))
              found))

    (setq *internallinks-helm* (reverse found)))))


(defun akl/main--list-all-orgheaders-helm ()
  "Find all org headers in buffer."
  (save-excursion
    (goto-char (point-min))
    (let ((found nil)
          (orgheader ""))
      (while (re-search-forward "^\\*+?[ ]+?\\(.*?\\)\\(?:[ \t]+<<\\|[ \t]+:\\|[ \t]+\\)?$" nil t nil)
        (progn
          (setq orgheader (substring-no-properties (match-string 1)))
          (setq orgheader (replace-regexp-in-string "\\*" "" orgheader))
                          (setq orgheader (replace-regexp-in-string "DONE" "" orgheader))
                          (setq orgheader (replace-regexp-in-string "TODO" "" orgheader))
                          (setq orgheader (replace-regexp-in-string "Review" "" orgheader))
                          (setq orgheader (replace-regexp-in-string "Note" "" orgheader))
                          (setq orgheader (replace-regexp-in-string "Delegated" "" orgheader))
                          (setq orgheader (replace-regexp-in-string "Canceled" "" orgheader))
                          (setq orgheader (replace-regexp-in-string "STARTED" "" orgheader))
                          (setq orgheader (replace-regexp-in-string "WAITING" "" orgheader))
                          (setq orgheader (replace-regexp-in-string "\s+:.*:$" "" orgheader))
                          (setq orgheader (string-trim orgheader))

          (push (cons orgheader orgheader) found)))

      (setq *all-orgheaders-helm* (reverse found)))))


(defun akl/main--list-all-bibitems-helm ()
  "Find all bibitems in buffer."
  (save-excursion
    (goto-char (point-min))
    (let ((found nil))
      (while (re-search-forward "<<bibitem:\\(.*?\\)>>" nil t nil)
        (push (cons (substring-no-properties (match-string 0))
                    (substring-no-properties (match-string 1)))
              found))

    (setq *all-bibitems-helm* (reverse found)))))


(defun akl/insert-named-intern-link-ref ()
  "Insert a link to headline or label.
If label than the link is:
[[sec:linkname]] [[sec:linkname][description]] 
                 @@latex: on page~\\pageref{sec:linkname}@@

If headline (default) than the link is:
[[*headline][headline]]

If cursor is on a headline a new label will be inserted below the
headline."
  (interactive)
  (akl/main--list-internallinks-helm)
  (akl/main--list-all-orgheaders-helm)
  (akl/main--list-all-bibitems-helm)
  (let* ((choice '("headline" "label" "bibitem"))
         (eitheror "")
         (sources-intern-links nil)
         (choosen "")
         (sources-orgheaders nil)
         (descr "")
         (sources-bibitems nil)
         (currline (buffer-substring-no-properties (point-at-bol) (point-at-eol))))

    (if (string-match
         "^\\*+?[ ]+?\\(.*?\\)\\(?:[ \t]+<<\\|[ \t]+:\\|[ \t]+\\)?$"
         currline) ;; Headline
        (progn
          (setq currline (match-string 1 currline))
          (setq currline (replace-regexp-in-string " " "" currline))
          (setq currline (replace-regexp-in-string "-" "" currline))
          (move-end-of-line 1)
          (newline)
          (insert "<<sec:" currline ">>"))
      (progn
        (setq eitheror (format "%s" (ido-completing-read "Insert a link to:" choice)))

        (if (string= "label" eitheror)
            (progn
              (if (< 0 (length *internallinks-helm*))
                  (progn
                    (setq sources-intern-links
                          `((name . "Named Internal Labels")
                            (candidates . ,*internallinks-helm*)
                            (action . (lambda (x)
                                        (helm-get-selection)))))
                    (setq choosen (helm :sources '(sources-intern-links)))

                    (if (< 0 (length *all-orgheaders-helm*))
                        (progn
                          (setq sources-orgheaders
                                `((name . "Choose a Header as Description")
                                  (candidates . ,*all-orgheaders-helm*)
                                  (action . (lambda (x)
                                              (helm-get-selection)))))

                          (setq descr (helm :sources '(sources-orgheaders)))))

                    (if (eq nil descr)
                        (setq descr (read-string (format "Description for %s:" choosen) nil nil choosen)))
                    
                    (insert "[[" choosen "]] [[" choosen "][" descr
                            "]] @@latex: on page~\\pageref{"
                            choosen "}@@"))
                (progn
                  (message "No named internal labels found!")))))

        (if (string= "headline" eitheror)
            (progn
              (if (< 0 (length *all-orgheaders-helm*))
                  (progn
                    (setq sources-orgheaders
                          `((name . "Choose a Header")
                            (candidates . ,(append *all-orgheaders-helm* *internallinks-helm*))
                            (action . (lambda (x)
                                        (helm-get-selection)))))

                    (setq choosen (helm :sources '(sources-orgheaders)))

                    (if (string-match "^\\(sec:\\bibitem:\\)" choosen) ;; probably a <<label>>
                        (progn
                          (insert "[[" choosen "][" choosen "]]"))
                      (progn
                        (insert "[[*" choosen "][" choosen "]]")))))))

        (if (string= "bibitem" eitheror)
            (progn
              (if (< 0 (length *all-bibitems-helm*))
                  (progn
                    (setq sources-bibitems
                          `((name . "Choose a bibitem")
                            (candidates . ,*all-bibitems-helm*)
                            (action . (lambda (x)
                                        (helm-get-selection)))))

                    (setq choosen (helm :sources '(sources-bibitems)))

                    (insert "[[[bibitem:" choosen "][" choosen "]]]")))))))))


;; search in current file for bibitem and list all found items
;; "Local variable to list found bibitems in current file."
(make-variable-buffer-local
  (defvar *bibitems* '()
    "List of infile bibitems."))

(defun akl/org-infile-find-bibitems ()
"Find all bibitems in current file."
  (save-excursion
    (goto-char (point-min))
    (while (re-search-forward "bibitem.*?\\({.*?}\\)" nil t)
        (add-to-list '*bibitems* (match-string 1)))))

(defun akl/org-infile-cite-bibitems ()
  "Find all bibitems in current file and list them.
Write the choosen bibitem in current buffer at point."
  (interactive)
  (akl/org-infile-find-bibitems)
  (insert "\\cite" (yas-choose-value *bibitems*)))


;; copied from http://kitchingroup.cheme.cmu.edu/blog/2016/06/16/Copy-formatted-org-mode-text-from-Emacs-to-other-applications/
;; does not run w/o textutil and pbcopy - search for somewhat better!!!
(defun akl/formatted-copy ()
  "Export region to HTML, and copy it to the clipboard."
  (interactive)
  (save-window-excursion
    (let* ((buf (org-export-to-buffer 'html "*Formatted Copy*" nil nil t t))
           (html (with-current-buffer buf (buffer-string))))
      (with-current-buffer buf
        (shell-command-on-region
         (point-min)
         (point-max)
         "textutil -stdin -format html -convert rtf -stdout | pbcopy"))
      (kill-buffer buf))))

;; org-confirm-babel-evaluate toggeln
(defun akl/babel-confirm (flag)
"Wenn ein Source Code Block evaluiert werden soll, muss das
bestätigt werden (default).  Das Ein- und Ausschalten von
~org-confirm-babel-evaluate~ kann über die Funktion erledigt werden.
Mit ~M-x babel-confirm~ wird der Status zurückgegeben.  Mit ~C-u M-x
babel-confirm~ die Einstellung getoggelt."
  (interactive "P")
  (if (equal flag '(4))
      (setq org-confirm-babel-evaluate (not org-confirm-babel-evaluate)))
  (message "Babel evaluation confirmation is %s"
           (if org-confirm-babel-evaluate "on" "off")))

;; insert filename with or without full path ;;
;; F5 for filename               ;;
;; S-F5 for filename and its full path     ;;
(defun akl/insert-file-name ()
  "Insert filename of the current buffer at cursorpoint."
  (interactive)
  (insert (file-name-nondirectory buffer-file-name)))

(defun akl/insert-file-path-name ()
  "Insert filename and its path of the current buffer at
cursorpoint."
  (interactive)
  (insert (buffer-file-name)))

;;;; neue Zeile unter aktueller erzeugen und Cursor dorthin setzen mit
;;;; M-n
(defun akl/insert-new-line-below (times)
  "Insert a new line below the current and set Cursor to the new
line.  It does not matter whether the curser is not at the end of
the old line."
  (interactive "p")
  (move-end-of-line 1)
  (newline times))

;;;; neue Zeile über aktueller erzeugen und Cursor dorthin setzen mit
;;;; M-p
(defun akl/insert-new-line-above (times)
  "Insert a new line above the current and set Cursor to the new
line.  It does not matter whether the curser is not at the end of
the old line."
  (interactive "p")
  (move-beginning-of-line 1)
  (newline times)
  (move-beginning-of-line (+ (* -1 times) 1) ))

;; Datum und Uhrzeit eingeben
(defun akl/datum-uhrzeit ()
  "Datum und Uhrzeit eingeben"
  (interactive)
  (insert (format-time-string "%d.%m.%Y %H:%M:%S")))

(defun akl/datum ()
  "Datum eingeben"
  (interactive)
  (insert (format-time-string "%d.%m.%Y")))

(defun akl/datum-embrace ()
  "Datum in eckigen Klammern."
  (interactive)
  (insert (format-time-string "[%Y-%m-%d %a]")))

(defun akl/uhrzeit ()
  "Uhrzeit eingeben"
  (interactive)
  (insert (format-time-string "%H:%M:%S")))


;; move current line up/down with M-up and M-down arrow
(defun akl/move-line-up ()
  "Move up the current line.  Cursor will move, too."
  (interactive)
  (transpose-lines 1)
  (forward-line -2)
  (indent-according-to-mode))

(defun akl/move-line-down ()
  "Move down the current line.  Cursor will move, too."
  (interactive)
  (forward-line 1)
  (transpose-lines 1)
  (forward-line -1)
  (indent-according-to-mode))

;; Another solution for current line move up/down.
;; Copied from https://www.emacswiki.org/emacs/MoveText.
(defun akl/move-text-internal (arg)
  (cond
   ((and mark-active transient-mark-mode)
    (if (> (point) (mark))
        (exchange-point-and-mark))
    (let ((column (current-column))
          (text (delete-and-extract-region (point) (mark))))
      (forward-line arg)
      (move-to-column column t)
      (set-mark (point))
      (insert text)
      (exchange-point-and-mark)
      (setq deactivate-mark nil)))
   (t
    (let ((column (current-column)))
      (beginning-of-line)
      (when (or (> arg 0) (not (bobp)))
        (forward-line)
        (when (or (< arg 0) (not (eobp)))
          (transpose-lines arg))
        (forward-line -1))
      (move-to-column column t)))))

(defun akl/move-text-down (arg)
  "Move region (transient-mark-mode active) or current line
  arg lines down."
  (interactive "*p")
  (akl/move-text-internal arg))

(defun akl/move-text-up (arg)
  "Move region (transient-mark-mode active) or current line
  arg lines up."
  (interactive "*p")
  (akl/move-text-internal (- arg)))

;; Damit ich einfacher ein elpa-mirror anlegen kann.
(defcustom akl/elpa-mirror-directory "~/orgnotes/elpa-mirror"
  "Absolute path to the directory for ~elpamr-create-mirror-for-installed~."
  :type  '(string)
  :group 'elpa-mirror)

(defun akl/delete-elpa-mirror-files ()
  "Removes all files in my elpa-mirror directory."
  (make-directory akl/elpa-mirror-directory t)
  (setq fileslist (directory-files akl/elpa-mirror-directory t "^[^.]" t))
  (while (car fileslist)
      (delete-file (car fileslist))
      (setq fileslist (cdr fileslist))))

(defun akl/zip-dir-elpa-mirror ()
  "Zip the elpa-mirror directory to \".../elpa-mirror.zip\".  If
zip file already exists, it will be deleted."
  (setq zip-command (concat "cd " *org-notes-path*
                            " && rm -f " *export-publish-destination-path*
                            "elpa-mirror.zip && zip -r9 " *export-publish-destination-path*
                            "elpa-mirror.zip elpa-mirror/"))
  (start-process-shell-command "zip-elpa-mirror" nil zip-command))

(defun akl/run-elpa-mirror ()
  "If not already exists, creates destination directory as
defined in \"customize akl/elpa-mirror-directory\".  Afterwards
old content will be removed, and the command to generate new
content will be executed.  After all the destination directory
will be zipped.  See \"akl/zip-dir-elpa-mirror\" for this."
  (interactive)
  (akl/delete-elpa-mirror-files)
  (setq elpamr-default-output-directory akl/elpa-mirror-directory)
  (elpamr-create-mirror-for-installed)
  (akl/zip-dir-elpa-mirror)
  (message "run-elpa-mirror done ..."))


;; Da ich zu Faul bin den Befehl immer auswählen zu müssen, hier
;; eine Kurzform.
(defun plp ()
  "Call up 'package-list-packages' with an alias."
  (interactive)
  ;; (setq package-archives
  ;;       '(("gnu"   . "http://elpa.gnu.org/packages/")
  ;;         ("melpa" . "https://melpa.org/packages/")
  ;;         ("org"   . "http://orgmode.org/elpa/")
  ;;         ))
  (package-list-packages))


;; sensitive mode to prevent backup file at sensitive files
(define-minor-mode sensitive-mode
  "For sensitive files like password lists.
It disables backup creation and auto saving.

With no argument, this command toggles the mode.
Non-null prefix argument turns on the mode.
Null prefix argument turns off the mode."
  ;; The initial value.
  nil
  ;; The indicator for the mode line.
  " Sensitive"
  ;; The minor mode bindings.
  nil
  (if (symbol-value sensitive-mode)
      (progn
        ;; disable backups
        (set (make-local-variable 'backup-inhibited) t)
        ;; disable auto-save
        (if auto-save-default
            (auto-save-mode -1)))
    ;resort to default value of backup-inhibited
    (kill-local-variable 'backup-inhibited)
    ;resort to default auto save setting
    (if auto-save-default
    (auto-save-mode 1))))

(setq auto-mode-alist
    (append '(("\\.gpg$" . sensitive-mode))
        auto-mode-alist))

;; toggle window split
(defun akl/toggle-window-split ()
  "Ändert die Fensteraufteilung von vertikal nach horizontal, und umgekehrt.
Funktioniert nur, wenn der Rahmen 2 Fenster hat.  Geklaut von
[[file+sys:https://stackoverflow.com/questions/2081577/setting-emacs-split-to-horizontal][stackoverflow]].
"
  (interactive)
    (if (= (count-windows) 2)
      (let* ((this-win-buffer (window-buffer))
            (next-win-buffer (window-buffer (next-window)))
            (this-win-edges (window-edges (selected-window)))
            (next-win-edges (window-edges (next-window)))
            (this-win-2nd
             (not (and (<= (car this-win-edges)
                        (car next-win-edges))
                    (<= (cadr this-win-edges)
                        (cadr next-win-edges)))))
         (splitter
          (if (= (car this-win-edges)
                 (car (window-edges (next-window))))
              'split-window-horizontally
            'split-window-vertically)))
    (delete-other-windows)
    (let ((first-win (selected-window)))
      (funcall splitter)
      (if this-win-2nd (other-window 1))
      (set-window-buffer (selected-window) this-win-buffer)
      (set-window-buffer (next-window) next-win-buffer)
      (select-window first-win)
      (if this-win-2nd (other-window 1))))))
;; C-x 4 t 'toggle-window-split
(define-key ctl-x-4-map "t" 'akl/toggle-window-split)


;; Alle Buffer, außer der aktuellen, schließen.
(defun akl/kill-all-other-buffers ()
  "Kill all other buffers."
  (interactive)
  (mapc 'kill-buffer (delq (current-buffer) (buffer-list))))


(defun akl/kill-other-buffers ()
  "Kill all buffers but the current one.
Don't mess with special buffers."
  (interactive)
  (dolist (buffer (buffer-list))
    (unless (or (eql buffer (current-buffer)) (not (buffer-file-name buffer)))
      (kill-buffer buffer))))


(defun akl/cp-curr-file-as-link ()
  "Save and copie current file as link in killring."
  (interactive)
  (save-excursion
       (save-buffer)
       (kill-new "" nil)
       (kill-append (concat "- [ ] [[" buffer-file-name "][" (file-name-base buffer-file-name) "]]\n") nil)))


;; type in
;; # -*- coding: utf-8-unix -*-
;; in first line to ensure utf-8 with unix style line break
(defun dos2unix ()
  "Convert a DOS formatted text buffer to UNIX format."
  (interactive)
  (set-buffer-file-coding-system 'undecided-unix nil))

(defun unix2dos ()
  "Convert a UNIX formatted text buffer to DOS format."
  (interactive)
  (set-buffer-file-coding-system 'undecided-dos nil))


(defun akl/main--fill-org-agenda-list ()
  "Fill the list org-agenda-files."
  (setq org-agenda-files '())
  (let* ((akl-org-agenda-files (directory-files-recursively *org-notes-path* "\\.org$"))
         (wanted-files (list (concat *project-emacs-init-path* "init.org")))
         (unwanted-files (list (concat *org-notes-path* "yankpad.org")
                               (concat *org-notes-path* "siduction.org")
                               (concat *org-notes-path* "python-examples.org")
                               (concat *org-notes-path* "pedometer.org")
                               (concat *org-notes-path* "mobile-inbox.org")
                               (concat *org-notes-path* "emacs.org")
                               (concat *org-notes-path* ".org2blog.org")
                               (concat *org-notes-path* "akl-org-options.org")
                               (concat *project-emacs-init-path* "akl-org-options.org")
                               (concat *org-notes-path* "Telefonliste.org")
                               (concat *org-notes-path* "presentation/reveal.org")))
         (unwanted-dirs (list (concat *org-notes-path* "blog/")
                              (concat *org-notes-path* "bmi/")
                              (concat *org-notes-path* "briefe/")
                              (concat *org-notes-path* "templates/")
                              (concat *org-notes-path* "presentation/")
                              (concat *org-notes-path* "presentations/")))
         (orig-buffer-list (buffer-list)))

    (dolist (udir unwanted-dirs)
      (dolist (ufile (directory-files-recursively udir "\\.org$"))
        (push ufile unwanted-files)))

    (dolist (wfile wanted-files)
      (push wfile akl-org-agenda-files))

    (dolist (exfile unwanted-files)
      (setq org-agenda-files (delete exfile akl-org-agenda-files)))))

(akl/main--fill-org-agenda-list)


;; customize my own agenda todo view
(defun akl/org-agenda-todo-view ()
  "My own agenda TODO view."
  (interactive)
  ;; (let* ((choice '("ALL" "init" "aufgaben"))
    ;;      (category '()))
    ;; (push (format "+%s" (ido-completing-read "Choose categroy:" choice)) category)
    ;; (if (string= (car category) "+ALL")
    ;;     (progn
    ;;       (setq org-agenda-category-filter-preset nil))
    ;;   (progn
    ;;     (setq org-agenda-category-filter-preset category)))
    (org-todo-list "TODO|STARTED|WAITING|Cyclic")
    (setq org-agenda-category-filter-preset nil))
;; )



(defun akl/org-agenda-custom-views ()
  "Customized org agenda views."
  (let* ( )
    (setq org-agenda-custom-commands
          '(("n" "Agenda and all TODO's"
             ((agenda "" nil)
              (alltodo "" nil))
             ((org-agenda-span 9))
             nil)

            ("ci" "init"
             ((todo ""
                    ((org-agenda-category-filter-preset '("+init"))))))

            ("ca" "aufgaben"
             ((agenda "" nil)
              (todo ""
                    ((org-agenda-category-filter-preset '("+aufgaben"))))))
            ))))
(akl/org-agenda-custom-views)


;; find files
(defun akl/list-find-files-in-dir-r ()
  "Insert all files with pattern in directory."
  (interactive)
  (save-excursion
    (let* ((ldir (read-directory-name "Directory:" "./" "./"))
           (lpat (read-regexp "File pattern:" "")))

      (dolist (f (directory-files-recursively ldir lpat))
        (insert (format "- %s\n" f))))))
;; (akl/find-files-in-dir-r)


(provide 'init-def)
;;; init-def ends here

18.1.3. Content of akl-faces.el

;;; init-faces --- set faces for modes
;;; Commentary:
;; Add some font-locks to several modes.
;;
;;; Code:
;; M-x list-faces-display
;;

(defun akl/insert-face-color ()
  "Choose a color."
  (interactive)
  (rainbow-mode t)
  (let ((some-helm-source nil)
        (akl-face-colors '(("akl-font-bg-blue #2E64FE" . "akl-font-bg-blue")
                           ("akl-font-fg-blue #2E64FE" . "akl-font-fg-blue")
                           ("akl-font-fg-darkgreen green3" . "akl-font-fg-darkgreen")
                           ("akl-font-bg-darkgreen dark green" . "akl-font-bg-darkgreen")
                           ("akl-names-face #FF8000" . "akl-names-face")
                           ("akl-check-tripple-face #0174DF" . "akl-check-tripple-face")
                           ("akl-check-open-face #FF0000" . "akl-check-open-face")
                           ("akl-check-done-face #3ADF00" . "akl-check-done-face")
                           )))
    (setq some-helm-source
          `((name . "Choose a color.")
            (candidates . ,akl-face-colors)
            (action . (lambda (candidate)
                        (helm-marked-candidates)))))
    (insert (mapconcat 'identity (helm :sources '(some-helm-source)) ", "))))


;; https://github.com/sugano-nu/emacs-lisp-stat
(defun akl/gen-list-of-names-n-properties ()
  "Fill *akl/list-of-names-n-properties*."
  (setq *akl/list-of-names-n-properties*
      (with-temp-buffer
        (org-table-import *akl/file-list-of-names-n-properties* "|")
        (org-table-to-lisp)))
  ;; clean up, comments start with #
  (dolist (line *akl/list-of-names-n-properties*)
    (progn
      (if (string-match-p "^#" (car line))
          (progn
            (setq *akl/list-of-names-n-properties* (delete line *akl/list-of-names-n-properties*)))))))

(akl/gen-list-of-names-n-properties)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; *Org-Mode*
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Old style replaced.
;; (font-lock-add-keywords 'org-mode '(("\\[X\\]" (0 (quote speedbar-button-face) prepend))))
;; (font-lock-add-keywords 'org-mode '(("Andreas[ \t\r\n\v\f]+Kruse" (0 (quote org-scheduled-previously) prepend))))
;;
;; Leider funktioniert das plötzlich mit den Checkboxen und HTML Export nicht
;; mehr.  Daher füge ich an den Anfang einer Org-Mode Datei diese Hi-Lock Zeilen
;; ein.
;; # Hi-lock: ((" \\[ \\]" (0 'akl-check-open-face prepend)))
;; # Hi-lock: ((" \\[-\\]" (0 'akl-check-tripple-face prepend)))
;; # Hi-lock: ((" \\[X\\]" (0 'akl-check-done-face prepend)))

(defun akl/set-font-lock-org-mode ()
  "Add font-lock for org mode.
Taken from \"*akl/list-of-names-n-properties*\" defined in
\"akl-namen.el\" the command \"font-lock-add-keywords 'org-mode\"
will be performed."
  (let ((muster "")
        (farbe ""))
    (dolist (line *akl/list-of-names-n-properties*)
      (progn
        (if (not (or (equal "" (nth 3 line))
                     (equal "" (nth 4 line))))
            (progn
              (setq muster (format "%s" (nth 3 line)))
              (setq farbe (format "%s" (nth 4 line)))
              (font-lock-add-keywords
               'org-mode
               `(( ,(format "%s" (nth 3 line)) (0 (quote ,(format "%s" (nth 4 line))) prepend))))))))))

(akl/set-font-lock-org-mode)

;; Special forms which can not be covered by ./akl-namen.org.
(font-lock-add-keywords 'org-mode '(("\\(§\\)\\(.*?\\)\\(§\\)" (1 (quote org-hide) prepend) (2 (quote show-paren-match) prepend) (3 (quote org-hide) prepend))))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; *LATEX*
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
      ;; (setq text (replace-regexp-in-string "Andreas[ ]+Kruse" "\\\\textcolor\{orange\}\{Andreas Kruse\}" text t))
      ;; (setq text (replace-regexp-in-string "Lindenberg" "\\\\textcolor\{orange\}\{Lindenberg\}" text t))

(defun akl/export-latex-filters (text backend info)
  "Beim Export auf TEXT einige Regexps anwenden.
BACKEND muss latex sein.  INFO wird nicht genutzt."
  (when (org-export-derived-backend-p backend 'latex)
    (progn
      (dolist (line *akl/list-of-names-n-properties*)
        (progn
          (if (not (or (equal "" (nth 3 line))
                       (equal "" (nth 5 line))))
              (progn
                (setq text (replace-regexp-in-string (format "\\(%s\\)" (nth 3 line)) (format "%s" (nth 5 line))  text t)
                      )))))

      ;; Special forms which can not be covered by ./akl-namen.org.
      ;; Positive side effect - the last exp must be the parm text.
      (setq text (replace-regexp-in-string \\(.*?\\)§" "\\\\colorbox\{aqua\}\{\\1\}" text t))
      )))

(add-to-list 'org-export-filter-plain-text-functions
             'akl/export-latex-filters)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; *HTML*
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; (setq-local text (replace-regexp-in-string "Andreas[ ]+Kruse" "<span style=\"color: orange\">Andreas Kruse</span>" text t))
;; (setq-local text (replace-regexp-in-string "Lindenberg" "<span style=\"color: orange\">Lindenberg</span>" text t))
      
(defun akl/export-html-filters (text backend info)
  "Beim Export auf TEXT einige Regexps anwenden.
BACKEND muss html sein.  INFO wird nicht genutzt."
  (when (org-export-derived-backend-p backend 'html)
    (progn
      (dolist (line *akl/list-of-names-n-properties*)
        (progn
          (if (not (or (equal "" (nth 3 line))
                       (equal "" (nth 6 line))))
              (progn
                (setq text (replace-regexp-in-string (format "\\(%s\\)" (nth 3 line)) (format "%s" (nth 6 line))  text t)
                      )))))

      ;; Special forms which can not be covered by ./akl-namen.org.
      ;; Positive side effect - the last exp must be the parm text.
      (setq-local text (replace-regexp-in-string \\(.*?\\)§" "<span style=\"color: black; font-weight: bold; background-color: #99ccff\">\\1</span>" text t))
      )))
    
(add-to-list 'org-export-filter-plain-text-functions
             'akl/export-html-filters) 
;;(akl/export-html-filters)

;; Note that only the ascii characters implement tri-state
;; checkboxes. The other two use the `off' checkbox for `trans'.
;; ascii unicode html
(setq org-html-checkbox-type 'unicode)

(defun akl/unicode-for-org-html-checkbox (checkbox)
  "Format CHECKBOX into Unicode Characters."
  (case checkbox (on "<span style=\"color: #3ADF00;\">&#x2611;</span>")
        (off "<span style=\"color: #FF0000;\">&#x2610;</span>")
        (trans "<span style=\"color: #0040FF; font-weight: bold;\">&#x22A1;</span>")
        (t "")))

(defadvice org-html-checkbox (around unicode-checkbox activate)
  (setq ad-return-value (akl/unicode-for-org-html-checkbox (ad-get-arg 0))))


(provide 'init-faces)
;;; init-faces.el ends here

18.1.4. Content of akl-namen.el

;;; akl-namen --- package
;;; Commentary:
;;
;; Andreas Kruse
;; Initial 03.12.2020
;; 
;;; Code:

(defun akl/fill-choose-n-insert-names ()
  "Fill the list for function  akl/choose-n-insert-names."
  (setq *akl/list-of-names* '())
  (let ((nametag '()))
    (dolist (line (reverse *akl/list-of-names-n-properties*))
      (progn
        (if (not (equal "" (nth 2 line)))
            (progn
              (setq nametag (format "%s" (nth 1 line)))
              (push (format "%s %s" (nth 1 line) (nth 2 line)) nametag)
              (push nametag  *akl/list-of-names*)))))))

(akl/fill-choose-n-insert-names)


(defun akl/choose-n-insert-names ()
  "Choose one or more names to insert.
Mark and unmark with C-SPC."
  (interactive)
  (let ((some-helm-source nil))
    (setq some-helm-source
          `((name . "Choose one or more names. Mark/unmark with C-Space")
            (candidates . ,*akl/list-of-names*)
            (action . (lambda (candidate)
                        (helm-marked-candidates)))))

    (if (equal current-prefix-arg '(4)) ; C-u
        (progn
          (insert "- ")
          (insert
           (mapconcat 'identity
                      (helm :sources '(some-helm-source))
                      "\n- "))))

    (if (not (equal current-prefix-arg '(4))) ; not C-u
        (progn
          (insert
           (mapconcat 'identity
                      (helm :sources '(some-helm-source))
                      ", "))))))


;; Namensliste und Org-Mode Farben aus akl-namen.org aktualisieren.
(defun akl/refresh-colors-n-nameslist ()
  "Refresh the colors in Org-Mode files.
Refresh the list for insert from nameslist.
Useful after adaptations in akl-names.org.

In Org-Mode files perform \\[minibuffer] 'org-mode' to refresh the buffer."
  (interactive)
  (progn
    (akl/gen-list-of-names-n-properties)
    (akl/fill-choose-n-insert-names)
    (akl/set-font-lock-org-mode))
)


(provide 'akl-namen)
;;; akl-namen.el ends here

18.1.5. Content of akl-duedate.el

;;; package --- init-duedate -*- coding: utf-8 -*-
;;; Commentary:
;; Functions to work with duedate ❢ and agreed ✓ within an org-mode buffer.
;;
;;; Code:

(make-variable-buffer-local
 (defconst *duedatedateform*
   "\\(\\)\\([0-9][0-9]\\)\\.\\([0-9][0-9]\\)\\.\\([0-9][0-9][0-9][0-9]\\) \\(Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)"
   "The pattern to catch the duedate."))

(make-variable-buffer-local
 (defconst *agreeddateform*
   "\\(\\)\\([0-9][0-9]\\)\\.\\([0-9][0-9]\\)\\.\\([0-9][0-9][0-9][0-9]\\) \\(Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)"
   "The pattern to catch the agreed."))

(make-variable-buffer-local
 (defconst *list-of-todo-n-dead-n-due*
   nil
   "List of TODOs, Deadline and duedates."))

(make-variable-buffer-local
 (defconst *list-of-over-dead-n-due*
   nil
   "List of Deadline and duedates out of date."))


(defun akl/font-lock-duedate ()
  "Find ✓<date> in org mode buffer.
Highlight them according to today date."
  (font-lock-add-keywords 'org-mode
        '(("\\(✓[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9] \\(?:Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)\\)"
           1
           'font-duedate-agreed ))))


(defun akl/check-highlight-duedate-date ()
  "Find duedate in current buffer.
Check for over due in comparision to today, and mark if overdue is true.
Fill list *list-of-over-dead-n-due*."
  (interactive)
  (save-excursion
    (let* ((catchtime "")
           (duepattern "")
           (outdate nil)
           (matched ""))
      (highlight-regexp *agreeddateform* (quote font-duedate-agreed))

      (goto-char (point-min))
      (while
          (re-search-forward
           (concat
            "\\(?:\\(\\)\\([0-9][0-9]\\)\\.\\([0-9][0-9]\\)\\.\\([0-9][0-9][0-9][0-9]\\) \\(Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)\\).*$\\|"
            "\\(?:\\(DEADLINE:[ ]<\\)\\([0-9][0-9][0-9][0-9]\\)-\\([0-9][0-9]\\)-\\([0-9][0-9]\\) \\(Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)\\(>\\)\\).*$\\|"
            "\\(\\* TODO\\|\\* STARTED\\|\\* WAITING\\).*$")
           nil t nil)
        (setq matched (match-string 0))
        ;; (if (not (eq nil (match-string 12)))
        (if (match-string 12)
            (progn
              (push (cons matched (point)) outdate))
          (progn
            ;; (message (format "MATCH PLEASE CALC: %s" (match-string 0)))
            (if (string= "❢" (match-string 1))
                (progn ;; FOUND ❢16.12.2020 Mi
                    (setq catchtime (concat (match-string 4) "-" (match-string 3) "-" (match-string 2) "T00:00:00"))
                    (setq duepattern (concat (concat (match-string 1) (match-string 2) "." (match-string 3) "." (match-string 4) " " (match-string 5))))))
            (if (string= "DEADLINE: <" (match-string 6))
                (progn ;; FOUND DEADLINE: <2021-01-28 Do>
                  (setq catchtime (concat (match-string 7) "-" (match-string 8) "-" (match-string 9) "T00:00:00"))
                    (setq duepattern (concat (match-string 6) (match-string 7) "-" (match-string 8) "-" (match-string 9) " " (match-string 10) (match-string 11)))))

            (if (time-less-p (date-to-time (format-time-string "%Y-%m-%dT00:00:00"))
                                   (date-to-time catchtime))
                (progn
                  (highlight-regexp duepattern (quote font-duedate-duedate-future)))
                (progn
                (highlight-regexp duepattern (quote font-duedate-duedate-past))
                (push (cons matched (point)) outdate))))
          )
      (setq *list-of-over-dead-n-due* (reverse outdate))))))


(defun akl/list-all-duedate-in-current-buffer ()
  "List all DUEDATE in current buffer."
  (interactive)
  (save-excursion
    (akl/check-highlight-duedate-date))
  (swiper "DEADLINE:[ ]<[0-9]\\|❢[0-9][0-9].[0-9][0-9].[0-9][0-9][0-9][0-9]"))


(defun akl/list-all-out-duedate-in-current-buffer ()
  "List all out dated DUEDATE in current buffer.
Find DUEDATE in current buffer, check for over due in
comparision to today, and mark if overdue is true."
  (interactive)
  (save-excursion
    (let ((matchtime "")
          (catchtime "")
          (duepattern "")
          (outdate '())
          (mocpattern ""))
      (save-buffer)
      (goto-char (point-min))
      (while (re-search-forward (concat "❢\\([0-9][0-9]\\)\\.\\([0-9][0-9]\\)\\.\\([0-9][0-9][0-9][0-9]\\) \\(Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)") nil t nil)
        (progn
          (setq matchtime (concat (match-string 1) "." (match-string 2) "." (match-string 3)));; " " (match-string 4)))
          (setq catchtime (concat (match-string 3) "-" (match-string 2) "-" (match-string 1) "T00:00:00"))
          (setq duepattern (concat "❢" (substring-no-properties matchtime) ""))
          (if (time-less-p (date-to-time (format-time-string "%Y-%m-%dT00:00:00"))
                           (date-to-time catchtime))
              (progn
                (highlight-regexp duepattern (quote font-duedate-duedate-future)))
            (progn
              (add-to-list 'outdate (substring-no-properties duepattern))
              (highlight-regexp duepattern (quote font-duedate-duedate-past))))))

      (goto-char (point-min))
      (while (re-search-forward "\\(DEADLINE:[ ]<\\)\\([0-9][0-9][0-9][0-9]\\)-\\([0-9][0-9]\\)-\\([0-9][0-9]\\) \\(Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)\\(>\\)" nil t nil)
        (progn
          (setq matchtime (concat (match-string 4) "." (match-string 3) "." (match-string 2) " " (match-string 5)))
          (setq catchtime (concat (match-string 2) "-" (match-string 3) "-" (match-string 4) "T00:00:00"))
          (setq duepattern (match-string 0))
          (if (time-less-p (date-to-time (format-time-string "%Y-%m-%dT00:00:00"))
                           (date-to-time catchtime))
              (progn
                (highlight-regexp duepattern (quote font-duedate-duedate-future)))
            (progn
              (add-to-list 'outdate (substring-no-properties duepattern))
              (highlight-regexp duepattern (quote font-duedate-duedate-past))))))

      (setq mocpattern (mapconcat #'(lambda (x) (format "%s" x)) outdate "\\|"))
      (swiper mocpattern))))


(defun akl/jump-to-next-duedate ()
  "Jump to the next DUEDATE entry."
  (interactive)
  (if (re-search-forward "DEADLINE:[ ]<[0-9]\\|\\(❢[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9]\\)" nil t nil)
      (progn)
    (progn
      (goto-char (point-min))
      (re-search-forward "DEADLINE:[ ]<[0-9]\\|\\(❢[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9]\\)" nil t nil))))


(defun akl/jump-to-previous-duedate ()
  "Jump to the previous DUEDATE entry."
  (interactive)
  (if (re-search-backward "DEADLINE:[ ]<[0-9]\\|\\(❢[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9]\\)" nil t nil)
      (progn)
    (progn
      (goto-char (point-max))
      (re-search-backward "DEADLINE:[ ]<[0-9]\\|\\(❢[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9]\\)" nil t nil))))


(defun akl/jump-to-next-duedate-todo ()
  "Jump to the next DUEDATE entry."
  (interactive)
  (if (re-search-forward "\\* TODO\\|\\* STARTED\\|\\* WAITING\\|DEADLINE:[ ]<[0-9]\\|❢[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9]" nil t nil)
      (progn)
    (progn
      (goto-char (point-min))
      (re-search-forward "\\* TODO\\|\\* STARTED\\|\\* WAITING\\|DEADLINE:[ ]<[0-9]\\|❢[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9]" nil t nil))))


(defun akl/jump-to-previous-duedate-todo ()
  "Jump to the next DUEDATE entry."
  (interactive)
  (if (re-search-backward "\\* TODO\\|\\* STARTED\\|\\* WAITING\\|DEADLINE:[ ]<[0-9]\\|❢[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9]" nil t nil)
      (progn)
    (progn
      (goto-char (point-max))
      (re-search-backward "\\* TODO\\|\\* STARTED\\|\\* WAITING\\|DEADLINE:[ ]<[0-9]\\|❢[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9]" nil t nil))))


(defun akl/insert-date-stamp-calendar ()
  "Opens calendar to insert time stamp."
  (let ((time (org-read-date nil 'to-time nil "Date:  ")))
    (insert (format-time-string "%d.%m.%Y %a" time))))


(defun akl/duedate-date-insert ()
  "Insert DUEDATE in current buffer."
  (interactive)
  (insert "❢")
  (akl/insert-date-stamp-calendar)
  (akl/check-highlight-duedate-date))


(defun akl/agreed-date-insert ()
  "Insert AGREED in current buffer."
  (interactive)
  (insert "✓")
  (akl/insert-date-stamp-calendar)
  (akl/check-highlight-duedate-date))


(defun akl/subst-duedate-agreed-date-insert ()
  "Replace DUEDATE <timestamp> by AGREED <timestamp> at next occurence."
  (interactive)
  (save-excursion
  (beginning-of-line)
  (if (re-search-forward "\\(❢[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9] \\(?:Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)\\)" nil t nil)
    (progn
      (replace-match "✓")
      (akl/insert-date-stamp-calendar)
      (akl/check-highlight-duedate-date))
    (message "No DUEDATE found!"))))


(defun akl/subst-duedate-duedate-date-insert ()
  "Replace DUEDATE <timestamp> by DUEDATE <timestamp> at next occurence."
  (interactive)
  (save-excursion
  (beginning-of-line)
  (if (re-search-forward "\\(❢[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9] \\(?:Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)\\)" nil t nil)
    (progn
      (replace-match "❢")
      (akl/insert-date-stamp-calendar)
      (akl/check-highlight-duedate-date))
    (message "No DUEDATE found!"))
  (akl/check-highlight-duedate-date)))


(defun akl/list-all-todos-in-current-buffer ()
  "List all TODO keywords and DUEDATEs in current buffer."
  (interactive)
  (save-excursion
    (akl/check-highlight-duedate-date)
    (occur-by-moccur "\\* TODO\\|\\* STARTED\\|\\* WAITING\\|DEADLINE:[ ]<[0-9]\\|❢[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9]"
                     (current-buffer))))


(defun akl/list-all-todos-in-org-files ()
  "List all TODO keywords and DUEDATEs in org files."
  (interactive)
  (load "color-moccur")
  (save-excursion
    (moccur-search-files "\\* TODO\\|\\* STARTED\\|\\* WAITING\\|DEADLINE:[ ]<[0-9]\\|❢[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9]"
                         (directory-files-recursively "~/orgnotes/" "\\.org$"))))


(defun akl/list-all-todos-in-current-project ()
  "List all TODOs and DUEDATEs in current project.
Find DUEDATE in current buffer, check for over due in
comparision to today, and mark if overdue is true."
  (interactive)
  (save-excursion
    (progn
      (moccur-search-files
       "\\* TODO\\|\\* STARTED\\|\\* WAITING\\|DEADLINE:[ ]<[0-9]\\|❢[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9]"
       (directory-files-recursively (projectile-acquire-root) "\\.org$")))))


(defun akl/duedate--list-all-todo-date ()
  "A dotted list of all TODOs, Deadlines and duedates in current buffer."
  (save-excursion
    (goto-char (point-min))
    (let* ((found '()))
      (while (re-search-forward (concat "\\(?:\\* TODO\\|\\* STARTED\\|\\* WAITING\\|"
                                        "DEADLINE:[ ]<[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][ ]\\(?:Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)>"
                                        "\\|❢[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9]\\).*$")
                                nil t nil)
        (push (cons (match-string 0) (point) ) found))
      (setq *list-of-todo-n-dead-n-due* (reverse found)))))


(defun akl/helm-list-all-todo-dead-due-currbuf ()
  "List all TODOs, DEADLINEs and DUEDATEs in current buffer."
  (interactive)
  (akl/duedate--list-all-todo-date)
  (let* ((akl-helm-sources nil))
    (if (< 0 (length *list-of-todo-n-dead-n-due*))
        (progn
          (setq akl-helm-sources
                `((name . "TODO DEADLINE DUEDATE")
                  (candidates . ,*list-of-todo-n-dead-n-due*)
                  (action . (lambda (candiate)
                              (helm-get-selection)))))
          (goto-char (helm :sources '(akl-helm-sources))))
      (progn
        (message "No TODO, DEADLINE or DUEDATE found!")))))


(defun akl/helm-list-all-over-date-currbuf ()
  "List all TODOs, DEADLINEs and DUEDATEs in current buffer."
  (interactive)
  (akl/check-highlight-duedate-date)
  (let* ((akl-helm-sources nil))
    (if (< 0 (length *list-of-over-dead-n-due*))
        (progn
          (setq akl-helm-sources
                `((name . "Out of date DEADLINE DUEDATE")
                  (candidates . ,*list-of-over-dead-n-due*)
                  (action . (lambda (candiate)
                              (helm-get-selection)))))
          (goto-char (helm :sources '(akl-helm-sources))))
      (progn
        (message "No DEADLINE or DUEDATE out of date found!")))))



(provide 'init-duedate)
;;; init-duedate.el ends here

18.1.6. Content of akl-org-exporter.el

;;; org-exporter --- functions to export
;;; Commentary:
;; Functions to export org-mode files.
;; -*- coding: utf-8 -*-
;;
;;; Code:

(defvar *exporter-header-macros*
  "#+MACRO: color @@html:<span style=\"color: $1\">$2</span>@@@@latex:\\textcolor{$1}{$2}@@
#+MACRO: mark @@html:<span style=\"color: black; background-color: #99ccff\">$1</span>@@@@latex:\\colorbox{lime}{$1}@@
#+MACRO: skipnoindent @@html:<br><br>@@@@latex:\\par\\medskip\\noindent @@
#+MACRO: newpage @@html:@@@@latex:\\newpage @@
#+MACRO: landscape @@html:@@@@latex:\\setpagelandscape @@
#+MACRO: portrait @@html:@@@@latex:\\setpageportrait @@
"
  "Macros inserted at very beginning of buffer.")

;; https://mirror.dogado.de/tex-archive/fonts/fontawesome5/doc/fontawesome5.pdf
;; https://ctan.math.washington.edu/tex-archive/graphics/pgf/contrib/tikzsymbols/tikzsymbols.pdf
;; https://ftp.mpi-inf.mpg.de/pub/tex/mirror/ftp.dante.de/pub/tex/fonts/marvosym/doc/fonts/marvosym/marvodoc.pdf
(defvar *exporter-header-pdf*
  (concat "#+BEGIN_EXPORT latex
%% Necessary for the proper export via akl/export-to-pdf
\\newcommand{\\ownCheckEmpty}{\\textcolor{red}{\\raisebox{-.14ex}{\\framebox(9,9){}}}\\xspace}
\\newcommand{\\ownCheckMinus}{\\textcolor{blue}{{\\large \\faIcon[regular]{minus-square}}}\\xspace}
\\newcommand{\\ownCheckDone}{\\textcolor{darkgreen}{{\\large \\faIcon[regular]{check-square}}}\\xspace}
\\newcommand{\\ownDone}[1]{\\textcolor{darkgreen}{{\\Large \\faIcon{check}}\\xspace #1}\\xspace}
\\newcommand{\\ownOverDue}[1]{\\textcolor{darkred}{{\\Large \\faIcon{exclamation}}\\xspace #1}\\xspace}
\\newcommand{\\ownOpen}[1]{\\textcolor{darkblue}{{\\Large \\faIcon{exclamation}}\\xspace #1}\\xspace}
\\newcommand{\\ownBell}{\\textcolor{darkred}{{\\large \\faIcon{bell}}}\\xspace}
\\newcommand{\\ownWarning}[1]{\\textcolor{goldenyellow}{{\\Large \\faIcon{exclamation-triangle}}\\xspace #1}\\xspace}
\\newcommand{\\ownStar}[1]{\\textcolor{goldenyellow}{{\\Large \\faIcon{star}}\\xspace #1}\\xspace}
\\newcommand{\\ownCross}{\\textcolor{darkred}{{\\large \\faIcon{times}}}\\xspace}
\\newcommand{\\ownCrossSquare}{\\textcolor{darkred}{{\\large \\faIcon{window-close}}}\\xspace}
\\newcommand{\\ownCircleRed}{\\textcolor{darkred}{{\\large \\faIcon{circle}}}\\xspace}
\\newcommand{\\ownCircleBlue}{\\textcolor{darkblue}{{\\large \\faIcon{circle}}}\\xspace}
\\newcommand{\\ownQuestionMark}{\\textcolor{darkgray}{{\\large \\faIcon{question}}}\\xspace}
\\newcommand{\\ownCaretRight}[1]{{\\Large \\faIcon{caret-right}\\xspace #1}\\xspace}
\\newcommand{\\ownXTimes}[1]{{\\Large \\textit{\\faIcon{times}}\\xspace #1}\\xspace}
\\newcommand{\\ownExclamation}[1]{{\\Large \\faIcon{exclamation}\\xspace #1}\\xspace}
\\newcommand{\\ownHandoright}[1]{{\\textcolor{royalblue}{\\Large \\faIcon{hand-point-right}}\\xspace #1}\\xspace}
\\newcommand{\\ownHandoleft}[1]{{\\textcolor{royalblue}{\\Large \\faIcon{hand-point-left}}\\xspace #1}\\xspace}

\\newcommand{\\ownSmile}{\\dSmiley[1.3]\\xspace}
\\newcommand{\\ownGrin}{\\dLaughey[1.3]\\xspace}
\\newcommand{\\ownColdsweat}{\\dSey[1.3]\\xspace}

\\newpage
\\tableofcontents
\\newpage
%% \\listoffigures
%% \\newpage
%% \\listoftables
%% \\newpage
#+END_EXPORT
#+OPTIONS: email:t tags:nil title:t toc:nil ^:nil
"
          *exporter-header-macros*)

  
  "The header inserted at the very beginning of the buffer.
For \\LaTeX PDF export.")

(defvar *exporter-header-html*
  (concat "#+HTML_HEAD_EXTRA: <meta charset=\"utf-8\">
#+HTML_HEAD: <style>
#+HTML_HEAD: html {
#+HTML_HEAD:      font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;
#+HTML_HEAD: }
#+HTML_HEAD:
#+HTML_HEAD: a:link {
#+HTML_HEAD:      color:#00b0b0;
#+HTML_HEAD: }
#+HTML_HEAD: a:visited {
#+HTML_HEAD:      color:#00b0b0;
#+HTML_HEAD: }
#+HTML_HEAD: a:active {
#+HTML_HEAD:      color:#00b0b0;
#+HTML_HEAD: }
#+HTML_HEAD: </style>
#+HTML_HEAD_EXTRA: <script async type=\"text/javascript\" src=\"https://cdn.rawgit.com/mathjax/MathJax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML\"></script>
#+HTML_CONTAINER: div
#+HTML_DOCTYPE: xhtml-strict
#+OPTIONS: ':t H:4 ^:nil email:t tags:nil title:t toc:t e:t html-postamble:nil
#+MACRO: color @@html:<span style=\"color: $1\">$2</span>@@@@latex:\\textcolor{$1}{$2}@@
#+MACRO: mark @@html:<span style=\"color: black; background-color: #99ccff\">$1</span>@@@@latex:\\colorbox{lime}{$1}@@
#+MACRO: skipnoindent @@html:<br><br>@@@@latex:\\par\\medskip\\noindent @@
#+MACRO: newpage @@html:@@@@latex:\\newpage @@
#+MACRO: landscape @@html:@@@@latex:\\setpagelandscape @@
#+MACRO: portrait @@html:@@@@latex:\\setpageportrait @@
"
          *exporter-header-macros*)
  
  "The header inserted at the very beginning of the buffer.
For HTML export.")


(defun akl/export-to-pdf ()
  "Export to \\LaTeX - PDF, but replace some strings before.
Tow or more blank lines will be replaces by:
\\par\\medskip\\noindent

To open the PDF file type \\[universal-argument] first."
  (interactive)

  (save-buffer)
  (let* ((selection (buffer-substring-no-properties 1 (1+ (buffer-size))))
         (tempfile (concat (buffer-file-name) "__temp__"))
         (matchtime "")
         (catchtime "")
         (origmtime ""))
    
    (with-temp-file tempfile
      (progn
        (insert selection)
        
        (goto-char (point-min))
        (while (re-search-forward "\\(^#\\+OPTIONS:.*\\)" nil t nil)
          (progn
            (replace-match "")))
        
        (goto-char (point-min))
        (while (re-search-forward "^#\\+SETUPFILE:.*$" nil t nil)
          (progn
            (replace-match "")))

        (goto-char (point-min))
        (insert *exporter-header-pdf*)
        
        (goto-char (point-min))
        (while (re-search-forward "\\(\\)\\([0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9] \\(?:Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)\\)" nil t nil)
          (progn
            (replace-match (concat "\\\\ownDone{" (match-string 2)  "}"))))

        (goto-char (point-min))
        (while (re-search-forward "❢\\([0-9][0-9]\\)\\.\\([0-9][0-9]\\)\\.\\([0-9][0-9][0-9][0-9]\\) \\(Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)" nil t nil)
          (progn
            (setq matchtime (concat (match-string 1) "." (match-string 2) "." (match-string 3) " " (match-string 4)))
            (setq catchtime (concat (match-string 3) "-" (match-string 2) "-" (match-string 1) "T00:00:00"))
            (replace-match "")
            (if (time-less-p (date-to-time (format-time-string "%Y-%m-%dT00:00:00"))
                             (date-to-time catchtime))
                (progn
                  (insert (concat "\\ownOpen{" matchtime "} \\addcontentsline{toc}{subsubsection}{Due date: " matchtime "}")))
              (progn
                (insert (concat "\\ownOverDue{" matchtime "} \\addcontentsline{toc}{subsubsection}{Out of date: " matchtime "}")))
              )))

        (goto-char (point-min))
        (while (re-search-forward "\\(DEADLINE:[ ]<\\)\\([0-9][0-9][0-9][0-9]\\)-\\([0-9][0-9]\\)-\\([0-9][0-9]\\) \\(Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)\\(>\\)" nil t nil)
          (progn
            (setq origmtime (replace-regexp-in-string "<" "\\\\textless " (match-string 0)))
            (setq origmtime (replace-regexp-in-string ">" "\\\\textgreater " origmtime))
            (setq matchtime (concat (match-string 4) "." (match-string 3) "." (match-string 2) " " (match-string 5)))
            (setq catchtime (concat (match-string 2) "-" (match-string 3) "-" (match-string 4) "T00:00:00"))
            (replace-match "")
            (if (time-less-p (date-to-time (format-time-string "%Y-%m-%dT00:00:00"))
                             (date-to-time catchtime))
                (progn
                  (insert (concat "\\textcolor{darkblue}{" origmtime "} \\addcontentsline{toc}{subsubsection}{Deadline: " matchtime "}")))
              (progn
                (insert (concat "\\textcolor{darkred}{" origmtime "} \\addcontentsline{toc}{subsubsection}{Out of Deadline: " matchtime "}"))))))
        ;; If next lines after DEADLINE: are :PROPERTIES: lines, they shall be
        ;; removed.  Will not be done by org-xxx-export-to-xxx because of
        ;; colorized DEADLINE.  The easiest way is to search and remove
        ;; :PROPERTIES: until :END: in a section globally.
        (goto-char (point-min))
        (while (re-search-forward "^:PROPERTIES:" nil t nil)
          (progn
            (let ((beg (point-at-bol)))
              (if (re-search-forward "^:END:" nil t nil)
                (delete-region beg (point))))))

        ;;two or more blank lines replacement
        (goto-char (point-min))
        (while (re-search-forward "\n\n\n+" nil "move" nil)
          (progn
            (let* ((beg (match-beginning 0))
                   (end (match-end 0)))

              (if (re-search-backward "\\([^,]#\\+end\\|[^,]#\\+begin\\)" nil t nil)
                  (progn
                    (if (not (string-match "[^,]#\\+begin" (match-string 0)))
                        (progn
                          (goto-char beg)
                          (delete-region beg end)
                          (insert "\n\\par\\medskip\\noindent\n"))
                      (progn
                        (goto-char (+ 1 end)))))
                (progn
                  (goto-char (+ 1 end)))))))
        
        ;; Some replacements from unicode to LaTeX PDF.
        (goto-char (point-min))
        (while (re-search-forward "\\(\\)" nil t nil)
          (progn
            (replace-match (concat "\\\\ownDone{}"))))
        (goto-char (point-min))
        (while (re-search-forward "\\(\\)" nil t nil)
          (progn
            (replace-match (concat "\\\\ownOverDue{}"))))

        (goto-char (point-min))
        (while (re-search-forward "- \\[ \\]" nil t nil)
          (progn
            (replace-match "- \\\\ownCheckEmpty")))
        (goto-char (point-min))
        (while (re-search-forward "- \\[-\\]" nil t nil)
          (progn
            (replace-match "- \\\\ownCheckMinus")))
        (goto-char (point-min))
        (while (re-search-forward "- \\[X\\]" nil t nil)
          (progn
            (replace-match "- \\\\ownCheckDone")))
        (goto-char (point-min))
        (while (re-search-forward "🔖" nil t nil)
          (progn
            (replace-match " ")))
        (goto-char (point-min))
        (while (re-search-forward "✘" nil t nil)
          (progn
            (replace-match "\\\\ownXTimes{}")))
        (goto-char (point-min))
        (while (re-search-forward "☺" nil t nil)
          (progn
            (replace-match "\\\\ownSmile{}")))
        (goto-char (point-min))
        (while (re-search-forward "⏰" nil t nil)
          (progn
            (replace-match "\\\\ownBell{}")))
        (goto-char (point-min))
        (while (re-search-forward "⚠" nil t nil)
          (progn
            (replace-match "\\\\ownWarning{}")))
        (goto-char (point-min))
        (while (re-search-forward "⭐" nil t nil)
          (progn
            (replace-match "\\\\ownStar{}")))
        (goto-char (point-min))
        (while (re-search-forward "❌" nil t nil)
          (progn
            (replace-match "\\\\ownCross{}")))
        (goto-char (point-min))
        (while (re-search-forward "❎" nil t nil)
          (progn
            (replace-match "\\\\ownCrossSquare{}")))
        (goto-char (point-min))
        (while (re-search-forward "🔴" nil t nil)
          (progn
            (replace-match "\\\\ownCircleRed{}")))
        (goto-char (point-min))
        (while (re-search-forward "🔵" nil t nil)
          (progn
            (replace-match "\\\\ownCircleBlue{}")))
        (goto-char (point-min))
        (while (re-search-forward "❔" nil t nil)
          (progn
            (replace-match "\\\\ownQuestionMark{}")))
        (goto-char (point-min))
        (while (re-search-forward "😀" nil t nil)
          (progn
            (replace-match "\\\\ownGrin{}")))
        (goto-char (point-min))
        (while (re-search-forward "►" nil t nil)
          (progn
            (replace-match "\\\\ownCaretRight{}")))
        (goto-char (point-min))
        (while (re-search-forward "❢" nil t nil)
          (progn
            (replace-match "\\\\ownExclamation{}")))
        (goto-char (point-min))
        (while (re-search-forward "👉" nil t nil)
          (progn
            (replace-match "\\\\ownHandoright{}")))
        (goto-char (point-min))
        (while (re-search-forward "👈" nil t nil)
          (progn
            (replace-match "\\\\ownHandoleft{}")))
        (goto-char (point-min))
        (while (re-search-forward "😓" nil t nil)
          (progn
            (replace-match "\\\\ownColdsweat{}")))
        (goto-char (point-min))
        (while (re-search-forward "😏\\|;-)" nil t nil)
          (progn
            (replace-match "\\\\olddWinkey[1.3]{}")))

        )) ;; END OF with-temp-file tempfile

    (if (file-exists-p tempfile)
        (progn
          (find-file tempfile)
          (org-latex-export-to-pdf)

          (delete-file tempfile)
          (kill-buffer)

          (if (equal current-prefix-arg '(4)) ; C-u
              (progn
                (let ((pdffile (concat (file-name-directory buffer-file-name) (file-name-base buffer-file-name) ".pdf"))
                      (reader *pdf-reader-path*))
                  (message (concat "Open " reader " " pdffile))
                  (process-file reader nil 0 nil pdffile)
                  )))
          ))))
;; END OF akl/duedate-export-to-pdf

(defun akl/export-to-html-white-word ()
  "Convert current Org Mode buffer to html and open it in word."
  (interactive)
  (akl/export-to-html-white '(16)))

(defun akl/export-to-html-white (&optional arg)
  "Convert the current Org mode buffer to html.
The line #+SETUPFILE will be ignored.  My setup file for Org-Mode
contains some CSS stuff, which - in some circumstances - is not
desired.
The file name will be extended with -white.

To open the HTML file in browser type \\[universal-argument] first.
To open the HTML file in word type \\[universal-argument] \\[universal-argument] first.

To export the buffer as it is use akl/export-to-html"
  (interactive)

  ;; (save-buffer)
  (let* ((selection (buffer-substring-no-properties 1 (1+ (buffer-size))))
         (tempfile (concat (buffer-file-name) "__temp__"))
         (newname (concat (file-name-sans-extension (buffer-file-name)) "-white.html"))
         (catchtime "")
         (matchtime "")
         (origmtime "")
         (orig-font-lock-string-face (face-attribute 'font-lock-string-face :foreground))
         (orig-font-lock-keyword-face (face-attribute 'font-lock-keyword-face :foreground))
         (orig-font-lock-function-name-face (face-attribute 'font-lock-function-name-face :foreground))
         (orig-font-lock-doc-face (face-attribute 'font-lock-doc-face :foreground))
         )

    (with-temp-file tempfile
      (progn
        (insert selection)

        ;; Some faces should be redefined for export to white background.
        (set-face-attribute 'font-lock-string-face nil :foreground "#8BC34A")
        (set-face-attribute 'font-lock-keyword-face nil :foreground "#FF8A65")
        (set-face-attribute 'font-lock-function-name-face nil :foreground "#5D54E1")
        (set-face-attribute 'font-lock-doc-face nil :foreground "#8BC34A")
        
        (goto-char (point-min))
        (while (re-search-forward "\\(^#\\+OPTIONS:.*\\)" nil t nil)
          (progn
            (replace-match "")))
        
        (goto-char (point-min))
        (while (re-search-forward "^#\\+SETUPFILE:.*$" nil t nil)
          (progn
            (replace-match "")))

        (goto-char (point-min))
        (insert *exporter-header-html*)

        (goto-char (point-min))
        (while (re-search-forward "\\(✓[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9] \\(?:Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)\\)" nil t nil)
          (progn
            (replace-match (concat "@@html:<span style=\"color: green\">" (match-string 1)  "</span>@@"))))

        (goto-char (point-min))
        (while (re-search-forward "❢\\([0-9][0-9]\\)\\.\\([0-9][0-9]\\)\\.\\([0-9][0-9][0-9][0-9]\\) \\(Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)" nil t nil)
          (progn
            (setq matchtime (concat "❢" (match-string 1) "." (match-string 2) "." (match-string 3) " " (match-string 4)))
            (setq catchtime (concat "❢" (match-string 3) "-" (match-string 2) "-" (match-string 1) "T00:00:00"))
            (replace-match "")
            (if (time-less-p (date-to-time (format-time-string "%Y-%m-%dT00:00:00"))
                             (date-to-time catchtime))
                (progn
                  (insert (concat "@@html:<span style=\"color: blue\">" matchtime "</span>@@")))
              (progn
                (insert (concat "@@html:<span style=\"color: red\">" matchtime "</span>@@")))
              )))

        (goto-char (point-min))
        (while (re-search-forward "\\(DEADLINE:[ ]<\\)\\([0-9][0-9][0-9][0-9]\\)-\\([0-9][0-9]\\)-\\([0-9][0-9]\\) \\(Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)\\(>\\)" nil t nil)
          (progn
            (setq origmtime (match-string 0))
            (setq matchtime (concat (match-string 4) "." (match-string 3) "." (match-string 2) " " (match-string 5)))
            (setq catchtime (concat (match-string 2) "-" (match-string 3) "-" (match-string 4) "T00:00:00"))
            (replace-match "")
            (if (time-less-p (date-to-time (format-time-string "%Y-%m-%dT00:00:00"))
                             (date-to-time catchtime))
                (progn
                  (insert (concat "@@html:<span style=\"color: blue\">" origmtime "</span>@@")))
              (progn
                (insert (concat "@@html:<span style=\"color: red\">" origmtime "</span>@@"))))))
        ;; If next lines after DEADLINE: are :PROPERTIES: lines, they shall be
        ;; removed.  Will not be done by org-xxx-export-to-xxx because of
        ;; colorized DEADLINE.  The easiest way is to search and remove
        ;; :PROPERTIES: until :END: in a section globally.
        (goto-char (point-min))
        (while (re-search-forward "^:PROPERTIES:" nil t nil)
          (progn
            (let ((beg (point-at-bol)))
              (if (re-search-forward "^:END:" nil t nil)
                (delete-region beg (point))))))

        (goto-char (point-min))
        (while (re-search-forward "\\(\\)[ .!?$]" nil t nil)
          (progn
            (replace-match (concat "@@html:<span style=\"color: green\">" (match-string 1) "</span>@@"))))
        (goto-char (point-min))
        (while (re-search-forward "\\(\\)[ .!?$]" nil t nil)
          (progn
            (replace-match (concat "@@html:<span style=\"color: red\">" (match-string 1) "</span>@@"))))

        )) ;; END OF with-temp-file tempfile

    (if (file-exists-p tempfile)
        (progn
          (find-file tempfile)
          (org-html-export-to-html)

          (delete-file tempfile)
          (kill-buffer)

          (set-face-attribute 'font-lock-string-face nil :foreground orig-font-lock-string-face)
          (set-face-attribute 'font-lock-keyword-face nil :foreground orig-font-lock-keyword-face)
          (set-face-attribute 'font-lock-function-name-face nil :foreground orig-font-lock-function-name-face)
          (set-face-attribute 'font-lock-doc-face nil :foreground orig-font-lock-doc-face)

          (if (file-exists-p newname)
              (delete-file newname))
          (copy-file (concat (file-name-sans-extension (buffer-file-name)) ".html")
                     newname)
          (message (format "%s" newname))

          (if (or (equal current-prefix-arg '(4)) ; C-u
                  (equal arg '(4)))
              (progn
                (let ((htmlfile (concat (file-name-directory buffer-file-name) (file-name-base buffer-file-name) ".html"))
                      (browser *browser-path*))
                  (message (concat "Open " browser " " htmlfile))
                  (process-file browser nil 0 nil htmlfile))))

          (if (or (equal current-prefix-arg '(16)) ; C-u C-u
                  (equal arg '(16)))
              (progn
                (let ((htmlfile (concat (file-name-directory buffer-file-name) (file-name-base buffer-file-name) ".html"))
                      (word *word-path*))
                  (message (concat "Open " word " " htmlfile))
                  (process-file word nil 0 nil htmlfile))))
          ))))
;; END OF akl/export-to-html-white

(defun akl/export-to-html-word ()
  "Convert current Org Mode buffer to html and open it in word."
  (interactive)
  (akl/export-to-html '(16)))

(defun akl/export-to-html (&optional arg)
  "Convert the current Org mode buffer to html.

To open the HTML file in browser type \\[universal-argument] first.
To open the HTML file in word type \\[universal-argument] \\[universal-argument] first.

ARG is \\[universal-argument] for non-interactive call."
  (interactive)

  (message "Export to html started!")
  ;; (save-buffer)
  (let* ((savecurrpoint (point))
         (selection (buffer-substring-no-properties 1 (1+ (buffer-size))))
         (tempfile (concat (buffer-file-name) "__temp__"))
         (catchtime "")
         (matchtime "")
         (origmtime ""))

    (with-temp-file tempfile
      (progn
        (insert selection)
        (goto-char (point-min))
        (while (re-search-forward "\\(✓[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9] \\(?:Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)\\)" nil t nil)
          (progn
            (replace-match (concat "@@html:<span style=\"color: green\">" (match-string 1)  "</span>@@"))))

        (goto-char (point-min))
        (while (re-search-forward "❢\\([0-9][0-9]\\)\\.\\([0-9][0-9]\\)\\.\\([0-9][0-9][0-9][0-9]\\) \\(Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)" nil t nil)
          (progn
            (setq matchtime (concat "❢" (match-string 1) "." (match-string 2) "." (match-string 3) " " (match-string 4)))
            (setq catchtime (concat "❢" (match-string 3) "-" (match-string 2) "-" (match-string 1) "T00:00:00"))
            (replace-match "")
            (if (time-less-p (date-to-time (format-time-string "%Y-%m-%dT00:00:00"))
                             (date-to-time catchtime))
                (progn
                  (insert (concat "@@html:<span style=\"color: #0174DF\">" matchtime "</span>@@")))
              (progn
                (insert (concat "@@html:<span style=\"color: red\">" matchtime "</span>@@")))
              )))

        (goto-char (point-min))
        (while (re-search-forward "\\(DEADLINE:[ ]<\\)\\([0-9][0-9][0-9][0-9]\\)-\\([0-9][0-9]\\)-\\([0-9][0-9]\\) \\(Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)\\(>\\)" nil t nil)
          (progn
            (setq origmtime (match-string 0))
            (setq matchtime (concat (match-string 4) "." (match-string 3) "." (match-string 2) " " (match-string 5)))
            (setq catchtime (concat (match-string 2) "-" (match-string 3) "-" (match-string 4) "T00:00:00"))
            (replace-match "")
            (if (time-less-p (date-to-time (format-time-string "%Y-%m-%dT00:00:00"))
                             (date-to-time catchtime))
                (progn
                  (insert (concat "@@html:<span style=\"color: #0174DF\">" origmtime "</span>@@")))
              (progn
                (insert (concat "@@html:<span style=\"color: red\">" origmtime "</span>@@"))))))
        ;; If next lines after DEADLINE: are :PROPERTIES: lines, they shall be
        ;; removed.  Will not be done by org-xxx-export-to-xxx because of
        ;; colorized DEADLINE.  The easiest way is to search and remove
        ;; :PROPERTIES: until :END: in a section globally.
        (goto-char (point-min))
        (while (re-search-forward "^:PROPERTIES:" nil t nil)
          (progn
            (let ((beg (point-at-bol)))
              (if (re-search-forward "^:END:" nil t nil)
                (delete-region beg (point))))))

        (goto-char (point-min))
        (while (re-search-forward "\\(\\)[ .!?$]" nil t nil)
          (progn
            (replace-match (concat "@@html:<span style=\"color: green\">" (match-string 1) "</span>@@"))))
        (goto-char (point-min))
        (while (re-search-forward "\\(\\)[ .!?$]" nil t nil)
          (progn
            (replace-match (concat "@@html:<span style=\"color: red\">" (match-string 1) "</span>@@"))))

        )) ;; END OF with-temp-file tempfile

    (if (file-exists-p tempfile)
        (progn
          (find-file tempfile)
          (org-html-export-to-html)

          (delete-file tempfile)
          (kill-buffer)

          (if (or (equal current-prefix-arg '(4)) ; C-u
                  (equal arg '(4)))
              (progn
                (let ((htmlfile (concat (file-name-directory buffer-file-name) (file-name-base buffer-file-name) ".html"))
                      (browser *browser-path*))
                  (message (concat "Open " browser " " htmlfile))
                  (process-file browser nil 0 nil htmlfile))))

          (if (or (equal current-prefix-arg '(16)) ; C-u C-u
                  (equal arg '(16)))
              (progn
                (let ((htmlfile (concat (file-name-directory buffer-file-name) (file-name-base buffer-file-name) ".html"))
                      (word *word-path*))
                  (message (concat "Open " word " " htmlfile))
                  (process-file word nil 0 nil htmlfile)))))))
  ) ;; END OF akl/export-to-html


(defun akl/what-face ()
  "To get the font-lock name under cursor."
  (interactive)
  (global-hl-line-mode 0)
  (let ((face (or (get-char-property (point) 'read-face-name)
                  (get-char-property (point) 'face))))
    (if face (message "Face: %s" face) (message "No face at %d" (point)))
    (kill-new "" nil)
  (kill-append (format "%s" face) nil))
  (global-hl-line-mode 1))


(defun akl/export-region-html-white (&optional beg end)
  "Get the region BEG to END for E-Mail.
Either the marked region or the Org mode section will be used to
create a HTML file with its content.  To get the whole buffer
type \\[mark-whole-buffer].

To open the HTML file in browser type \\[universal-argument] first.
To open Kmail and attach the HTML file type \\[universal-argument] \\[universal-argument] first."
  (interactive)
  (save-excursion
    (let* ((beg (if (region-active-p) (region-beginning)
                  (progn
                    (org-back-to-heading)
                    (point))))
           (end (if (region-active-p) (region-end)
                  (progn
                    (org-end-of-subtree)
                    (point))))
           (selection (buffer-substring-no-properties beg end))
           (tempfile (concat (buffer-file-name) "__temp__"))
           (catchtime "")
           (matchtime "")
           (origmtime "")
           (orig-font-lock-string-face (face-attribute 'font-lock-string-face :foreground))
           (orig-font-lock-keyword-face (face-attribute 'font-lock-keyword-face :foreground))
           (orig-font-lock-function-name-face (face-attribute 'font-lock-function-name-face :foreground))
           (orig-font-lock-doc-face (face-attribute 'font-lock-doc-face :foreground))
           )

      (with-temp-file tempfile
        (progn
          (insert selection)
          ;; Some faces should be redefined for export to white background.
          (set-face-attribute 'font-lock-string-face nil :foreground "#8BC34A")
          (set-face-attribute 'font-lock-keyword-face nil :foreground "#FF8A65")
          (set-face-attribute 'font-lock-function-name-face nil :foreground "#5D54E1")
          (set-face-attribute 'font-lock-doc-face nil :foreground "#8BC34A")

          (goto-char (point-min))
          (while (re-search-forward "\\(^#\\+OPTIONS:.*\\)" nil t nil)
            (progn
              (replace-match "")))
          
          (goto-char (point-min))
          (while (re-search-forward "^#\\+SETUPFILE:.*$" nil t nil)
            (progn
              (replace-match "")))

          (goto-char (point-min))
          (insert *exporter-header-html*)

          (goto-char (point-min))
          (while (re-search-forward "\\(✓[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9] \\(?:Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)\\)" nil t nil)
            (progn
              (replace-match (concat "@@html:<span style=\"background-color: #9AFE2E\">" (match-string 1)  "</span>@@"))))

          (goto-char (point-min))
          (while (re-search-forward "❢\\([0-9][0-9]\\)\\.\\([0-9][0-9]\\)\\.\\([0-9][0-9][0-9][0-9]\\) \\(Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)" nil t nil)
            (progn
              (setq matchtime (concat "❢" (match-string 1) "." (match-string 2) "." (match-string 3) " " (match-string 4)))
              (setq catchtime (concat "❢" (match-string 3) "-" (match-string 2) "-" (match-string 1) "T00:00:00"))
              (replace-match "")
              (if (time-less-p (date-to-time (format-time-string "%Y-%m-%dT00:00:00"))
                               (date-to-time catchtime))
                  (progn
                    (insert (concat "@@html:<span style=\"background-color: #58ACFA\">" matchtime "</span>@@")))
                (progn
                  (insert (concat "@@html:<span style=\"background-color: #FE2E2E\">" matchtime "</span>@@")))
                )))

          (goto-char (point-min))
          (while (re-search-forward "\\(DEADLINE:[ ]<\\)\\([0-9][0-9][0-9][0-9]\\)-\\([0-9][0-9]\\)-\\([0-9][0-9]\\) \\(Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)\\(>\\)" nil t nil)
            (progn
              (setq origmtime (match-string 0))
              (setq matchtime (concat (match-string 4) "." (match-string 3) "." (match-string 2) " " (match-string 5)))
              (setq catchtime (concat (match-string 2) "-" (match-string 3) "-" (match-string 4) "T00:00:00"))
              (replace-match "")
              (if (time-less-p (date-to-time (format-time-string "%Y-%m-%dT00:00:00"))
                               (date-to-time catchtime))
                  (progn
                    (insert (concat "@@html:<span style=\"background-color: #58ACFA\">" origmtime "</span>@@")))
                (progn
                  (insert (concat "@@html:<span style=\"background-color: #FE2E2E\">" origmtime "</span>@@"))))))
          ;; If next lines after DEADLINE: are :PROPERTIES: lines, they shall be
          ;; removed.  Will not be done by org-xxx-export-to-xxx because of
          ;; colorized DEADLINE.  The easiest way is to search and remove
          ;; :PROPERTIES: until :END: in a section globally.
          (goto-char (point-min))
          (while (re-search-forward "^:PROPERTIES:" nil t nil)
            (progn
              (let ((beg (point-at-bol)))
                (if (re-search-forward "^:END:" nil t nil)
                    (delete-region beg (point))))))

          (goto-char (point-min))
          (while (re-search-forward "\\(\\)[ .!?$]" nil t nil)
            (progn
              (replace-match (concat "@@html:<span style=\"background-color: #9AFE2E\">" (match-string 1) "</span>@@"))))

          (goto-char (point-min))
          (while (re-search-forward "\\(\\)[ .!?$]" nil t nil)
            (progn
              (replace-match (concat "@@html:<span style=\"background-color: #FE2E2E\">" (match-string 1) "</span>@@"))))

          ;; for internal links to org header
          (goto-char (point-min))
          (while (re-search-forward "\\[\\[\\*\\(.*?\\)\\].*?\\]" nil t nil)
            (progn
              (replace-match (match-string 1))))

          (set-face-attribute 'font-lock-string-face nil :foreground orig-font-lock-string-face)
          (set-face-attribute 'font-lock-keyword-face nil :foreground orig-font-lock-keyword-face)
          (set-face-attribute 'font-lock-function-name-face nil :foreground orig-font-lock-function-name-face)
          (set-face-attribute 'font-lock-doc-face nil :foreground orig-font-lock-doc-face)
          )) ; END OF with-temp-file tempfile

      (if (file-exists-p tempfile)
          (progn
            (find-file tempfile)
            (org-html-export-to-html)

            (delete-file tempfile)
            (kill-buffer)
            
            (if (equal current-prefix-arg '(4)) ; C-u
                (progn
                  (let ((htmlfile (concat (file-name-directory buffer-file-name) (file-name-base buffer-file-name) ".html"))
                        (browser *browser-path*))
                    (message (concat "Open " browser " " htmlfile))
                    (process-file browser nil 0 nil htmlfile))))

            (if (equal current-prefix-arg '(16)) ; C-u C-u
                (progn
                  (let* ((htmlfile (concat (file-name-directory tempfile) (file-name-base tempfile) ".html"))
                         (command (concat " --attach \"" htmlfile "\""))
                         (mailer *mail-path*))
                    (message (concat "Open \"" mailer "\" " command))
                    (shell-command (concat "\"" mailer "\"" command))))))))))
;; END OF akl/export-region-html-white


;; https://orgmode.org/worg/org-hacks.html#org0737d7a
(defun akl/org-export-region-as-html-attachment (beg end arg)
  "Export region between BEG and END as html attachment.
If BEG and END are not set, use current subtree.  Region or
subtree is exported to html without header and footer, prefixed
with a mime entity string and pushed to clipboard and killring.
When called with prefix ARG, mime entity is not marked as
attachment."
  (interactive "r\nP")
  (save-excursion
    (let* ((beg (if (region-active-p) (region-beginning)
                  (progn
                    (org-back-to-heading)
                    (point))))
           (end (if (region-active-p) (region-end)
                  (progn
                    (org-end-of-subtree)
                    (point))))
           (html (concat "--[[text/html"
                         (if arg "" "\nContent-Disposition: attachment")
                         "]]\n"
                         ;; (org-export-region-as-html beg end t 'string)
                         (org-html-htmlize-region-for-paste beg end)
                         )))
      (when (fboundp 'x-set-selection)
        (ignore-errors (x-set-selection 'PRIMARY html))
        (ignore-errors (x-set-selection 'CLIPBOARD html)))
      (message "html export done, pushed to kill ring and clipboard"))))


;; https://github.com/fniessen/org-html-themes
;; #+SETUPFILE: https://fniessen.github.io/org-html-themes/org/theme-NAME.setup
;; (where NAME is either bigblow or readtheorg)
(defun akl/export-to-html-bigblow ()
  "Convert the current Org mode buffer to html.
The file name will be extended with -bigblow.

To open the HTML file in browser type \\[universal-argument] first."
  (interactive)

  (message "Export to html started!")
  ;; (save-buffer)
  (let* ((selection (buffer-substring-no-properties 1 (1+ (buffer-size))))
         (tempfile (concat (buffer-file-name) "__temp__"))
         (newname (concat (file-name-sans-extension (buffer-file-name)) "-bigblow.html"))
         (catchtime "")
         (matchtime "")
         (origmtime ""))

    (with-temp-file tempfile
      (progn
        (insert selection)

        (goto-char (point-min))
        (while (re-search-forward "\\(^#\\+OPTIONS:.*\\)" nil t nil)
          (progn
            (replace-match "")))
        
        (goto-char (point-min))
        (while (re-search-forward "^#\\+SETUPFILE:.*$" nil t nil)
          (progn
            (replace-match "")))

        (goto-char (point-min))
        (insert "#+SETUPFILE: https://fniessen.github.io/org-html-themes/org/theme-bigblow.setup\n")
        (insert "#+HTML_HEAD: <style>pre.src{background:#343131;color:white;} </style>\n")
        (insert "#+HTML_HEAD: <style> #content{max-width:1200px;}</style>\n")
        (insert "#+HTML_HEAD: <style> p{max-width:800px;}</style>\n")
        (insert "#+HTML_HEAD: <style> li{max-width:800px;}</style\n")
        (insert *exporter-header-macros*)

        (goto-char (point-min))
        (while (re-search-forward "\\(✓[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9] \\(?:Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)\\)" nil t nil)
          (progn
            (replace-match (concat "@@html:<span style=\"color: green\">" (match-string 1)  "</span>@@"))))

        (goto-char (point-min))
        (while (re-search-forward "❢\\([0-9][0-9]\\)\\.\\([0-9][0-9]\\)\\.\\([0-9][0-9][0-9][0-9]\\) \\(Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)" nil t nil)
          (progn
            (setq matchtime (concat "❢" (match-string 1) "." (match-string 2) "." (match-string 3) " " (match-string 4)))
            (setq catchtime (concat "❢" (match-string 3) "-" (match-string 2) "-" (match-string 1) "T00:00:00"))
            (replace-match "")
            (if (time-less-p (date-to-time (format-time-string "%Y-%m-%dT00:00:00"))
                             (date-to-time catchtime))
                (progn
                  (insert (concat "@@html:<span style=\"color: #0174DF\">" matchtime "</span>@@")))
              (progn
                (insert (concat "@@html:<span style=\"color: red\">" matchtime "</span>@@")))
              )))

        (goto-char (point-min))
        (while (re-search-forward "\\(DEADLINE:[ ]<\\)\\([0-9][0-9][0-9][0-9]\\)-\\([0-9][0-9]\\)-\\([0-9][0-9]\\) \\(Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)\\(>\\)" nil t nil)
          (progn
            (setq origmtime (match-string 0))
            (setq matchtime (concat (match-string 4) "." (match-string 3) "." (match-string 2) " " (match-string 5)))
            (setq catchtime (concat (match-string 2) "-" (match-string 3) "-" (match-string 4) "T00:00:00"))
            (replace-match "")
            (if (time-less-p (date-to-time (format-time-string "%Y-%m-%dT00:00:00"))
                             (date-to-time catchtime))
                (progn
                  (insert (concat "@@html:<span style=\"color: #0174DF\">" origmtime "</span>@@")))
              (progn
                (insert (concat "@@html:<span style=\"color: red\">" origmtime "</span>@@"))))))
        ;; If next lines after DEADLINE: are :PROPERTIES: lines, they shall be
        ;; removed.  Will not be done by org-xxx-export-to-xxx because of
        ;; colorized DEADLINE.  The easiest way is to search and remove
        ;; :PROPERTIES: until :END: in a section globally.
        (goto-char (point-min))
        (while (re-search-forward "^:PROPERTIES:" nil t nil)
          (progn
            (let ((beg (point-at-bol)))
              (if (re-search-forward "^:END:" nil t nil)
                (delete-region beg (point))))))

        (goto-char (point-min))
        (while (re-search-forward "\\(\\)[ .!?$]" nil t nil)
          (progn
            (replace-match (concat "@@html:<span style=\"color: green\">" (match-string 1) "</span>@@"))))
        (goto-char (point-min))
        (while (re-search-forward "\\(\\)[ .!?$]" nil t nil)
          (progn
            (replace-match (concat "@@html:<span style=\"color: red\">" (match-string 1) "</span>@@"))))
        )) ;; END OF with-temp-file tempfile

    (if (file-exists-p tempfile)
        (progn
          (find-file tempfile)
          (org-html-export-to-html)

          (delete-file tempfile)
          (kill-buffer)

          (if (file-exists-p newname)
              (delete-file newname))
          (copy-file (concat (file-name-sans-extension (buffer-file-name)) ".html")
                     newname)
          (message (format "%s" newname))
          
          (if (equal current-prefix-arg '(4)) ; C-u
              (progn
                (let ((htmlfile newname)
                      (browser *browser-path*))
                  (message (concat "Open " browser " " htmlfile))
                  (process-file browser nil 0 nil htmlfile))))
          )))) ;; END OF akl/export-to-html-bigblow


;; https://github.com/fniessen/org-html-themes
;; #+SETUPFILE: https://fniessen.github.io/org-html-themes/org/theme-NAME.setup
;; (where NAME is either bigblow or readtheorg)
(defun akl/export-to-html-readtheorg ()
  "Convert the current Org mode buffer to html.
The file name will be extended with -readtheorg.

To open the HTML file in browser type \\[universal-argument] first."
  (interactive)

  (message "Export to html started!")
  ;; (save-buffer)
  (let* ((selection (buffer-substring-no-properties 1 (1+ (buffer-size))))
         (tempfile (concat (buffer-file-name) "__temp__"))
         (newname (concat (file-name-sans-extension (buffer-file-name)) "-readtheorg.html"))
         (catchtime "")
         (matchtime "")
         (origmtime ""))

    (with-temp-file tempfile
      (progn
        (insert selection)

        (goto-char (point-min))
        (while (re-search-forward "\\(^#\\+OPTIONS:.*\\)" nil t nil)
          (progn
            (replace-match "")))
        
        (goto-char (point-min))
        (while (re-search-forward "^#\\+SETUPFILE:.*$" nil t nil)
          (progn
            (replace-match "")))

        (goto-char (point-min))
        (insert "#+SETUPFILE: https://fniessen.github.io/org-html-themes/org/theme-readtheorg.setup\n")
        (insert "#+HTML_HEAD: <style>pre.src{background:#343131;color:white;} </style>\n")
        (insert "#+HTML_HEAD: <style> #content{max-width:1200px;}</style>\n")
        (insert "#+HTML_HEAD: <style> p{max-width:800px;}</style>\n")
        (insert "#+HTML_HEAD: <style> li{max-width:800px;}</style\n")
        (insert *exporter-header-macros*)

        (goto-char (point-min))
        (while (re-search-forward "\\(✓[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9] \\(?:Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)\\)" nil t nil)
          (progn
            (replace-match (concat "@@html:<span style=\"color: green\">" (match-string 1)  "</span>@@"))))

        (goto-char (point-min))
        (while (re-search-forward "❢\\([0-9][0-9]\\)\\.\\([0-9][0-9]\\)\\.\\([0-9][0-9][0-9][0-9]\\) \\(Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)" nil t nil)
          (progn
            (setq matchtime (concat "❢" (match-string 1) "." (match-string 2) "." (match-string 3) " " (match-string 4)))
            (setq catchtime (concat "❢" (match-string 3) "-" (match-string 2) "-" (match-string 1) "T00:00:00"))
            (replace-match "")
            (if (time-less-p (date-to-time (format-time-string "%Y-%m-%dT00:00:00"))
                             (date-to-time catchtime))
                (progn
                  (insert (concat "@@html:<span style=\"color: #0174DF\">" matchtime "</span>@@")))
              (progn
                (insert (concat "@@html:<span style=\"color: red\">" matchtime "</span>@@")))
              )))

        (goto-char (point-min))
        (while (re-search-forward "\\(DEADLINE:[ ]<\\)\\([0-9][0-9][0-9][0-9]\\)-\\([0-9][0-9]\\)-\\([0-9][0-9]\\) \\(Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)\\(>\\)" nil t nil)
          (progn
            (setq origmtime (match-string 0))
            (setq matchtime (concat (match-string 4) "." (match-string 3) "." (match-string 2) " " (match-string 5)))
            (setq catchtime (concat (match-string 2) "-" (match-string 3) "-" (match-string 4) "T00:00:00"))
            (replace-match "")
            (if (time-less-p (date-to-time (format-time-string "%Y-%m-%dT00:00:00"))
                             (date-to-time catchtime))
                (progn
                  (insert (concat "@@html:<span style=\"color: #0174DF\">" origmtime "</span>@@")))
              (progn
                (insert (concat "@@html:<span style=\"color: red\">" origmtime "</span>@@"))))))
        ;; If next lines after DEADLINE: are :PROPERTIES: lines, they shall be
        ;; removed.  Will not be done by org-xxx-export-to-xxx because of
        ;; colorized DEADLINE.  The easiest way is to search and remove
        ;; :PROPERTIES: until :END: in a section globally.
        (goto-char (point-min))
        (while (re-search-forward "^:PROPERTIES:" nil t nil)
          (progn
            (let ((beg (point-at-bol)))
              (if (re-search-forward "^:END:" nil t nil)
                (delete-region beg (point))))))

        (goto-char (point-min))
        (while (re-search-forward "\\(\\)[ .!?$]" nil t nil)
          (progn
            (replace-match (concat "@@html:<span style=\"color: green\">" (match-string 1) "</span>@@"))))
        (goto-char (point-min))
        (while (re-search-forward "\\(\\)[ .!?$]" nil t nil)
          (progn
            (replace-match (concat "@@html:<span style=\"color: red\">" (match-string 1) "</span>@@"))))
        )) ;; END OF with-temp-file tempfile

    (if (file-exists-p tempfile)
        (progn
          (find-file tempfile)
          (org-html-export-to-html)

          (delete-file tempfile)
          (kill-buffer)

          (if (file-exists-p newname)
              (delete-file newname))
          (copy-file (concat (file-name-sans-extension (buffer-file-name)) ".html")
                     newname)
          (message (format "%s" newname))
          
          (if (equal current-prefix-arg '(4)) ; C-u
              (progn
                (let ((htmlfile newname)
                      (browser *browser-path*))
                  (message (concat "Open " browser " " htmlfile))
                  (process-file browser nil 0 nil htmlfile))))
          )))) ;; END OF akl/export-to-html-readtheorg


(defun akl/export-to-html-all ()
  "Export buffer to three kinds of HTML.

Call up:
- akl/export-to-html
- akl/export-to-html-white
- akl/export-to-html-bigblow
- akl/export-to-html-readtheorg"
  (interactive)
  (akl/export-to-html-white)
  (akl/export-to-html-bigblow)
  (akl/export-to-html-readtheorg)
  (akl/export-to-html))


(defun akl/export-region-email-outlook (&optional beg end)
  "Get the region BEG to END for E-Mail.
Either the marked region or the org mode section will be copied
and a new Outlook E-Mail will be openend with its content.
*Note*: Useful at OS Windows, only."
  (interactive)
  (save-excursion
    (let* ((beg (if (region-active-p) (region-beginning)
                  (progn
                    (org-back-to-heading)
                    (point))))
           (end (if (region-active-p) (region-end)
                  (progn
                    (org-end-of-subtree)
                    (point))))
           (tempfile (concat (buffer-file-name) "__temp__"))
           (catchtime "")
           (matchtime "")
           (selection (buffer-substring-no-properties beg end))
           (orig-font-lock-string-face (face-attribute 'font-lock-string-face :foreground))
           (orig-font-lock-keyword-face (face-attribute 'font-lock-keyword-face :foreground))
           (orig-font-lock-function-name-face (face-attribute 'font-lock-function-name-face :foreground))
           (orig-font-lock-doc-face (face-attribute 'font-lock-doc-face :foreground))
           )

      ;; Some faces should be redefined for export to white background.
      (set-face-attribute 'font-lock-string-face nil :foreground "#8BC34A")
      (set-face-attribute 'font-lock-keyword-face nil :foreground "#FF8A65")
      (set-face-attribute 'font-lock-function-name-face nil :foreground "#5D54E1")
      (set-face-attribute 'font-lock-doc-face nil :foreground "#8BC34A")

      (with-temp-file tempfile
       (progn
          (insert selection)

          (goto-char (point-min))
          (while (re-search-forward "\\(^#\\+OPTIONS:.*\\)" nil t nil)
            (progn
              (replace-match "")))
        
          (goto-char (point-min))
          (while (re-search-forward "^#\\+SETUPFILE:.*$" nil t nil)
            (progn
              (replace-match "")))

          (goto-char (point-min))
          (insert *exporter-header-html*)
          
          (goto-char (point-min))
          (while (re-search-forward "\\(✓[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9] \\(?:Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)\\)" nil t nil)
            (progn
              (replace-match (concat "@@html:<span style=\"background-color: #9AFE2E\">" (match-string 1)  "</span>@@"))))

          (goto-char (point-min))
          (while (re-search-forward "❢\\([0-9][0-9]\\)\\.\\([0-9][0-9]\\)\\.\\([0-9][0-9][0-9][0-9]\\) \\(Mo\\|Di\\|Mi\\|Do\\|Fr\\|Sa\\|So\\)" nil t nil)
            (progn
              (setq matchtime (concat "❢" (match-string 1) "." (match-string 2) "." (match-string 3) " " (match-string 4)))
              (setq catchtime (concat "❢" (match-string 3) "-" (match-string 2) "-" (match-string 1) "T00:00:00"))
              (replace-match "")
              (if (time-less-p (date-to-time (format-time-string "%Y-%m-%dT00:00:00"))
                               (date-to-time catchtime))
                  (progn
                    (insert (concat "@@html:<span style=\"background-color: #58ACFA\">" matchtime "</span>@@")))
                (progn
                  (insert (concat "@@html:<span style=\"background-color: #FE2E2E\">" matchtime "</span>@@")))
                )))

          (goto-char (point-min))
          (while (re-search-forward "\\(\\)[ .!?$]" nil t nil)
            (progn
              (replace-match (concat "@@html:<span style=\"background-color: #9AFE2E\">" (match-string 1) "</span>@@"))))
          (goto-char (point-min))
          (while (re-search-forward "\\(\\)[ .!?$]" nil t nil)
            (progn
              (replace-match (concat "@@html:<span style=\"background-color: #FE2E2E\">" (match-string 1) "</span>@@"))))

          ;;- [[*Architecture Specification Validation]]
          (goto-char (point-min))
          (while (re-search-forward "\\[\\[\\*\\(.*?\\)\\]\\[?.*?\\]\\]?" nil t nil)
            (progn
              (replace-match (match-string 1))))

          (goto-char (point-max))
          (insert "\n----")
          )) ; END OF with-temp-file tempfile

      (if (file-exists-p tempfile)
          (progn
            (find-file tempfile)
            (org-html-export-to-html)

            (delete-file tempfile)
            (kill-buffer)

            ;; https://www.howto-outlook.com/howto/commandlineswitches.htm
            ;; https://www.andysblog.de/outlook-per-cli-eine-neue-e-mail-erstellen
            (let* ((htmlfile (concat (file-name-directory tempfile) (file-name-base tempfile) ".html"))
                  (command (concat "/c ipm.note /a \"" htmlfile "\""))
                  (outlook *email-outlook-path*))
              (message (concat "Open \"" outlook "\" " command))
              (shell-command (concat "\"" outlook "\" " command)))
            ))
      (set-face-attribute 'font-lock-string-face nil :foreground orig-font-lock-string-face)
      (set-face-attribute 'font-lock-keyword-face nil :foreground orig-font-lock-keyword-face)
      (set-face-attribute 'font-lock-function-name-face nil :foreground orig-font-lock-function-name-face)
      (set-face-attribute 'font-lock-doc-face nil :foreground orig-font-lock-doc-face)
      )))
;; END OF akl/export-region-email-outlook


(provide 'akl-org-exporter)
;;; akl-org-exporter.el ends here

18.1.7. Content of akl-python.el

;;; package --- akl-python  -*- coding: utf-8 -*-
;;; Commentary:
;; Functions to work with python and eshell.
;;
;;; Code:

(defun akl/run-script-in-eshell ()
  "Switch to *eshell* and change directory to current.
If *eshell* not exist it will be opened.
If a region is selected, the selected string will be used as command."
  (interactive)
  (let (selected)
  (if (get-buffer "*eshell*")
    (progn
      (setq chdir (file-name-directory buffer-file-name))
      (switch-to-buffer "*eshell*")
      (setq currdir (concat (eshell/pwd) "/"))
      (if (not (equal chdir currdir))
        (progn
        (insert (concat "cd " chdir))
        (eshell-send-input nil nil nil))))
    (progn
    (eshell)))))

(defun akl/run-script-in-eshell-region ()
  "Switch to *eshell* and change directory to current.
If *eshell* not exist it will be opened.
If a region is selected, the selected string will be used as command."
  (interactive)
  (let (selected)
  (if (use-region-p)
    (progn
      (setq selected (buffer-substring-no-properties (region-beginning) (region-end))))
    (progn
    (message "No region selected. Type in your commands.")
    (setq selected "")))

  (if (get-buffer "*eshell*")
    (progn
      (setq chdir (file-name-directory buffer-file-name))
      (switch-to-buffer "*eshell*")
      (setq currdir (concat (eshell/pwd) "/"))
      (if (not (equal chdir currdir))
        (progn
        (insert (concat "cd " chdir))
        (eshell-send-input nil nil nil))))
    (progn
    (eshell)))

  (if (not (eq "" selected))
    (progn
      (insert selected)
      (eshell-send-input nil nil nil)))))

18.1.8. Content of akl-hydra-menus.el

;;; package --- akl-hydra-menus  -*- coding: utf-8 -*-
;;; Commentary:
;; Functions to work with hydra menus.
;;
;;; Code:

(defhydra hydra-org-roam-menu (:color pink :hint nil)
"
^Org Roam
^^^^^^------------------------------------------------------------------------------------------------
_l_: roam buffer toggle
_f_: node find      _i_: node insert      _j_: goto dailies today
_s_: find ag        _g_: find phi         _A_: find acronym            _d_: Deft (C-c d)
_t_: add tag        _a_: add alias        _r_: add reference           _p_: add roam id

^Submenus^
^^^^^^^^-------------------------------------------------------------------------------------------------
_d_: dailies (C-c n d)

"
  ("l" org-roam-buffer-toggle :exit t)
  ("f" org-roam-node-find :exit t)
  ("i" org-roam-node-insert :exit t)
  ("j" org-roam-dailies-goto-today :exit t)
  ("s" akl/org-roam-ag-regexp :exit t)
  ("g" akl/org-roam-phi-grep :exit t)
  ("A" akl/org-roam-acronyms :exit t)
  ("t" org-roam-tag-add :exit t)
  ("a" org-roam-alias-add :exit t)
  ("r" org-roam-ref-add :exit t)
  ("p" org-id-get-create :exit t)
  ("d" deft :exit t)

  ("d" hydra-org-roam-dailies-menu/body :exit t)

  ("q" nil "quit" :color blue)
  ("<RET>" nil "quit" :color blue))

(defhydra hydra-org-roam-dailies-menu (:color pink :hint nil)
"
^Org Roam Dailies
^^^^^^------------------------------------------------------------------------------------------------
_._: find-directory
_T_: capture-tomorrow    _Y_: capture-yesterday
_n_: capture-today       _v_: capture-date
_b_: goto-previous       _f_: goto-next-note
_d_: goto-today          _t_: goto-tomorrow        _y_: goto-yesterday
_c_: goto-date

"

  ("." org-roam-dailies-find-directory :exit t)
  ("T" org-roam-dailies-capture-tomorrow :exit t)
  ("Y" org-roam-dailies-capture-yesterday :exit t)
  ("b" org-roam-dailies-goto-previous :exit t)
  ("c" org-roam-dailies-goto-date :exit t)
  ("d" org-roam-dailies-goto-today :exit t)
  ("f" org-roam-dailies-goto-next-note :exit t)
  ("n" org-roam-dailies-capture-today :exit t)
  ("t" org-roam-dailies-goto-tomorrow :exit t)
  ("v" org-roam-dailies-capture-date :exit t)
  ("y" org-roam-dailies-goto-yesterday :exit t)

  ("q" nil "quit" :color blue)
  ("<RET>" nil "quit" :color blue))

(defhydra hydra-org-duedate-menu (:color pink :hint nil)
"
^Duedate
^^^^^^------------------------------------------------------------------------------------------------
_._: Duedate insert (M-s M-d)      _a_: Agreed insert (M-s M-a)      _l_: Duedates (M-s d)
_u_: Duedate update (M-s M-u)      _s_: Duedate to Agreed (M-s M-s)  _o_: Out of date Duedates (M-s M-l)
_R_: Refresh (M-s u)               ^ ^                               _t_: Duedates and TODOs (M-s M-t)
^ ^                                ^ ^                               _T_: Duedates and TODOs in all org files (M-s T)
_f_: Jump to next Duedate (M-s f)          _b_: Jump to previous Duedate (M-s b)
_F_: Jump to next Duedate or TODO (M-s F)  _B_: Jump to previous Duedate or TODO (M-s B)
"

  ("." akl/duedate-date-insert :exit t)
  ("u" akl/subst-duedate-duedate-date-insert :exit t)
  ("a" akl/agreed-date-insert :exit t)
  ("s" akl/subst-duedate-agreed-date-insert :exit t)
  ("l" akl/list-all-duedate-in-current-buffer :exit t)
  ("o" akl/helm-list-all-over-date-currbuf :exit t)
  ("t" akl/helm-list-all-todo-dead-due-currbuf :exit t)
  ("T" akl/list-all-todos-in-org-files :exit t)
  ("R" akl/check-highlight-duedate-date :exit t)
  ("f" akl/jump-to-next-duedate)
  ("b" akl/jump-to-previous-duedate)
  ("F" akl/jump-to-next-duedate-todo)
  ("B" akl/jump-to-previous-duedate-todo)

  ("q" nil "quit" :color blue)
  ("<RET>" nil "quit" :color blue))

(defhydra hydra-org-window-split-menu (:color pink :hint nil)
"
^Windows^                                 
------------------------------------------
_2_ split vertical (C-x 2)               
_3_ split horizontal (C-x 3)             
_4_ toggle vertical horizontal (C-x 4 t) 
_5_ resize vertical (C-M-v)              
_6_ resize horizontal (C-M-h)            
"
  ("2" split-window-vertically :exit t)
  ("3" split-window-horizontally :exit t)
  ("4" akl/toggle-window-split :exit t)
  ("5" cycle-resize-window-vertically)
  ("6" cycle-resize-window-horizontally)

  ("q" nil "quit" :color blue)
  ("<RET>" nil "quit" :color blue))


(defhydra hydra-org-register-menu (:color pink :hint nil)
  "
  ^Register^
^^^^^^^^-------------------------------------------------------------------------------------------------
_h_ helm list (C-c h x) (C-x C-h)
_l_ list (C-x C-l)
_p_ point (C-x C-p)
_j_ jump (C-x C-j)
_r_ copy (C-x C-r)
_i_ insert (C-x C-i)
"
  ("h" helm-register :exit t)
  ("l" register-list :exit t)
  ("p" point-to-register :exit t)
  ("j" jump-to-register :exit t)
  ("r" copy-to-register :exit t)
  ("i" insert-register :exit t)

  ("q" nil "quit" :color blue)
  ("<RET>" nil "quit" :color blue))


(defhydra hydra-org-cp-to-kill-ring-menu (:color pink :hint nil)
  "
^Copy to kill-ring
^^^^^^^^^^^^^^^^^^---------------------------------------------------------------------------------------
_f_ current file (C-F10)
_h_ current header
"
  ("f" akl/copy-current-headline-as-link :exit t)
  ("h" akl/cp-curr-file-as-link :exit t)
  ("q" nil "quit" :color blue)
  ("<RET>" nil "quit" :color blue)
)


(defhydra hydra-org-insert-menu (:color pink :hint nil)
  "
^Insert^                    ^ ^
^^^^^^^^-------------------------------------------------------------------------------------------------
_1_ file name (F5)          _t_ tooltip on region
_2_ file/path name (S-F5)   _c_ color region
_3_ date and time           _l_ intern link 
_4_ date (F6)               _n_ name from list
_5_ date embraced (S-F6) 
_6_ time                 
_7_ protected space \\nbsp{} (C-c _)
"
  ("1" akl/insert-file-name :exit t)
  ("2" akl/insert-file-path-name :exit t)
  ("3" akl/datum-uhrzeit :exit t)
  ("4" akl/datum :exit t)
  ("5" akl/datum-embrace :exit t)
  ("6" akl/uhrzeit :exit t)
  ("7" (insert "\\nbsp{}") :exit t)
  ("t" akl/toggle-tooltip--org-annotate :exit t)
  ("c" akl/toggle-colorize--color-region :exit t)
  ("l" akl/insert-named-intern-link-ref :exit t)
  ("n" akl/choose-n-insert-names :exit t)

  ("q" nil "quit" :color blue)
  ("<RET>" nil "quit" :color blue))


(defhydra hydra-org-exporter-menu (:color pink :hint nil)
  "
^Export^                    ^ ^
^^^^^^^^-------------------------------------------------------------------------------------------------
_p_ PDF (C-c C-x C-p)       _h_ HTML (C-c C-x C-h)
_w_ Word (C-c C-x C-w)      _o_ outlook (C-c C-x C-o)
"
  ("p" akl/export-to-pdf :exit t)
  ("h" akl/export-to-html-all :exit t)
  ("w" akl/export-to-html-word :exit t)
  ("o" akl/export-region-email-outlook :exit t) ;; only for Windows OS

  ("q" nil "quit" :color blue)
  ("<RET>" nil "quit" :color blue))

(defhydra hydra-org-mode-menu (:color pink :hint nil)
  "
^Submenus^
^^^^^^^^-------------------------------------------------------------------------------------------------
_o_ Org-Roam _d_ Duedate  _w_ Windows  _r_ Register  _i_ Insert  _c_ Copy to kill-ring  _e_ Exporter 

^Archive^
^^^^^^^^-------------------------------------------------------------------------------------------------
_A_ Archive subtree, place cursor on headline to archive

^Agenda^
^^^^^^^^-------------------------------------------------------------------------------------------------
_a_ agenda (C-c a)  _t_ agenda todo view (C-c f)

^Jump^                            ^ ^
^^^^^^^^-------------------------------------------------------------------------------------------------
_n_ Next Header (C-c C-n)        _f_ next Duedate (M-s f)
_p_ Previous Header (C-c C-p)    _b_ previous Duedate (M-s b)
_N_ Next link (C-N)              _F_ next Duedate Todo (M-s F)
_P_ Previous link (C-P)          _B_ previous Duedate Todo (M-s B)
_+_ mark jump point (C-c C-+)    _#_ jump to mark point (C-c C-#)
_1_ imenu-list (F9)               
_2_ helm-imenu (C-c C-j)            
_3_ counsel-imenu  
"
  ("A" akl/org-archive-subtree :exit t)
  ("a" org-agenda :exit t)
  ("t" akl/org-agenda-todo-view :exit t)

  ("f" akl/jump-to-next-duedate)
  ("b" akl/jump-to-previous-duedate)
  ("F" akl/jump-to-next-duedate-todo)
  ("B" akl/jump-to-previous-duedate-todo)

  ("n" org-next-visible-heading)
  ("p" org-previous-visible-heading)
  ("N" org-next-link)
  ("P" org-previous-link)
  ("1" imenu-list :exit t)
  ("2" helm-imenu :exit t)  
  ("3" counsel-imenu :exit t)  
  ("+" org-mark-ring-push :exit t)
  ("#" org-mark-ring-goto :exit t)

  ("i" hydra-org-insert-menu/body :exit t)
  ("c" hydra-org-cp-to-kill-ring-menu/body :exit t)
  ("r" hydra-org-register-menu/body :exit t)
  ("w" hydra-org-window-split-menu/body :exit t)
  ("d" hydra-org-duedate-menu/body :exit t)
  ("e" hydra-org-exporter-menu/body :exit t)
  ("o" hydra-org-roam-menu/body :exit t)
  ("q" nil "quit" :color blue)
  ("<RET>" nil "quit" :color blue))


(defhydra hydra-python-mode-menu (:color pink :hint nil)
  "
^Submenus^
^^^^^^^^-------------------------------------------------------------------------------------------------
 _w_ Windows  _r_ Register  _i_ Insert 

^Jump^                            ^ ^
^^^^^^^^-------------------------------------------------------------------------------------------------
_e_ *eshell*, change dir
_E_ *eshell*, change dir and run selected region
_1_ imenu-list (F9)               
_2_ helm-imenu (C-c C-j)            
_+_ mark jump point (C-c C-+)     
_#_ jump to mark point (C-c C-#)
"
  ("e" akl/run-script-in-eshell :exit t)
  ("E" akl/run-script-in-eshell-region :exit t)
  ("1" imenu-list :exit t)
  ("2" helm-imenu :exit t)  
  ("+" org-mark-ring-push :exit t)
  ("#" org-mark-ring-goto :exit t)

  ("i" hydra-org-insert-menu/body :exit t)
  ("r" hydra-org-register-menu/body :exit t)
  ("w" hydra-org-window-split-menu/body :exit t)
  ("q" nil "quit" :color blue)
  ("<RET>" nil "quit" :color blue))



(provide 'init-org-mode)
;;; akl-hydra-menus ends here

18.1.9. Content of akl-org-tree-slide.org

:END:

  1. org-tree-slide
    (use-package org-tree-slide
      :ensure t
      :init
      :config
    )
    
    (use-package hide-mode-line
      :ensure t
      :init
      :config
    )
    
    (defun akl/org-presentation-start ()
      "Start presentation."
      (interactive)
      (org-sticky-header-mode 0) ;; switch of the sticky header in presentation
      (hide-mode-line-mode 1) ;; Hide the mode line
      (org-display-inline-images) ;; Display images inline
                                  ;; Will only work if org-file is fully unfolded.
    
      (org-tree-slide-simple-profile)
      (setq-local org-tree-slide-slide-in-effect t)
      (setq-local org-tree-slide-activate-message "Presentation started!")
      (setq-local org-tree-slide-deactivate-message "Presentation finished!")
      (setq-local org-image-actual-width nil)
      
      (setq text-scale-mode-amount 3) ;; Scale the text.  The next line is for basic scaling:
      (text-scale-mode 1)
      (org-tree-slide-mode 1))
    
    (defun akl/org-presentation-stop ()
      "Stop presentation."
      (interactive)
      (org-sticky-header-mode 1)
      (hide-mode-line-mode 0) ;; Show the mode line again
      (text-scale-mode 0) ;; Turn off text scale mode
      (org-tree-slide-mode 0))
    
  2. Beispiel für org-tree-slide
    :ORGOPTIONS:
    #+TITLE: Präsentation mit org-tree-slide
    #+DESCRIPTION: 
    #+AUTHOR: Andreas Kruse
    #+EMAIL: leak@online.ms
    #+DATE: 19.11.2020
    #+STARTUP: indent showall hidestars hideblocks inlineimages entitiespretty
    #+SETUPFILE: /home/ankr/projects/emacs/init/akl/akl-org-options.org
    :END:
    
    * Was macht das
    
    Mit =org-tree-slide-mode= kann man aus Org-Mode heraus eine Presentation halten.
      
    * Wo
    
    - Das Paket für Emacs ist beschrieben unter
      - https://github.com/takaxp/org-tree-slide
    
        
    - Eine Vorstellung findet man auch auf Youtube
      - https://www.youtube.com/watch?v=vz9aLmxYJB0
    - Die Einstellungen habe ich mir von da abgeschaut
      - https://github.com/daviwil/emacs-from-scratch/blob/master/show-notes/Emacs-Tips-04.org#customization
    
    * Bilder
    
    - Bilder müssen unter Umständen erst mit =M-x org-toggle-inline-images=
      (C-c C-x C-v) für die org-mode Datei aktiviert werden.
    - Die größe des Bildes im Puffer kann mit ~#+ATTR_HTML: :width 123~
      eingestellt werden.
    
    ** Bild
    
    #+ATTR_HTML: :width 600
    [[file:~/Bilder/Lindenberg/Wandern_2009/Manzen_Weiher/IMG_1472.JPG]]
    Das Kornhaus in Weiler am Hausbach
    
    * Liste
    
    1) Dies
       * ist
         1. eine
            + nested
    2) Liste
    
    * TODO Was liegt noch an
    
    - [ ] Das muss noch getan werden.
    - [X] Das ist schon erledigt.
    
    * COMMENT Ausblenden
    
    Dieser Teil wird in der Präsentaation *nicht* angezeigt.
    

18.1.10. Content of akl-colorize.el

;;; package --- akl-colorize  -*- coding: utf-8 -*-
;;; Commentary:
;; Set/unset the foreground color at region.

;;; Code:


(defun akl/colorize--choose-color ()
  "Return a color of a list of colors for colorize region."
  (let ((retclr "blue")
        (some-helm-source nil)
        ;; "helm name" . ("org color" "latex color" "html color")
        (akl-face-colors '(("Red" . ("red" "red" "red"))
                           ("Green" . ("green" "darkgreen" "green"))
                           ("Yellow" . ("yellow" "darkyellow" "#Ffd700"))
                           ("Orange" . ("orange" "orange" "orange"))
                           ("Blue" . ("DodgerBlue" "blue" "blue"))
                           ("Magenta" . ("magenta" "magenta" "magenta"))
                           ("Cyan" . ("cyan" "aqua" "#00bfff"))
                           )))
    (setq some-helm-source
          `((name . "Choose a color.")
            (candidates . ,akl-face-colors)
            (action . (lambda (candidate)
                        (helm-marked-candidates)))))
    (setq retclr (helm :sources '(some-helm-source)))))


(defun akl/toggle-colorize--color-region ()
  "Toggle colorized.

For uncolorize next colorize marker must be the end-marker.  Cursor have to be
in colorized region.  If region is marked, the region beginning is start point.

For colorize region -- well as expected.
The control sequence ist hidden.
Start control sequence:
@@org:aklclr,CLR@@@@latex:\\textcolor{CLR}{@@@@html:<span style=\"color: CLR\">@@
End control sequence:
@@org:aklclrend@@@@latex:}@@@@html:</span>@@"
  (interactive)
  (save-excursion
    (let* ((beg (if (region-active-p)
                    (region-beginning)
                  (point)))
           (end (if (region-active-p)
                    (region-end)
                  (point))))

      (goto-char beg)
      (if (re-search-forward "@@org:aklclr.*?@@@@latex.*?@@@@html.*?@@" nil t nil)
          (progn
            (if (string-match "@@org:aklclrend@@@@latex.*?@@@@html.*?@@" (match-string 0))
                (progn
                  (setq end (+ end (match-end 0)))
                  (akl/uncolorize--color-region beg end))
              (progn
                (akl/colorize--color-region beg end))))
        (progn
          (akl/colorize--color-region beg end))))))


(defun akl/colorize--color-region (beg end)
  "Insert at BEG and END of region the color marker.
If a marker is already in region, the old one will be removed.

If region is in already colorized region, the old colorized
region will be de-colorized."
  (if (region-active-p)
      (progn
        (let* ((len (- end beg))
               (begend 0)
               (begtext 0)
               (fclr (akl/colorize--choose-color)))

          (akl/uncolorize--color-region beg end)
          (goto-char beg)
          (if (and (eq beg (point-at-bol))
                   (string-match "\\(- \\|\\+ \\|[0-9]+?. \\)" (buffer-substring-no-properties beg end)))
              (progn
                (setq beg (+ beg (match-end 1)))
                (setq len (- len (match-end 1)))))
          (goto-char beg)
          (insert (format "@@org:aklclr,%s@@@@latex:\\textcolor{%s}{@@@@html:<span style=\"color: %s\">@@" (nth 0 (car fclr)) (nth 1 (car fclr)) (nth 2 (car fclr))))
          (setq begtext (point))
          (goto-char (+ (point) len))
          (setq begend (point))
          (insert (format "%s" "@@org:aklclrend@@@@latex:}@@@@html:</span>@@"))
          
          (overlay-put (make-overlay beg (point)) 'face `(foreground-color . ,(nth 0 (car fclr))))
          (overlay-put (make-overlay beg begtext) 'invisible t)
          (overlay-put (make-overlay begend (point)) 'invisible t)))))


(defun akl/uncolorize--color-region (beg end)
  "Remove the colorized at region of BEG till END."

  (goto-char beg)
  (if (re-search-forward "@@org:aklclr.*?@@@@latex.*?@@@@html.*?@@" nil t nil)
      (progn
        (if (string-match "@@org:aklclrend@@@@latex.*?@@@@html.*?@@" (match-string 0))
            (progn
              (if (re-search-backward "@@org:aklclr,.*?@@@@latex.*?@@@@html.*?@@" nil t nil)
                  (progn
                    (setq beg (match-beginning 0))
                    (delete-region beg (match-end 0))))
              (if (re-search-forward "@@org:aklclrend@@@@latex.*?@@@@html.*?@@" nil t nil)
                  (progn
                    (setq end (match-beginning 0)) ;; the new end after deletion
                    (delete-region end (match-end 0))))))

        (remove-overlays beg end)
        (akl/colorize--overlay-color))))


(defun akl/remove-overlays-region ()
  "Remove the overlays in region."
  (interactive)
  (if (region-active-p)
      (progn
        (let* ((beg (region-beginning))
               (end (region-end)))
          (remove-overlays beg end)))))

(defun akl/colorize--overlay-color ()
  "Set the colorized overlays in buffer."
  (save-excursion
    (let ((beg 0)
          (begtext 0)
          (endtext 0)
          (end 0)
          (clr ""))
      (goto-char (point-min))
      (while (re-search-forward "\\(@@org:aklclr,\\)\\(.*?\\)@@@@latex.*?@@@@html.*?@@" nil t nil)
        (progn
          (if (not (string-match "^: " (buffer-substring-no-properties (point-at-bol) (point-at-eol))))
              (progn
                (setq beg (match-beginning 1))
                (setq clr (match-string 2))
                (setq begtext (point))
                (if (re-search-forward "\\(@@org:aklclrend@@@@latex.*?@@@@html.*?@@\\)" nil t nil)
                    (progn
                      (setq end (point))
                      (setq endtext (match-beginning 1))
                      (overlay-put (make-overlay beg end) 'face `(foreground-color . ,clr))
                      (overlay-put (make-overlay beg begtext) 'invisible t)
                      (overlay-put (make-overlay endtext end) 'invisible t))))))))))



(provide 'akl-colorize)
;;; akl-colorize ends here

18.1.11. Content of akl-org-annotate.el

;;; package --- akl-org-annotate  -*- coding: utf-8 -*-
;;; Commentary:
;; Set an annotation in background.

;;; Code:


(defun akl/toggle-tooltip--org-annotate ()
  "Toggle the tooltip.

If new, the tooltip will be created.
If modifiy, the tooltip will be inserted as default.
If tooltip text is empty, the tooltip will be removed or not created.

@@org:aklann1@@@@latex:\\margin{@@@@html:<abbr title=\"@@
NOTE
@@org:aklann2@@@@latex:}\\textcolor{darkblue}{\\uline{@@@@html:\">@@
MARK
@@org:aklannend@@@@latex:}}@@@@html:</abbr>@@"
  (interactive)
  (save-excursion
    (let* ((beg (if (region-active-p)
                    (region-beginning)
                  (point)))
           (end (if (region-active-p)
                    (region-end)
                  (point)))
           (part1 "@@org:aklann1@@@@latex:\\margin{@@@@html:<abbr title=\"@@")
           (part2 "@@org:aklann2@@@@latex:}\\textcolor{darkblue}{\\uline{@@@@html:\">@@")
           (part3 "@@org:aklannend@@@@latex:}}@@@@html:</abbr>@@")
           (text "")
           (tip "")
           (new nil))

      (deactivate-mark)
      ;; Cursor in tooltip region?
      (if (re-search-forward "@@org:aklann.*?@@@@.*?@@@@.*?@@" nil t nil)
          (progn
            (if (string= (match-string 0) part3)
                (progn
                  ;; now we are at the end of the tooltip pattern
                  (if (re-search-backward "@@org:aklann1@@@@.*?@@@@.*?@@\\(.*?\\)@@org:aklann2@@@@.*?@@@@.*?@@\\(.*?\\)@@org:aklannend@@@@.*?@@@@.*?@@" nil t nil)
                      (progn
                        (setq beg (match-beginning 0))
                        (setq end (match-end 0))
                        (setq text (match-string 2))
                        (setq tip (read-string (format "Tooltip %s: " text) (match-string 1) nil nil))
                        (delete-region beg end)
                        (if (not (string= "" tip))
                            (progn
                              (insert (concat part1 tip part2 text part3))
                              (akl/org-annotate--overlay-color))
                          (progn
                            (insert text))))))
              (progn
                ;; not in tooltip region, so create a new one
                (setq new t))))
        (progn
          (setq new t)))

      (if (not (equal nil new))
          (progn
            (akl/org-annotate--annotation beg end)))
      )))


(defun akl/org-annotate--annotation (beg end)
  "Insert an annoation in region of BEG to END.

Add annotation to marked region.  If no region active a icon will
be set instead.

@@org:aklann1@@@@latex:\\margin{@@@@html:<abbr title=\"@@
NOTE
@@org:aklann2@@@@latex:}\\textcolor{darkblue}{\\uline{@@@@html:\">@@
MARK
@@org:aklannend@@@@latex:}}@@@@html:</abbr>@@"
  (let* ((len (- end beg))
         (ann (read-string "Tooltip: " "" nil nil))
         (begtxt 0)
         (endtxt 0))

    (if (not (string= "" ann))
        (progn
          (if (and (eq beg (point-at-bol))
                   (string-match "\\(- \\|\\+ \\|[0-9]+. \\)" (buffer-substring-no-properties beg end)))
              (progn
                (setq beg (+ beg (match-end 1)))
                (setq len (- len (match-end 1)))))

          (goto-char beg)
          (insert "@@org:aklann1@@@@latex:\\margin{@@@@html:<abbr title=\"@@")
          (insert ann)
          (insert "@@org:aklann2@@@@latex:}")
          
          (if (< 0 len)
              (progn
                (insert "\\textcolor{darkblue}{\\uline{@@@@html:\">@@")
                (setq begtxt (point))
                (goto-char (+ (point) len))
                (setq endtxt (point))
                (insert "@@org:aklannend@@@@latex:}}@@@@html:</abbr>@@"))
            (progn
              (insert "@@@@html:\">@@")
              (setq begtxt (point))
              (insert "🔖")
              (setq endtxt (point))
              (insert "@@org:aklannend@@@@latex:@@@@html:</abbr>@@")))

          (if (< 0 len)
              (progn
                (overlay-put (make-overlay begtxt endtxt) 'face `(foreground-color . "#6495ed"))
                (overlay-put (make-overlay begtxt endtxt) 'face `(underline))))
          (overlay-put (make-overlay beg (point)) 'help-echo ann)
          (overlay-put (make-overlay beg begtxt) 'invisible t)
          (overlay-put (make-overlay endtxt (point)) 'invisible t)))))


(defun akl/org-annotate--overlay-color ()
  "Set the annotate overlays in buffer.

@@org:aklann1@@@@latex:\\margin{@@@@html:<abbr title=\"@@
NOTE
@@org:aklann2@@@@latex:}\\textcolor{darkblue}{\\uline{@@@@html:\">@@
MARK
@@org:aklannend@@@@latex:}}@@@@html:</abbr>@@"
  (save-excursion
    (let* ((beg 0)
           (end 0)
           (begann 0)
           (endann 0)
           (begtxt 0)
           (endtxt 0))
      (goto-char (point-min))
      (while (re-search-forward "@@org:aklann1@@@@.*?@@@@.*?@@\\(.*?\\)@@org:aklann2@@@@.*?@@@@.*?@@\\(.*?\\)@@org:aklannend@@@@.*?@@@@.*?@@" nil t nil)
        (progn
          (setq beg (match-beginning 0))
          (setq end (match-end 0))
          (setq begann (match-beginning 1))
          (setq endann (match-end 1))
          (setq begtxt (match-beginning 2))
          (setq endtxt (match-end 2))
          (if (= begtxt endtxt)
              (progn
                (remove-overlays beg end))
            (progn
              (if (not (string-match "🔖" (buffer-substring-no-properties begtxt endtxt)))
                  (progn
                    (overlay-put (make-overlay begtxt endtxt) 'face `(foreground-color . "#6495ed"))
                    (overlay-put (make-overlay begtxt endtxt) 'face `(underline))
                    ))
              (overlay-put (make-overlay beg end) 'help-echo (buffer-substring-no-properties begann endann))
              (overlay-put (make-overlay beg begtxt) 'invisible t)
              (overlay-put (make-overlay endtxt end) 'invisible t))))))))




(provide 'akl-org-annotate)
;;; akl-org-annotate ends here

18.1.12. Content of akl-namen.org

Der Inhalt der Datei akl-namen.org kann bsw. so aussehen. Dabei sind die einzelnen Spalten

text tags pattern color for org-mode color pdf latex exporter color html exporter
  • Zeilen, die mit # beginnen, werden als Kommentar ignoriert.
  • Der Inhalt der Spalte pattern, der eingefangen wird, kann mit \1 an die color Spalten übergeben werden.
  • In der color Spalte für LaTeX muss vor den Steuerbefehlen ein Schutz-Backslash gesetzt werden.
Otto Hahn Kernchemie Göttingen Otto[ \t\r\n\v\f]+Hahn akl-names-face \\textcolor{orange}{\1} <span style="color: orange;" >\1</span>
Göttingen Ort Göttingen akl-names-face \\textcolor{orange}{\1} <span style="color: orange;" >\1</span>

18.2. Dateien packen, archivieren, exportieren

18.2.1. Zippen

Die Projekt Dateien packen.

Das Emacs-Lisp Skript erstelle ich mit einem Python Skript, welches dann ausgeführt werden kann. Ein anderer Weg wäre es gewesen, die Liste der Dateien, die gezippt werden sollen, als Listenvariable auszugeben. Diese Variable kann dann von einer anderen Funktion genutzt werden.

 1: #+HEADER: :var initpath="/home/ankr/projects/emacs/init/" :var subdirs=(list "akl" "images")
 2: import glob
 3: import re
 4: 
 5: def filepattern(ff):
 6:     if((re.search(r'org$', ff) is not None or
 7:         re.search(r'tex$', ff) is not None or
 8:         re.search(r'el$', ff) is not None or
 9:         re.search(r'html$', ff) is not None or
10:         re.search(r'jpg$', ff) is not None or
11:         re.search(r'png$', ff) is not None or
12:         re.search(r'pgf$', ff) is not None or
13:         re.search(r'pdf$', ff) is not None
14:         ) and (
15:             re.search(r'init.tex$', ff) is None
16:         )):
17:         return ff
18:     return None
19: 
20: # find all relevant files we want to zip
21: zfiles = []
22: for ff in glob.glob(initpath + r'*'):
23:     if filepattern(ff) is not None:
24:         zfiles.append(ff)
25: 
26: for sdir in subdirs:
27:     for ff in glob.glob(initpath + "/" + sdir + "/" + r'*'):
28:         if filepattern(ff) is not None:
29:             zfiles.append(ff)
30: 
31: for i, zf in enumerate(zfiles):
32:     zfiles[i] = re.sub(initpath, r'./', zf)
33:     # print(zfiles[i])
34: 
35: print(f"#+ATTR_LATEX: :options style=akl-elisp")
36: print(f"#+begin_src emacs-lisp")
37: print(f";; '{initpath}'")
38: print('(defun akl/zip-emacs-init-project ()')
39: print('  "Zip the project files."')
40: print('  (interactive)')
41: print('(setq zfiles (string-join (list ".gitignore"')
42: for x in zfiles:
43:     print(f'                                "{x}"')
44: print('                          )')
45: print('                          " "))')
46: print('  (setq zip-command (concat "cd " *project-emacs-init-path* " && "')
47: print('                            "rm -f " *export-publish-destination-path* "akl-emacs-init.zip && "')
48: print('                            "zip -9 " *export-publish-destination-path* "akl-emacs-init.zip "')
49: print('                            zfiles))')
50: print('  (start-process-shell-command "zip-emacs-init-project" nil zip-command))')
51: print('')
52: print(';; (akl/zip-emacs-init-project)')
53: print(f"#+end_src")
;; '/home/ankr/projects/emacs/init/'
(defun akl/zip-emacs-init-project ()
  "Zip the project files."
  (interactive)
(setq zfiles (string-join (list ".gitignore"
                                "./init-readtheorg.html"
                                "./custom.el"
                                "./init-bigblow.html"
                                "./init-private.el"
                                "./init.html"
                                "./init.el"
                                "./init.pdf"
                                "./init-white.html"
                                "./init.org"
                                ".//akl/akl-colorize.el"
                                ".//akl/akl-org-annotate.el"
                                ".//akl/akl-latex-colors.tex"
                                ".//akl/akl-namen.org"
                                ".//akl/akl-org-tree-slide.el"
                                ".//akl/akl-report-header.tex"
                                ".//akl/akl-hydra-menus.el"
                                ".//akl/akl-org-tree-slide.org"
                                ".//akl/akl-main-defs.el"
                                ".//akl/akl-namen.el"
                                ".//akl/akl-org-exporter.el"
                                ".//akl/akl-org-options.org"
                                ".//akl/akl-main.el"
                                ".//akl/akl-faces.el"
                                ".//akl/akl-python.el"
                                ".//akl/akl-duedate.el"
                                ".//images/gnu_logo.png"
                                ".//images/xkcd-python-comic.png"
                                ".//images/tikz-beispiel.pdf"
                                ".//images/logos-banner.png"
                                ".//images/org-mode-unicorn-logo.png"
                                ".//images/emacs_gnu_logo.jpg"
                                ".//images/utf8-latex-fonts.png"
                                ".//images/tikz-beispiel.png"
                                ".//images/ziege.jpg"
                                ".//images/tikz-beispiel.pgf"
                                ".//images/emacs_gnu_logo.png"
                          )
                          " "))
  (setq zip-command (concat "cd " *project-emacs-init-path* " && "
                            "rm -f " *export-publish-destination-path* "akl-emacs-init.zip && "
                            "zip -9 " *export-publish-destination-path* "akl-emacs-init.zip "
                            zfiles))
  (start-process-shell-command "zip-emacs-init-project" nil zip-command))

;; (akl/zip-emacs-init-project)

18.2.2. Git Archive

Da das Projekt mit Git versioniert wird, geht das auch mit dem letzten, eingecheckten Zustand.

(defun akl/git-archive-emacs-init-project ()
  "Git Archive the project file."
  (interactive)
  (setq git-archive-command
        (concat "git archive --format zip "
                "--output " *export-publish-destination-path* " git-archive-emacs-init.zip "
                "master "))
  (start-process-shell-command "git-archive-emacs-init-project"
                               nil git-archive-command))

;; (akl/git-archive-emacs-init-project)

18.2.3. Export der Dokumente

Dieses Skript exportiert den Buffer nach HTML und PDF und kopiert die exportierten Dateien in einen anderen Ordner.

(defun akl/export-all--cp-to-destination ()
  "Export the org buffer to all HTML and PDF formats.
Zip the project files.
Copy the exported files and the zipped file to destination."
  (interactive)
  (save-buffer)
  (let* ((sourcebasename (file-name-sans-extension (buffer-file-name)))
         (targetbasename (concat *export-publish-destination-path*
                                 (file-name-nondirectory (file-name-sans-extension (buffer-file-name))))))
         (progn
           (akl/export-to-html-white)
           (akl/export-to-html-bigblow)
           (akl/export-to-html-readtheorg)
           (akl/export-to-html)
           (akl/export-to-pdf)
           (akl/zip-emacs-init-project)

           (copy-file (concat sourcebasename "-white.html")
                      (concat targetbasename "-white.html") t)

           (copy-file (concat sourcebasename "-readtheorg.html")
                      (concat targetbasename "-readtheorg.html") t)

           (copy-file (concat sourcebasename "-bigblow.html")
                      (concat targetbasename "-bigblow.html") t)

           (copy-file (concat sourcebasename ".html")
                      (concat targetbasename ".html") t)

           (copy-file (concat sourcebasename ".pdf")
                      (concat targetbasename ".pdf") t)
           )))

;; (akl/export-all--cp-to-destination)

18.3. Kopieren ohne Zeilenumbruch und Leerzeichen

Das Kopieren eines Textes ohne Zeilenumbrüche. Die Substrings werden ebenfalls getrimmt, d.h. dass die Leerzeichen am Anfang und am Ende jeder Zeile ebenfalls entfernt werden. Dies kann nützlich sein, wenn man Text in eine Applikation wie Excel, Outlook u.ä. kopieren muss.

Beispiel:

Aus diesen
  Text, der viele
Zeilenumbrüche   und    unnötige    Leerzeichen     enthält,
                 wird dann ein    einzeiliger
Text.

Aus diesen Text, der viele Zeilenumbrüche und unnötige Leerzeichen enthält, wird dann ein einzeiliger Text.

(defun akl/copy-clean-wo-space ()
  "Copy the text but replace newline by space.
Also the substrings will be trimmed."
  (interactive)
  (save-restriction
    (let ((cptext (split-string
                   (substring-no-properties
                    (filter-buffer-substring (mark) (point)))
                   "[ \f\t\r\v\n]"
                   t)))
      (kill-new "" nil)
      (kill-append (mapconcat #'(lambda (x) (format "%s" x)) cptext " ") nil))))

(global-set-key (kbd "M-W") 'akl/copy-clean-wo-space)

18.4. Fringe Farbe in narrow Mode ändern

(defun akl/narrowed-fringe-status ()
  "Make the fringe background reflect the buffer's narrowing status."
  (if (buffer-narrowed-p)
      (set-face-attribute 'fringe nil :background "cyan")
    (set-face-attribute 'fringe nil :background "#263238")))

(add-hook 'post-command-hook 'akl/narrowed-fringe-status)

18.5. Dateistatus in Modeline

Damit wird dem Dateistatus ein wenig Farbe hinterlegt.

I use this code. It colors the buffer-modified indicator on the left orange if it's read-only and red if it's modified. When you narrow a buffer it colors the line number indicator yellow. Obviously you might want to change the format yourself.

(defface akl-narrow-face
  '((t (:foreground "black" :background "yellow3")))
  "todo/fixme highlighting."
  :group 'faces)

(defface akl-read-only-face
  '((t (:foreground "black" :background "orange3")))
  "Read-only buffer highlighting."
  :group 'faces)

(defface akl-modified-face
  '((t (:foreground "gray80" :background "red4")))
  "Modified buffer highlighting."
  :group 'faces)

(setq-default
 mode-line-format
 '("  "
   (:eval (let ((str (if buffer-read-only
                         (if (buffer-modified-p) "%%*" "%%%%")
                       (if (buffer-modified-p) "**" "--"))))
            (if buffer-read-only
                (propertize str 'face 'akl-read-only-face)
              (if (buffer-modified-p)
                  (propertize str 'face 'akl-modified-face)
                str))))
   (list 'line-number-mode "  ")
   (:eval (when line-number-mode
            (let ((str "L%l"))
              (if (/= (buffer-size) (- (point-max) (point-min)))
                  (propertize str 'face 'akl-narrow-face)
                str))))
   "  %p"
   (list 'column-number-mode "  C%c")
   "  " mode-line-buffer-identification
   "  " mode-line-modes))

18.6. Collapse everything except current tab

(defun akl/org-show-current-heading-tidily ()
  (interactive)
  "Show next entry, keeping other entries closed."
  (if (save-excursion (end-of-line) (outline-invisible-p))
      (progn (org-show-entry) (show-children))
    (outline-back-to-heading)
    (unless (and (bolp) (org-on-heading-p))
      (org-up-heading-safe)
      (hide-subtree)
      (error "Boundary reached"))
    (org-overview)
    (org-reveal t)
    (org-show-entry)
    (show-children)))

18.7. Keystrokes

Keystrokes die auf Funktionen in den Dateien oben zugreifen.

(define-key org-mode-map    (kbd "C-c C-x C-t") 'akl/toggle-tooltip--org-annotate)
(define-key org-mode-map    (kbd "C-c C-x C-c") 'akl/toggle-colorize--color-region)
(define-key org-mode-map    (kbd "C-c C-x C-l") 'akl/insert-named-intern-link-ref)
(define-key org-mode-map    (kbd "C-c C-x C-n") 'akl/choose-n-insert-names)
(define-key org-mode-map    (kbd "C-c C-x C-p") 'akl/export-to-pdf)
(define-key org-mode-map    (kbd "C-c C-x C-h") 'akl/export-to-html-all)
(define-key org-mode-map    (kbd "C-c C-x C-w") 'akl/export-to-html-word)
(define-key org-mode-map    (kbd "C-c C-x C-o") 'akl/export-region-email-outlook) ;; only for Windows OS
(define-key org-mode-map    (kbd "C-c C-x l")   'akl/list-all-links-to-open)
(global-set-key             (kbd "C-c f")       'akl/org-agenda-todo-view)
(global-set-key             (kbd "<f5>")        'akl/insert-file-name)
(global-set-key             (kbd "<S-f5>")      'akl/insert-file-path-name)
(global-set-key             (kbd "<f6>")        'akl/datum)
(global-set-key             (kbd "<S-f6>")      'akl/datum-embrace)
(global-set-key             (kbd "M-p")         'akl/insert-new-line-above)
(global-set-key             (kbd "M-n")         'akl/insert-new-line-below)
(define-key global-map      (kbd "<C-f10>")     'akl/cp-curr-file-as-link)
(define-key org-mode-map    (kbd "<f7>")        'hydra-org-mode-menu/body)
(define-key python-mode-map (kbd "<f7>")        'hydra-python-mode-menu/body)
(define-key org-mode-map    (kbd "<C-tab>")     'akl/org-show-current-heading-tidily)

;; Does not work in Org-Mode buffers.  Org-Mode overwrites the keystrokes.
(global-set-key             (kbd "<M-up>")      'akl/move-text-up)
(global-set-key             (kbd "<M-down>")    'akl/move-text-down)

;; Keystrokes for duedate
(global-set-key             (kbd "M-s M-d")     'akl/duedate-date-insert)
(global-set-key             (kbd "M-s M-a")     'akl/agreed-date-insert)
(global-set-key             (kbd "M-s M-s")     'akl/subst-duedate-agreed-date-insert)
(global-set-key             (kbd "M-s M-u")     'akl/subst-duedate-duedate-date-insert)
(global-set-key             (kbd "M-s d")       'akl/list-all-duedate-in-current-buffer)
(global-set-key             (kbd "M-s l")       'akl/list-all-out-duedate-in-current-buffer)
(global-set-key             (kbd "M-s M-l")     'akl/helm-list-all-over-date-currbuf)
(global-set-key             (kbd "M-s t")       'akl/list-all-todos-in-current-buffer)
(global-set-key             (kbd "M-s M-t")     'akl/helm-list-all-todo-dead-due-currbuf)
(global-set-key             (kbd "M-s T")       'akl/list-all-todos-in-org-files)
(global-set-key             (kbd "M-s p")       'akl/list-all-todos-in-current-project)
(global-set-key             (kbd "M-s u")       'akl/check-highlight-duedate-date)
(global-set-key             (kbd "M-s f")       'akl/jump-to-next-duedate)
(global-set-key             (kbd "M-s b")       'akl/jump-to-previous-duedate)
(global-set-key             (kbd "M-s F")       'akl/jump-to-next-duedate)
(global-set-key             (kbd "M-s B")       'akl/jump-to-previous-duedate)

18.8. Hooks

(defun akl/set-org-hooks ()
  "Set org mode hooks."
  ;; Lists cycling like headings
  (setq integrate t)
  (setq org-cycle-include-plain-lists 'integrate)
  (add-hook 'org-mode-hook 'akl/colorize--overlay-color)
  (add-hook 'org-mode-hook 'akl/org-annotate--overlay-color)
  (add-hook 'org-mode-hook 'akl/font-lock-duedate)
  (add-hook 'org-mode-hook 'akl/check-highlight-duedate-date)
  )

(defun akl/set-after-save-hooks ()
  "Set after safe hooks."
  (add-hook 'after-save-hook 'akl/colorize--overlay-color)
  (add-hook 'after-save-hook 'akl/org-annotate--overlay-color)
  (add-hook 'after-save-hook 'akl/font-lock-duedate)
  (add-hook 'after-save-hook 'akl/check-highlight-duedate-date)
  )

(akl/set-org-hooks)
(akl/set-after-save-hooks)

19. Byte Compile

Die .el Dateien Kompilieren, wenn sie sich denn geändert haben sollten.

(byte-recompile-directory "/home/ankr/projects/emacs/init/" 0 nil)

20. Runtime Performance

Dial the GC threshold back down so that garbage collection happens more frequently but in less time.

;; Make gc pauses faster by decreasing the threshold.
(setq gc-cons-threshold (* 2 1000 1000))

21. Macros

Hier ein paar Macros, die beim Erstellen einer Org-Mode Datei hilfreich sind.

Dein großer Vorteil der Macros ist, dass sie je nach Export Backend sichtbar sind, oder auch nicht.

#+MACRO: color @@html:<span style="color: $1">$2</span>@@@@latex:\textcolor{$1}{$2}@@
#+MACRO: mark @@html:<span style="color: black; background-color: #99ccff">$1</span>@@@@latex:\colorbox{lime}{$1}@@
#+MACRO: skipnoindent @@html:<br><br>@@@@latex:\par\medskip\noindent @@
#+MACRO: newpage @@html:@@@@latex:\newpage @@
#+MACRO: landscape @@html:@@@@latex:\setpagelandscape @@
#+MACRO: portrait @@html:@@@@latex:\setpageportrait @@

{{{modification-time(%d.%m.%Y %a %H:%M)}}}

{{{color(darkblue,Vorsicht\, da bei den Macros die Parameter kommagetrennt
übergeben werden\, müssen Kommas im Text mit einen Backslash geschützt
werden.)}}}
{{{skipnoindent}}}
{{{mark(Vorsicht\, da bei den Macros die Parameter kommagetrennt)}}} \\
{{{mark(übergeben werden\, müssen Kommas im Text mit einen Backslash geschützt)}}} \\
{{{mark(werden.  Bei diesem Macro wird in LaTeX nicht automatisch umgebrochen.)}}}

{{{newpage}}}
{{{landscape}}}
{{{portrait}}}

25.09.2023 Mo 20:00

Vorsicht, da bei den Macros die Parameter kommagetrennt übergeben werden, müssen Kommas im Text mit einen Backslash geschützt werden.

Vorsicht, da bei den Macros die Parameter kommagetrennt
übergeben werden, müssen Kommas im Text mit einen Backslash geschützt
werden. Bei diesem Macro wird in LaTeX nicht automatisch umgebrochen.

22. Lokale Variabeln

Lokale Variabeln werden als Kommentar unten in einer Datei geschrieben.

  • coding wurde auf utf-8 gesetzt.
  • org-confirm-babel-evaluate wurde auf t gesetzt, was auch der voreingestellte Wert ist. Wenn er auf nil gesetzt wird, werden die Source Blöcke beim Speichern automatisch, und ohne nachzufragen, durchgeführt.
    🐄 Habe ich rausgenommen, damit beim Starten nicht nach der Rechtmäßigkeit der Einstellung gefragt wird, nachdem die Datei mal geändert wurde.
  • eval den Code
    (add-hook 'after-save-hook (lambda () (org-html-export-to-html)) nil t)
    damit die Datei beim Speichern direkt nach HTML exportiert wird.
    🐄 Habe ich rausgenommen, damit beim Starten nicht nach der Rechtmäßigkeit der Einstellung gefragt wird, nachdem die Datei mal geändert wurde.

Um zu verhindern, dass die Lokalen Variabeln, die ja ganz am Ende einer Datei stehen, bei Org-Mode Dateien versehentlich mit dem letzten Kapitel verschoben oder gar gelöscht werden, ist es sinvoll, dafür ein eigenes - unsichtbares - Kapitel zu erstellen. Damit es nicht exportiert, bekommt die Kapitelüberschrift den Tag :noexport:, und damit es geschlossen bleibt, den Tag :ARCHIVE:. Solche :ARCHIVE: Kapitel lassen sich nur mit C-c C-Tab öffnen.

* Lokale Variablen    :ARCHIVE:noexport:

23. Meine interaktiven Funktionen

Um eine Liste aller interaktiven emacs-lisp Funktionen von mir zu bekommen, rufe ich einfach das Kommando

(apropos-command "^akl")

auf. Hinter dem Funktionsnamen steht dann entweder der vergebene Keystroke, oder aber M-x ... RET, was schlicht bedeutet, dass die Funktion keinen Keystroke hat. Es wird nur die erste Zeile des Kommentars ausgegeben. Um sich die gesamten Informationen dazu anzusehen, kann man dann einfach C-h f <Funktionsname> aufrufen.

23.1. akl/agreed-date-insert M-s M-a

Insert AGREED in current buffer.

23.2. akl/babel-confirm M-x … RET

Wenn ein Source Code Block evaluiert werden soll, muss das bestätigt werden (default). Das Ein- und Ausschalten von org-confirm-babel-evaluate kann über die Funktion erledigt werden. Mit M-x babel-confirm wird der Status zurückgegeben. Mit C-u M-x babel-confirm die Einstellung getoggelt.

23.3. akl/check-highlight-duedate-date M-s u

Find duedate in current buffer.

Check for over due in comparision to today, and mark if overdue is true. Fill list *list-of-over-dead-n-due*.

23.4. akl/choose-n-insert-names C-c C-x C-n

Choose one or more names to insert.

Mark and unmark with C-SPC.

23.5. akl/copy-clean-wo-space M-W

Copy the text but replace newline by space.

Also the substrings will be trimmed.

23.6. akl/copy-current-headline-as-link M-x … RET

Copy current Org-Mode headline as link in kill-ring.

Cursor has to be in headline line.

23.7. akl/cp-curr-file-as-link <C-f10>

Save and copie current file as link in killring.

23.8. akl/duedate-date-insert M-s M-d

Insert DUEDATE in current buffer.

23.9. akl/elpy-goto-definition M-x … RET

(not documented)

23.10. akl/export-all–cp-to-destination M-x … RET

Export the org buffer to all HTML and PDF formats.

Zip the project files. Copy the exported files and the zipped file to destination.

23.11. akl/export-region-email-outlook C-c C-x C-o

Get the region BEG to END for E-Mail.

Either the marked region or the org mode section will be copied and a new Outlook E-Mail will be openend with its content. Note: Useful at OS Windows, only.

23.12. akl/export-region-html-white M-x … RET

Get the region BEG to END for E-Mail.

Either the marked region or the Org mode section will be used to create a HTML file with its content. To get the whole buffer type C-x h.

  • To open the HTML file in browser type C-u first.
  • To open Kmail and attach the HTML file type C-u C-u first.

23.13. akl/export-to-html M-x … RET

Convert the current Org mode buffer to html.

  • To open the HTML file in browser type C-u first.
  • To open the HTML file in word type C-u C-u first.

23.14. akl/export-to-html-all C-c C-x C-h

Export buffer to three kinds of HTML.

Call up:

  • akl/export-to-html
  • akl/export-to-html-white
  • akl/export-to-html-bigblow
  • akl/export-to-html-readtheorg

23.15. akl/export-to-html-bigblow M-x … RET

Convert the current Org mode buffer to html.

The file name will be extended with -bigblow.

  • To open the HTML file in browser type C-u first.

23.16. akl/export-to-html-readtheorg M-x … RET

Convert the current Org mode buffer to html.

The file name will be extended with -readtheorg.

  • To open the HTML file in browser type C-u first.

23.17. akl/export-to-html-white M-x … RET

Convert the current Org mode buffer to html.

The line #+SETUPFILE will be ignored. My setup file for Org-Mode contains some CSS stuff, which - in some circumstances - is not desired.

The file name will be extended with -white.

  • To open the HTML file in browser type C-u first.
  • To open the HTML file in word type C-u C-u first.

To export the buffer as it is use akl/export-to-html.

23.18. akl/export-to-html-white-word M-x … RET

Convert current Org Mode buffer to html and open it in word.

23.19. akl/export-to-html-word C-c C-x C-w

Convert current Org Mode buffer to html and open it in word.

23.20. akl/export-to-pdf C-c C-x C-p

Export to \LaTeX - PDF, but replace some strings before.

Tow or more blank lines will be replaces by:

\par\medskip\noindent

To open the PDF file type C-u first.

23.21. akl/formatted-copy M-x … RET

Export region to HTML, and copy it to the clipboard.

23.22. akl/git-archive-emacs-init-project M-x … RET

Git Archive the project file.

23.23. akl/helm-list-all-over-date-currbuf M-s M-l

List all TODOs, DEADLINEs and DUEDATEs in current buffer.

23.24. akl/helm-list-all-todo-dead-due-currbuf M-s M-t

List all TODOs, DEADLINEs and DUEDATEs in current buffer.

23.25. akl/insert-face-color M-x … RET

Choose a color.

23.26. akl/insert-file-name <f5>

Insert filename of the current buffer at cursor point.

23.27. akl/insert-file-path-name <S-f5>

Insert filename and its path of the current buffer at cursor point.

23.28. akl/insert-named-intern-link-ref C-c C-x C-l

Insert a link to headline or label.

If label than the link is:

[[sec:linkname]] [[sec:linkname][description]] 
                 @@latex: on page~\pageref{sec:linkname}@@

If headline (default) than the link is:

[[*headline][headline]]

If cursor is on a headline a new label will be inserted below the headline.

23.29. akl/insert-new-line-above M-p

Insert a new line above the current and set Cursor to the new line. It does not matter whether the curser is not at the end of the old line.

23.30. akl/insert-new-line-below M-n

Insert a new line below the current and set Cursor to the new line. It does not matter whether the curser is not at the end of the old line.

23.31. akl/jump-to-next-duedate M-s f, M-s F

Jump to the next DUEDATE entry.

23.32. akl/jump-to-next-duedate-todo M-x … RET

Jump to the next DUEDATE entry.

23.33. akl/jump-to-previous-duedate M-s b, M-s B

Jump to the previous DUEDATE entry.

23.34. akl/jump-to-previous-duedate-todo M-x … RET

Jump to the next DUEDATE entry.

23.35. akl/kill-all-other-buffers M-x … RET

Kill all other buffers.

23.36. akl/kill-other-buffers M-x … RET

Kill all buffers but the current one.

Don't mess with special buffers.

23.37. akl/list-all-duedate-in-current-buffer M-s d

List all DUEDATE in current buffer.

23.38. akl/list-all-out-duedate-in-current-buffer M-s l

List all out dated DUEDATE in current buffer.

Find DUEDATE in current buffer, check for over due in comparision to today, and mark if overdue is true.

23.39. akl/list-all-todos-in-current-buffer M-s t

List all TODO keywords and DUEDATEs in current buffer.

23.40. akl/list-all-todos-in-current-project M-s p

List all TODOs and DUEDATEs in current project.

Find DUEDATE in current buffer, check for over due in comparision to today, and mark if overdue is true.

23.41. akl/list-all-todos-in-org-files M-s T

List all TODO keywords and DUEDATEs in org files.

23.42. akl/list-find-files-in-dir-r M-x … RET

Insert all files with pattern in directory.

23.43. akl/move-line-down M-x … RET

Move down the current line. Cursor will move, too.

23.44. akl/move-line-up M-x … RET

Move up the current line. Cursor will move, too.

23.45. akl/move-text-down M-x … RET

Move region (transient-mark-mode active) or current line arg lines down.

23.46. akl/move-text-up M-x … RET

Move region (transient-mark-mode active) or current line arg lines up.

23.47. akl/open-dashboard-buffer <S-f8>

Opens the *dashboard* buffer.

23.48. akl/open-start-org-file <f8>

Opens the aufgaben.org buffer.

23.49. akl/org-agenda-todo-view C-c f

My own agenda TODO view.

23.50. akl/org-archive-subtree M-x … RET

Execute org-archive-subtree-default after the headline is copied.

Cursor has to be on the headline line. Saves the headline in special form into the kill ring. As include and as link to the archive file entry.

#+INCLUDE: "./<buffer-file-name>_archive::<headline>"
[[file+emacs:./<buffer-file-name>_archive::<headline>]]

23.51. akl/org-export-region-as-html-attachment M-x … RET

Export region between BEG and END as html attachment.

If BEG and END are not set, use current subtree. Region or subtree is exported to html without header and footer, prefixed with a mime entity string and pushed to clipboard and killring. When called with prefix ARG, mime entity is not marked as attachment.

23.52. akl/org-find-broken-links M-x … RET

Insert comment for broken links in org-mode buffer.

23.53. akl/org-infile-cite-bibitems M-x … RET

Find all bibitems in current file and list them.

Write the choosen bibitem in current buffer at point.

23.54. akl/org-internal-links-description M-x … RET

Find all internal links in current file and list them.

Write the choosen internal link in current buffer at point. Description will be inserted by writer.

23.55. akl/org-presentation-start M-x … RET

Start presentation.

23.56. akl/org-presentation-stop M-x … RET

Stop presentation.

23.57. akl/refresh-colors-n-nameslist M-x … RET

Refresh the colors in Org-Mode files.

Refresh the list for insert from nameslist. Useful after adaptations in akl-names.org.

In Org-Mode files perform M-x org-mode to refresh the buffer.

23.58. akl/remove-overlays-region M-x … RET

Remove the overlays in region.

23.59. akl/run-elpa-mirror M-x … RET

If not already exists, creates destination directory as defined in "customize akl/elpa-mirror-directory". Afterwards old content will be removed, and the command to generate new content will be executed. After all the destination directory will be zipped. See "akl/zip-dir-elpa-mirror" for this.

23.60. akl/run-script-in-eshell M-x … RET

Switch to *eshell* and change directory to current.

If *eshell* not exist it will be opened. If a region is selected, the selected string will be used as command.

23.61. akl/run-script-in-eshell-region M-x … RET

Switch to *eshell* and change directory to current.

If *eshell* not exist it will be opened. If a region is selected, the selected string will be used as command.

23.62. akl/subst-duedate-agreed-date-insert M-s M-s

Replace DUEDATE <timestamp> by AGREED <timestamp> at next occurence.

23.63. akl/subst-duedate-duedate-date-insert M-s M-u

Replace DUEDATE <timestamp> by DUEDATE <timestamp> at next occurence.

23.64. akl/toggle-colorize–color-region C-c C-x C-c

Toggle colorized.

For uncolorize next colorize marker must be the end-marker. Cursor have to be in colorized region. If region is marked, the region beginning is start point.

For colorize region – well as expected. The control sequence ist hidden. Start control sequence:

@@org:aklclr,CLR@@@@latex:\textcolor{CLR}{@@@@html:<span style="color: CLR">@@

End control sequence:

@@org:aklclrend@@@@latex:}@@@@html:</span>@@

23.65. akl/toggle-tooltip–org-annotate C-c C-x C-t

Toggle the tooltip.

  • If new, the tooltip will be created.
  • If modifiy, the tooltip will be inserted as default.
  • If tooltip text is empty, the tooltip will be removed or not created.
@@org:aklann1@@@@latex:\margin{@@@@html:<abbr title="@@
NOTE
@@org:aklann2@@@@latex:}\\textcolor{darkblue}{\\uline{@@@@html:">@@
MARK
@@org:aklannend@@@@latex:}}@@@@html:</abbr>@@

23.66. akl/toggle-window-split C-x 4 t

Ändert die Fensteraufteilung von vertikal nach horizontal, und umgekehrt.

Funktioniert nur, wenn der Rahmen 2 Fenster hat. Geklaut von stackoverflow.

23.67. akl/user-python-debug-buffer M-x … RET

Run python debugger on current buffer.

23.68. akl/what-face M-x … RET

To get the font-lock name under cursor.

23.69. akl/zip-emacs-init-project M-x … RET

Zip the project files.

23.70. akl/org-roam-acronyms C-c n A

Search for pattern in org roam file acronyms.

23.71. akl/org-roam-ag-regexp C-c n s

Search in org roam directory for pattern in files.

23.72. akl/org-roam-navigate-note M-x … RET

Navigate notes by link. With universal ARG tries to use only

23.73. akl/org-roam-phi-grep C-c n g

Search in org roam directory for pattern in files.

23.74. akl/org-roam-ref-add C-c n r

Add REF with prefix ref:: to org roam node at point.

24. Was noch anliegt

24.1. TODO diredc

Mal genauer diredc anschauen.

25. Appendix

Für die HTML Ausgabe bringt das leider nichts, aber im PDF wird ab dem LaTeX Kommando \appendix die Kapitelnummerierung neu mit Buchstaben begonnen. Um dies zu setzen, habe ich dieses Kommando vor die Überschrift gesetzt.

@@latex: \appendix@@

26. Anhänge für PDF

Anhänge sind nur für die PDF Ausgabe sinnvoll, daher wird es in eine #+begin_export latex Umgebung eingebettet.

Hierbei nutze ich ein LaTeX Kommando, welches ich in der Header Datei definiert habe.

\newcommand{\appfile}
           [1]
           {\textattachfile[color=0.23 0.27 0.29]
                           {#1}
                           {\faIcon{paperclip}}}
#+begin_export latex
\section{Dateien eingefügt in dieses Dokument}\label{sec:filesusedindoc}
\setlist[itemize,1]{leftmargin=\dimexpr 26pt -1.4em}
\begin{multicols}{2} % to set the list to two columns
  \begin{itemize}
    \item \appfile{./init.org} \texttt{init.org} -- {\small Die originale, \textit{rohe} Org-Mode Datei.}
    \item \appfile{/home/ankr/.emacs} \texttt{.emacs}
    \item \appfile{./akl/akl-org-options.org} \texttt{akl-org-options.org} 
    \item \appfile{./akl/akl-report-header.tex} \texttt{akl-report-header.tex} 
    \item \appfile{/home/ankr/.emacs.d/snippets/org-mode/org-start-header} \texttt{org-start-header} 
    \item \appfile{./akl/akl-main-defs.el} \texttt{akl-main-defs.el} 
    \item \appfile{./akl/akl-main.el} \texttt{akl-main.el} 
    \item \appfile{./akl/akl-faces.el}  \texttt{akl-faces.el}
    \item \appfile{./akl/akl-namen.el}  \texttt{akl-namen.el}
    \item \appfile{./akl/akl-duedate.el} \texttt{akl-duedate.el} 
    \item \appfile{./akl/akl-org-exporter.el} \texttt{akl-org-exporter.el} 
    \item \appfile{./akl/akl-colorize.el} \texttt{akl-colorize.el} 
    \item \appfile{./akl/akl-org-annotate.el} \texttt{akl-org-annotate.el} 
    \item \appfile{./akl/akl-python.el} \texttt{akl-python.el} 
    \item \appfile{./akl/akl-hydra-menus.el} \texttt{akl-hydra-menus.el} 
    \item \appfile{./akl/akl-org-tree-slide.org} \texttt{akl-org-tree-slide.org} 
    \item \appfile{./images/emacs_gnu_logo.jpg} \texttt{emacs\_gnu\_logo.jpg}
    \item \appfile{./images/emacs_gnu_logo.png} \texttt{emacs\_gnu\_logo.png}
    \item \appfile{./images/gnu_logo.png} \texttt{gnu\_logo.png}
    \item \appfile{./images/logos-banner.png} \texttt{logos-banner.png}
    \item \appfile{./images/org-mode-unicorn-logo.png} \texttt{org-mode-unicorn-logo.png}
    \item \appfile{./images/tikz-beispiel.pgf} \texttt{tikz-beispiel.pgf}
    \item \appfile{./images/tikz-beispiel.pdf} \texttt{tikz-beispiel.pdf}
    \item \appfile{./images/tikz-beispiel.png} \texttt{tikz-beispiel.png}
    \item \appfile{./images/utf8-latex-fonts.png} \texttt{utf8-latex-fonts.png}
    \item \appfile{./images/xkcd-python-comic.png} \texttt{xkcd-python-comic.png}
    \item \appfile{./images/ziege.jpg} \texttt{ziege.jpg}
  \end{itemize}
\end{multicols}
\setlist[itemize,1]{leftmargin=\dimexpr 26pt}
#+end_export

Datum: 25.09.2023

Autor: Andreas Kruse

Created: 2023-09-25 Mo 20:00