all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Wrapping an Emacs dynamic module in a package
Date: Mon, 17 Oct 2016 09:27:16 -0400	[thread overview]
Message-ID: <jwvbmyjdshz.fsf-monnier+gmane.emacs.help@gnu.org> (raw)
In-Reply-To: CAFytq+nFwaeYHaEG6OxDiUFrPCK5oJgxNm-kLZZtpNvb-d38Hg@mail.gmail.com

> 1) I wrote an emacs module _mymod.so, as well as wrappers mymod.el (with
> some local setup) and mymod-pkg.el (which only has a call to
> define-package).

FWIW, I doubt you wrote _mymod.so.  Most likely you wrote something like
_mymod.c and then you asked a C compiler and a linker turn that into
a _mycmd.so.

Yes, it's a nitpick, but when you send your bug-report, please try to
use precise wording, because it's often surprisingly easy to introduce
major confusion otherwise.

> In my messages buffer, I see that Emacs tries to generate autoloads for the
> .so, and fails with the error indicated in the original email ("_mymod.so:0:0:
> error: scan-error: (Containing expression ends prematurely 238020
> 238021))").

In your bug-report, please show the corresponding backtrace.

> 1) Should Emacs be able to generate autoloads for an .so?

No.  It shouldn't scan those files for autoloads.

> 2) Does anybody have any experience with embedding an emacs module in an
> emacs package? Any best practices I should be aware of?

You might very well be the first to try it out.

Note, tho, that the ELPA format is a tarball containing .el files,
i.e. *source* files.  Similarly, it should hold _mycmd.c rather than
_mycmd.so.  Then again, package.el doesn't know how to turn that
_mycmd.c into _mycmd.so.   You can probably work around that problem by
adding something like

    (eval-when-compile
      (call-process "cc" nil nil nil <args>))

in your mymod.el (so that when the .el file gets byte-compiled, it
triggers compilation and linking of the C module).

But yes, including the .so *should* happen work (barring bugs) as long
as you're lucky enough to use the package on the right OS with the right
Emacs version, on the right architecture.


        Stefan




  parent reply	other threads:[~2016-10-17 13:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-16 17:37 Wrapping an Emacs dynamic module in a package Joris Vankerschaver
2016-10-17  5:51 ` Eli Zaretskii
2016-10-17  8:34   ` Joris Vankerschaver
2016-10-17  9:02     ` Eli Zaretskii
2016-10-17 13:27     ` Stefan Monnier [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-10-18  7:31 Joris Vankerschaver
2016-10-18 13:08 ` Stefan Monnier

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

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

  git send-email \
    --in-reply-to=jwvbmyjdshz.fsf-monnier+gmane.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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.