;;; toromona-voyager.el -*- lexical-binding: t; -*- ;; ;; Version 1.0 ;; Copyright 2021 ;; This file forms part of. ;; Mode: rec ;; File: toromona-voyager.el ;; Version: File Version 1.0 ;; Brief: Organises ;; FileVers: 1.0 ;; Copyright: 2021 ;; License: Gnu Affero General Public License (Gnu AGPL) ;; + Version 3 or Any Later Version ;; Author: Strategist Christopher Dimech ;; Keywords: ;; # end of rec ;;; Copying Conditions ;; _ _ ;; __ ___ _ __ _ _ __ ___ _ _ __| (_) ;; / _/ _ \ '_ \ || | / _/ _ \ ' \/ _` | | ;; \__\___/ .__/\_, | \__\___/_||_\__,_|_| ;; |_| |__/ ;; This file is part of Behistun, a Gnu Package. ;; Gnu Behistun is free software. You can re-distribute Behistun or ;; modify it under the terms of the Gnu Affero General Public License ;; as published by the Free Software Foundation, either Version 3 of ;; the License, or (at your option) any later version. ;; A copy of the license is included in the file entitled ;; "gnu-agpl.texi". If not, see https://www.gnu.org/licenses/. ;;; Commentary: ;; _ ;; __ ___ _ __ _ __ ___ _ _| |_ __ _ _ _ _ _ ;; / _/ _ \ ' \| ' \/ -_) ' \ _/ _` | '_| || | ;; \__\___/_|_|_|_|_|_\___|_||_\__\__,_|_| \_, | ;; |__/ ;;; Code: ;; _ ;; __ ___ __| |___ ;; / _/ _ \/ _` / -_) ;; \__\___/\__,_\___| ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defgroup toromona nil "A minor mode that sets typeface for comments." :prefix "toromona-" :group 'applications) ;; +++++++++++++++++++++++++++++++++++++++++++++++++++++ ;; _ _ _ ;; __ _ _ _ _ _ ___| |_ __ _| |_(_)___ _ _ ;; / _` | ' \| ' \/ _ \ _/ _` | _| / _ \ ' \ ;; \__,_|_||_|_||_\___/\__\__,_|\__|_\___/_||_| ;; Copy and Inherit Face Attributes ;; ******************************** ;; ;; :inherit ;; The name of a face from which to inherit attributes, or a list ;; of face names. Attributes from inherited faces are merged into ;; the face. ;; ;; ;; comment-delimiter-face inherits from font-lock-comment-face ;; (set-face-attribute 'font-lock-comment-delimiter-face ;; :inherit 'font-lock-comment-face) ;; ;; copy-face copies typeface to font-lock-comment-delimiter-face ;; ;; (copy-face 'font-lock-comment-face 'font-lock-comment-delimiter-face) (defun toromona-annotation-style () "Set colour for the comment delimiter. Use normal weight typeface for comments." (set-face-attribute 'font-lock-comment-face nil :weight 'normal :slant 'italic)) ;; ----------------------------------------------------- (defvar toromona-annotation-contrast 2 "Sets the colour contrast (against background) for comments.") ;; ----------------------------------------------------- (defvar toromona-annotation-chroma ;; Uses two Association Lists, comprising a Chroma Intensity Key ;; (low, mid, high) associated with an RGB Hex-Code. To list ;; colour-names and hex-codes, call the Emacs Minibuffer Command ;; `M-x list-colors-display'. '( (dark . ((low . "#8600E6") ; indigo (Blu:63% Red:37% Grn:0%) (mid . "#AA33FF") ; indigo (Blu:54% Red:36% Grn:11%) (high . "#C370FF"))) ; indigo (Blu:45% Red:35% Grn:20%) (light . ((low . "#C16BFF") ; indigo (Blu:46% Red:35% Grn:19%) (mid . "#AA33FF") ; indigo (Blu:54% Red:36% Grn:11%) (high . "#8000DB"))) ) ; indigo (Blu:63% Red:37% Grn:0%) "Colour contrast for comments, indigo on dark and light background.") ;; ----------------------------------------------------- (defun toromona-annotation-body (chroma) "Set the foreground colour for comments following delimiter. CHROMA Intensity Key used for setting colour of comments ." (let* ( (colors toromona-annotation-chroma) (levels (alist-get (frame-parameter nil 'background-mode) colors)) ) (face-remap-add-relative 'font-lock-comment-face `(:foreground ,(alist-get chroma levels)))) ) ;; +++++++++++++++++++++++++++++++++++++++++++++++++++++ (defun toromona-annotation-delimiter () "Set foreground colour for the comment delimiter." ;; comment-delimiter-face inherits from font-lock-comment-face (if (eq 'dark (frame-parameter nil 'background-mode)) ;; for dark theme (set-face-attribute 'font-lock-comment-delimiter-face nil :foreground "#00FF00") ;; for light theme (set-face-attribute 'font-lock-comment-delimiter-face nil :foreground "#00FFFF") )) ;; +++++++++++++++++++++++++++++++++++++++++++++++++++++ (defun toromona-annotation-sweep () "Cycles through the colour chroma for comment body. Colours are determined by `toromona-annotation'." (interactive) (pcase toromona-annotation-contrast (1 (toromona-annotation-body 'low) (message "Arktika | Toromona Annotation | %s" "Low Contrast") (setq toromona-annotation-contrast 2)) (2 (toromona-annotation-body 'mid) (message "Arktika | Toromona Annotation | %s" "Mid Contrast") (setq toromona-annotation-contrast 3)) (_ (toromona-annotation-body 'high) (message "Arktika | Toromona Annotation | %s" "High Contrast") (setq toromona-annotation-contrast 1)) )) ;; +++++++++++++++++++++++++++++++++++++++++++++++++++++ (defun toromona-annotation-low-contrast () (when toromona-minor-mode (toromona-annotation-body 'low))) ;; +++++++++++++++++++++++++++++++++++++++++++++++++++++ (defun toromona-annotation-keytrigger () "Key trigger for rapid execution of richkov commands" (interactive) (global-set-key (kbd "H-;") #'toromona-annotation-sweep)) ;; +++++++++++++++++++++++++++++++++++++++++++++++++++++ (defun toromona-annotation-tools () "Aggregates annotation tools for comments." (toromona-annotation-style) (toromona-annotation-delimiter) (toromona-annotation-low-contrast) (toromona-annotation-keytrigger)) ;; ----------------------------------------------------- (defun toromona-annotation-typeface (chroma) "Set the foreground colour for comments. CHROMA Intensity Key used for setting colour of comments ." (message "toromona-annotation-typeface") (let* ( (colors toromona-annotation-chroma) (levels (alist-get (frame-parameter nil 'background-mode) colors)) ) (face-remap-add-relative 'font-lock-comment-face `(:foreground ,(alist-get chroma levels))) ;; delimiter-face inherits from font-lock-comment-face (if (eq 'dark (frame-parameter nil 'background-mode)) (set-face-attribute 'font-lock-comment-delimiter-face nil :foreground "#00FF00") ; for dark theme (set-face-attribute 'font-lock-comment-delimiter-face nil :foreground "#00FFFF") ) ; for light theme (message "toromona: %s Annotation: " chroma)) ) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun toromona-margins (&optional width) "Sets size of window margins. \n WIDTH Number of character cells for two margin areas. WIDTH dafaults to 3, but can be set using the Universal Prefix Argument. \nC-u Width M-x toromona-margins" (interactive) (let ( (width (or width 3)) ) (dolist (window (window-list)) (set-window-margins window width width))) ) ;; ----------------------------------------------------- (defvar emacsbars-enable 1 "Sets the action for enabling or disabling bar modes.") (defun toromona-switch (&optional action) "Enables or disables Emacs Bars M-x toromona-emacsbars RET Activates (enables) emacs bars. C-u M-x toromona-emacsbars RET Deactivates (disables) emacs bars. C-u action M-x toromona-margins Uses value in action to enable or disable." (interactive "P") ;; If action in nil, set action to enable the bar modes (unless action (setq action 1)) (if action (progn ; enables emacs bar modes (menu-bar-mode 1) (tool-bar-mode 1) (scroll-bar-mode 1)) (progn ; disables emacs bar modes (menu-bar-mode -1) (tool-bar-mode -1) (scroll-bar-mode -1)) )) ;; ----------------------------------------------------- (defun toromona-enable () "Use Margined Fullscreen without Emacs Tool Bars" (interactive) (tool-bar-mode -1) ; disable emacs bar modes (scroll-bar-mode -1) (menu-bar-mode -1) (if (one-window-p) (toromona-margins) ; single window (toromona-margins 2)) ; multiple windows (set-frame-parameter (selected-frame) 'fullscreen 'fullboth)) ;; ----------------------------------------------------- (defun toromona-disable () "Disables toromona, enables emacs Tool Bars" (interactive) (menu-bar-mode 1) ; enables emacs bar modes (tool-bar-mode 1) (scroll-bar-mode 1) (toromona-margins 0) (set-frame-parameter (selected-frame) 'fullscreen 'maximised)) ;; ----------------------------------------------------- (defvar toromona-kondor-level 1) (defun toromona-sweep () "Cycles frame-size among default, big, and small." (interactive) (pcase toromona-kondor-level (1 (message "+ Toromona") (toromona-enable) (setq toromona-kondor-level 2)) (2 (message "+ Fullscreen") (toromona-disable) (setq toromona-kondor-level 3)) (3 (message "+ Reduced Size") ;; Turn off fullscreen, then perform a frame resize. (let ( (w (frame-width)) (h (frame-height)) ) (set-frame-parameter (selected-frame) 'fullscreen nil) (set-frame-size nil 75 (1- h))) (setq toromona-kondor-level 1))) ) ;; +++++++++++++++++++++++++++++++++++++++++++++++++++++ (defun toromona-keytrigger () "Set keybinding for changing toromona-recluder mode" (global-unset-key [f11]) (global-set-key (kbd "") 'toromona-sweep) ) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun toromona-launch () "Set keybinding for changing toromona mode" (toromona-keytrigger)) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; _ _ ;; _ __ (_)_ _ ___ _ _ _ __ ___ __| |___ ;; | ' \| | ' \/ _ \ '_| | ' \/ _ \/ _` / -_) ;; |_|_|_|_|_||_\___/_| |_|_|_\___/\__,_\___| ;;;###autoload (define-minor-mode toromona-minor-mode "Colour Brace Marks according to their depth." :lighter " toromona" ; indicator in mode-line (set-face-attribute 'font-lock-comment-face nil :weight (face-attribute 'default :weight)) (when toromona-minor-mode ; evaluates true when mode enabled (set-face-attribute 'default nil :weight 'bold) (toromona-annotation-tools)) ) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;###autoload (defun toromona-minor-mode-enable () "Enable `toromona-minor-mode'." (toromona-minor-mode 1)) ;;;###autoload (defun toromona-minor-mode-disable () "Disable `toromona-minor-mode'." (toromona-minor-mode 0)) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (provide 'toromona) ;; file ends here [toromona.el]