# HG changeset patch # User Steve Losh # Date 1578446204 28800 # Node ID 48a26e13c94f9fa5939780f22619ed2674d50186 # Parent ebc3de26327155ca31a787d7168c4594b9ba7cd5 More diff -r ebc3de263271 -r 48a26e13c94f lisp/batchcolor.lisp --- a/lisp/batchcolor.lisp Mon Jan 06 22:56:40 2020 -0800 +++ b/lisp/batchcolor.lisp Tue Jan 07 17:16:44 2020 -0800 @@ -8,7 +8,7 @@ (in-package :batchcolor) ;;;; Configuration ------------------------------------------------------------ -(defparameter *version* "0.0.1") +(defparameter *version* "1.0.0") (defparameter *start* 0) (defun rgb-code (r g b) @@ -97,42 +97,56 @@ ;;;; User Interface ----------------------------------------------------------- -(defparameter *examples* - '(("Colorize IRC nicknames in a chat log:" - . "cat channel.log | batchcolor '<(\\\\w+)>'") - ("Colorize UUIDs in a request log:" - . "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})'"))) +(defmacro defparameters (parameters values-form) + `(progn + ,@(loop :for parameter :in parameters + :collect `(defparameter ,parameter nil)) + (setf (values ,@parameters) ,values-form) + ',parameters)) + +(defun make-boolean-options + (name &key + (name-no (intern (concatenate 'string (string 'no-) (string name)))) + long + (long-no (when long (format nil "no-~A" long))) + short + (short-no (when short (char-upcase short))) + (result-key name) + help + help-no + manual + manual-no + initial-value) + (values (adopt:make-option name + :result-key result-key + :long long + :short short + :help help + :manual manual + :initial-value initial-value + :reduce (constantly t)) + (adopt:make-option name-no + :result-key result-key + :long long-no + :short short-no + :help help-no + :manual manual-no + :reduce (constantly nil)))) -(defparameter *option-randomize* - (adopt:make-option 'randomize +(defparameters (*option-randomize* *option-no-randomize*) + (make-boolean-options 'randomize :help "Randomize the choice of color each run." + :help-no "Do not randomize the choice of color each run (the default)." :long "randomize" - :short #\r - :reduce (constantly t))) + :short #\r)) -(defparameter *option-no-randomize* - (adopt:make-option 'no-randomize - :result-key 'randomize - :help "Do not randomize the choice of color each run (the default)." - :long "no-randomize" - :short #\R - :reduce (constantly nil))) - -(defparameter *option-debug* - (adopt:make-option 'debug - :help "Enable the lisp debugger." +(defparameters (*option-debug* *option-no-debug*) + (make-boolean-options 'debug :long "debug" :short #\d - :reduce (constantly t))) - -(defparameter *option-no-debug* - (adopt:make-option 'no-debug - :result-key 'debug - :help "Disable the lisp debugger (the default)." - :long "no-debug" - :short #\D - :reduce (constantly nil))) + :help "Enable the Lisp debugger." + :help-no "Disable the Lisp debugger (the default).")) (defparameter *option-help* (adopt:make-option 'help @@ -153,6 +167,13 @@ input one line at a time. Each unique match is highlighted in a random ~ color.") +(defparameter *examples* + '(("Colorize IRC nicknames in a chat log:" + . "cat channel.log | batchcolor '<(\\\\w+)>'") + ("Colorize UUIDs in a request log:" + . "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})'"))) + + (defparameter *ui* (adopt:make-interface :name "batchcolor" @@ -183,7 +204,7 @@ (defmacro exit-on-error-unless (expr &body body) `(if ,expr - (progn ,@body) + (progn ,@body) (exit-on-error ,@body))) (defmacro exit-on-ctrl-c (&body body) diff -r ebc3de263271 -r 48a26e13c94f lispwords --- a/lispwords Mon Jan 06 22:56:40 2020 -0800 +++ b/lispwords Tue Jan 07 17:16:44 2020 -0800 @@ -122,7 +122,7 @@ ; adopt (2 define-interface) -(1 make-option) +(1 make-option make-boolean-options) (1 quit-on-ctrl-c) ; boots diff -r ebc3de263271 -r 48a26e13c94f vim/vimrc --- a/vim/vimrc Mon Jan 06 22:56:40 2020 -0800 +++ b/vim/vimrc Tue Jan 07 17:16:44 2020 -0800 @@ -2627,14 +2627,18 @@ " Vlime {{{ +" \ "xref": { +" \ "pos": "float", +" \ "size": 5, +" \ "vertical": v:false +" \ }, let g:vlime_window_settings = { \ "sldb": { \ "pos": "belowright", \ "vertical": v:false \ }, \ "xref": { - \ "pos": "float", - \ "size": 5, + \ "pos": "belowright", \ "vertical": v:false \ }, \ "repl": {