unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Re: Re: Retrieving the "include" directory for Emacs Modules
       [not found] <mailman.77.1733590872.28947.help-gnu-emacs@gnu.org>
@ 2024-12-08  9:59 ` Marco Antoniotti
  0 siblings, 0 replies; 7+ messages in thread
From: Marco Antoniotti @ 2024-12-08  9:59 UTC (permalink / raw)
  To: help-gnu-emacs

Sorry Eli

your solution is not portable and it doesn't work on Mac and Windows (29.2)

On Mac the following works

ELISP> (expand-file-name "../include" data-directory)
"/Applications/Emacs.app/Contents/Resources/include"

On Windows the include folder is "higher" up.
"C:\Program Files\Emacs\emacs-29.2\include\"

Given that people (like me) are experimenting with emacs modules, I'd lobby
for the introduction of a 'include-direcotry' variable.

All the best

Marco




On Sat, Dec 7, 2024 at 6:02 PM <help-gnu-emacs-request@gnu.org> wrote:

> Send help-gnu-emacs mailing list submissions to
>         help-gnu-emacs@gnu.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://lists.gnu.org/mailman/listinfo/help-gnu-emacs
> or, via email, send a message with subject or body 'help' to
>         help-gnu-emacs-request@gnu.org
>
> You can reach the person managing the list at
>         help-gnu-emacs-owner@gnu.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of help-gnu-emacs digest..."
>
>
> Today's Topics:
>
>    1. Retrieving the "include" directory for Emacs Modules
>       (Marco Antoniotti)
>    2. Re: Retrieving the "include" directory for Emacs Modules
>       (Eli Zaretskii)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 7 Dec 2024 17:27:16 +0100
> From: Marco Antoniotti <marcoxa@gmail.com>
> To: help-gnu-emacs@gnu.org
> Subject: Retrieving the "include" directory for Emacs Modules
> Message-ID:
>         <CAKmY7cVprXCPm6kibaCoBjWutcW2QMmRQCL=
> qcARJ9Bp+1Djrg@mail.gmail.com>
> Content-Type: text/plain; charset="UTF-8"
>
> Hi
>
> To compile Emacs C modules we need the proper 'include' directory.  I.e.,
> we need to stick that information into Makefiles.
>
> We do have lisp-directory (and we can surmise the location of the include
> directory from it), but it would be nice to have something like
> em-include-directory (the em- prefix for "Emacs Module").
>
> Meanwhile, any idea about how to make this somewhat portable?
>
> Any idea?
>
> --
> Marco Antoniotti
> Somewhere over the Rainbow
>
>
> ------------------------------
>
> Message: 2
> Date: Sat, 07 Dec 2024 18:43:19 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Retrieving the "include" directory for Emacs Modules
> Message-ID: <86zfl7h2ag.fsf@gnu.org>
>
> > From: Marco Antoniotti <marcoxa@gmail.com>
> > Date: Sat, 7 Dec 2024 17:27:16 +0100
> >
> > To compile Emacs C modules we need the proper 'include' directory.  I.e.,
> > we need to stick that information into Makefiles.
> >
> > We do have lisp-directory (and we can surmise the location of the include
> > directory from it), but it would be nice to have something like
> > em-include-directory (the em- prefix for "Emacs Module").
>
> Isn't that
>
>   (expand-file-name "../../../include" data-directory)
>
> ?
>
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> https://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>
>
> ------------------------------
>
> End of help-gnu-emacs Digest, Vol 265, Issue 33
> ***********************************************
>


-- 
Marco Antoniotti
Somewhere over the Rainbow


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Re: Retrieving the "include" directory for Emacs Modules
       [not found] <mailman.606.1733669386.12711.help-gnu-emacs@gnu.org>
@ 2024-12-08 15:18 ` Marco Antoniotti
  2024-12-08 15:29   ` Jean Louis
  2024-12-08 16:30   ` Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: Marco Antoniotti @ 2024-12-08 15:18 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Eli

sorry again: the behavior on Mac and Windows is different w.r.t.
data-directory (see previous message).  I can try on a Linux machine
tomorrow.  Note that I installed Emacs with brew on my Mac

