# HG changeset patch # User Steve Losh # Date 1622066104 14400 # Node ID cebefea75bfdd93c238e110841dddd3b6a3e65b5 # Parent 56c21532b9433f3226e80edfb4ebf55f3c36cd8d# Parent 3400347c28319d40e7fdbd0ad91cfe2752a75b26 Merge diff -r 56c21532b943 -r cebefea75bfd bin/pf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/pf Wed May 26 17:55:04 2021 -0400 @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -euo pipefail + +P="$1" +F=$(basename "$P") + +scp "$P" paste.stevelosh.com:"/var/www/paste/$F" +URL="https://paste.stevelosh.com/$F" + +echo -n "$URL" | pbcopy +echo "Copied $URL to the clipboard." diff -r 56c21532b943 -r cebefea75bfd bin/sbcl-raw --- a/bin/sbcl-raw Wed May 26 17:54:02 2021 -0400 +++ b/bin/sbcl-raw Wed May 26 17:55:04 2021 -0400 @@ -2,7 +2,4 @@ set -e -rlwrap --quote-characters '' \ - --histsize 1000 \ - --history-filename "$HOME/.rlwrap-lisp-history" \ - /usr/local/bin/sbcl --noinform "$@" +/usr/local/bin/sbcl --noinform "$@" diff -r 56c21532b943 -r cebefea75bfd lisp/Makefile --- a/lisp/Makefile Wed May 26 17:54:02 2021 -0400 +++ b/lisp/Makefile Wed May 26 17:55:04 2021 -0400 @@ -1,4 +1,4 @@ -files := $(shell ls *.lisp) +files := $(wildcard *.lisp) names := $(files:.lisp=) .PHONY: all clean $(names) @@ -7,14 +7,14 @@ $(names): %: bin/% man/man1/%.1 -bin/%: %.lisp build-binary +bin/%: %.lisp build-binary.sh Makefile mkdir -p bin - ./build-binary $< + ./build-binary.sh $< mv $(@F) bin/ -man/man1/%.1: %.lisp build-manual +man/man1/%.1: %.lisp build-manual.sh Makefile mkdir -p man/man1 - ./build-manual $< + ./build-manual.sh $< mv $(@F) man/man1/ clean: diff -r 56c21532b943 -r cebefea75bfd lisp/batchcolor.lisp --- a/lisp/batchcolor.lisp Wed May 26 17:54:02 2021 -0400 +++ b/lisp/batchcolor.lisp Wed May 26 17:55:04 2021 -0400 @@ -8,34 +8,8 @@ (in-package :batchcolor) ;;;; Configuration ------------------------------------------------------------ -(defparameter *version* "1.0.0") (defparameter *start* 0) (defparameter *dark* t) -(defparameter *only-matching* nil) - - -;;;; Colors ------------------------------------------------------------------- -(defun rgb-code (r g b) - ;; The 256 color mode color values are essentially r/g/b in base 6, but - ;; shifted 16 higher to account for the intiial 8+8 colors. - (+ (* r 36) - (* g 6) - (* b 1) - 16)) - -(defun make-colors (excludep) - (let ((result (make-array 256 :fill-pointer 0))) - (dotimes (r 6) - (dotimes (g 6) - (dotimes (b 6) - (unless (funcall excludep (+ r g b)) - (vector-push-extend (rgb-code r g b) result))))) - result)) - -(defparameter *dark-colors* (make-colors (lambda (v) (< v 3)))) -(defparameter *light-colors* (make-colors (lambda (v) (> v 11)))) - -(defparameter *explicits* (make-hash-table :test #'equal)) ;;;; Errors ------------------------------------------------------------------- @@ -60,6 +34,29 @@ ;;;; Functionality ------------------------------------------------------------ +(defun rgb-code (r g b) + ;; The 256 color mode color values are essentially r/g/b in base 6, but + ;; shifted 16 higher to account for the intiial 8+8 colors. + (+ (* r 36) + (* g 6) + (* b 1) + 16)) + +(defun make-colors (excludep) + (let ((result (make-array 256 :fill-pointer 0))) + (dotimes (r 6) + (dotimes (g 6) + (dotimes (b 6) + (unless (funcall excludep (+ r g b)) + (vector-push-extend (rgb-code r g b) result))))) + result)) + +(defparameter *dark-colors* (make-colors (lambda (v) (< v 3)))) +(defparameter *light-colors* (make-colors (lambda (v) (> v 11)))) + +(defparameter *explicits* (make-hash-table :test #'equal)) + + (defun djb2 (string) ;; http://www.cse.yorku.ca/~oz/hash.html (reduce (lambda (hash c) @@ -101,8 +98,7 @@ (print-colorized (subseq line word-start word-end)) (setf start word-end)) starts ends))) - (unless (and (zerop start) *only-matching*) - (write-line line *standard-output* :start start)) + (write-line line *standard-output* :start start) (values)) @@ -156,13 +152,6 @@ :help-no "Optimize for light terminals." :initial-value t)) -(adopt:defparameters (*option-only-matching* *option-no-only-matching*) - (adopt:make-boolean-options 'only-matching - :long "only-matching" - :long-no "all-lines" - :short #\o - :help "Only print lines with at least one match." - :help-no "Print all lines, even if they don't have any matches (the default).")) (defparameter *option-explicit* (adopt:make-option 'explicit @@ -185,12 +174,6 @@ :short #\h :reduce (constantly t))) -(defparameter *option-version* - (adopt:make-option 'version - :help "Display version information and exit." - :long "version" - :reduce (constantly t))) - (adopt:define-string *help-text* "batchcolor takes a regular expression and matches it against standard ~ @@ -219,8 +202,8 @@ . "tail -f /var/log/foo | batchcolor '[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}'") ("Colorize some keywords explicitly and IPv4 addresses randomly (note that the keywords have to be in the main regex too, not just in the -e options):" . "batchcolor 'WARN|INFO|ERR|(?:[0-9]{1,3}\\\\.){3}[0-9]{1,3}' -e '5,0,0:ERR' -e '5,4,0:WARN' -e '2,2,5:INFO' foo.log") - ("Colorize earmuffed symbols in a Lisp file, only printing lines with at least one such symbol:" - . "batchcolor --only-matching '(?:^|[^*])([*][-a-zA-Z0-9]+[*])(?:$|[^*])' tests/test.lisp"))) + ("Colorize earmuffed symbols in a Lisp file:" + . "batchcolor '(?:^|[^*])([*][-a-zA-Z0-9]+[*])(?:$|[^*])' tests/test.lisp"))) (defparameter *ui* @@ -229,11 +212,10 @@ :usage "[OPTIONS] REGEX [FILE...]" :summary "colorize regex matches in batches" :help *help-text* - :manual (concatenate 'string *help-text* (format nil "~2%") *extra-manual-text*) + :manual (format nil "~A~2%~A" *help-text* *extra-manual-text*) :examples *examples* :contents (list *option-help* - *option-version* *option-debug* *option-no-debug* (adopt:make-group 'color-options @@ -242,11 +224,7 @@ *option-no-randomize* *option-dark* *option-light* - *option-explicit*)) - (adopt:make-group 'output-options - :title "Output Options" - :options (list *option-only-matching* - *option-no-only-matching*))))) + *option-explicit*))))) (defmacro exit-on-ctrl-c (&body body) @@ -259,8 +237,7 @@ (setf *start* (if (gethash 'randomize options) (random 256 (make-random-state t)) 0) - *dark* (gethash 'dark options) - *only-matching* (gethash 'only-matching options))) + *dark* (gethash 'dark options))) (defun toplevel () (sb-ext:disable-debugger) @@ -271,7 +248,6 @@ (handler-case (cond ((gethash 'help options) (adopt:print-help-and-exit *ui*)) - ((gethash 'version options) (write-line *version*) (adopt:exit)) ((null arguments) (error 'missing-regex)) (t (destructuring-bind (pattern . files) arguments (configure options) diff -r 56c21532b943 -r cebefea75bfd lisp/build-binary --- a/lisp/build-binary Wed May 26 17:54:02 2021 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -LISP=$1 -BINARY=$(basename "$1" .lisp) -shift - -sbcl --load "$LISP" --eval "(sb-ext:save-lisp-and-die \"$BINARY\" :executable t :save-runtime-options t :toplevel '$BINARY:toplevel)" "$@" diff -r 56c21532b943 -r cebefea75bfd lisp/build-binary.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lisp/build-binary.sh Wed May 26 17:55:04 2021 -0400 @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -euo pipefail + +LISP=$1 +NAME=$(basename "$1" .lisp) +shift + +sbcl --load "$LISP" \ + --eval "(sb-ext:save-lisp-and-die \"$NAME\" + :executable t + :save-runtime-options t + :toplevel '$NAME:toplevel)" diff -r 56c21532b943 -r cebefea75bfd lisp/build-manual --- a/lisp/build-manual Wed May 26 17:54:02 2021 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -LISP=$1 -NAME=$(basename "$LISP" .lisp) -OUT="$NAME.1" -shift - -sbcl --disable-debugger --load "$LISP" --eval "(with-open-file (f \"$OUT\" :direction :output :if-exists :supersede) (adopt:print-manual $NAME:*ui* :stream f))" --quit "$@" diff -r 56c21532b943 -r cebefea75bfd lisp/build-manual.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lisp/build-manual.sh Wed May 26 17:55:04 2021 -0400 @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -euo pipefail + +LISP=$1 +NAME=$(basename "$LISP" .lisp) +OUT="$NAME.1" +shift + +sbcl --load "$LISP" \ + --eval "(with-open-file (f \"$OUT\" :direction :output :if-exists :supersede) + (adopt:print-manual $NAME:*ui* :stream f))" \ + --quit diff -r 56c21532b943 -r cebefea75bfd lispwords --- a/lispwords Wed May 26 17:54:02 2021 -0400 +++ b/lispwords Wed May 26 17:55:04 2021 -0400 @@ -54,7 +54,7 @@ (2 defsketch) ; sbcl -(1 with-profiling) +(1 with-profiling save-lisp-and-die) ; policy-cond (1 policy-if) @@ -138,3 +138,5 @@ (1 dovec) (1 dolist) +; boots +(1 event-case) diff -r 56c21532b943 -r cebefea75bfd vim/custom-dictionary.utf-8.add --- a/vim/custom-dictionary.utf-8.add Wed May 26 17:54:02 2021 -0400 +++ b/vim/custom-dictionary.utf-8.add Wed May 26 17:55:04 2021 -0400 @@ -312,3 +312,5 @@ lifecycle unapplied reimplementations +UUIDs +metaclass