From 8370eddfaeb4abb94f50a93b7383b829ed7a2b2a Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Wed, 12 Apr 2023 20:24:10 +0200 Subject: [PATCH] get rid of outshine --- conf-lisp/elisp.el | 7 +- conf-lisp/org.el | 365 ++++++++++++++++++++++--------------------- conf-lisp/outline.el | 8 +- 3 files changed, 189 insertions(+), 191 deletions(-) diff --git a/conf-lisp/elisp.el b/conf-lisp/elisp.el index 7474ce1..853dff6 100644 --- a/conf-lisp/elisp.el +++ b/conf-lisp/elisp.el @@ -100,7 +100,7 @@ Returns t if version changed, nil otherwise." (beginning-of-buffer) (re-search-forward ";; .. Changelog") (next-line) - (tvd-outshine-end-of-section) + ;; (tvd-outshine-end-of-section) (when newversion (insert (format "\n;; %s\n" tvd-emacs-version))) (insert (format ";; - %s\n" entry))))) @@ -116,12 +116,9 @@ Returns t if version changed, nil otherwise." show-trailing-whitespace t) (eldoc-mode t) - ;; enable outline (with outshine) + ;; enable outline (outline-minor-mode) - ;; enable outshine mode - (outshine-hook-function) - (electric-indent-local-mode t))) ;; use UP arrow for history in *ielm* as well, just as C-up diff --git a/conf-lisp/org.el b/conf-lisp/org.el index c42e10e..52c6345 100644 --- a/conf-lisp/org.el +++ b/conf-lisp/org.el @@ -6,163 +6,163 @@ ;; I like custom bullets (use-package org-bullets - :config - (setq org-bullets-bullet-list '("►" "✜" "✸" "✿" "♦"))) + :config + (setq org-bullets-bullet-list '("►" "✜" "✸" "✿" "♦"))) (use-package org - :config + :config - ;; enable syntax highlighting for embedded source blocks - (require 'ob-python) - (require 'ob-perl) - (require 'ob-shell) + ;; enable syntax highlighting for embedded source blocks + (require 'ob-python) + (require 'ob-perl) + (require 'ob-shell) - ;; capture target, os-dependend - ;; FIXME: put this file outside emacs? - (setq tvd-org-file (concat tvd-config-dir "/notizen.org") - org-attach-directory (concat tvd-config-dir "/attachments")) + ;; capture target, os-dependend + ;; FIXME: put this file outside emacs? + (setq tvd-org-file (concat tvd-config-dir "/notizen.org") + org-attach-directory (concat tvd-config-dir "/attachments")) - ;; easier to open that way - (defun notizen() - (interactive) - (switch-to-buffer (find-file tvd-org-file)) - (agenda)) + ;; easier to open that way + (defun notizen() + (interactive) + (switch-to-buffer (find-file tvd-org-file)) + (agenda)) - ;; text formatting made easy, bound to C-c keys locally - (defun tvd-org-emphasize(CHAR) - "expand once if no region and apply emphasize CHAR" - (interactive) - (unless (region-active-p) - (er/expand-region 1)) - (org-emphasize CHAR)) + ;; text formatting made easy, bound to C-c keys locally + (defun tvd-org-emphasize(CHAR) + "expand once if no region and apply emphasize CHAR" + (interactive) + (unless (region-active-p) + (er/expand-region 1)) + (org-emphasize CHAR)) - (defun bold() - "bold text in org mode" - (interactive) - (tvd-org-emphasize '42)) + (defun bold() + "bold text in org mode" + (interactive) + (tvd-org-emphasize '42)) - (defun italic() - "italic text in org mode" - (interactive) - (tvd-org-emphasize '47)) + (defun italic() + "italic text in org mode" + (interactive) + (tvd-org-emphasize '47)) - (defun code() - "verbatim text in org mode" - (interactive) - (tvd-org-emphasize '126)) + (defun code() + "verbatim text in org mode" + (interactive) + (tvd-org-emphasize '126)) - (defun underline() - "underline text in org mode" - (interactive) - (tvd-org-emphasize '95)) + (defun underline() + "underline text in org mode" + (interactive) + (tvd-org-emphasize '95)) - ;; my org-mode specific and - (defun tvd-org-left-or-level-up() - "jump one word to the left if not on a org heading, + ;; my org-mode specific and + (defun tvd-org-left-or-level-up() + "jump one word to the left if not on a org heading, otherwise fold current level and jump one level up." - (interactive) - (if (and (org-at-heading-p) (looking-at "*")) - (progn - (hide-subtree) - (outline-up-heading 1)) - (left-word))) + (interactive) + (if (and (org-at-heading-p) (looking-at "*")) + (progn + (hide-subtree) + (outline-up-heading 1)) + (left-word))) - (defun tvd-org-heading-up() - "If on a heading, fold current heading, jump one level + (defun tvd-org-heading-up() + "If on a heading, fold current heading, jump one level up and unfold it, otherwise jump paragraph as usual." - (interactive) - (if (and (org-at-heading-p) (looking-at "*")) - (progn - (hide-subtree) - (org-backward-heading-same-level 1) - (org-cycle)) - (backward-paragraph))) + (interactive) + (if (and (org-at-heading-p) (looking-at "*")) + (progn + (hide-subtree) + (org-backward-heading-same-level 1) + (org-cycle)) + (backward-paragraph))) - (defun tvd-org-heading-down() - "If on a heading, fold current heading, jump one level + (defun tvd-org-heading-down() + "If on a heading, fold current heading, jump one level down and unfold it, otherwise jump paragraph as usual." - (interactive) - (if (and (org-at-heading-p) (looking-at "*")) - (progn - (hide-subtree) - (org-forward-heading-same-level 1) - (org-cycle)) - (forward-paragraph))) + (interactive) + (if (and (org-at-heading-p) (looking-at "*")) + (progn + (hide-subtree) + (org-forward-heading-same-level 1) + (org-cycle)) + (forward-paragraph))) - ;; org-mode specific config, after load - (eval-after-load "org" - '(progn - (add-hook 'org-mode-hook - (lambda () - (setq - org-M-RET-may-split-line nil - org-agenda-files (list tvd-org-file) - org-agenda-restore-windows-after-quit t - org-blank-before-new-entry (quote ((heading . auto) (plain-list-item . auto))) - org-catch-invisible-edits (quote error) - org-columns-default-format "%80ITEM %22Timestamp %TODO %TAGS %0PRIORITY" - org-insert-heading-always-after-current (quote t) - org-mouse-1-follows-link nil - org-remember-store-without-prompt t - org-reverse-note-order t - org-startup-indented t - org-startup-truncated nil - org-return-follows-link t - org-use-speed-commands t - org-yank-adjusted-subtrees t - org-refile-targets '((nil . (:maxlevel . 5))) - org-refile-use-outline-path t - org-outline-path-complete-in-steps nil - org-completion-use-ido t - org-support-shift-select t - org-hide-emphasis-markers t - org-fontify-done-headline t - org-pretty-entities t - org-use-sub-superscripts nil - org-confirm-babel-evaluate nil) + ;; org-mode specific config, after load + (eval-after-load "org" + '(progn + (add-hook 'org-mode-hook + (lambda () + (setq + org-M-RET-may-split-line nil + org-agenda-files (list tvd-org-file) + org-agenda-restore-windows-after-quit t + org-blank-before-new-entry (quote ((heading . auto) (plain-list-item . auto))) + org-catch-invisible-edits (quote error) + org-columns-default-format "%80ITEM %22Timestamp %TODO %TAGS %0PRIORITY" + org-insert-heading-always-after-current (quote t) + org-mouse-1-follows-link nil + org-remember-store-without-prompt t + org-reverse-note-order t + org-startup-indented t + org-startup-truncated nil + org-return-follows-link t + org-use-speed-commands t + org-yank-adjusted-subtrees t + org-refile-targets '((nil . (:maxlevel . 5))) + org-refile-use-outline-path t + org-outline-path-complete-in-steps nil + org-completion-use-ido t + org-support-shift-select t + org-hide-emphasis-markers t + org-fontify-done-headline t + org-pretty-entities t + org-use-sub-superscripts nil + org-confirm-babel-evaluate nil) ; shortcuts - (setq org-speed-commands-user - (quote ( - ("0" . ignore) - ("1" . delete-other-windows) - ("2" . ignore) - ("3" . ignore) - ("d" . org-archive-subtree-default-with-confirmation) ; delete, keep track - ("v" . org-narrow-to-subtree) ; only show current heading ("view") - ("q" . widen) ; close current heading and show all ("quit") - (":" . org-set-tags-command) ; add/edit tags - ("t" . org-todo) ; toggle todo type, same as C-t - ("z" . org-refile) ; archive the (sub-)tree - ("a" . org-attach) ; manage attachments - ))) + (setq org-speed-commands-user + (quote ( + ("0" . ignore) + ("1" . delete-other-windows) + ("2" . ignore) + ("3" . ignore) + ("d" . org-archive-subtree-default-with-confirmation) ; delete, keep track + ("v" . org-narrow-to-subtree) ; only show current heading ("view") + ("q" . widen) ; close current heading and show all ("quit") + (":" . org-set-tags-command) ; add/edit tags + ("t" . org-todo) ; toggle todo type, same as C-t + ("z" . org-refile) ; archive the (sub-)tree + ("a" . org-attach) ; manage attachments + ))) ; same as toggle - (local-set-key (kbd "C-t") 'org-todo) + (local-set-key (kbd "C-t") 'org-todo) ; alt-enter = insert new subheading below current - (local-set-key (kbd "") 'org-insert-subheading) + (local-set-key (kbd "") 'org-insert-subheading) ; search for tags (ends up in agenda view) - (local-set-key (kbd "C-f") 'org-tags-view) + (local-set-key (kbd "C-f") 'org-tags-view) ; run presenter, org-present must be installed and loadedwhite - (local-set-key (kbd "C-p") 'org-present) + (local-set-key (kbd "C-p") 'org-present) ; todo colors - (setq org-todo-keyword-faces '( - ("TODO" . (:foreground "deepskyblue" :weight bold)) - ("START" . (:foreground "olivedrab" :weight bold)) - ("WAIT" . (:foreground "darkorange" :weight bold)) - ("DONE" . (:foreground "forestgreen" :weight bold)) - ("CANCEL" . (:foreground "red" :weight bold)) - ("FAIL" . (:foreground "red" :weight bold)) - )) + (setq org-todo-keyword-faces '( + ("TODO" . (:foreground "deepskyblue" :weight bold)) + ("START" . (:foreground "olivedrab" :weight bold)) + ("WAIT" . (:foreground "darkorange" :weight bold)) + ("DONE" . (:foreground "forestgreen" :weight bold)) + ("CANCEL" . (:foreground "red" :weight bold)) + ("FAIL" . (:foreground "red" :weight bold)) + )) - (local-set-key (kbd "C-c b") 'bold) - (local-set-key (kbd "C-c /") 'italic) - (local-set-key (kbd "C-c 0") 'code) ; aka = without shift - (local-set-key (kbd "C-c _") 'underline) + (local-set-key (kbd "C-c b") 'bold) + (local-set-key (kbd "C-c /") 'italic) + (local-set-key (kbd "C-c 0") 'code) ; aka = without shift + (local-set-key (kbd "C-c _") 'underline) ; edit babel src block in extra buffer: ; default is C-c ' which is hard to type @@ -170,73 +170,78 @@ down and unfold it, otherwise jump paragraph as usual." ; Also note: enter ") 'tvd-org-heading-up) - (local-set-key (kbd "") 'tvd-org-heading-down) + ;; faster jumping + (local-set-key (kbd "") 'tvd-org-heading-up) + (local-set-key (kbd "") 'tvd-org-heading-down) - ;; move word left or heading up, depending where point is - (local-set-key (kbd "") 'tvd-org-left-or-level-up) + ;; move word left or heading up, depending where point is + (local-set-key (kbd "") 'tvd-org-left-or-level-up) - ;; use nicer bullets - (when (fboundp 'org-bullets-mode) - (org-bullets-mode 1)) + ;; use nicer bullets + (when (fboundp 'org-bullets-mode) + (org-bullets-mode 1)) - (org-babel-do-load-languages 'org-babel-load-languages - '((python . t) - (emacs-lisp . t) - (shell . t) - (perl . t))))))) + (org-babel-do-load-languages 'org-babel-load-languages + '((python . t) + (emacs-lisp . t) + (shell . t) + (perl . t))))))) - ;; no more ... at the end of a heading - (setq org-ellipsis " ⤵") + ;; no more ... at the end of a heading + (setq org-ellipsis " ⤵") - ;; my own keywords, must be set globally, not catched correctly inside hook - (setq org-todo-keywords - '((sequence "TODO" "START" "WAIT" "|" "DONE" "CANCEL" "FAIL"))) + ;; my own keywords, must be set globally, not catched correctly inside hook + (setq org-todo-keywords + '((sequence "TODO" "START" "WAIT" "|" "DONE" "CANCEL" "FAIL"))) - ;; I always want to be able to capture, even if no ORG is running - (global-set-key (kbd "C-n") (lambda () (interactive) (org-capture))) + ;; I always want to be able to capture, even if no ORG is running + (global-set-key (kbd "C-n") (lambda () (interactive) (org-capture))) - ;; must be global since code edit sub buffers run their own major mode, not org - (global-set-key (kbd "C-c C-#") 'org-edit-src-exit) + ;; must be global since code edit sub buffers run their own major mode, not org + (global-set-key (kbd "C-c C-#") 'org-edit-src-exit) - ;; some org mode vars must be set globally - (setq org-default-notes-file tvd-org-file - org-startup-indented t - org-indent-indentation-per-level 4) + ;; some org mode vars must be set globally + (setq org-default-notes-file tvd-org-file + org-startup-indented t + org-indent-indentation-per-level 4) - ;; my own capture templates - (setq org-capture-templates - '(("n" "Project" entry (file+headline tvd-org-file "Unsorted Tasks") - "* TODO %^{title}\n%u\n** Kostenstelle\n** Contact Peer\n** Contact Customer\n** Aufträge\n** Daten\n** Notizen\n %i%?\n" - :prepend t :jump-to-captured t) + ;; my own capture templates + (setq org-capture-templates + '(("n" "Project" entry (file+headline tvd-org-file "Unsorted Tasks") + "* TODO %^{title}\n%u\n** Kostenstelle\n** Contact Peer\n** Contact Customer\n** Aufträge\n** Daten\n** Notizen\n %i%?\n" + :prepend t :jump-to-captured t) - ("t" "Todo Item" entry (file+headline tvd-org-file "Manual-Agenda-Tasks") - "* TODO %^{title}\n:LOGBOOK:\n%u:END:\n" :prepend t :immediate-finish t) + ("t" "Todo Item" entry (file+headline tvd-org-file "Manual-Agenda-Tasks") + "* TODO %^{title}\n:LOGBOOK:\n%u:END:\n" :prepend t :immediate-finish t) - ("s" "Scheduled Item" entry (file+headline tvd-org-file "Scheduled-Agenda-Tasks") - "* TODO %^t %^{title}\n:LOGBOOK:\n%u:END:\n" :prepend t :immediate-finish t) + ("s" "Scheduled Item" entry (file+headline tvd-org-file "Scheduled-Agenda-Tasks") + "* TODO %^t %^{title}\n:LOGBOOK:\n%u:END:\n" :prepend t :immediate-finish t) - ("j" "Journal" entry (file+headline tvd-org-file "Kurznotizen") - "* TODO %^{title}\n%u\n %i%?\n" :prepend t :jump-to-captured t) + ("j" "Journal" entry (file+headline tvd-org-file "Kurznotizen") + "* TODO %^{title}\n%u\n %i%?\n" :prepend t :jump-to-captured t) - ("c" "Copy/Paste" entry (file+headline tvd-org-file "Kurznotizen") - "* TODO %^{title}\n%u\n %x\n" :immediate-finish t :prepend t :jump-to-captured t))) + ("c" "Copy/Paste" entry (file+headline tvd-org-file "Kurznotizen") + "* TODO %^{title}\n%u\n %x\n" :immediate-finish t :prepend t :jump-to-captured t))) - ;; follow links using eww, if present - ;; (if (fboundp 'eww-browse-url) - ;; (setq browse-url-browser-function 'eww-browse-url)) + ;; follow links using eww, if present + ;; (if (fboundp 'eww-browse-url) + ;; (setq browse-url-browser-function 'eww-browse-url)) - ;; mark narrowing with an orange fringe, the advice for 'widen - ;; is in the outline section. - (advice-add 'org-narrow-to-subtree :after - '(lambda (&rest args) - (set-face-attribute 'fringe nil :background tvd-fringe-narrow-bg))) + ;; mark narrowing with an orange fringe, the advice for 'widen + ;; is in the outline section. + (advice-add 'org-narrow-to-subtree :after + '(lambda (&rest args) + (set-face-attribute 'fringe nil :background tvd-fringe-narrow-bg))) - ;; always use the latest docs - (with-eval-after-load 'info - (info-initialize) - (add-to-list 'Info-directory-list - (expand-file-name "~/.emacs.d/lisp/org/doc")))) + ;; always use the latest docs + (with-eval-after-load 'info + (info-initialize) + (add-to-list 'Info-directory-list + (expand-file-name "~/.emacs.d/lisp/org/doc"))) + + ;; orange fringe when narrowed + (advice-add 'org-narrow-to-subtree :after + '(lambda (&rest args) + (set-face-attribute 'fringe nil :background tvd-fringe-narrow-bg)))) diff --git a/conf-lisp/outline.el b/conf-lisp/outline.el index 773b79b..9ee702c 100644 --- a/conf-lisp/outline.el +++ b/conf-lisp/outline.el @@ -57,16 +57,12 @@ otherwise fold current level and jump one level up." '(progn (add-hook 'outline-minor-mode-hook (lambda () - ;; narrowing, we use outshine functions, it's loaded anyway - (defalias 'n 'outshine-narrow-to-subtree) + ;; narrowing, we use org functions, it's loaded anyway + (defalias 'n 'org-narrow-to-subtree) (defalias 'w 'widen) (define-key outline-minor-mode-map (kbd "") 'tvd-outline-heading-up) (define-key outline-minor-mode-map (kbd "") 'tvd-outline-heading-down) ;;(define-key outline-minor-mode-map (kbd "") 'tvd-outline-left-or-level-up) )))) -;; orange fringe when narrowed -(advice-add 'outshine-narrow-to-subtree :after - '(lambda (&rest args) - (set-face-attribute 'fringe nil :background tvd-fringe-narrow-bg)))