unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: "Sébastien Gendre" <seb@k-7.ch>
Cc: GNU Emacs text editor <help-gnu-emacs@gnu.org>
Subject: Re: Using Org-mode for literate Emacs configuration with use-package
Date: Sat, 13 Jul 2024 14:36:10 +0000	[thread overview]
Message-ID: <87ikx9pdet.fsf@localhost> (raw)
In-Reply-To: <87le2acq2f.fsf@k-7.ch>

Sébastien Gendre <seb@k-7.ch> writes:

> Sometimes, I need to split a package configuration into multiple
> sections of my Org-mode document. For example Org-mode, because I set a
> lot of settings. By spiting my config, I can correctly document each
> option and organize it in a more comprehensible way.
>
> But with the elisp function `(use-package)`, I need to join each package
> configuration into the call of `(use-package)` function. Which prevent
> me from splitting my config into Org-mode sections.
>
> I was thinking of writing Org-mode source block with different parts of
> my `(use-package)` call, so I can distribute it into different section of my
> Org-mode document. But in this case, I can no-longer evaluate my
> `(use-package)` call directly from my Org-mode document.
>
> Do you have any suggestion ? How do you manage this problem ?

You can make use of noweb expansion:

* Org config

#+begin_src emacs-lisp :tangle yes :noweb yes
  (use-package org
    :config
    <<org-settings>>
    )
#+end_src

** Actual config
:PROPERTIES:
:header-args: :noweb-ref org-settings :tangle no
:END:
*** Agenda files
#+begin_src emacs-lisp
(setq org-agenda-files '("/path/to/agenda/files"))
#+end_src
*** Startup
#+begin_src emacs-lisp
  (setq org-startup-indented t)
#+end_src


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



  parent reply	other threads:[~2024-07-13 14:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-09 19:39 Using Org-mode for literate Emacs configuration with use-package Sébastien Gendre
2024-07-13 13:45 ` John Kitchin
2024-07-15 17:13   ` Sébastien Gendre
2024-07-13 14:36 ` Ihor Radchenko [this message]
2024-07-15 17:17   ` Sébastien Gendre
2024-07-15 17:32     ` Ihor Radchenko
2024-07-13 17:56 ` Dominic Martinez
2024-07-15 17:20   ` Sébastien Gendre
2024-07-15  9:37 ` Rens Oliemans
2024-07-15 17:20   ` Sébastien Gendre
2024-07-16  6:02 ` Björn Bidar

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=87ikx9pdet.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=help-gnu-emacs@gnu.org \
    --cc=seb@k-7.ch \
    /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.
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).