add views to tab bar and into menu and dashboard and move view functions to own file

add commentary function for org-mode with list function to create strings
This commit is contained in:
2021-01-27 01:57:52 +01:00
parent 15ee156a36
commit d8336fbbae
7 changed files with 831 additions and 119 deletions

View File

@@ -648,8 +648,10 @@ with a drive letter and a colon.")
(easy-menu-define my-view-menu nil "My Views Menu"
'("Views"
["ELisp" my-view-elisp :help "my-view-elisp"]
["Python" my-view-python :help "my-view-python"]
["Gnuplot" my-view-gnuplot :help "my-view-gnuplot"]
["Org PDF" my-view-org-pdf :help "my-view-org-pdf"]
["Python" my-view-python :help "my-view-python"]
["Shell" my-view-shell :help "my-view-shell"]
))
(easy-menu-add my-view-menu nil)
(easy-menu-add-item nil '("My") my-view-menu)

View File

@@ -92,6 +92,55 @@
)
)
(use-package tab-bar
:config
(tab-bar-mode)
(tab-bar-rename-tab "Default")
(defun my-tab-view-elisp ()
(if (tab-bar--tab-index-by-name "ELisp IDE")
(tab-bar-switch-to-tab "ELisp IDE")
(tab-bar-new-tab)
(tab-bar-rename-tab "ELisp IDE")
(switch-to-buffer "*scratch*")
(my-view-elisp)))
(defun my-tab-view-python ()
(if (tab-bar--tab-index-by-name "Python IDE")
(tab-bar-switch-to-tab "Python IDE")
(tab-bar-new-tab)
(tab-bar-rename-tab "Python IDE")
(if (get-buffer "*scratch-python*")
(switch-to-buffer "*scratch-python*")
(switch-to-buffer "*scratch-python*")
(insert "#!/usr/bin/env python\n")
(insert "\"\"\"\n")
(insert "\"\"\"\n"))
(python-mode)
(my-view-python)))
(defun my-tab-view-shell ()
(if (tab-bar--tab-index-by-name "Shell IDE")
(tab-bar-switch-to-tab "Shell IDE")
(tab-bar-new-tab)
(tab-bar-rename-tab "Shell IDE")
(switch-to-buffer "*scratch-shell*")
(shell-script-mode)
(my-view-shell)))
(defun my-tab-view-org-pdf ()
(if (tab-bar--tab-index-by-name "Org PDF")
(tab-bar-switch-to-tab "Org PDF")
(tab-bar-new-tab)
(tab-bar-rename-tab "Org PDF")
(switch-to-buffer "*scratch-org*")
(org-mode)
(my-view-org-pdf)))
(defun my-tab-view-gnuplot ()
(if (tab-bar--tab-index-by-name "Gnuplot IDE")
(tab-bar-switch-to-tab "Gnuplot IDE")
(tab-bar-new-tab)
(tab-bar-rename-tab "Gnuplot IDE")
(switch-to-buffer "*scratch-gnuplot*")
(gnuplot-mode)
(my-view-gnuplot))))
(use-package awesome-tray
:defer 0.2
:config
@@ -170,9 +219,15 @@
`(( ;; views
("" "Custom Views:" "custom views" nil default "" "")
(,(all-the-icons-fileicon "elisp" :height 1.0 :v-adjust -0.1)
"ELisp" "my-view-elisp" (lambda (&rest _) (my-view-elisp)))
"ELisp" "my-view-elisp" (lambda (&rest _) (my-tab-view-elisp)))
(,(all-the-icons-alltheicon "python" :height 1.0 :v-adjust 0.0)
"Python" "my-view-python" (lambda (&rest _) (my-view-python)))
"Python" "my-view-python" (lambda (&rest _) (my-tab-view-python)))
(,(all-the-icons-alltheicon "script" :height 1.0 :v-adjust 0.0)
"Shell" "my-view-shell" (lambda (&rest _) (my-tab-view-shell)))
(,(all-the-icons-octicon "file-media" :height 1.0 :v-adjust 0.0)
"Gnuplot" "my-view-gnuplot" (lambda (&rest _) (my-tab-view-gnuplot)))
(,(all-the-icons-octicon "file-pdf" :height 1.0 :v-adjust 0.0)
"Org PDF" "my-view-org-pdf" (lambda (&rest _) (my-tab-view-org-pdf)))
)
( ;; major modes
("" "Major Modes:" "major modes" nil default "" "")

View File

@@ -2,11 +2,11 @@
;;; Commentary:
;;; Code:
(use-package my
:load-path (lambda() (concat user-emacs-directory "lisp/my"))
:config
(with-eval-after-load 'org
(add-hook 'org-mode-hook 'my-org-link-color-hook)
(add-hook 'org-ctrl-c-ctrl-c-hook 'my-org-table-cell-color-attr))
)
(add-hook 'org-ctrl-c-ctrl-c-hook 'my-org-table-cell-color-attr)))
(provide 'my-settings)
;;; my-settings.el ends here

View File

@@ -1,15 +1,102 @@
;;; org-settings.el --- Org settings -*- lexical-binding: t -*-
;;; Commentary:
;; Package-Requires: ((emacs) (org-mode) (org-bullets) (org-cliplink))
;; This file is not part of GNU Emacs.
;; direct LaTeX (not org)
;; hyphen via AUCTeX (not installed)
;; https://tex.stackexchange.com/questions/282448/why-does-emacs-or-auctex-turns-into
;; Requirements:
;; org-mode https://orgmode.org/
;; org-bullets
;; org-cliplink https://melpa.org/#/org-cliplink
;;; Commentary:
;; * Overview of modes and commands
;; --------------------------------
;; ** Export `ox-reveal'
;; ---------------------
;; (org-export-get-all-options 'reveal)
;;
;; *** KEYWORDs
;; ------------
;; *Note*: Using an option which is also set in the configuration will
;; overwrite it.
;;
;; #+REVEAL_ROOT:
;; - path to reveal.js root directory, can be used once
;; - is defined in the configuration, see `org-reveal-root'
;;
;; #+REVEAL_EXTRA_CSS:
;; - path to css file, can be used multiple times
;; - is defined in the configuration, see `org-reveal-extra-css'
;;
;; #+REVEAL_POSTAMBLE:
;; - postamble content, can be used once
;; - is defined in the configuration, see `org-reveal-postamble'
;;
;; #+REVEAL_HLEVEL:
;; - can be configured, see `org-reveal-hlevel'
;;
;; #+REVEAL: split
;; #+REVEAL: split:t
;;
;; #+REVEAL_THEME:
;;
;; #+OPTIONS: reveal_title_slide:auto|"string"|nil
;; #+REVEAL_TITLE_SLIDE:
;; - path to css file, can be used multiple times
;; - can be configured, see `org-reveal-title-slide'
;;
;; #+REVEAL_TITLE_SLIDE_BACKGROUND: #123456|rgb(0,0,0)|./image/path.jpg
;; #+REVEAL_TITLE_SLIDE_BACKGROUND_SIZE: 200px
;; #+REVEAL_TITLE_SLIDE_BACKGROUND_REPEAT: repeat
;; #+REVEAL_TITLE_SLIDE_BACKGROUND_OPACITY: 0.2
;;
;; #+REVEAL_TOC_SLIDE_BACKGROUND: #123456|rgb(0,0,0)|./image/path.jpg
;; #+REVEAL_TOC_SLIDE_BACKGROUND_SIZE: 200px
;; #+REVEAL_TOC_SLIDE_BACKGROUND_REPEAT: repeat
;; #+REVEAL_TOC_SLIDE_BACKGROUND_OPACITY: 0.2
;;
;; #+REVEAL_DEFAULT_SLIDE_BACKGROUND: #123456|rgb(0,0,0)|./image/path.jpg
;; #+REVEAL_DEFAULT_SLIDE_BACKGROUND_SIZE: 200px
;; #+REVEAL_DEFAULT_SLIDE_BACKGROUND_POSITION:
;; #+REVEAL_DEFAULT_SLIDE_BACKGROUND_REPEAT: repeat
;; #+REVEAL_DEFAULT_SLIDE_BACKGROUND_TRANSITION:
;;
;; #+OPTIONS: reveal_width: org-reveal-width
;; #+OPTIONS: reveal_height: org-reveal-height
;; #+REVEAL_MARGIN: org-reveal-margin
;; #+REVEAL_MIN_SCALE: org-reveal-min-scale
;; #+REVEAL_MAX_SCALE: org-reveal-max-scale
;;
;; #+REVEAL_INIT_OPTIONS: slideNumber:true|“h.v”|“h/v”|“c”|“c/t”
;;
;; #+REVEAL_SLIDE_HEADER: css class slide-header
;; #+REVEAL_SLIDE_FOOTER: css class slide-footer
;; #+OPTIONS: reveal_global_header:t reveal_global_footer:t
;;
;; *** Properties
;; --------------
;; see `org-reveal-slide-section-tag' (org-element-property :xxx headline)
;; :PROPERTIES:
;; :reveal_background: #123456|rgb(0,0,0)|./image/path.jpg
;; :reveal_background_trans: slide
;; :reveal_background_size: 200px
;; :reveal_background_repeat: repeat
;; :reveal_background_opacity: 0.2
;; :reveal_background_iframe: https://domain.tld
;; :END:
;;
;; *** Variables
;; -------------
;; - `org-reveal-root' - string
;; - `org-reveal-extra-css' - string - multiple values separated by \n
;; - `org-reveal-postamble' - string - only one line
;; - `org-reveal-single-file' - t|nil
;; - `org-reveal-hlevel'
;;
;; {{(my-list-to-org-table (org-export-get-all-options 'reveal))}}
;;
;;; Code:
(defgroup my-org nil
"My org-mode concept mapping"
@@ -106,6 +193,42 @@ Example defines
(const (expand-file-name "brain" "~/org"))
(const "~/Sync/workspace/emacs/org-brain")))
(defun my-org-commentary ()
"View org documentation in `outline-mode'."
(interactive)
(let ((buf "*Org: Commentary*"))
;; kill buffer if aleady open
(when (buffer-live-p (get-buffer buf))
(kill-buffer buf))
;; Use `finder-commentary' to generate the buffer.
(require 'finder)
(cl-letf (((symbol-function 'finder-summary) #'ignore))
(finder-commentary "org-settings"))
;; change commentary text
(let ((inhibit-read-only t))
;;(insert "org-settings.el\n\n")
;; point under headline
(forward-line 1)
(save-excursion
;; remove --- under headlines
(while (re-search-forward "^-+$" nil :noerror)
(replace-match ""))
;; replace `xxx' with =xxx=
(goto-char (point-min))
(while (re-search-forward (rx (and "`" (group (+? anything)) "'")) nil :noerror)
(replace-match (concat "=" (match-string 1) "=")))
;; find {{xxx}} and eval xxx
(goto-char (point-min))
(while (re-search-forward (rx (and "{{" (group (+? anything)) "}}")) nil :noerror)
(replace-match (eval (my-eval-string (match-string 1)))))
;; align all tables
(org-table-map-tables 'org-table-align)
))
(rename-buffer buf)
;; Enable `org-mode' and `view-mode' for user convenience.
(org-mode)
(view-mode 1)))
;; uses the org version from the org ELPA repository instead of the
;; one shipped with emacs. Therefore, any org related code should not
;; be loaded before, otherwise both versions will be loaded and will
@@ -1083,5 +1206,6 @@ Suggest the URL title as a description for resource."
:config
(add-hook 'org-brain-visualize-mode-hook #'org-brain-polymode))
(provide 'org-settings)
;;; org-settings.el ends here