emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* looking for a macro eval workaround (9.1 vs 9.2 and +) for export backend test
@ 2020-11-21 10:56 Bruno BEAUFILS
  2020-11-21 13:18 ` Tim Cross
  2020-11-23 10:19 ` Eric S Fraga
  0 siblings, 2 replies; 9+ messages in thread
From: Bruno BEAUFILS @ 2020-11-21 10:56 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Bruno BEAUFILS

[-- Attachment #1: Type: text/plain, Size: 1584 bytes --]

I have a *lot* of org files with a macro =if-backend= which enables me
to decide what to export depending on the backend :

#+begin_src org
  #+macro: if-backend (eval (if (org-export-derived-backend-p org-export-current-backend '$1) "$2"))
#+end_src

For instance, I use it to include =\hfill= in LaTeX family export
engines but not in others (html for instance) :

#+begin_src org
  #+macro: hfill {{{if-backend(latex, \\hfill{} )}}}
#+end_src

I generally use emacs 26.3 as distributed by Debian bullseyes (which
offer org-mode version 9.1.9).

On another box I need to work with a more recent org-mode, precisely
9.4.

In that environment, due to an incompatible change introduced by
[[https://orgmode.org/Changes_old.html#outline-container-org003add6][release 9.2]] the same macro has to be written in a different way :

#+begin_src org
  #+macro: if-backend (eval (if (org-export-derived-backend-p org-export-current-backend (intern $1)) $2))
#+end_src

And thus I need to change also the macro using it, for instance the
=hfill= macro has to be written that way :

#+begin_src org
  #+macro: hfill {{{if-backend(latex, \hfill{} )}}}
#+end_src

For now I need to work on the same files in these two different environment.

Do anyone have an idea on how to be able whether to define the
=if-backend= in a way that it can work in both org versions or if
there is a way to define these macro in different ways depending on
org version?

I would like to let the definitions in org files and not in emacs init
files.

-- 
Bruno BEAUFILS

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2020-11-29 20:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-21 10:56 looking for a macro eval workaround (9.1 vs 9.2 and +) for export backend test Bruno BEAUFILS
2020-11-21 13:18 ` Tim Cross
2020-11-22 20:49   ` Bruno BEAUFILS
2020-11-23 10:19 ` Eric S Fraga
2020-11-23 13:02   ` Bruno BEAUFILS
2020-11-23 13:12     ` Eric S Fraga
2020-11-29 17:30       ` Bruno BEAUFILS
2020-11-29 17:45         ` Eric S Fraga
2020-11-29 20:55           ` Tom Gillespie

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).