all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / 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
  2024-12-08 11:40   ` Eli Zaretskii
  0 siblings, 1 reply; 10+ 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] 10+ messages in thread

* Re: Retrieving the "include" directory for Emacs Modules
  2024-12-08  9:59 ` Re: Retrieving the "include" directory for Emacs Modules Marco Antoniotti
@ 2024-12-08 11:40   ` Eli Zaretskii
  2024-12-08 15:47     ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2024-12-08 11:40 UTC (permalink / raw)
  To: help-gnu-emacs

> 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?



^ permalink raw reply	[flat|nested] 10+ 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
  0 siblings, 1 reply; 10+ 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] 10+ messages in thread

* Re: Re: Retrieving the "include" directory for Emacs Modules
  2024-12-08 15:18 ` Marco Antoniotti
@ 2024-12-08 15:29   ` Jean Louis
  2024-12-08 15:36     ` Marco Antoniotti
  0 siblings, 1 reply; 10+ 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] 10+ 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
  0 siblings, 0 replies; 10+ 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] 10+ messages in thread

* Re: Retrieving the "include" directory for Emacs Modules
  2024-12-08 11:40   ` Eli Zaretskii
@ 2024-12-08 15:47     ` Stefan Monnier via Users list for the GNU Emacs text editor
  2024-12-08 16:39       ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2024-12-08 15:47 UTC (permalink / raw)
  To: help-gnu-emacs

> 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?

That presumes that Emacs is installed system-wide (and "properly").
When the compilation of the module is initiated from within Emacs, it
would make a lot of sense for this "ambient" Emacs to be able to tell
`make/gcc/younameit` explicitly and reliably where its own
`emacs-module.h` can be found.


        Stefan




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

* Re: Retrieving the "include" directory for Emacs Modules
  2024-12-08 15:47     ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2024-12-08 16:39       ` Eli Zaretskii
  2024-12-08 16:48         ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2024-12-08 16:39 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sun, 08 Dec 2024 10:47:54 -0500
> From:  Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
> 
> > 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?
> 
> That presumes that Emacs is installed system-wide (and "properly").

What other way is there to install Emacs?

> When the compilation of the module is initiated from within Emacs, it
> would make a lot of sense for this "ambient" Emacs to be able to tell
> `make/gcc/younameit` explicitly and reliably where its own
> `emacs-module.h` can be found.

But if Emacs is "not installed properly", we don't know that.



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

* Re: Retrieving the "include" directory for Emacs Modules
  2024-12-08 16:39       ` Eli Zaretskii
@ 2024-12-08 16:48         ` Stefan Monnier via Users list for the GNU Emacs text editor
  2024-12-08 17:46           ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2024-12-08 16:48 UTC (permalink / raw)
  To: help-gnu-emacs

>> > 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?
>> 
>> That presumes that Emacs is installed system-wide (and "properly").
>
> What other way is there to install Emacs?

Compile manually and run from the build tree?
Uncompress a downloaded pre-compiled archive into a directory and just
use it from there (AFAIK, very common under macOS and Windows)?
With luck on some systems the C (or other) compiler is installed in
a similar way (i.e. in its own subdirectory, siloed from Emacs).

>> When the compilation of the module is initiated from within Emacs, it
>> would make a lot of sense for this "ambient" Emacs to be able to tell
>> `make/gcc/younameit` explicitly and reliably where its own
>> `emacs-module.h` can be found.
> But if Emacs is "not installed properly", we don't know that.

Emacs *should* know that, just like it knows where is its
`lisp-directory`.


        Stefan




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

* Re: Retrieving the "include" directory for Emacs Modules
  2024-12-08 16:48         ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2024-12-08 17:46           ` Eli Zaretskii
  2024-12-09 14:11             ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2024-12-08 17:46 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sun, 08 Dec 2024 11:48:24 -0500
