IRC channel logs

2022-09-09.log

back to list of logs

<daviid>dsmith-work: back to this attempt to enhance font-lock, i a on debian testing, the /usr/share/emacs/27.1/lisp/progmodes/scheme.el.gz does not contain any of define*, lambda*, define-method ... what file were youlooking at?
<daviid>dsmith-work: here is a list of what is installed here - https://paste.centos.org/view/0c64df53
<daviid>dsmith-work: in scheme.el.gz, line 119 seems the one, but you need a phd in rx to change it:)
<daviid>anyone has a phd in emacs rx to change this "^(define\\(\\|-\\(generic\\(\\|-procedure\\)\\|method\\)\\)*\\s-+(?\\(\\sw+\\)" to also accept "vfunc" [the hyphen seems to be 'there' already, next to the ^define
<jao>"^(define\\(\\|-\\(generic\\(\\|-procedure\\)\\|method\\|vfunc\\)\\)*\\s-+(?\\(\\sw+\\)"
<jao>daviid, you can check it finds it interactively by typing M-: (re-search-forward "^(define\\(\\|-\\(generic\\(\\|-procedure\\)\\|method\\|vfunc\\)\\)*\\s-+(?\\(\\sw+\\)")
<jao>maybe you're just hitting a problem with font-lock, not with the regexp per se
<jao>ah, no wait, there's the pesky *
<jao>that will find define-vfunc*
<jao>ah nah, i think it should work as i wrote
<daviid>jao: actually, that is the wrong variable in the scheme.el.gz file, my bad
<daviid>jao: i am on #emacs, trying to solve this 'problem' with help ...
<daviid>dsmith-work: i found the entries, forget what i asked
***Server sets mode: +ntz
<daviid>jao: i updated the scheme-font-lock-keywords-1 to use "\\(\\|-public\\|-method\\*?\\|-vfunc\\|-generic\\(-procedure\\)?\\)\\|", recompiled install the scheme.el file in /usr/share/emacs/27.1/lisp/progmodes/, and that worked fine - as i was asked to, i'll try to submit a patch to emacs-devel
<daviid>jao: thanks for your help as well
<daviid>dsmith-work: ^^ thanks as well
***reyman_aw is now known as reyman
***reyman is now known as reyman_aw
***reyman_aw is now known as reyman
***karlosz_ is now known as karlosz
***reyman is now known as reyman_aw
<dsmith-work>Happy Friday, Guilers!!
<dsmith-work>daviid: Cool, you got it working!
<dsmith-work>daviid: Probably better to put that into your ~/.emacs ( or ~/.emacs.d/init.el ) in the meantimme.
<dsmith-work>daviid: Next time your emacs package upgrades, your changes will go away.
<dsmith-work>daviid: regexps are not that hard. But string escapes make it harder.
<dsmith-work>daviid: '*' means zero or more, but you want to match '*'. In emacs, that's \*
<dsmith-work>daviid: But because it's a string, you need \\*
<dsmith-work>Ugh.
<ArneBab>dsmith-work: have a look at the rx macro, it’s pretty nice.
<dsmith-work>ArneBab: Is there a companion that does string -> rx ?
<vldn>is compiling the libguile header to windows possible?
<vldn>i try using guile in combination with raylib (a small multiplatform c gaming toolkit)
<lilyp>guile 3 has no mingw build afaik, guile 2.2 does
<renken>are modules seen as objects that can be passed to functions? for each module I want to call <module-name-prefix>:function, is that possible? if so, how?
<dthompson>renken: you can get module objects to inspect via procedures like current-module and resolve-module
<dthompson>(resolve-module (srfi srfi-1)) for example
<renken>dthompson: sorry I couldn't figure out how to use resolve-module but (@ (srfi srfi-1) reduce) is the closest to what I want but instead I'm expecting to receive the prefix srfi-1: not (srfi srfi-1)
<renken>assuming (use-module ((srfi srfi-1) #:prefix srfi-1:))
<dthompson>sorry I forgot a character: (resolve-module '(srfi srfi-1))
<dthompson>oh you're talking about imports, though.
<dthompson>that's quite different.
<dthompson>I don't know if you can introspect that kind of information
<renken>here's a practical example of how I want to use it https://gitlab.com/renken/nichijou/-/raw/master/nichijou/home/host/siga.scm
<renken>this is wrong because I assumed : is treated as a way to access a module's procedures
<dthompson>when a module is imported, it creates bindings in the current module with the names of the exports from the other module. optionally, a prefix may be applied for the local names.
<dthompson>it's not a property of a module. does that make sense?
<renken>yeah that makes sense
<renken>meaning if you (use-modules ((srfi srfi-1) #:prefix srfi1:)), the prefix itself does not exist, guile simply redefines the functions exported by srfi-1 with the new prefixed name
<dthompson>yeah basically, the local binding's name gets the prefix.
<dthompson>maybe if you explain more about what you're trying to do someone could offer an alternative.
<dthompson>like what problem are you trying to solve that led you to looking at module prefixes?
<dthompson>I don't quite understand from the source you posted
<renken>each module implements a function get-packages, e.g., nvim:get-packages, mpd:get-packages and so on... for each module I would like to execute this function
<renken>(map apply-get-packages (list mpd mpv nvim zsh)))) translates to (map g (list mpd:get-packages mpv:get-packages))) where g is (define (g f) (f #:foreign-distro #t))
<renken>maybe I made it even more confusing. the goal is to simplify (list (module1:f #t) (module2:f #t) (module3:f #t))
<renken>if there was a "magic" function called get-property then this would work (map (lambda (module) (get-property module 'f) (list module1 module2 module3))
***daviid` is now known as daviid
<renken>or perhaps even better (map (lambda (module) (get-property-from-prefix module-prefix 'f) (list module1: module2: module3:))
<renken>oops I forgot call the property itself but this example should be clear
<renken>(map (lambda (module-prefix) ((get-property-from-prefix module-prefix 'f) #:key #t) (list module1: module2: module3:))
<daviid>renken: it seems you are 'mixing' the guile module introspection functionalities with 'the guix machinery', I think you should ask for help in #guix, also askwhat they think of 'your design' approach ... a 2c comment :)
<rekado>renken: I would not bother with prefixes but use resolve-interface and the like
<rekado>module-ref lets you pick a named variable from any module
<rekado>so you’d just iterate over the list of modules you care about and pick the predictably named procedure from each.
<renken>I see, thanks for your comments daviid and rekado
<renken>daviid: I don't think there's anything guix-specific in the code I linked. this is strictly guile modules as far as I know. here's the equivalent of what I wanted to implement in python https://paste.debian.net/1253335/
<renken>however, I misunderstood prefixes as module objects which is wrong
<daviid>renken: get-packakes, bar:get-packages, baz:get-packages... i doubt guix doesn have a solution to 'this problem', but ... i don'tuse guix myself
<dthompson>renken: I agree with rekado, use module-ref for programmatic access to module bindings.
<dthompson>I think there's probably a better design, but if you're sticking to a get-packages procedure in each module then I think the code would be rather clean if you iterated over a list of module names that are then queried for their get-packages procedure.
<renken>yeah I agree too, I'm currently going through the manual!
***justache is now known as justJingo
<dsmith-work>!uptime
<dsmith-work>sneek: botsnack
<sneek>:)
<dsmith-work>sneek: seen daviid?
<sneek>daviid was last seen in #guile 2 hours and 11 minutes ago, saying: renken: get-packakes, bar:get-packages, baz:get-packages... i doubt guix doesn have a solution to 'this problem', but ... i don'tuse guix myself.
<dsmith-work>Hmm.
<sneek>dsmith-work: Greetings :)
<dsmith-work>!uptime
<sneek>I've been running for one month and 1 day
<sneek>This system has been up 4 weeks, 3 days, 15 hours, 54 minutes
<dsmith-work>goodbot
*sneek wags