Mercurial > infra > home / .emacs.d/lib/stumpwm-mode.el
changeset 86: |
a86cb552d6df |
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Wed, 21 Aug 2024 20:29:13 -0400 |
permissions: |
-rw-r--r-- |
description: |
stumpwm utils |
1 ;;; stumpwm-mode.el --- special lisp mode for evaluating code into running stumpwm 3 ;; Copyright (C) 2007 Shawn Betts 5 ;; Maintainer: Shawn Betts 6 ;; Keywords: comm, lisp, tools 8 ;; This file is free software; you can redistribute it and/or modify 9 ;; it under the terms of the GNU General Public License as published by 10 ;; the Free Software Foundation; either version 2, or (at your option) 13 ;; This file is distributed in the hope that it will be useful, 14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 ;; GNU General Public License for more details. 18 ;; You should have received a copy of the GNU General Public License 19 ;; along with GNU Emacs; see the file COPYING. If not, see 20 ;; <http://www.gnu.org/licenses/>. 24 ;; load this file, set stumpwm-shell-program to point to stumpish and 25 ;; run M-x stumpwm-mode in your stumpwm lisp files. Now, you can 26 ;; easily eval code into a running stumpwm using the regular bindings. 30 (defvar stumpwm-shell-program "stumpish" 31 "program name, including path if needed, for the stumpish program.") 34 (define-minor-mode stumpwm-mode 35 "add some bindings to eval code into a running stumpwm using stumpish." 38 :keymap (let ((m (make-sparse-keymap))) 39 (define-key m (kbd "C-M-x") 'stumpwm-eval-defun) 40 (define-key m (kbd "C-x C-e") 'stumpwm-eval-last-sexp) 43 (defun stumpwm-eval-region (start end) 45 (let ((s (buffer-substring-no-properties start end))) 48 (call-process stumpwm-shell-program nil (current-buffer) nil 54 (defun stumpwm-eval-defun () 58 (skip-chars-backward " \t\n\r\f") 61 (stumpwm-eval-region (point) end)))) 63 (defun stumpwm-eval-last-sexp () 65 (stumpwm-eval-region (save-excursion (backward-sexp) (point)) (point))) 67 (provide 'stumpwm-mode) 68 ;;; stumpwm-mode.el ends here