unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Irelan <rirelan@gmail.com>
To: Phil Sainty <psainty@orcon.net.nz>
Cc: "Basil L. Contovounesios" <contovob@tcd.ie>,
	Lars Ingebrigtsen <larsi@gnus.org>,
	46958@debbugs.gnu.org
Subject: bug#46958: 28.0.50; invalid-function error for macros that have function bindings
Date: Sun, 7 Mar 2021 13:38:53 -0800	[thread overview]
Message-ID: <CAJUyYjq4ooSBrY1rT=VUXkHsCqSa-piaM=UQz1rJpUj+OpeTaw@mail.gmail.com> (raw)
In-Reply-To: <2f63faf5-656a-e9cd-2249-0576da0b9e0c@orcon.net.nz>

No, that results in a circular import.

The way this file (not my code, by the way) seems to work is that it
started out as one file, org-fc.el, that contained everything. At
various points, they decided to break out some parts of the file into
separate files like this:

```
;;; org-fc.el

;; ... some definitions, including macro
`org-fc-with-point-at-back-heading' and the other `org-fc' symbols
mentioned in org-fc-type-normal.el

(require 'org-fc-type-normal)

;; ... some more definitions

(provide 'org-fc)
```

```
;;; org-fc-type-normal.el

(defun org-fc-type-normal-init ()
  "Mark headline as card of the normal type."
  (interactive)
  (org-fc--init-card "normal")
  (org-fc-review-data-update '("front")))

(defun org-fc-type-normal-setup (_position)
  "Prepare a normal card for review."
  (interactive)
  ;; Make sure the card is collapsed
  (outline-hide-subtree)
  (when (org-fc-has-back-heading-p)
    (org-show-entry)
    ;; Make sure the back heading is visible
    (org-fc-with-point-at-back-heading
     (org-show-set-visibility 'minimal))))

(defun org-fc-type-normal-flip ()
  "Flip a normal card."
  (interactive)
  (org-show-entry)
  (org-show-children)
  ;; NOTE: the body only runs if the card has a back heading
  (org-fc-with-point-at-back-heading
   (org-show-entry)
   (org-show-children)
   (org-fc-show-latex)))

(org-fc-register-type
 'normal
 'org-fc-type-normal-setup
 'org-fc-type-normal-flip
 'org-fc-noop)

;;; Footer

(provide 'org-fc-type-normal)
```

Note that `org-fc-type-normal.el` doesn't `require` anything from
`org-fc`, but assumes that they have been already defined by the time
`org-fc.el` runs the `require` call.

On Sat, Mar 6, 2021 at 2:39 PM Phil Sainty <psainty@orcon.net.nz> wrote:
>
> On 7/03/21 7:28 am, Robert Irelan wrote:
> > The call that's actually failing is located here:
> > https://git.sr.ht/~l3kn/org-fc/tree/711511192c62f6dccc96644dcf0705fda99e753a/item/org-fc-type-normal.el#L41.
>
> It looks like org-fc-type-normal.el should (require 'org-fc)
> at the start.
>
> Does that fix the problem?
>


-- 
Robert Irelan
rirelan@gmail.com





  parent reply	other threads:[~2021-03-07 21:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-06  2:00 bug#46958: 28.0.50; invalid-function error for macros that have function bindings Robert Irelan
2021-03-06 12:55 ` Lars Ingebrigtsen
2021-03-06 14:24   ` Basil L. Contovounesios
2021-03-06 18:28     ` Robert Irelan
2021-03-06 22:39       ` Phil Sainty
2021-03-07 14:27         ` Basil L. Contovounesios
2021-03-07 21:38         ` Robert Irelan [this message]
2021-03-08  6:30           ` Phil Sainty
2021-03-08  7:18             ` Robert Irelan
2021-03-08  9:06               ` Phil Sainty
2022-06-20  1:10               ` Lars Ingebrigtsen
2021-03-07 14:33   ` Pip Cet
2021-03-07 15:58     ` Lars Ingebrigtsen
2021-03-07 18:06       ` Pip Cet

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='CAJUyYjq4ooSBrY1rT=VUXkHsCqSa-piaM=UQz1rJpUj+OpeTaw@mail.gmail.com' \
    --to=rirelan@gmail.com \
    --cc=46958@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    --cc=larsi@gnus.org \
    --cc=psainty@orcon.net.nz \
    /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 public inbox

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

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