diff options
author | sterni <sternenseemann@systemli.org> | 2021-01-29T17·22+0100 |
---|---|---|
committer | sterni <sternenseemann@systemli.org> | 2021-01-29T17·36+0000 |
commit | 001ee91169c4e25bd3696fc3c69e5151f5547a7f (patch) | |
tree | 05e5c5019d1b0df8e119ab49468a32233b2e46a4 /users/sterni/clhs/clhs-lookup.lisp | |
parent | 1fb5a17f1430840da4990ffa35a04aca96f06d0a (diff) |
feat(users/sterni): move clhs.clhs-lookup to clhs-lookup r/2151
This way ci should pick up on clhs-lookup since only a single derivation is exposed with the default.nix and it is less cumbersome to type the attribute path (users.sterni.clhs.clhs-lookup → users.sterni.clhs-lookup). The exposed CLHS wasn't used for anything anyways and I can always expose it again using passthru or extra if it's ever merged. Change-Id: I6c5aeba1b58ca650700c6efa0913e4b42685ea6b Reviewed-on: https://cl.tvl.fyi/c/depot/+/2461 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'users/sterni/clhs/clhs-lookup.lisp')
-rw-r--r-- | users/sterni/clhs/clhs-lookup.lisp | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/users/sterni/clhs/clhs-lookup.lisp b/users/sterni/clhs/clhs-lookup.lisp deleted file mode 100644 index 0e61dd901f93..000000000000 --- a/users/sterni/clhs/clhs-lookup.lisp +++ /dev/null @@ -1,46 +0,0 @@ -(in-package :clhs-lookup) -(declaim (optimize (safety 3))) - -(defun find-symbols-paths (syms clhs) - "Find pathnames to HyperSpec files describing the listed - symbol names (as strings). Paths are returned in the order - of the symbols given with missing entries removed." - (check-type syms list) - (check-type clhs pathname) - (let* ((data-dir (merge-pathnames "HyperSpec/Data/" clhs)) - (data (merge-pathnames "Map_Sym.txt" data-dir)) - (found (make-hash-table :test #'equal)) - (syms (mapcar #'string-upcase syms))) - (with-open-file (s data :direction :input) - (loop - with missing = syms - for symbol-line = (read-line s nil :eof) - for path-line = (read-line s nil :eof) - until (or (eq symbol-line :eof) - (eq path-line :eof) - (null missing)) - for pos = (position symbol-line missing :test #'equal) - when pos - do (progn - (delete symbol-line missing) - (setf (gethash symbol-line found) path-line))) - ; TODO(sterni): get rid of Data/../ in path - (mapcar - (lambda (x) (merge-pathnames x data-dir)) - (remove nil - (mapcar (lambda (x) (gethash x found)) syms)))))) - -(defun main () - (let* ((browser (or (uiop:getenvp "BROWSER") "xdg-open")) - (args (uiop:command-line-arguments)) - (prin (member "--print" args :test #'equal)) - (syms (remove-if (lambda (x) (eq (char x 0) #\-)) args)) - (paths (find-symbols-paths syms *clhs-path*))) - (if (null paths) - (uiop:quit 1) - (dolist (p paths) - (if prin - (format t "~A~%" p) - (uiop:launch-program - (format nil "~A ~A" browser p) - :force-shell t)))))) |