unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Hartmut Goebel <h.goebel@crazy-compilers.com>
To: help-gnu-emacs@gnu.org
Subject: Folding yaml by markers
Date: Fri, 11 Oct 2019 16:41:07 +0200	[thread overview]
Message-ID: <3e45ddf0-5bb0-c065-df59-cb38285ed9cb@crazy-compilers.com> (raw)

Hello,

I have to deal with some YAML documents, which use some kind of
"literate programming": The comments contain documentation for the
values. These files already contain fold markers `[[[` and `]]]`
provided by the mainterner (who uses vim).

I want to leverage these fold markers for emacs, by adjusting
hs-special-modes-alist, but did not manage.  The blocks are folded by
yaml-structure, not by fold marks.

Any idea how do I need to set hs-special-modes-alist?

Here is my code:

 (defvar hs-special-modes-alist
   (mapcar 'purecopy
    '((yaml-mode "[[[" "#\s+]]]" nil))))

And here is an example document:

---
# Heading/Folding structure in this document
# * Variables
# ** PostgreSQL installation, packages
# *** .. envvar:: postgresql__upstream
# *** .. envvar:: postgresql__upstream_key_id
# *** pg_wrapper integration
# *** .. envvar:: postgresql__default_database
#

# Variables [[[
# =======================================

# PostgreSQL installation, packages [[[
# -------------------------------------

# .. envvar:: postgresql__upstream [[[
#
# Enable PostgreSQL Global Developmet Group APT repository?
# More information: https://wiki.postgresql.org/wiki/Apt
postgresql__upstream: False

                                                                   # ]]]
# .. envvar:: postgresql__upstream_key_id [[[
#
# The GPG fingerprint of the upstream APT repository key.
postgresql__upstream_key_id: 'B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8'
                                                                   # ]]]
                                                                   # ]]]
# pg_wrapper integration [[[
# --------------------------

# .. envvar:: postgresql__default_database [[[
#
# Name of the database the users should connect to, set as default in
# :file:`/etc/postgresql-common/user_clusters`. If the name is ``*``,
users will
# connect to the database with the same name as their login.
postgresql__default_database: '*'

                                                                   # ]]]
                                                                   # ]]]
                                                                   # ]]]

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |




             reply	other threads:[~2019-10-11 14:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-11 14:41 Hartmut Goebel [this message]
2019-10-14 13:02 ` Folding yaml by markers Robert Pluim
2019-10-16 20:33   ` Hartmut Goebel

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=3e45ddf0-5bb0-c065-df59-cb38285ed9cb@crazy-compilers.com \
    --to=h.goebel@crazy-compilers.com \
    --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.
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).