From ab65e9d5cd1165d7213fdf3295ddbabb481766ff Mon Sep 17 00:00:00 2001 From: jao Date: Thu, 29 Sep 2022 00:09:53 +0100 Subject: attic --- attic/elisp/misc.el | 97 ++++++++++++++++++++++++++++++++++++++++++++ init.el | 113 ++-------------------------------------------------- 2 files changed, 100 insertions(+), 110 deletions(-) diff --git a/attic/elisp/misc.el b/attic/elisp/misc.el index 3c9a7b8..12da196 100644 --- a/attic/elisp/misc.el +++ b/attic/elisp/misc.el @@ -1,5 +1,74 @@ ;; -*- lexical-binding: t; -*- +;;; programming languages +;;;; Erlang +(use-package erlang + :ensure t + :custom ((inferior-erlang-machine-options '("shell")) + (inferior-erlang-machine "rebar3") + (inferior-erlang-shell-type nil) + (erlang-indent-level 4)) + + ;; :bind (:map erlang-mode-map (("C-c C-z" . jao-vterm-repl-pop-to-repl))) + + :init + ;; (require 'jao-vterm-repl) + ;; (add-to-list 'auto-mode-alist '("^rebar\\.config\\`" . erlang-mode)) + ;; (jao-vterm-repl-register "rebar.config" "rebar3 shell" "^[0-9]+> ") + + :config + ;; (defun jao-erlang-current-module () + ;; (when (save-excursion (goto-char (point-min)) + ;; (re-search-forward "^-module(\\([^)]+\\))" nil t)) + ;; (match-string-no-properties 1))) + + ;; (defun jao-erlang-compile (arg) + ;; (interactive "P") + ;; (save-some-buffers) + ;; (when-let ((mname (jao-erlang-current-module))) + ;; (with-current-buffer (jao-vterm-repl) + ;; (vterm-send-string (format "c(%s).\n" mname)) + ;; (sit-for 0) + ;; (setq compilation-last-buffer (current-buffer)) + ;; (when arg (jao-vterm-repl-pop-to-repl))))) + + ;; (setq erlang-shell-function #'jao-vterm-repl + ;; erlang-shell-display-function #'jao-vterm-repl-pop-to-repl + ;; erlang-compile-function #'jao-erlang-compile) + ) +;;;; Idris +(use-package idris-mode + :ensure t + :custom ((idris-interpreter-path "idris2") + (idris-pretty-printer-width 80) + (idris-repl-history-file "~/.emacs.d/cache/idris-history.eld") + (idris-stay-in-current-window-on-compiler-error t))) +(jao-define-attached-buffer "^\\*idris.*") + +;;; vterm +(use-package vterm + :ensure t + :demand t + :commands (vterm vterm-mode) + :init (setq vterm-kill-buffer-on-exit t + vterm-copy-exclude-prompt t + jao-use-vterm t) + :config + + (defun jao-vterm-send-C-c () (interactive) (vterm-send-key "c" nil nil t)) + + (jao-define-attached-buffer "\\*vterm\\*" 0.5) + + :bind (:map vterm-mode-map ("C-c C-c" . jao-vterm-send-C-c))) + +(defun jao-exec-in-vterm (cmd bname) + (if (string-blank-p (or cmd "")) + (vterm) + (let ((vterm-shell cmd) + (vterm-kill-buffer-on-exit t) + (buff (generate-new-buffer bname))) + (switch-to-buffer buff) + (vterm-mode)))) ;;; ace window (use-package ace-window :ensure t @@ -570,6 +639,34 @@ (add-to-list 'browse-url-handlers '("^\\(gemini\\|gopher\\)://.*" . jao-elpher--browse)) +;;; fontsets +(defun jao--set-fontsets (_f) + (when (and (display-graphic-p) (fboundp 'set-fontset-font)) + (set-fontset-font t 64257 "Quivira" nil) + (set-fontset-font t 'egyptian "Noto Sans Egyptian Hieroglyphs" nil) + (set-fontset-font t 'hangul "NanumGothicCoding" nil) + (set-fontset-font t 'unicode (face-attribute 'default :family) nil) + (set-fontset-font t 'unicode-bmp (face-attribute 'default :family) nil) + (set-fontset-font t 'symbol "Symbola-10" nil) + (set-fontset-font t 'greek "GFS Didot" nil) + (set-fontset-font t 'mathematical "FreeSerif" nil) + (set-fontset-font t 'emoji "Noto Color Emoji" nil) + ;; boxes + (set-fontset-font t '(9472 . 9599) "Source Code Pro" nil) + ;; variation selector-16 + (set-fontset-font t 65039 "BabelStone Modern-1" nil))) + +(jao--set-fontsets nil) +(add-to-list 'after-make-frame-functions 'jao--set-fontsets) + +;;; eshell history completion to allow !$ +;; This is done by advising eshell-history-reference to expand !$ +;; into !!:$ which works... +(defadvice jao-eshell-history-reference (before ben-fix-eshell-history) + "Fixes eshell history to allow !$ as abbreviation for !!:$" + (when (string= (ad-get-arg 0) "!$") (ad-set-arg 0 "!!:$"))) +(ad-activate 'jao-eshell-history-reference) +(add-hook 'eshell-expand-input-functions #'eshell-expand-history-references) ;;; snippets (defun jao-sway-run-or-focus-tidal () (interactive) diff --git a/init.el b/init.el index 05b6ffb..8682275 100644 --- a/init.el +++ b/init.el @@ -317,26 +317,6 @@ widget-push-button-prefix "" widget-push-button-suffix "") -;;;; fontsets -(defun jao--set-fontsets (_f) - (when (and (display-graphic-p) (fboundp 'set-fontset-font)) - (set-fontset-font t 64257 "Quivira" nil) - (set-fontset-font t 'egyptian "Noto Sans Egyptian Hieroglyphs" nil) - (set-fontset-font t 'hangul "NanumGothicCoding" nil) - (set-fontset-font t 'unicode (face-attribute 'default :family) nil) - (set-fontset-font t 'unicode-bmp (face-attribute 'default :family) nil) - (set-fontset-font t 'symbol "Symbola-10" nil) - (set-fontset-font t 'greek "GFS Didot" nil) - (set-fontset-font t 'mathematical "FreeSerif" nil) - (set-fontset-font t 'emoji "Noto Color Emoji" nil) - ;; boxes - (set-fontset-font t '(9472 . 9599) "Source Code Pro" nil) - ;; variation selector-16 - (set-fontset-font t 65039 "BabelStone Modern-1" nil))) - -(jao--set-fontsets nil) -(add-to-list 'after-make-frame-functions 'jao--set-fontsets) - ;;;; nobreak char display (setq nobreak-char-display nil) @@ -503,6 +483,7 @@ display-time-24hr-format nil display-time-default-load-average nil display-time-format " %a %e %H:%M") + ;;;; mode line toggle (use-package jao-mode-line :init @@ -513,6 +494,7 @@ :bind (("" . jao-mode-line-toggle-inactive) ("" . jao-mode-line-toggle) ("" . jao-mode-line-echo))) + ;;;; diminish (use-package diminish :ensure t @@ -895,10 +877,6 @@ (jao-define-attached-buffer "\\*eldoc\\( .*\\)?\\*" 0.33) -;;;; images -(setq image-use-external-converter t) -(setq widget-image-enable nil) - ;;;; same mode (defun jao-buffer-same-mode (&optional mode pre-fn switch-fn) (interactive) @@ -1653,34 +1631,8 @@ ;; translates ANSI colors into text-properties, for eshell (autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t) (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) - -;;;; vterm (defvar jao-use-vterm nil) -(use-package vterm - :ensure t - :demand t - :commands (vterm vterm-mode) - :init (setq vterm-kill-buffer-on-exit t - vterm-copy-exclude-prompt t - jao-use-vterm t) - :config - - (defun jao-vterm-send-C-c () (interactive) (vterm-send-key "c" nil nil t)) - - (jao-define-attached-buffer "\\*vterm\\*" 0.5) - - :bind (:map vterm-mode-map ("C-c C-c" . jao-vterm-send-C-c))) - -(defun jao-exec-in-vterm (cmd bname) - (if (string-blank-p (or cmd "")) - (vterm) - (let ((vterm-shell cmd) - (vterm-kill-buffer-on-exit t) - (buff (generate-new-buffer bname))) - (switch-to-buffer buff) - (vterm-mode)))) - ;;;; term (defvar-local jao-term--cmd nil) @@ -1692,7 +1644,7 @@ (buffer-list))) (defun jao-exec-in-term (cmd &optional name) - (if jao-use-vterm + (if (and jao-use-vterm (fboundp 'jao-exec-in-vterm)) (jao-exec-in-vterm cmd name) (ansi-term "bash" name) (set-process-sentinel (get-buffer-process (current-buffer)) @@ -1750,9 +1702,6 @@ eshell-destroy-buffer-when-process-dies nil eshell-escape-control-x t) -;; (use-package eshell-vterm :ensure t) -;; (when jao-use-vterm (eshell-vterm-mode)) - ;;;;; bol (defun jao-eshell-maybe-bol () (interactive) @@ -1831,15 +1780,6 @@ ;;;;; history (setq eshell-history-size 10000) -;;;;; fix eshell history completion to allow !$ -;; This is done by advising eshell-history-reference to expand !$ -;; into !!:$ which works... -(defadvice jao-eshell-history-reference (before ben-fix-eshell-history) - "Fixes eshell history to allow !$ as abbreviation for !!:$" - (when (string= (ad-get-arg 0) "!$") (ad-set-arg 0 "!!:$"))) -(ad-activate 'jao-eshell-history-reference) - -(add-hook 'eshell-expand-input-functions #'eshell-expand-history-references) ;;;;; toggle (use-package jao-eshell-here @@ -2190,53 +2130,6 @@ ("M-," . pop-tag-mark) ("C-c <" . lc-show-package-summary)))) -;;;; Erlang -(use-package erlang - :disabled t - :ensure t - :custom ((inferior-erlang-machine-options '("shell")) - (inferior-erlang-machine "rebar3") - (inferior-erlang-shell-type nil) - (erlang-indent-level 4)) - - ;; :bind (:map erlang-mode-map (("C-c C-z" . jao-vterm-repl-pop-to-repl))) - - :init - ;; (require 'jao-vterm-repl) - ;; (add-to-list 'auto-mode-alist '("^rebar\\.config\\`" . erlang-mode)) - ;; (jao-vterm-repl-register "rebar.config" "rebar3 shell" "^[0-9]+> ") - - :config - ;; (defun jao-erlang-current-module () - ;; (when (save-excursion (goto-char (point-min)) - ;; (re-search-forward "^-module(\\([^)]+\\))" nil t)) - ;; (match-string-no-properties 1))) - - ;; (defun jao-erlang-compile (arg) - ;; (interactive "P") - ;; (save-some-buffers) - ;; (when-let ((mname (jao-erlang-current-module))) - ;; (with-current-buffer (jao-vterm-repl) - ;; (vterm-send-string (format "c(%s).\n" mname)) - ;; (sit-for 0) - ;; (setq compilation-last-buffer (current-buffer)) - ;; (when arg (jao-vterm-repl-pop-to-repl))))) - - ;; (setq erlang-shell-function #'jao-vterm-repl - ;; erlang-shell-display-function #'jao-vterm-repl-pop-to-repl - ;; erlang-compile-function #'jao-erlang-compile) - ) - -;;;; Idris -(use-package idris-mode - :disabled t - :ensure t - :custom ((idris-interpreter-path "idris2") - (idris-pretty-printer-width 80) - (idris-repl-history-file "~/.emacs.d/cache/idris-history.eld") - (idris-stay-in-current-window-on-compiler-error t))) -(jao-define-attached-buffer "^\\*idris.*") - ;;;; Clojure (use-package clojure-mode :ensure t -- cgit v1.2.3