# HG changeset patch # User Richard Westhaver # Date 1724286553 14400 # Node ID a86cb552d6df0f5bfd09978c71352b441a3afceb # Parent 862659891933d80135c84940cab910d94ad34052 stumpwm utils diff -r 862659891933 -r a86cb552d6df .emacs.d/ellis.el --- a/.emacs.d/ellis.el Thu Aug 15 21:53:06 2024 -0400 +++ b/.emacs.d/ellis.el Wed Aug 21 20:29:13 2024 -0400 @@ -1,4 +1,4 @@ -;;; ellis.el --- Richard's custom Emacs config -*- lexical-binding: t -*- +;;; ellis.el --- user Emacs config -*- lexical-binding: t -*- ;; Copyright (C) 2024 @@ -81,12 +81,15 @@ (keymap-set minibuffer-local-map "C-" #'hippie-expand) (keymap-set ctl-x-x-map "p p" #'remember-project) (keymap-set ctl-x-x-map "p l" #'remember-lab-projects) +(keymap-set ctl-x-x-map "p c" #'remember-comp-projects) (add-hook 'prog-mode-hook #'skel-minor-mode) (add-hook 'org-mode-hook #'skel-minor-mode) ;; (add-hook 'prog-mode-hook #'company-mode) (add-hook 'notmuch-message-mode-hook #'turn-on-orgtbl) +( +ouse-package ef-themes :ensure t) (use-package markdown-mode :ensure t) @@ -742,18 +745,11 @@ (auto-insert-mode t) (keymap-set skel-minor-mode-map "C-" 'company-tempo)) -;;; dictionary -;; requires dictd server running -(setq dictionary-server "compiler.company") -;;; ispell -;; requires aspell and a hunspell dictionary (hunspell-en_us) -(setq-default ispell-program-name "aspell") -(add-hook 'mail-send-hook #'ispell-message) ;;; glossary -(with-eval-after-load 'org-glossary - (setq org-glossary-collection-root (join-paths company-source-directory "org/meta/")) - (cl-pushnew '("Terms" . glossary) org-glossary-headings) - (cl-pushnew '("Acronyms" . acronym) org-glossary-headings)) +;; (with-eval-after-load 'org-glossary +;; (setq org-glossary-collection-root (join-paths company-source-directory "org/meta/")) +;; (cl-pushnew '("Terms" . glossary) org-glossary-headings) +;; (cl-pushnew '("Acronyms" . acronym) org-glossary-headings)) (provide 'ellis) -;;; ellis.el ends here +;; ellis.el ends here diff -r 862659891933 -r a86cb552d6df .emacs.d/lib/stumpwm-mode.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.emacs.d/lib/stumpwm-mode.el Wed Aug 21 20:29:13 2024 -0400 @@ -0,0 +1,68 @@ +;;; stumpwm-mode.el --- special lisp mode for evaluating code into running stumpwm + +;; Copyright (C) 2007 Shawn Betts + +;; Maintainer: Shawn Betts +;; Keywords: comm, lisp, tools + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, see +;; . + +;;; Commentary: + +;; load this file, set stumpwm-shell-program to point to stumpish and +;; run M-x stumpwm-mode in your stumpwm lisp files. Now, you can +;; easily eval code into a running stumpwm using the regular bindings. + +;;; Code: + +(defvar stumpwm-shell-program "stumpish" + "program name, including path if needed, for the stumpish program.") + +;;;###autoload +(define-minor-mode stumpwm-mode + "add some bindings to eval code into a running stumpwm using stumpish." + :global nil + :lighter " StumpWM" + :keymap (let ((m (make-sparse-keymap))) + (define-key m (kbd "C-M-x") 'stumpwm-eval-defun) + (define-key m (kbd "C-x C-e") 'stumpwm-eval-last-sexp) + m)) + +(defun stumpwm-eval-region (start end) + (interactive "r") + (let ((s (buffer-substring-no-properties start end))) + (message "%s" + (with-temp-buffer + (call-process stumpwm-shell-program nil (current-buffer) nil + "eval" + s) + (delete-char -1) + (buffer-string))))) + +(defun stumpwm-eval-defun () + (interactive) + (save-excursion + (end-of-defun) + (skip-chars-backward " \t\n\r\f") + (let ((end (point))) + (beginning-of-defun) + (stumpwm-eval-region (point) end)))) + +(defun stumpwm-eval-last-sexp () + (interactive) + (stumpwm-eval-region (save-excursion (backward-sexp) (point)) (point))) + +(provide 'stumpwm-mode) +;;; stumpwm-mode.el ends here diff -r 862659891933 -r a86cb552d6df .emacs.d/lib/stumpwm-utils.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.emacs.d/lib/stumpwm-utils.el Wed Aug 21 20:29:13 2024 -0400 @@ -0,0 +1,79 @@ +(defun stumpwm-connect () + "Start slime and connect to the lisp image that is running the + swank server. Must have \"(require 'swank) + (swank:create-server)\" in your .stumpwmrc " + (interactive) + (slime-connect "127.0.0.1" 4005) + (with-current-buffer (current-buffer) + (rename-buffer "*sbcl-stumpwm-repl*") + (slime-eval '(in-package :stumpwm)))) + +(defun stumpwm-disconnect () + "Disconnects from the swank server currently open." + (with-current-buffer + (switch-to-buffer "*sbcl-stumpwm-repl*") + (slime-disconnect))) +;;Lifted (with stylistic changes) from http://www.emacswiki.org/emacs/EmacsAsDaemon#toc9 +(defun modified-buffers-exist () + "This function will check to see if there are any buffers +that have been modified. It will return true if there are +and nil otherwise. Buffers that have buffer-offer-save set to +nil are ignored." + (let (modified-found) + (dolist (buffer (buffer-list)) + (when (and (buffer-live-p buffer) + (buffer-modified-p buffer) + (not (buffer-base-buffer buffer)) + (or + (buffer-file-name buffer) + (progn + (set-buffer buffer) + (and buffer-offer-save (> (buffer-size) 0))))) + (setq modified-found t))) + modified-found)) + +(defun stumpwm-daemon-shutdown-emacs (&optional display) + " This is a function that can bu used to shutdown save buffers and +shutdown the emacs daemon. It should be called using +emacsclient -e '(stumpwm-daemon-shutdown-emacs)'. This function will +check to see if there are any modified buffers or active clients +or frame. If so an x window will be opened and the user will +be prompted." + + (let (new-frame modified-buffers active-clients-or-frames) + ; Check if there are modified buffers or active clients or frames. + (setq modified-buffers (modified-buffers-exist)) + (setq active-clients-or-frames ( or (> (length server-clients) 1) + (> (length (frame-list)) 1))) + ; Create a new frame if prompts are needed. + (when (or modified-buffers active-clients-or-frames) + (when (not (eq window-system 'x)) + (message "Initializing x windows system.") + (x-initialize-window-system)) + (when (not display) (setq display (getenv "DISPLAY"))) + (message "Opening frame on display: %s" display) + (select-frame (make-frame-on-display display '((window-system . x))))) + ; Save the current frame. + (setq new-frame (selected-frame)) + ; When displaying the number of clients and frames: + ; subtract 1 from the clients for this client. + ; subtract 2 from the frames this frame (that we just created) and the default frame. + (when ( or (not active-clients-or-frames) + (yes-or-no-p (format "There are currently %d clients and %d frames. Exit anyway?" + (- (length server-clients) 1) (- (length (frame-list)) 2)))) + ; If the user quits during the save dialog then don't exit emacs. + ; Still close the terminal though. + (let((inhibit-quit t)) + ; Save buffers + (with-local-quit + (save-some-buffers)) + (if quit-flag + (setq quit-flag nil) + ; Kill all remaining clients + (progn + (dolist (client server-clients) + (server-delete-client client)) + ; Exit emacs + (kill-emacs))))) + ; If we made a frame then kill it. + (when (or modified-buffers active-clients-or-frames) (delete-frame new-frame)))) diff -r 862659891933 -r a86cb552d6df .stumpwm.d/init.lisp --- a/.stumpwm.d/init.lisp Thu Aug 15 21:53:06 2024 -0400 +++ b/.stumpwm.d/init.lisp Wed Aug 21 20:29:13 2024 -0400 @@ -2,13 +2,7 @@ (in-package :stumpwm) -;; (ql:quickload :swank) -;; (require :swank) - -;; (defvar *stumpwm-port* 4040) -;; (swank-loader:init) -;; (swank:create-server :port *stumpwm-port* -;; :style swank:*communication-style*) +(stumpwm:set-prefix-key (kbd "s-SPC")) (defcommand load-std () () (ql:quickload :std)) @@ -26,10 +20,23 @@ *float-window-modifier* :SUPER *startup-message* "Greetings, stranger.") -(set-font "-*-terminal") -(set-module-dir "/usr/share/stupmwm/contrib/") +(set-module-dir "~/.stumpwm.d/contrib") (init-load-path *module-dir*) +(ql:quickload :clx-truetype) +(load-module "ttf-fonts") +(xft:cache-fonts) +(set-font (make-instance 'xft:font + :family "Mononoki Nerd Font" + :subfamily "Regular" + :size 12)) + +(load-module "swm-golden-ratio") +(unless swm-golden-ratio:*golden-ratio-on* + (swm-golden-ratio:toggle-golden-ratio)) + +(load-module "stumptray") + (set-fg-color "#ffffff") (set-bg-color "#000000") (set-border-color "#7E5D90") @@ -60,15 +67,15 @@ (set-transient-gravity :center) (setf *time-modeline-string* "%a %b %e %k:%M") -(setq *mode-line-timeout* 4) -(which-key-mode) +(setq *mode-line-timeout* 4)( +which-key-mode) (when *initializing* (run-shell-command "sh ~/.fehbg") (when (equal (machine-instance) "zor") (run-shell-command "sh ~/.screenlayout/default.sh")) - (dolist (s stumpwm:*screen-list*) - (enable-mode-line s (car (screen-heads s)) t))) + (dolist (h (screen-heads (current-screen))) + (enable-mode-line (current-screen) h t))) (defcommand term (&optional program) () (sb-thread:make-thread @@ -87,4 +94,7 @@ (lambda () (run-shell-command "chromium")))) +(defcommand emacsclient () () + (run-shell-command "emacsclient -c -a=")) + (define-key *root-map* (kbd "c") "term")