Case in point: if I try to install 'pq' from the package manager I get the
following error.

gcc -I/Users/marcoxa/.emacs.d/elpa/pq-0.2 -I -I/usr/share/emacs/29.4
-I/usr/local/include/postgresql@14 -std=gnu99 -ggdb3 -Wall -fPIC -c
pq-core.c

pq-core.c:19:10: fatal error: 'emacs-module.h' file not found
   19 | #include <emacs-module.h>
      |          ^~~~~~~~~~~~~~~~
1 error generated.
make: *** [pq-core.o] Error 1

which is not surprising as the include directory is not listed in the -I
options.

Of course, I can muck around and ensure that the C_INCLUDE_PATH has the
right things in it, but the issue, as is, IMHO remains.

Having said that, another reason for needing a reliable
include-directory variable,
is to query Emacs in batch mode (I know: iti is expensive), to run a build
system outside Emacs for testing.

All the best

Marco

On Sun, Dec 8, 2024 at 3:50 PM <help-gnu-emacs-request@gnu.org> wrote:

> Send help-gnu-emacs mailing list submissions to
>         help-gnu-emacs@gnu.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://lists.gnu.org/mailman/listinfo/help-gnu-emacs
> or, via email, send a message with subject or body 'help' to
>         help-gnu-emacs-request@gnu.org
>
> You can reach the person managing the list at
>         help-gnu-emacs-owner@gnu.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of help-gnu-emacs digest..."
>
>
> Today's Topics:
>
>    1. Re: Retrieving the "include" directory for Emacs Modules
>       (Eli Zaretskii)
>    2. Checking conditions unrelated to expression (Heime)
>    3. Re: Checking conditions unrelated to expression (Thibaut Verron)
>    4. Unicode and text editors (Heime)
>    5. Re: Unicode and text editors (Jean Louis)
>    6. Re: Unicode and text editors (Basile Starynkevitch)
>    7. Re: Unicode and text editors (Heime)
>    8. Re: Checking conditions unrelated to expression (Heime)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sun, 08 Dec 2024 13:40:00 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Retrieving the "include" directory for Emacs Modules
> Message-ID: <86seqyflnz.fsf@gnu.org>
>
> > From: Marco Antoniotti <marcoxa@gmail.com>
> > Date: Sun, 8 Dec 2024 10:59:28 +0100
> >
> > Sorry Eli
> >
> > your solution is not portable and it doesn't work on Mac and Windows
> (29.2)
> >
> > On Mac the following works
> >
> > ELISP> (expand-file-name "../include" data-directory)
> > "/Applications/Emacs.app/Contents/Resources/include"
> >
> > On Windows the include folder is "higher" up.
> > "C:\Program Files\Emacs\emacs-29.2\include\"
>
> Sorry, I used too few "..".  The correct way is
>
>   (expand-file-name "../../../../include" data-directory)
>
> > Given that people (like me) are experimenting with emacs modules, I'd
> lobby
> > for the introduction of a 'include-direcotry' variable.
>
> I honestly don't understand why you need this at all.  emacs-module.h
> is supposed to be installed in the compilers include tree, where the
> compiler looks for header files by default.  So you shouldn't even
> need to know where the header lives, in order to compile a module.
> The module's code should just do
>
>   #include <emacs-module.h>
>
> and that's it.  Or what am I missing?
>
>
>
> ------------------------------
>
> Message: 2
> Date: Sun, 08 Dec 2024 12:05:35 +0000
> From: Heime <heimeborgia@protonmail.com>
> To: Heime via Users list for the GNU Emacs text editor
>         <help-gnu-emacs@gnu.org>
> Subject: Checking conditions unrelated to expression
> Message-ID:
>
> <vSFJsFKqJj6N1ZDie3BNU5VFGw2Qzcst66syykRK8mjUn0h8CnXjKVRrgmV_j7sh8keg-caCrU_YxwdujHhF6LYOTIgAZqA2lopakYfsiwI=@
> protonmail.com>
>
> Content-Type: text/plain; charset=utf-8
>
> It looks like pcase can only be used with some variable condition
>
> This will check condition of featr
>
>   (pcase featr
>      ('this (do-this))
>      ('that (do-that))
>      (_ (message "some message"))
>
> What if I want to check a number of conditions, not all dependent upon
> featr, what should one do?
>
> Suppose I want to test (eq duck 'quack), cannot use a pcase because tests
> are dependent upon featr.
>
>   (pcase featr
>      ('this (do-this))
>      ('that (do-that))
>      (_ (message "some message"))
>
>
>
>
>
>
> ------------------------------
>
> Message: 3
> Date: Sun, 8 Dec 2024 13:31:01 +0100
> From: Thibaut Verron <thibaut.verron@gmail.com>
> To: Heime <heimeborgia@protonmail.com>
> Cc: Heime via Users list for the GNU Emacs text editor
>         <help-gnu-emacs@gnu.org>
> Subject: Re: Checking conditions unrelated to expression
> Message-ID:
>         <CAFsi02RoDZrEardmmuLJRqxXraBOLA=
> RNQ46V8VQJr7uJf3xdA@mail.gmail.com>
> Content-Type: text/plain; charset="UTF-8"
>
> Le dim. 8 déc. 2024 à 13:06, Heime via Users list for the GNU Emacs text
> editor <help-gnu-emacs@gnu.org> a écrit :
>
> > It looks like pcase can only be used with some variable condition
> >
> > This will check condition of featr
> >
> >   (pcase featr
> >      ('this (do-this))
> >      ('that (do-that))
> >      (_ (message "some message"))
> >
> > What if I want to check a number of conditions, not all dependent upon
> > featr, what should one do?
> >
> > Suppose I want to test (eq duck 'quack), cannot use a pcase because tests
> > are dependent upon featr.
> >
> >   (pcase featr
> >      ('this (do-this))
> >      ('that (do-that))
> >      (_ (message "some message"))
> >
>
> You can use a plain case-switch, rather than a pattern-matching one:
>
> (cond
>   ((eq featr 'this) (do-this))
>   ((eq featr 'that) (do-that))
>   ((eq duck 'quack) (do-duck))
>   (t (message "blabla")))
>
> https://www.gnu.org/s/emacs/manual/html_node/elisp/Conditionals.html
>
> You can also replace the first two cases by a pattern-matching case, if
> you'd like:
>
> (cond
>   (pcase featr
>       ('this (do-this) t) ;; important to return non-nil in each branch
>       ('that (do-that) t)
>       (_ nil))
>   ((eq duck 'quack) (do-duck))
>    (t (message "blabla")))
>
>
> ------------------------------
>
> Message: 4
> Date: Sun, 08 Dec 2024 13:16:40 +0000
> From: Heime <heimeborgia@protonmail.com>
> To: Heime via Users list for the GNU Emacs text editor
>         <help-gnu-emacs@gnu.org>
> Subject: Unicode and text editors
> Message-ID:
>
> <nH6NYG-fnvnxkThmCS4DJ_k8YdfRu3QWxcezgZDFlw04v1VTAl9Okx3AV19GJznORt_PjYA2rqAyU4mnSNILeZdAir6kQF_CP5RMX8mcs-U=@
> protonmail.com>
>
> Content-Type: text/plain; charset=utf-8
>
>
>
> I am using unicode characters in emacs.  What happens when people load the
> file in a different text editor?  Will the characters be illegible?
>
>
>
> ------------------------------
>
> Message: 5
> Date: Sun, 8 Dec 2024 16:29:41 +0300
> From: Jean Louis <bugs@gnu.support>
> To: Heime <heimeborgia@protonmail.com>
> Cc: Heime via Users list for the GNU Emacs text editor
>         <help-gnu-emacs@gnu.org>
> Subject: Re: Unicode and text editors
> Message-ID: <Z1WfRVgLAss9AmlJ@lco2>
> Content-Type: text/plain; charset=utf-8
>
> * Heime via Users list for the GNU Emacs text editor <
> help-gnu-emacs@gnu.org> [2024-12-08 16:18]:
> >
> >
> > I am using unicode characters in emacs.  What happens when people load
> the
> > file in a different text editor?  Will the characters be illegible?
>
> So far those editors I have inspected they accepted Unicode.
>
> Some editors in terminal, like Zile, Emacs clone, did not accept, I just
> wish it could.
>
> All graphical editors I know so far accept Unicode. Some not, but are
> older already, rarely used.
>
> --
> Jean Louis
>
>
>
> ------------------------------
>
> Message: 6
> Date: Sun, 08 Dec 2024 14:31:52 +0100
> From: Basile Starynkevitch <basile@starynkevitch.net>
> To: Heime <heimeborgia@protonmail.com>, Heime via Users list for the
>         GNU Emacs text editor <help-gnu-emacs@gnu.org>
> Subject: Re: Unicode and text editors
> Message-ID:
>         <2427ab10a48abba2c811bcb01f4e74ce3832794f.camel@starynkevitch.net>
> Content-Type: text/plain; charset="UTF-8"
>
> On Sun, 2024-12-08 at 13:16 +0000, Heime via Users list for the GNU
> Emacs text editor wrote:
> >
> >
> > I am using unicode characters in emacs.  What happens when people
> > load the
> > file in a different text editor?  Will the characters be illegible?
> >
>
>
> I guess you mean Unicode characters with UTF-8 encoding. I will refer
> to the people mentioned in your question as colleagues (but they could
> be friends or customers or students or authorities or managers). Your
> computer means the computer you are using (probably under Linux) for
> GNU emacs. Their computer or the other computer is the one used by the
> collague.
>
> I see several possible issues.
>
> The other computer don't have the required font to display some
> character (like a cyrillic letter, or § ....)
>
> The other computer (or your colleague) don't know that the file is UTF-
> 8 encoded.
>
> The other computer don't have any editor.
>
> the other computer has an editor which does not understand UTF-8
> encoding.
>
> The other computer has an editor requiring UTF-16 encoding.
>
> The file has been corrupted during transmission.
>
> Regards
>
> NB my open source project is
> https://github.com/RefPerSys/RefPerSys (GPLv3+ inference engine)
>
> --
> Basile STARYNKEVITCH <basile@starynkevitch.net>
> 8 rue de la Faïencerie
> 92340 Bourg-la-Reine, France
> http://starynkevitch.net/Basile & https://github.com/bstarynk
>
>
>
> ------------------------------
>
> Message: 7
> Date: Sun, 08 Dec 2024 14:02:17 +0000
> From: Heime <heimeborgia@protonmail.com>
> To: Basile Starynkevitch <basile@starynkevitch.net>
> Cc: Heime via Users list for the GNU Emacs text editor
>         <help-gnu-emacs@gnu.org>
> Subject: Re: Unicode and text editors
> Message-ID:
>
> <z9SMaPjhd1MYl-O-VeHnIoH-VhBnPrpIftjSfb4G4WfrVLNAt1S_ONyxly9qqlf5IIuXpeAxBz2-sQgeTc6dSCiM6EYSWRC1aQSCn5D1DV8=@
> protonmail.com>
>
> Content-Type: text/plain; charset=utf-8
>
>
>
>
>
>
> Sent with Proton Mail secure email.
>
> On Monday, December 9th, 2024 at 1:31 AM, Basile Starynkevitch <
> basile@starynkevitch.net> wrote:
>
> > On Sun, 2024-12-08 at 13:16 +0000, Heime via Users list for the GNU
> > Emacs text editor wrote:
> >
> > > I am using unicode characters in emacs. What happens when people
> > > load the
> > > file in a different text editor? Will the characters be illegible?
> >
> >
> >
> > I guess you mean Unicode characters with UTF-8 encoding.
>
> Correct
>
> > I will refer
> > to the people mentioned in your question as colleagues (but they could
> > be friends or customers or students or authorities or managers). Your
> > computer means the computer you are using (probably under Linux) for
> > GNU emacs. Their computer or the other computer is the one used by the
> > collague.
> >
> > I see several possible issues.
> >
> > The other computer don't have the required font to display some
> > character (like a cyrillic letter, or § ....)
> >
> > The other computer (or your colleague) don't know that the file is UTF-
> > 8 encoded.
> >
> > The other computer don't have any editor.
> >
> > the other computer has an editor which does not understand UTF-8
> > encoding.
> >
> > The other computer has an editor requiring UTF-16 encoding.
>
> Is this becoming the norm?  What about emacs?
>
> Does emacs encourage use of unicode characters (UTF-8) in code comments
> and documentation?
>
> > The file has been corrupted during transmission.
> >
> > Regards
> >
> > NB my open source project is
> > https://github.com/RefPerSys/RefPerSys (GPLv3+ inference engine)
> >
> > --
> > Basile STARYNKEVITCH basile@starynkevitch.net
> >
> > 8 rue de la Faïencerie
> > 92340 Bourg-la-Reine, France
> > http://starynkevitch.net/Basile & https://github.com/bstarynk
>
>
>
> ------------------------------
>
> Message: 8
> Date: Sun, 08 Dec 2024 14:49:34 +0000
> From: Heime <heimeborgia@protonmail.com>
> To: thibaut.verron@gmail.com
> Cc: Heime via Users list for the GNU Emacs text editor
>         <help-gnu-emacs@gnu.org>
> Subject: Re: Checking conditions unrelated to expression
> Message-ID:
>
> <UTDyRbxHqrNoXGWfAGt7UBstb51wLVipwk6VV-PGNMc02eax62Tj3eE8zcOCvUoRcM1PVKRXxx90U-sdkkN3cfiHHGYagAiIg9jCKYIlOgQ=@
> protonmail.com>
>
> Content-Type: text/plain; charset=utf-8
>
>
>
>
>
>
> Sent with Proton Mail secure email.
>
> On Monday, December 9th, 2024 at 12:31 AM, Thibaut Verron <
> thibaut.verron@gmail.com> wrote:
>
> > Le dim. 8 déc. 2024 à 13:06, Heime via Users list for the GNU Emacs text
> > editor help-gnu-emacs@gnu.org a écrit :
> >
> > > It looks like pcase can only be used with some variable condition
> > >
> > > This will check condition of featr
> > >
> > > (pcase featr
> > > ('this (do-this))
> > > ('that (do-that))
> > > (_ (message "some message"))
> > >
> > > What if I want to check a number of conditions, not all dependent upon
> > > featr, what should one do?
> > >
> > > Suppose I want to test (eq duck 'quack), cannot use a pcase because
> tests
> > > are dependent upon featr.
> > >
> > > (pcase featr
> > > ('this (do-this))
> > > ('that (do-that))
> > > (_ (message "some message"))
> >
> >
> > You can use a plain case-switch, rather than a pattern-matching one:
> >
> > (cond
> > ((eq featr 'this) (do-this))
> > ((eq featr 'that) (do-that))
> > ((eq duck 'quack) (do-duck))
> > (t (message "blabla")))
> >
> > https://www.gnu.org/s/emacs/manual/html_node/elisp/Conditionals.html
> >
> > You can also replace the first two cases by a pattern-matching case, if
> > you'd like:
> >
> > (cond
> > (pcase featr
> > ('this (do-this) t) ;; important to return non-nil in each branch
> > ('that (do-that) t)
> > (_ nil))
> > ((eq duck 'quack) (do-duck))
> > (t (message "blabla")))
>
>
> But I cannot do the other way round, right?  Cannot have a pcase using
> featr
> as EXP, but checking something else.
>
>
>
>
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> https://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>
>
> ------------------------------
>
> End of help-gnu-emacs Digest, Vol 265, Issue 36
> ***********************************************
>


-- 
Marco Antoniotti
Somewhere over the Rainbow


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Re: Retrieving the "include" directory for Emacs Modules
  2024-12-08 15:18 ` Re: Retrieving the "include" directory for Emacs Modules Marco Antoniotti
@ 2024-12-08 15:29   ` Jean Louis
  2024-12-08 15:36     ` Marco Antoniotti
  2024-12-08 16:30   ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: Jean Louis @ 2024-12-08 15:29 UTC (permalink / raw)
  To: Marco Antoniotti; +Cc: help-gnu-emacs

* Marco Antoniotti <marcoxa@gmail.com> [2024-12-08 18:20]:
> Hi Eli
> 
> sorry again: the behavior on Mac and Windows is different w.r.t.
> data-directory (see previous message).  I can try on a Linux machine
> tomorrow.  Note that I installed Emacs with brew on my Mac
> 
> Case in point: if I try to install 'pq' from the package manager I get the
> following error.

I am using emacs-libpq and I have changed:

EMACS_INCLUDE_DIR := /home/data1/protected/Programming/Software/emacs/src
EMACS_SRC_DIR := /home/data1/protected/Programming/Software/emacs/src

in Makefile to get it compiled

EMACS = emacs
EMACS_VERSION := $(shell $(EMACS) -q --batch --eval "(princ emacs-version)")
EMACS_MAJOR_VERSION := $(shell $(EMACS) -q --batch --eval "(princ emacs-major-version)")
EMACS_INCLUDE_DIR := /home/data1/protected/Programming/Software/emacs/src
EMACS_SRC_DIR := /home/data1/protected/Programming/Software/emacs/src

Module works great, no complains.

-- 
Jean Louis



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Re: Retrieving the "include" directory for Emacs Modules
  2024-12-08 15:29   ` Jean Louis
@ 2024-12-08 15:36     ` Marco Antoniotti
  2024-12-08 15:50       ` Stefan Monnier via Users list for the GNU Emacs text editor
  2024-12-08 16:36       ` Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: Marco Antoniotti @ 2024-12-08 15:36 UTC (permalink / raw)
  To: Marco Antoniotti, help-gnu-emacs

Hi

I have no qualms about being able to "fix" 'pq' to make it work.

But I am writing an Emacs Module and I do not want to force anybody to
"fix" my setup ("It works on my machine" (tm))

In other words, I would like to be able to write

EMACS_INCLUDE_DIR := $(shell $(EMACS) -q --batch --eval "(princ
*em-include-directory*)")
EMACS_SRC_DIR := $(shell $(EMACS) -q --batch --eval "(princ
*em-scr-directory*)")

All the best

MA


On Sun, Dec 8, 2024 at 4:29 PM Jean Louis <bugs@gnu.support> wrote:

> * Marco Antoniotti <marcoxa@gmail.com> [2024-12-08 18:20]:
> > Hi Eli
> >
> > sorry again: the behavior on Mac and Windows is different w.r.t.
> > data-directory (see previous message).  I can try on a Linux machine
> > tomorrow.  Note that I installed Emacs with brew on my Mac
> >
> > Case in point: if I try to install 'pq' from the package manager I get
> the
> > following error.
>
> I am using emacs-libpq and I have changed:
>
> EMACS_INCLUDE_DIR := /home/data1/protected/Programming/Software/emacs/src
> EMACS_SRC_DIR := /home/data1/protected/Programming/Software/emacs/src
>
> in Makefile to get it compiled
>
> EMACS = emacs
> EMACS_VERSION := $(shell $(EMACS) -q --batch --eval "(princ
> emacs-version)")
> EMACS_MAJOR_VERSION := $(shell $(EMACS) -q --batch --eval "(princ
> emacs-major-version)")
> EMACS_INCLUDE_DIR := /home/data1/protected/Programming/Software/emacs/src
> EMACS_SRC_DIR := /home/data1/protected/Programming/Software/emacs/src
>
> Module works great, no complains.
>
> --
> Jean Louis
>


-- 
Marco Antoniotti
Somewhere over the Rainbow


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Retrieving the "include" directory for Emacs Modules
  2024-12-08 15:36     ` Marco Antoniotti
@ 2024-12-08 15:50       ` Stefan Monnier via Users list for the GNU Emacs text editor
  2024-12-08 16:36       ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2024-12-08 15:50 UTC (permalink / raw)
  To: help-gnu-emacs

> EMACS_INCLUDE_DIR := $(shell $(EMACS) -q --batch --eval "(princ
> *em-include-directory*)")
> EMACS_SRC_DIR := $(shell $(EMACS) -q --batch --eval "(princ
> *em-scr-directory*)")

FWIW, when compiled from within Emacs, you'd be better served with
something like:

    (call-process "make" nil nil nil
                  (concat "EMACS_INCLUDE_DIR=" em-include-directory))


- Stefan




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Retrieving the "include" directory for Emacs Modules
  2024-12-08 15:18 ` Re: Retrieving the "include" directory for Emacs Modules Marco Antoniotti
  2024-12-08 15:29   ` Jean Louis
@ 2024-12-08 16:30   ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2024-12-08 16:30 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Marco Antoniotti <marcoxa@gmail.com>
> Date: Sun, 8 Dec 2024 16:18:15 +0100
> 
> sorry again: the behavior on Mac and Windows is different w.r.t.
> data-directory (see previous message).  I can try on a Linux machine
> tomorrow.  Note that I installed Emacs with brew on my Mac
> 
> Case in point: if I try to install 'pq' from the package manager I get the
> following error.
> 
> gcc -I/Users/marcoxa/.emacs.d/elpa/pq-0.2 -I -I/usr/share/emacs/29.4
> -I/usr/local/include/postgresql@14 -std=gnu99 -ggdb3 -Wall -fPIC -c
> pq-core.c
> 
> pq-core.c:19:10: fatal error: 'emacs-module.h' file not found
>    19 | #include <emacs-module.h>
>       |          ^~~~~~~~~~~~~~~~
> 1 error generated.
> make: *** [pq-core.o] Error 1
> 
> which is not surprising as the include directory is not listed in the -I
> options.

It shouldn't be: if the compiler cannot find emacs-module.h, then your
Emacs is installed incorrectly.  The installation should put
emacs-module.h where the compiler looks for include files.

> Of course, I can muck around and ensure that the C_INCLUDE_PATH has the
> right things in it, but the issue, as is, IMHO remains.

You shouldn't need to mess with C_INCLUDE_PATH, because emacs-module.h
is supposed to be in the C include path to begin with.

> Having said that, another reason for needing a reliable
> include-directory variable,
> is to query Emacs in batch mode (I know: iti is expensive), to run a build
> system outside Emacs for testing.

Sorry, I don't understand that: what do you mean by "to run a build
system"?



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Retrieving the "include" directory for Emacs Modules
  2024-12-08 15:36     ` Marco Antoniotti
  2024-12-08 15:50       ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2024-12-08 16:36       ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2024-12-08 16:36 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Marco Antoniotti <marcoxa@gmail.com>
> Date: Sun, 8 Dec 2024 16:36:09 +0100
> 
> I have no qualms about being able to "fix" 'pq' to make it work.
> 
> But I am writing an Emacs Module and I do not want to force anybody to
> "fix" my setup ("It works on my machine" (tm))
> 
> In other words, I would like to be able to write
> 
> EMACS_INCLUDE_DIR := $(shell $(EMACS) -q --batch --eval "(princ
> *em-include-directory*)")
> EMACS_SRC_DIR := $(shell $(EMACS) -q --batch --eval "(princ
> *em-scr-directory*)")

Once again: if your Emacs is installed correctly, emacs-module.h
should be in a directory where the C compiler looks by default for its
header files.  No -I command-line options should be needed.  Just make
sure to put emacs-module.h where you have stdio.h and other standard
headers.




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-12-08 16:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.606.1733669386.12711.help-gnu-emacs@gnu.org>
2024-12-08 15:18 ` Re: Retrieving the "include" directory for Emacs Modules Marco Antoniotti
2024-12-08 15:29   ` Jean Louis
2024-12-08 15:36     ` Marco Antoniotti
2024-12-08 15:50       ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-12-08 16:36       ` Eli Zaretskii
2024-12-08 16:30   ` Eli Zaretskii
     [not found] <mailman.77.1733590872.28947.help-gnu-emacs@gnu.org>
2024-12-08  9:59 ` Marco Antoniotti

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).