Coder Social home page Coder Social logo

amagura / eggs Goto Github PK

View Code? Open in Web Editor NEW
1.0 4.0 1.0 196 KB

Chicken Scheme eggs I either maintain or wrote

Makefile 0.62% Shell 0.06% C 35.77% C++ 0.02% Scheme 60.39% HTML 3.14%
chicken-scheme-eggs chicken chicken-scheme readline-library readline-interface gnu-readline

eggs's People

Contributors

amagura avatar wasamasa avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

hwinslow3

eggs's Issues

Refactoring Readline

Issue Description

The code used in the readline egg was very old (some of it anyway) when I adopted it; I then refactored/rewrote what I could (according to my understanding of C at the time) to make it easier to maintain, extend, and improve. However, after reviewing readline bindings for other languages, I've begun to realize that this egg may not be as solid as I had hoped; therefore, I would like to begin working on a new major version of readline, featuring:

  • rudimentary syntax color support? (Is it worth it?)

    • when an odd number of parens are present in the current expression, the last paren (or odd one out) should be highlighted a shade of red.

    • symbols should be highlighted? Maybe?

  • Better signal handling (non-blocking) (see #9)

highlight matching parens/braces

The Enhancement

If the cursor is over a paren or brace (e.g. ( or [) and said paren/brace has a matching paren/brace, the matched paren/brace pair should be highlighted in teal. If the paren/brace does not have a match, it should be highlighted in purple.

The Problem

IIRC, Arrow keys are manufacturer, therefore we'll need a function that can be used to register the current systems arrow key codes:

Example

bool register_arrwkys(char up, char down, char left, char right)
{
   return true;
}

The Scheme binding should be usable like so

(readline#register-up-arrow-key "^[[A")
;; OR
(readline#register-arrow-keys '((up . "^[[A") ...))

For now, I think recognizing the arrow keys should be more than enough, but eventually it'd be nice to be able to highlight the matching paren/brace whenever the cursor is placed on one.

Unnecessary test dependency?

Now that setup-helper finally deprecated the include usage, a number of eggs broke, including kvlists which is a test dependency for the readline egg. As the test file does only use kvlist?, I wonder whether it's necessary to use this dependency at all. One could easily copy this one definition and just use it.

What could also work is thinking a bit more about the tested variable, readline#session. It is defined as a list with four special keys. Why not test for the presence of each with kvlist-ref or a copied definition instead?

Readline catches SIGINT

Issue Description(s)

CSI responds to SIGINT differently after readline is loaded

When csi is started without an rc file (e.g. csi -n) it: responds to SIGINT immediately and prints a new prompt, however, when/after readline has been loaded, csi only responds to SIGINT after encountering a carriage return (\r): this behavior is awkward and differs from other major lisps implementations such as clisp and sbcl (both of which respond to SIGINT after a short pause without any further intervention from the user).

CSI reports an unknown variable named rl_catch_signals when loading readline.so

; loading /home/rr257875/usr/lib/chicken/8/readline.so ...
readline: rl_catch_signals: unknown variable name

After doing a small amount of research, I realized that the issue is caused by the following code in interface.c:

#endif
     rl_completion_entry_function = &gnu_readline_tab_complete;
     rl_variable_bind("rl_catch_signals", 0);
     rl_clear_signals();
     rl_set_signals();

In the code above, rl_variable_bind is being misused, it is not designed to set C variables, but readline variables such as you could set by calling set ... on the command-line.

The code should be something like this:

#endif
     rl_completion_entry_function = &gnu_readline_tab_complete;
     int rl_catch_signals = 0;
     rl_clear_signals();
     rl_set_signals();

This misuse does not seem to be present in trunk, but is present in the most recent release.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.