> From:  Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
> 
> >> >   #include <emacs-module.h>
> >> >
> >> > and that's it.  Or what am I missing?
> >> 
> >> That presumes that Emacs is installed system-wide (and "properly").
> >
> > What other way is there to install Emacs?
> 
> Compile manually and run from the build tree?

That's called "run uninstalled".  And in that case, the user who does
that knows very well where the header lives: in the same directory
from which he/she runs Emacs.

> Uncompress a downloaded pre-compiled archive into a directory and just
> use it from there (AFAIK, very common under macOS and Windows)?

If that doesn't place emacs-module.h in the system-wide include
directory, it is a broken installation.

> With luck on some systems the C (or other) compiler is installed in
> a similar way (i.e. in its own subdirectory, siloed from Emacs).

That's not how multi-package installation should be organized if the
user wants the packages to cooperate.

> >> When the compilation of the module is initiated from within Emacs, it
> >> would make a lot of sense for this "ambient" Emacs to be able to tell
> >> `make/gcc/younameit` explicitly and reliably where its own
> >> `emacs-module.h` can be found.
> > But if Emacs is "not installed properly", we don't know that.
> 
> Emacs *should* know that, just like it knows where is its
> `lisp-directory`.

That's impractical expectation.  Recall how hard we worked to find the
pdumper file and the preloaded *.eln files, what with all the tricks
people use when installing Emacs.  I'm not interested in adding
another burden to our maintenance so that Emacs will paper over broken
installations.  Sorry.



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

* Re: Retrieving the "include" directory for Emacs Modules
  2024-12-08 17:46           ` Eli Zaretskii
@ 2024-12-09 14:11             ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2024-12-09 14:11 UTC (permalink / raw)
  To: help-gnu-emacs

>> Compile manually and run from the build tree?
> That's called "run uninstalled".  And in that case, the user who does
> that knows very well where the header lives: in the same directory
> from which he/she runs Emacs.

Why would they know that?  I mean, of course, some will, but many people
compile their own Emacs just to live on the bleeding edge and may never
really look at the C code.

[ Personally, I knew that *an* `emacs-module.h` file lived in there, but
  I wasn't 100% sure it's the right one to use (I expected there might
  be another one in some other directory).  ]

>> Uncompress a downloaded pre-compiled archive into a directory and just
>> use it from there (AFAIK, very common under macOS and Windows)?
> If that doesn't place emacs-module.h in the system-wide include
> directory, it is a broken installation.

If the user doesn't have administrator rights, then the installation
can't really be blamed for not adding itself to a system-wide
include directory.

>> Emacs *should* know that, just like it knows where is its
>> `lisp-directory`.
> That's impractical expectation.

We decide where the .h file is put, so it's really not.

> Recall how hard we worked to find the pdumper file and the preloaded
> *.eln files, what with all the tricks people use when
> installing Emacs.

Yup.  And we don't need anything *more*.  We just need to place the
include file at a place that's easy to find once we know the rest.
E.g. it could be `$(data-directory)/module-include`.

> I'm not interested in adding another burden to our maintenance so that
> Emacs will paper over broken installations.

The system-wide install may have an older version of Emacs than the one
from which we want to compile a module.

It's good that we expose `emacs-module.h` system-wide, but I think it's
even more important for Emacs to be able to compile its own modules
without having to rely on that.


        Stefan




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

end of thread, other threads:[~2024-12-09 14:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.77.1733590872.28947.help-gnu-emacs@gnu.org>
2024-12-08  9:59 ` Re: Retrieving the "include" directory for Emacs Modules Marco Antoniotti
2024-12-08 11:40   ` Eli Zaretskii
2024-12-08 15:47     ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-12-08 16:39       ` Eli Zaretskii
2024-12-08 16:48         ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-12-08 17:46           ` Eli Zaretskii
2024-12-09 14:11             ` Stefan Monnier via Users list for the GNU Emacs text editor
     [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 15:36     ` Marco Antoniotti

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.