unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Basile Starynkevitch <basile@starynkevitch.net>
To: help-gnu-emacs@gnu.org
Cc: seb@k-7.ch
Subject: Re: API to control the GTK parts from Elisp
Date: Fri, 25 Aug 2023 09:25:39 +0200	[thread overview]
Message-ID: <a86be19b-8824-ef33-a65d-182b7d2a33e9@starynkevitch.net> (raw)
In-Reply-To: <87o7iv51w7.fsf@yahoo.com>


On 8/25/23 03:47, Po Lu wrote:
> Sébastien Gendre <seb@k-7.ch> writes:
>
>> Hello world!
>>
>> On GNU/Linux, the GUI version use GTK for some parts, like the
>> header-bar, the tool-box, etc.
>>
>> Is it possible to control these GTK elements from Elisp ? Like modifying
>> their CSS rules or the GTK theme applied ?
>>
>>
>> Best regards
> Such features aren't available in Emacs Lisp.


But recent GNU emacs is (on Linux) already using dlopen and dlsym (in 
file emacs/src/dynlib.c)

So I guess it should not be too difficult to customize your GNU emacs 
source code (or its GNU Elisp scripts) to add the necessary Elisp 
primitives to control these GTK elements. Some C and Elisp code is needed.

A practical possibility (see https://arxiv.org/pdf/1109.0779.pdf ...) 
could even be to generate -in some temporary file- some short C code 
dynamically on the fly (using your Elisp scripts), compile that short C 
temporary code as a plugin, then have it dlopen-ed and dlsym-ed. Current 
Linux laptops are fast enough to make that compatible with human 
interaction. (e.g. generating 200 lines of C and compiling it into a 
shared object can be done in a fraction of a second, and is doable 
perhaps once every few keystrokes handed by GNU emacs).

Another practical possibility could be to develop (in a few hundred 
lines of C) your background process handling these.   The GNU emacs 
process would start it at initialization and communicate with it (e.g. 
thru pipes or AF_UNIX sockets). Proof of concept code on 
https://github.com/bstarynk/misc-basile/blob/master/manydl.c and 
https://github.com/bstarynk/misc-basile/blob/master/execicar.c ...


PS. My pet open source project is the RefPerSys inference engine (see 
code on https://github.com/RefPerSys/RefPerSys/ ....)


-- 

Basile Starynkevitch                  <basile@starynkevitch.net>
(only mine opinions / les opinions sont miennes uniquement)
92340 Bourg-la-Reine, France
web page: starynkevitch.net/Basile/




      reply	other threads:[~2023-08-25  7:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-24 14:19 API to control the GTK parts from Elisp Sébastien Gendre
2023-08-25  1:47 ` Po Lu
2023-08-25  7:25   ` Basile Starynkevitch [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a86be19b-8824-ef33-a65d-182b7d2a33e9@starynkevitch.net \
    --to=basile@starynkevitch.net \
    --cc=help-gnu-emacs@gnu.org \
    --cc=seb@k-7.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).