From e7a29d6f3243a9749c4f5095404c9222a510c059 Mon Sep 17 00:00:00 2001 From: Daniel Weschke Date: Sat, 5 Dec 2020 14:19:31 +0100 Subject: [PATCH] add gui settings --- settings/my-settings.el | 12 ++ settings/popwin-settings.el | 36 ++++++ settings/theme-settings.el | 65 +++++++++++ settings/toolbar-settings.el | 214 +++++++++++++++++++++++++++++++++++ 4 files changed, 327 insertions(+) create mode 100644 settings/my-settings.el create mode 100644 settings/popwin-settings.el create mode 100644 settings/theme-settings.el create mode 100644 settings/toolbar-settings.el diff --git a/settings/my-settings.el b/settings/my-settings.el new file mode 100644 index 00000000..55069bbf --- /dev/null +++ b/settings/my-settings.el @@ -0,0 +1,12 @@ +;;; my-settings.el --- Summary -*- lexical-binding: t -*- +;;; Commentary: +;;; Code: +(use-package 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)) + ) + +(provide 'my-settings) +;;; my-settings.el ends here diff --git a/settings/popwin-settings.el b/settings/popwin-settings.el new file mode 100644 index 00000000..29d47f45 --- /dev/null +++ b/settings/popwin-settings.el @@ -0,0 +1,36 @@ +;;; popwin-settings.el --- popwin settings -*- lexical-binding: t -*- + +;;; Commentary: +;; https://github.com/m2ym/popwin-el +;; Popwin makes you free from the hell of annoying buffers such like *Help*, *Completions*, *compilation*, and etc. +;; popwin resolves there problems. Windows of such temporary buffers +;; will be shown as a popup window, and you can close them smoothly by +;; typing C-g in anytime. + +;; Requirements: +;; popwin https://melpa.org/#/popwin + +;;; Code: +(use-package popwin + :config + ;; don't use default value but manage it ourselves + (setq popwin:special-display-config nil) + ;; buffers that we manage + ;;(push '("*Help*" :dedicated t :position bottom :stick t :noselect t :height 0.4) popwin:special-display-config) + (push '(help-mode :dedicated t :position bottom :stick t :noselect t :height 0.4) popwin:special-display-config) ;; "*Help*", "*Faces*", "*Colors*" + (push '("*Messages*" :dedicated t :position bottom :stick t :noselect t :height 0.4) popwin:special-display-config) + (push '("*compilation*" :dedicated t :position bottom :stick t :noselect t :height 0.4) popwin:special-display-config) + (push '("*Shell Command Output*" :dedicated t :position bottom :stick t :noselect nil ) popwin:special-display-config) + (push '("*Async Shell Command*" :dedicated t :position bottom :stick t :noselect nil ) popwin:special-display-config) + (push '(" *undo-tree*" :dedicated t :position bottom :stick t :noselect nil :height 0.4) popwin:special-display-config) + (push '("*ert*" :dedicated t :position bottom :stick t :noselect nil ) popwin:special-display-config) + (push '("*grep*" :dedicated t :position bottom :stick t :noselect nil ) popwin:special-display-config) + (push '("*nosetests*" :dedicated t :position bottom :stick t :noselect nil ) popwin:special-display-config) + (push '("^\*WoMan.+\*$" :regexp t :position bottom ) popwin:special-display-config) + (push '("^\\*Flycheck.+\\*$" :regexp t :dedicated t :position bottom :stick t :noselect t ) popwin:special-display-config) + + (popwin-mode 1) + ) + +(provide 'popwin-settings) +;;; popwin-settings.el ends here diff --git a/settings/theme-settings.el b/settings/theme-settings.el new file mode 100644 index 00000000..efd12f24 --- /dev/null +++ b/settings/theme-settings.el @@ -0,0 +1,65 @@ +;;; theme-settings.el --- Theme settings -*- mode: emacs-lisp; lexical-binding: t -*- + +;;; Commentary: + +;; Requirements: +;; spacemacs-theme https://github.com/nashamri/spacemacs-theme +;; emojify https://melpa.org/#/emojify +;; Fonts: +;; Source Han Mono (debian fonts-noto-cjk-extra) +;; Asana Math (debian texlive-fonts-extra) + +;;; Code: +(use-package spacemacs-common + :after (cl-lib) ;; spacemacs-common misses to load cl-lib + :load-path (lambda() (concat user-emacs-directory "lisp/spacemacs-theme")) + :config + (load-theme 'spacemacs-dark t) + ) + +;; Test char and monospace: +;; 1234567890abcdefghijklmnopqrstuvwxyz [] () :;,. !@#$^&* +;; 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ {} <> "'` ~-_/|\? +;; abcdefghijklmnopqrstuvwxyz FULLWIDTH LATIN SMALL LETTER X +;; ABCDEFGHIJKLMNOPQRSTUVWXYZ FULLWIDTH LATIN CAPITAL LETTER X +;; ⑴⑵⑶⑷⑸⑹⑺⑻⑼⑽⑾⑿⒀⒁⒂⒃⒄⒅⒆⒇ PARENTHESIZED DIGIT X, PARENTHESIZED NUMBER X +;; ⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵ PARENTHESIZED LATIN SMALL LETTER X +;; 🄐🄑🄒🄓🄔🄕🄖🄗🄘🄙🄚🄛🄜🄝🄞🄟🄠🄡🄢🄣🄤🄥🄦🄧🄨🄩 PARENTHESIZED LATIN CAPITAL LETTER X +;; ①②③④⑤⑥⑦⑧⑨⓪ ⓵⓶⓷⓸⓹⓺⓻⓼⓽ CIRCLED DIGIT X, DOUBLE CIRCLED DIGIT ONE +;; ❶❷❸❹❺❻❼❽❾  ➊➋➌➍➎➏➐➑➒🄌 DINGBAT NEGATIVE CIRCLED DIGIT X, DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT X +;; ⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩ CIRCLED LATIN SMALL LETTER X +;; ⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏ CIRCLED LATIN CAPITAL LETTER X +;; 🅐🅑🅒🅓🅔🅕🅖🅗🅘🅙🅚🅛🅜🅝🅞🅟🅠🅡🅢🅣🅤🅥🅦🅧🅨🅩 NEGATIVE CIRCLED LATIN CAPITAL LETTER X +;; 🄰🄱🄲🄳🄴🄵🄶🄷🄸🄹🄺🄻🄼🄽🄾🄿🅀🅁🅂🅃🅄🅅🅆🅇🅈🅉 SQUARED LATIN CAPITAL LETTER X +;; 🅰🅱🅲🅳🅴🅵🅶🅷🅸🅹🅺🅻🅼🅽🅾🅿🆀🆁🆂🆃🆄🆅🆆🆇🆈🆉 🆊 NEGATIVE SQUARED LATIN CAPITAL LETTER X +;; 𝓪𝓫𝓬𝓭𝓮𝓯𝓰𝓱𝓲𝓳𝓴𝓵𝓶𝓷𝓸𝓹𝓺𝓻𝓼𝓽𝓾𝓿𝔀𝔁𝔂𝔃 MATHEMATICAL BOLD SCRIPT SMALL X +;; 𝓐𝓑𝓒𝓓𝓔𝓕𝓖𝓗𝓘𝓙𝓚𝓛𝓜𝓝𝓞𝓟𝓠𝓡𝓢𝓣𝓤𝓥𝓦𝓧𝓨𝓩 MATHEMATICAL BOLD SCRIPT CAPITAL X +;; ✈↵#↹⏎⇤⇥␣↑↓←→ ☐☑ +;; :rage::hamburger: +;; see M-x describe-char +(cond + ((find-font (font-spec :name "DejaVu Sans Mono")) + (set-frame-font "DejaVu Sans Mono-10")) + ((find-font (font-spec :name "Source Han Mono")) + (set-frame-font "Source Han Mono-9")) + ((find-font (font-spec :name "inconsolata")) + (set-frame-font "inconsolata-10")) + ((find-font (font-spec :name "Source Code Pro")) + (set-frame-font "Source Code Pro-10")) + ((find-font (font-spec :name "Lucida Console")) + (set-frame-font "Lucida Console-10")) + ((find-font (font-spec :name "courier")) + (set-frame-font "courier-10"))) + +(setq inhibit-compacting-font-caches t) + +(use-package emojify + :commands emojify-mode + :load-path (lambda() (concat user-emacs-directory "lisp/emojify")) + :hook (after-init . global-emojify-mode) + :init + (setq emojify-emojis-dir (concat user-emacs-directory ".cache/emojify")) + ) + +(provide 'theme-settings) +;;; theme-settings.el ends here diff --git a/settings/toolbar-settings.el b/settings/toolbar-settings.el new file mode 100644 index 00000000..6ab911be --- /dev/null +++ b/settings/toolbar-settings.el @@ -0,0 +1,214 @@ +;; toolbar-settings.el --- Tool bar settings -*- mode: emacs-lisp; lexical-binding: t -*- + +;;; Commentary: +;; icon name and item name must be the same, e.g. pepper +;; "/home/daniel/.config/emacs/icon/pepper.xpm" +;; defining toolbar items +;; emacs look into the data-directory to find files. +;; either copy global etc folder to local and overwrite the path to local +;; (setq data-directory "/home/daniel/.config/emacs/icon/") ;; default "/usr/share/emacs/28.0.50/etc/" +;; or copy local files to global etc folder +;; then add item with name of icon name, e. g. pepper because of pepper.xpm +;; but before changing data-directory, better add local icon folder to the image-load-path + +;; Requirements: +;; dialog.el https://www.emacswiki.org/emacs/Dialog https://www.emacswiki.org/emacs/dialog.el https://www.emacswiki.org/emacs/download/dialog.el + +;;; Code: + +;;(setq tool-bar-style "image") ;; uses GTK+ toolkit / does not work + +(use-package x-win + :defer t + :config + (when (boundp 'x-gtk-stock-map) + ;; icon-map-list (x-gtk-stock-map) + (delete '("etc/images/diropen" . "n:system-file-manager") x-gtk-stock-map) + (delete '("etc/images/close" . ("window-close" "gtk-close")) x-gtk-stock-map) + (delete '("etc/images/cancel" . "gtk-cancel") x-gtk-stock-map) + (mapc (lambda (item) (add-to-list 'x-gtk-stock-map item)) + '( + ;; key . value + ;; key: file names without extension and with two directory components + ;; value: either "stock-icon", "n:named-icon" or ("named-icon" "stock-icon") (or is it like: Let stock be a list of icon names to try.) + ("etc/images/diropen" . ("n:folder-stash" "n:system-file-manager")) + ("etc/images/close" . ("n:document-close" "window-close" "gtk-close")) + ("etc/images/cancel" . ("n:dialog-close" "gtk-cancel")) + + ("images/newsticker/narrow" . "format-justify-fill") + ("etc/images/next-node" . "document-export") + ("etc/images/refresh" . ("document-revert" "refresh" "gtk-convert")) + ("etc/images/exit" . ("n:application-exit" "n:system-shutdown" "exit" "gtk-quit")) + )) + ) + ) + +(use-package dialog + :defer 2 + :config + (defun my-org-export-dialog-html-fun () + "Ask." + (interactive) + ;;(my-org-export-dialog) + ;;(previous-buffer) + ;;(get-buffer "*Messages*") + ;;(switch-to-buffer "*Messages*") + ;;(message "ja") + ;;(my-org-export-html + (when t + (message "ja") + (previous-buffer) + (my-org-export-html) + (next-buffer) + ) + ) + (setq my-org-export-dialog-html-var 'my-org-export-dialog-html-fun) + (defun my-org-export-dialog-pdf-fun () + "Ask." + (interactive) + (when t + (message "ja") + (previous-buffer) + (my-org-export-pdf) + (next-buffer) + ) + ) + (setq my-org-export-dialog-pdf-var 'my-org-export-dialog-pdf-fun) + + (dialog-define my-org-export-dialog + '(:style window + [navigation 1 1 :tag "Navigation"] + [text 3 1 "Export org document:"] + ;;[text 4 1 "HTML"] + ;; :notify needs a variable which points to a function + [button-quit 4 1 :tag "HTML" :notify my-org-export-dialog-html-var] + ;;[text 5 1 "PDF (LaTeX)"] + [button-quit 5 1 :tag "PDF (LaTeX)" :notify my-org-export-dialog-pdf-var] + [button-quit 7 1] + [text 8 1 ""] + ) + "This is my-org-export dialog.") + ;; (my-org-export-dialog) + ) + + +(defun my-org-export-ivy () + "" + (setq my-org-export-list '( + ("HTML" . my-org-export-html) + ("HTML async" . my-org-export-html-async) + ("PDF (LaTeX)" . my-org-export-pdf) + ("PDF (LaTeX) async" . my-org-export-pdf-async) + )) + (ivy-read + "Org export: " + ;;'("HTML" "PDF (LaTeX)") + ;;'(my-org-export-html "PDF (LaTeX)") + my-org-export-list + :action '(1 ;; index (1 based) of the default action + ("s" (lambda (x) + ;;(message x) + ;;(command-execute 'x) + ;;(call-interactively x) + ;; get the value from the key value pair and call value (fun) + (funcall (cdr x)) + ) + "switch" + ) + ) + ) + ) + +(defun my-org-export () + "" + (interactive) + ;;(my-org-export-dialog) + ;;(dialog-run 'my-org-export-dialog) + (my-org-export-ivy) + ) +;;(my-org-export) +;;(makunbound 'my-org-export) + +;; (describe-key [tool-bar]) +;; see tool-bar.el - tool-bar-setup +;; https://www.gnu.org/software/emacs/manual/html_node/elisp/Tool-Bar.html +;; auto-resize-tool-bars +(use-package tool-bar + :defer t + :config + ;; add local icon folder to the image-load-path + (add-to-list 'image-load-path (concat user-emacs-directory "icon/")) + + ;; TODO: revert after close? + ;; TODO: add redo? + ;; TODO: add toggle-window-split with icon transform-rotate? or view-multiple-objects + ;; TODO: add swap windows left with right with icon view-pages-facing? or better view-split-left-right? text-frame-link + ;; TODO: export to html; icon viewhtml? + ;; TODO: export to pdf: icon viewpdf? + ;;(define-key-after (default-value 'tool-bar-map) [separator-6] menu-bar-separator 'kill-buffer) + + ;; ("etc/images/spell" "tools-check-spelling" "gtk-spell-check") + ;;(tool-bar-add-item-from-menu 'ispell-buffer "spell") + (tool-bar-add-item "spell" + #'flyspell-buffer + 'flyspell-buffer + :help "Run function `flyspell-buffer'") + + (tool-bar-add-item "languagetool.org" + #'langtool-check-buffer + 'langtool-check-buffer + :help "Run function `langtool-check-buffer'") + + ;; fill, using the defined logic of Menu - Edit - Fill using function fill-region + (tool-bar-add-item "newsticker/narrow" + #'fill-region + 'fill-region + :help "Fill text in region to fit between left and right margin `fill-region'") + ;;(tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [fill]) + ;; "images/newsticker/narrow" nil :vert-only t) + + ;; add separator + (define-key-after (default-value 'tool-bar-map) [separator-4] menu-bar-separator) + + ;; ("etc/images/refresh" "view-refresh" "gtk-refresh") + (tool-bar-add-item "refresh" + #'revert-buffer + 'revert-buffer + :help "Re-read current buffer from its file `revert-buffer'") + ;;(tool-bar-add-item-from-menu (lookup-key menu-bar-file-menu [revert-buffer]) + ;; "refresh" nil :vert-only t) + + ;; text-html + ;;(tool-bar-add-item "export_html" + ;; #'my-org-export-html + ;; 'my-org-export-html + ;; :help "Run function `my-org-export-html'") + ;; x-office-document + ;;(tool-bar-add-item "export_pdf" + ;; #'my-org-export-pdf + ;; 'my-org-export-pdf + ;; :help "Run function `my-org-export-pdf'") + (tool-bar-add-item "next-node" + #'my-org-export + 'my-org-export + :enable '(eq major-mode 'org-mode) + :help "Run function `my-org-export'") + + ;; add separator + (define-key-after (default-value 'tool-bar-map) [separator-5] menu-bar-separator) + + (tool-bar-add-item "cancel" + #'keyboard-escape-quit + 'keyboard-escape-quit + :help "Run function `keyboard-escape-quit'") + + (tool-bar-add-item "exit" + #'kill-emacs + 'kill-emacs + :help "Exit the Emacs job and kill it `kill-emacs'") + ;;(tool-bar-add-item-from-menu (lookup-key menu-bar-file-menu [Kill\ Emacs]) + ;; "exit" nil :vert-only t) + ) + +(provide 'toolbar-settings) +;;; toolbar-settings.el ends here