help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Folding yaml by markers


From: Hartmut Goebel
Subject: Folding yaml by markers
Date: Fri, 11 Oct 2019 16:41:07 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0

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          | address@hidden               |
| www.crazy-compilers.com | compilers which you thought are impossible |




reply via email to

[Prev in Thread] Current Thread [Next in Thread]