Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #47

Merged
merged 130 commits into from
Jul 22, 2024
Merged

Dev #47

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
e690a15
wip: add css for highlighting code
fstamour Oct 23, 2023
3c8660b
fix .envrc
fstamour Oct 23, 2023
71d2708
fix pattern iterators
fstamour Oct 30, 2023
3a4dd5a
add tests on pattern:match
fstamour Oct 30, 2023
547c24a
patterns:match : make it possible to use a ref directly as a pattern
fstamour Oct 30, 2023
ecb61fe
pattern: implement matching :maybe
fstamour Oct 31, 2023
e98a75a
pattern: implement matching for :alternation
fstamour Oct 31, 2023
cacef66
pattern: WIP implement matching for :zero-or-more
fstamour Oct 31, 2023
8000bcc
notes: add example of structural editing
fstamour Nov 24, 2023
d72d79e
ci: add .gitlab-ci.yml
fstamour Nov 24, 2023
aa57344
ci: WIP add jobs to test on other implementations
fstamour Nov 24, 2023
924abc5
ci: add job to generate documentation
fstamour Nov 24, 2023
36a7a8a
ci: use a "matrix" to test different implementations
fstamour Nov 24, 2023
fff5ff9
readme: replace link to github by links to gitlab
fstamour Nov 24, 2023
c363145
ci: WIP add job to run the emacs "demo" (integration test)
fstamour Nov 24, 2023
dae91e0
ci: make it possible to release pages from other pipelines
fstamour Nov 24, 2023
6f5523c
doc: explode notes.org in smaller files
fstamour Nov 24, 2023
a848309
move code out of scratch/report.lisp; and out of utils.lisp
fstamour Aug 27, 2023
9222607
scracth: improve report.lisp again
fstamour Aug 27, 2023
dfee352
lossless-reader: split "at" into "at" and "at="
fstamour Aug 27, 2023
0473de6
WIP doc: reduce deps; use emacs to export org-mode files
fstamour Nov 27, 2023
9f7e4e1
notes
fstamour Dec 13, 2023
b6bff93
#48 inspector: first try at improving slime's inspector (place form)
fstamour Dec 13, 2023
be1964e
notes
fstamour Dec 14, 2023
1a603ad
wip: add scratch-files/erts-files.lisp
fstamour Dec 14, 2023
cc2ba81
clean up; erts-file -> test-file
fstamour Dec 14, 2023
30e5769
wip integrating "test-file.lisp" into breeze
fstamour Dec 14, 2023
67c0456
notes
fstamour Dec 16, 2023
0a16505
add scratch-files/fancy-emacs-buffers.el
fstamour Dec 16, 2023
01dea21
notes and small tweaks (mostly notes)
fstamour Dec 21, 2023
dde5874
shed dependencies and dead code
fstamour Dec 24, 2023
8a0f6ab
notes
fstamour Dec 24, 2023
57686c4
get rid of the dependency "str"
fstamour Dec 24, 2023
41c4cb8
rm unused dependencies trivial-{package-local-nicknames,features}
fstamour Dec 24, 2023
9c81dab
big cleanup of breeze.el; dynamically define editor commands
fstamour Dec 26, 2023
f5415b6
fix: able to call commands with arguments without providing them
fstamour Jan 1, 2024
1e4ebbc
emacs: add tests on emacs' side
fstamour Jan 1, 2024
02e18ce
ci(gitlab): make the jobs manual only
fstamour Jan 3, 2024
2660ed1
lossless-reader: add minimal handling of sharpsign reader macros
fstamour Jan 5, 2024
cced751
notes: add some more poc tests for structural editing
fstamour Jan 5, 2024
97829f2
add syntax highlight to the html code listing
fstamour Jan 5, 2024
f945317
WIP refactor read-sharpsign-dispatching-reader-macro
fstamour Jan 5, 2024
f462cbb
reader: improve test failure reports; fix more #-readers
fstamour Jan 7, 2024
a4558f3
reader: implement read-sharpsign-c
fstamour Jan 8, 2024
b7a945f
reader: implement read-sharpsign-a
fstamour Jan 8, 2024
8de9a3f
implement read-sharpsign-{s,p,equal,sharpsign,+,-}
fstamour Jan 10, 2024
f89d50e
remove wip and obsolete command-to-emacs-lisp
fstamour Jan 10, 2024
ae045c8
wip: start to implement code formatting
fstamour Jan 10, 2024
d0625ca
more notes on structural editing
fstamour Jan 11, 2024
78881ef
wip org-publish
fstamour Jan 11, 2024
fe0104b
fix stupid bug in breeze.el's initialization
fstamour Jan 12, 2024
46f205b
able to remove leading and trailing whitespaces in (...)
fstamour Jan 12, 2024
3350e9a
better "unparse", much better "fix whitespaces inside parens"
fstamour Jan 12, 2024
38fe551
wip poc for simpler "unparse" and formatting rules
fstamour Jan 12, 2024
7ced041
fix read-token, read-sharpsign-backslash and test-read-breeze
fstamour Jan 13, 2024
1da8cfa
wip: integrate with flymake
fstamour Jan 13, 2024
1789334
lint: make sure breeze is loaded before calling its linter
fstamour Jan 13, 2024
409b977
doc: generate public/*.html docs from docs/*.org using org-publish
fstamour Jan 13, 2024
864647f
ensure-breeze.lisp: use asdf instead of cl:require
fstamour Jan 14, 2024
d3d85fd
linter: remove debug info in the messages
fstamour Jan 14, 2024
741bdef
linter: don't automatically start a lisp listener
fstamour Jan 14, 2024
920119d
move the readme's content into the documentation files
fstamour Jan 14, 2024
df1322e
remove dead code
fstamour Jan 14, 2024
6fe3144
notes
fstamour Jan 14, 2024
c5931b9
docs: add listings; fix link; fix typo; cleanup
fstamour Jan 14, 2024
e783ed9
fix rogue reference to cl-fad
fstamour Feb 12, 2024
5fe23f4
notes about errors
fstamour Feb 13, 2024
22e1ad9
notes
fstamour Feb 13, 2024
c34e932
breeze.el: make it easier to support both sly and slime
fstamour Feb 13, 2024
9b39816
notes
fstamour Feb 13, 2024
bac9589
fix crash on invalid syntax in the lossless parser
fstamour Feb 18, 2024
9477b3a
refactor: extract suggestion.lisp from listener.lisp; big cleanupS
fstamour Feb 18, 2024
be38a64
remove utterly obsolete comment
fstamour Feb 18, 2024
e75dd15
wip: using signals to get (and memoize) stuff from/to the context
fstamour Feb 18, 2024
3f758dc
refactor: simplify "context functions"
fstamour Feb 19, 2024
9c2287a
implement in-package-node-p, find-node and find-path-to-position
fstamour Feb 19, 2024
bccd21c
breeze.el: improve initialization
fstamour Mar 3, 2024
2bb0e2f
breeze.el: fix accidental use of cl.el's function
fstamour Mar 3, 2024
f66e085
extract linting and formatting stuff from lossless-reader
fstamour Mar 3, 2024
3585b79
move more functions from "lossless-reader" into "analysis"
fstamour Mar 3, 2024
5ad54b9
starting to integrate pattern.lisp and lossless-parser.lisp
fstamour Mar 3, 2024
c11257b
match-parse: skip values to match & match symbols against parse tree
fstamour Mar 4, 2024
a6bb4e7
add minimal support for package-designator in match-symbol-to-token
fstamour Mar 4, 2024
aeb17fd
implement matching terms against parse trees
fstamour Mar 4, 2024
21147b4
refactor(pattern): more flexible matching against iterators
fstamour Mar 4, 2024
9176be6
wip: implement match vector against parse tree
fstamour Mar 4, 2024
06f32d2
cleanup pattern.lisp; use it to implement in-package-node-p
fstamour Mar 5, 2024
d530988
add scratch file about integration with emac's compile command
fstamour Mar 5, 2024
b462ef9
WIP add more basic tests on analysis.lisp
fstamour Mar 7, 2024
b6c5710
add lots of small unit tests on matching over parse trees
fstamour Mar 7, 2024
919164a
fix: line comments that are not followed by a newline are valid
fstamour Mar 7, 2024
c5c16db
fix (again) in-package-node-p; add tests on the linter
fstamour Mar 7, 2024
575ee89
add some structure to the linter
fstamour Mar 7, 2024
be3b904
refactor: make a macro to define in-package-node-p
fstamour Mar 7, 2024
782f524
WIP trying to use patterns to match more complex parse trees
fstamour Mar 7, 2024
176d83a
warn about extraneous whitespaces in between forms
fstamour Mar 9, 2024
941d78b
WIP: replace "zero-or-more" and "maybe" by "repetition"
fstamour Mar 9, 2024
7a35d6d
add robust function to split a token into package and symbol names
fstamour Mar 16, 2024
264f30a
revert to "in-package-node-p" without macro
fstamour Mar 16, 2024
2bba486
way too many notes
fstamour Mar 16, 2024
5128a8a
disable some test on incomplete code
fstamour Mar 28, 2024
2c9ec9b
be less verbose when generating documentations as part of the tests
fstamour Mar 28, 2024
3bb5c21
much less verbose test results reporting
fstamour Mar 28, 2024
0ae3f4c
add notes about "linting" let <=> when-let*
fstamour Mar 28, 2024
617375b
add egraph.lisp
fstamour Mar 28, 2024
bed5369
add bare-bone note about emacs' eglot package
fstamour Apr 6, 2024
765444b
committing whatever I had uncommitted before I moved
fstamour Jun 4, 2024
26e4663
ci: fix documentation generation on windows
fstamour Jun 12, 2024
6499615
ci: fix unit test on windows
fstamour Jun 12, 2024
d6ef78d
fix: tests/egraph.lisp was missing from the .asd
fstamour Jun 12, 2024
be7f9ff
breeze.el: "fix" generated commands
fstamour Jun 12, 2024
cd4c995
fix typo "cannon[...]" -> "canon[...]"
fstamour Jun 12, 2024
3513b1d
workbench: fix missing package designator
fstamour Jun 15, 2024
f0ba647
patterns: use alist instead of plist for bindings
fstamour Jun 16, 2024
2f652e9
pattern: add *term-pool*
fstamour Jun 16, 2024
465154a
egraph: slightly shorter printed representation
fstamour Jun 16, 2024
5fe3894
WIP first working example of e-matching (pattern matching + egraph)
fstamour Jun 16, 2024
ed445c5
working ematching! (not pretty though)
fstamour Jun 16, 2024
0d6bf7e
move function "pattern-substitute" in pattern.lisp
fstamour Jun 16, 2024
bec6233
move function merge-sets-of-bindings into pattern.lisp
fstamour Jun 16, 2024
6e3fb2e
add 2 tests on (compile-pattern '(?x ?x))
fstamour Jun 16, 2024
6471530
rename mkrule -> make-rewrite; move to pattern.lisp
fstamour Jun 16, 2024
63a8b56
WIP egraph term rewriting and enumeration (~extraction)
fstamour Jul 4, 2024
fc94c4a
ignore org-roam's sqlite *.db files
fstamour Jul 4, 2024
5aaa90c
egraph: fix tracking of parent enodes
fstamour Jul 21, 2024
0c9a73f
fix egraph's rewrites and iteration over equivalent classes
fstamour Jul 21, 2024
14231b5
fix documentation generation
fstamour Jul 21, 2024
2b2b7d9
use alpine instead of clfoundation's docker as base image
fstamour Jul 21, 2024
9ff7ba2
fix makefile and dockerfile
fstamour Jul 21, 2024
e0a4764
ci: fix jobs "pages" has no artifacts
fstamour Jul 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .dir-locals.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
;;; Directory Local Variables -*- no-byte-compile: t -*-
;;; For more information see (info "(emacs) Directory Variables")

((nil . ((eval . (progn
(setq-local org-roam-directory
(file-truename
(file-name-concat
(locate-dominating-file default-directory ".dir-locals.el")
"docs/")))
(setq-local org-roam-db-location
(file-name-concat org-roam-directory "org-roam.db"))))
(org-roam-capture-templates . (("d" "default" plain "%?" :target (file+head "${slug}.org" "#+title: ${title}
") :unnarrowed t))))))
25 changes: 17 additions & 8 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
scratch-files/
.git/
.github/
.githooks/
.gitattributes
.gitmodules
# *.core
*.dot
*.fasl
*.log
*.org
result
*.png
*.svg
*~
dockerfile
.dockerignore
.git/
.gitattributes
.githooks/
.github/
.gitignore
.gitmodules
/.direnv/
dockerfile
githooks/*.sample
public/
result
scratch-files/
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ GUIX_PKGS="make python-codespell"


if has guix; then
use guix --ad-hoc $PKGS_COMMON $GUIX_PKGS
use guix $PKGS_COMMON $GUIX_PKGS
elif has nix-shell; then
use nix -p $PKGS_COMMON $NIX_PKGS
fi
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@
*.core
*.svg
result
docs/index.html
public/

# org-roam db
*.db

githooks/*.sample
/.direnv/
*.dot

*.png
*.log
*~
*~
/docs/sitemap.org
65 changes: 65 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@

# Only run pipelines for merge requests, tags, and protected branches.
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_REF_PROTECTED == "true"

.base:
image: clfoundation/$LISP:latest
variables:
LISP: sbcl
QUICKLISP_ADD_TO_INIT_FILE: "true"
QUICKLISP_DIST_VERSION: "latest"
before_script:
- install-quicklisp
script:
- make test
rules:
- when: manual

test:
extends: .base
variables:
LISP: sbcl
parallel:
matrix:
- STACK:
- sbcl
# TODO
# - abcl
# - ccl
# - ecl


## The job "doc" will re-run the tests, but I'm keeping that
## redundancy because the job "test" will be expanded to work on
## multiple cl implementations.

# Build public/ folder using org-publish on docs/
doc:
image: docker:24.0.7
services:
- docker:24.0.5-dind
script:
- apk add --no-cache make
- make public
artifacts:
paths:
- public
rules:
- when: manual

pages:
needs:
- job: doc
artifacts: true
script:
- echo "nothing to do!"
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
- when: manual
artifacts:
paths:
- public
63 changes: 63 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
######################################################################
### Base layers, setup working directory and quicklisp
# FROM docker.io/clfoundation/${LISP}:${LISP_VERSION} as base
FROM alpine:3.18.4 as base

RUN mkdir /breeze
WORKDIR /breeze


FROM base as quicklisp

RUN apk add sbcl
COPY scripts/quicklisp.lisp scripts/quicklisp.lisp
RUN sbcl --non-interactive \
--load scripts/quicklisp.lisp \
--eval "(quicklisp-quickstart:install)" \
--eval "(ql-util:without-prompting (ql:add-to-init-file))"

######################################################################
### Download all needed dependencies (for the main and the test
### systems).
FROM quicklisp as deps

COPY breeze.asd .
COPY scripts/load-dependencies.lisp scripts/load-dependencies.lisp

RUN sbcl --noinform --non-interactive \
--load scripts/load-dependencies.lisp


FROM scratch as dependencies.core

COPY --from=deps /breeze/dependencies.core /dependencies.core

######################################################################
### Run the tests and generate some documentation
FROM quicklisp as test

COPY . .
RUN sbcl --core dependencies.core \
--eval "(asdf:test-system '#:breeze)"

FROM base as org-publish

RUN apk add bash ca-certificates emacs

COPY . .
COPY --from=test /breeze/docs /breeze/docs

RUN emacs -Q --batch --load scripts/org-publish-project.el --kill
RUN ls
RUN ls /breeze/public

FROM scratch as public

COPY --from=org-publish /breeze/public /


######################################################################
### This is where I left off

# FROM deps as integration-tests
# RUN emacs -batch -l ert -l my-tests.el -f ert-run-tests-batch-and-exit
154 changes: 2 additions & 152 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,162 +1,12 @@
# <a name="readme">Breeze</a>
# Breeze

Breeze is a set of tools that aims to make lisp development a breeze
(hence the name).

It is very much alpha quality, I'm experimenting with a lot of things
in parallel.

Please take a look at the
[notes.org](https://github.com/fstamour/breeze/blob/master/notes.org)
to get a better idea of the things I wanna try.

![ci](https://github.com/fstamour/breeze/actions/workflows/ci.yml/badge.svg)

[github.com/fstamour/breeze](https://github.com/fstamour/breeze)

## What is this?

This is a git repository that contains lots of common lisp code that I
use to make developing with common lisp easier. It is a personal
project that I work on from time to time, but that I use (and break)
pretty much all the time.

## Features

* [Emacs integration](#emacs)
* Integration with quickproject
* Context-aware, configurable snippets and refactorings
* Command for quick code capture (trying out code in a new file)
* Implemented in common lisp to be able to port it to other editors in
the future

Currently, breeze's main interface is emacs; `breeze.el` adds a few
commands and one minor-mode with one bindings (`C-.`).

The one binding calls a command named `breeze-quickfix` (might rename
in the future). This command suggests applicable actions given the
current context (file name, file content, position in the file,
etc.). For example, if the file ends with ".asd" it will suggest a
command to insert a `defsystem` form. If breeze was already
configured, it will pre-fill the `:maintainer`, `:author` and
`:licence` fields. Another example is that if the file is empty, or
contains only comments, it will suggest to insert a `defpackage` or
`uiop:define-package` form. It is also able to detect when you're
trying to edit/evaluate forms that are in a package that doesn't
exists (_did you forget to evaluate the `defpackage` form_).

The integration with quickproject is pretty simple and let's you
quickly create new projects from the comfort of your editor. The
integration consists of one command that asks you for some
information, like the project name and licence. It takes some default
values from breeze's configuration, but let's you change them. All
this to ease the use of quickproject.

Another simple command that helps me is `breeze-capture`, it creates a
new file in a pre-determined (must be configured) folder and fills it
with some pre-configured content (template) and let's you code right
away. This could've easily be done in emacs (that's how I prototyped
the first version), but doing this in common lisp makes it easy to
port it to other editors (or just the repl) in the future.

I must stress that this whole project is in constant flux, and until I
add more and more tests, stuff might break any time.

## Goals and non-goals

### Goals

- Make it easier to develop in common lisp
- by any means
- With any editor (or even without one)
- Be as portable as possible
- Be useful to new and experimented developer (or even
non-developpers, we'll get there)

### Non-goals

- Replace slime, sly, slimv, slima, etc
- Replace existing test framework
- Force the user to use a set of conventions
- If there are conventions used by breeze it is only for convenience
and they should be customizable.
- e.g. Currently, some refactoring utilities only work when the user
use `cl:defpackage` (as opposed to `uiop:defpackage`) and there's
one `defpackage` per file, but it doesn't have to be that way.

## Getting started

1. Clone this repository in quicklisp's local-projects folder.

2. Load the `breeze` system. From the repl:

(ql:quickload "breeze")

3. Load `<breeze>/src/breeze.el` in emacs.

And enable `breeze-mode` minor mode in `lisp-mode` automatically using
a hook:

(add-hook 'lisp-mode-hook #'breeze-mode)

Now you should be able to use `C-.` (control + period) in any lisp
buffer to bring up the "quickfix menu".

### Configuring breeze

> This is optional, but it will help make breeze more to your liking.

Simply put this in your implementation's initialization file
(e.g. `~/.sbclrc` for sbcl). In the future, breeze might use it's own
configuration folder, but for now this will do.


(require '#:breeze.config)

(setf breeze.config:*default-author* "your name"
breeze.config:*capture-folder* #p"~/capture/")

### How to run the tests

From the repl:

(ql:quickload "breeze/test")
(asdf:test-system "breeze")


Or from the command line:

./scripts/test.sh

### How to generate the documentation

From the repl:

(breeze.documentation::generate-documentation)

Or from the command line:

./scripts/doc.sh

With either method, the documentation is generated into to `docs/`
folder.

### Contributing

Start by forking and cloning this repository into quicklisp's
local-projects directory.

Setup the pre-commit hook

git config core.hooksPath githooks

Look for TODOs in the code

grep -ir --include='*.lisp' todo
# or
rg -i todo

Peruse the [notes.org](notes.org).
More information in the [documentation](https://fstamour.gitlab.io/breeze/).

## Support me

Expand Down
Loading
Loading