
I think I ran into the same problem you’re running into with koyo. I had tried adding the blueprints
folder of koyo-lib
to compile-omit-paths
, but that wasn’t respected under all circumstances:
https://github.com/Bogdanp/koyo/blob/master/koyo-lib/info.rkt#L19
Adding a bespoke info.rkt
under that folder ended up doing the trick:
https://github.com/Bogdanp/koyo/blob/master/koyo-lib/blueprints/info.rkt

I think my issue was that raco setup koyo
did the right thing and ignored the blueprints
folder, but raco setup
by itself (which gets run when I build racket) did not.

Packages have info.rkt files, and collections have info.rkt files, and they contain different keys. The files are merged in the case of single-collection packages, but for multi-collection packages, you must put package-related keys (eg deps
) in the package info.rkt file and put collection-related keys (eg, scribblings
and apparently compile-omit-paths
) in the collection’s info.rkt file.

This makes sense, thanks!

Also, I just saw the sidenote at https://docs.racket-lang.org/pkg/metadata.html, which describes exactly what you just said

My Ubuntu 18.04 machine (the DrDr machine) has 1.15.

Is it possible to overwrite a keybinding? (send _a-keymap_ map-function _keyname_ _fname_)
doesn’t allow for it, and I can’t find an unmap
function that would remove a keybinding beforehand.

My ubuntu 14.04(!) machine has 1.13 so we’re probably safe.

basically, I want to remove some bindings defined by keymap:setup-global

Otherwise, is there a way to use the “backward-kill-word” keymap function without using keymap:setup-global
?

@robby keymap:setup-global
defines a lot of useful functions, but they are completely unavailable apart from some default keybindings that can’t be redefined: https://github.com/racket/gui/blob/001c57b86c624ad367354d6bf168f55f82e79c20/gui-lib/framework/private/keymap-global.rkt#L45 Would it make sense to define and export each such function, so that they can be mapped individually to other text editors with different keybindings?

I’ll say “yes” but also note that they are available if you get the keymap and make calls into it. So, sort of “somewhat available” rather than “completely unavailable” :slightly_smiling_face:

Ah, I see. That does work indeed. Somewhat convoluted, but it’s feasible at least. Thanks.

Here’s the magic code for the curious one: (define map-global-function
(let* ([km-global (keymap:get-global)]
[table (for/hash ([name (in-list (dict-values (send km-global get-map-function-table)))])
(values name #t))])
(λ (km key name)
(unless (dict-has-key? table name)
(error "Unknown function" name))
(send km add-function name
(λ (in ev)
(send km-global call-function name in ev #t)))
(send km map-function key name))))
(map-global-function my-keymap "c:backspace" "backward-kill-word")

And here’s the list of available functions: '("TeX compress"
"back-to-prev-embedded-editor"
"backward-character"
"backward-kill-word"
"backward-select"
"backward-select-word"
"backward-word"
"beginning-of-file"
"beginning-of-line"
"capitalize-word"
"center-in-unicode-ascii-art-box"
"center-view-on-line"
"collapse-newline"
"collapse-space"
"command-repeat-0"
"command-repeat-1"
"command-repeat-2"
"command-repeat-3"
"command-repeat-4"
"command-repeat-5"
"command-repeat-6"
"command-repeat-7"
"command-repeat-8"
"command-repeat-9"
"copy-clipboard"
"copy-clipboard/disable-anchor"
"cut-clipboard"
"delete-key"
"delete-next-character"
"delete-previous-character"
"delete-to-end-of-line"
"down-into-embedded-editor"
"downcase-word"
"end-of-file"
"end-of-line"
"forward-character"
"forward-select"
"forward-select-word"
"forward-to-next-embedded-editor"
"forward-word"
"goto-line"
"highten-unicode-ascii-art-box"
"insert Α"
"insert Β"
"insert Γ"
"insert Δ"
"insert Ε"
"insert Ζ"
"insert Η"
"insert Θ"
"insert Ι"
"insert Κ"
"insert Λ"
"insert Μ"
"insert Ν"
"insert Ξ"
"insert Ο"
"insert Π"
"insert Ρ"
"insert Σ"
"insert Τ"
"insert Υ"
"insert Φ"
"insert Χ"
"insert Ψ"
"insert Ω"
"insert α"
"insert β"
"insert γ"
"insert δ"
"insert ε"
"insert ζ"
"insert η"
"insert θ"
"insert ι"
"insert κ"
"insert λ"
"insert μ"
"insert ν"
"insert ξ"
"insert ο"
"insert π"
"insert ρ"
"insert ς"
"insert σ"
"insert τ"
"insert υ"
"insert φ"
"insert χ"
"insert ψ"
"insert ω"
"keyboard-macro-end-record"
"keyboard-macro-run-saved"
"keyboard-macro-start-record"
"kill-word"
"make-read-only"
"mouse-popup-menu"
"newline"
"next-line"
"next-page"
"normalize-unicode-ascii-art-box"
"open-line"
"paste-click-region"
"paste-clipboard"
"paste-next"
"previous-line"
"previous-page"
"redo"
"ring-bell"
"select-click-line"
"select-click-word"
"select-down"
"select-page-down"
"select-page-up"
"select-to-beginning-of-file"
"select-to-beginning-of-line"
"select-to-end-of-file"
"select-to-end-of-line"
"select-up"
"shift-focus"
"shift-focus-backwards"
"toggle-anchor"
"toggle-overwrite (when enabled in prefs)"
"toggle-unicode-ascii-art-enlarge-mode"
"transpose-chars"
"transpose-words"
"undo"
"up-out-of-embedded-editor"
"upcase-word"
"widen-unicode-ascii-art-box")
First time I hear about the macro-recording one!

@popa.bogdanp How can I retrieve a record in a way that I can save it so I can make changes and update-one!
back to the database? I thought lookup
would do this but lookup
produces many values
apparently. I don’t know how to make-client
with what lookup
produces. I haven’t understood that and your guide doesn’t seem to show an example.
(define-schema client
([id id/f #:primary-key #:auto-increment]
[id-integer integer/f]
[name string/f]
[id-string string/f]
[secret string/f]
[refresh-token string/f]
[active string/f]
[demo string/f]))
racket@db.rkt> (lookup db-conn (where (from "clients" #:as u) (= u.id 1)))
1
1031
"My name"
"my-invalid-id"
"my-non-secret"
"a-fresh-token"
"Yes"
"Yes"
racket@db.rkt>
I can’t (define c (lookup ...))
.
Then I tried in-entities
. I’m puzzled with this result.
racket@db.rkt> (in-entities db-conn (where (from "clients" #:as u) (= u.id 1)))
#<sequence>
racket@db.rkt> (sequence? (in-entities db-conn (where (from "clients" #:as u) (= u.id 1))))
#t
racket@db.rkt> (sequence->list (in-entities db-conn (where (from "clients" #:as u) (= u.id 1))))
result arity mismatch;
expected number of values not received
expected: 1
received: 8
values...:
1
1031
"My name"
"my-invalid-id"
"my-non-secret"
"a-fresh-token"
"Yes"
"Yes"
racket@db.rkt>
In other words, I’m lost. Thanks for any information!

Expressions in Racket can return multiple values, which can be pretty tricky to figure out if you haven’t seen it before. I believe an element of a Racket sequence can be multiple values as well, even though an element of a list can only be one value. (edit: “have” -> “only”)
The easiest way to deal with multiple return values is to use define-values
. It looks like this call is returning 8 values, so you’ll need (define-values (a b c d e f g h) (lookup ...))
to properly bind them to variables. (Hopefully you can come up with some better variable names than I did….)

Another pretty common way to handle multiple return values is to use call-with-values
.

There’s also match-define-values
, and for positions you don’t want the value, you can just put _
instead.

@anything Is (lookup db (~> (from clients #:as u) (where (= u.id 1)))))
what you are after?

That’s wild! That’s precisely what I want, but I’m having trouble identifying the difference between your expression and mine. Very interesting! :smile:

@soegaard2’s statement is what I was really after:
(lookup db-conn (~> (from client #:as u) (where (= u.id 1))))
Here’s what tripped me. Using a string table is not the same as using the named schema.
(lookup db-conn (where (from "clients" #:as u) (= u.id 1)))
By using a string, the library must assume I don’t want a client structure, so it produces multiple values. Soegaard spotted what I couldn’t even tell myself.

ah, interesting :)

@okcohen has joined the channel