From: Sterling Hooten <hooten@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: Completely hide properties drawer in 9.6
Date: Wed, 14 Dec 2022 15:27:55 -0300 [thread overview]
Message-ID: <25EC8C19-CFD9-4973-8F5B-896AF45C7002@gmail.com> (raw)
In-Reply-To: <87bko6t3tb.fsf@localhost>
I was able to get a very rough version working to fold and hide
the properties drawer completely at point.
#+begin_src emacs-lisp
(defun swh-org-hide-properties-drawer ()
"Completely hide the property drawer in heading at point."
(org-fold-add-folding-spec 'org-hide-property-drawer
'((:ellipsis . nil)
(:isearch-open . t))
nil
'append)
(let* ((block (org-get-property-block))
;; Extremely hacky way to get the whole property drawer
(beg (- (car block) 14))
(end (+ (cdr block) 5)))
(with-silent-modifications
(org-fold-region beg end t 'org-hide-property-drawer))))
#+end_src
Is there a better way to get the beginning and end
of the property drawer more robustly?
This is a step in the right direction, but it seems too sensitive to accidental editing.
This should be impervious to most types of user interaction,
and prevent accidentally deleting or abutting anything
up against either the start or end of the properties box.
I tried setting `org-fold-catch-invisible-edits' to different values, but even
with set to nil I can backward delete and erase some invisible
text. Is this dependent on their being an ellipsis? Or is there
another way to make this impervious to most edits?
When adding a property with `org-property-put’ this would need
to be called again, is there a way to do that robustly?
> On 2022-12-14, at 12:14, Ihor Radchenko <yantar92@posteo.net> wrote:
>
> I tried my best to explain the design in the top comment. You may also
> look into `org-fold-initialize'.
next prev parent reply other threads:[~2022-12-14 18:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-14 5:37 Completely hide properties drawer in 9.6 Sterling Hooten
2022-12-14 9:15 ` Ihor Radchenko
2022-12-14 14:37 ` Sterling Hooten
2022-12-14 15:14 ` Ihor Radchenko
2022-12-14 18:27 ` Sterling Hooten [this message]
2022-12-14 18:40 ` Ihor Radchenko
2022-12-23 3:33 ` Sterling Hooten
2023-01-16 14:16 ` Ihor Radchenko
2022-12-16 9:38 ` Jean Louis
2022-12-16 11:46 ` Ihor Radchenko
2022-12-16 14:44 ` Jean Louis
2022-12-16 15:18 ` Ihor Radchenko
2022-12-17 23:54 ` Jean Louis
2022-12-18 13:26 ` [Feature] Store heading properties remotely, outside the Org file (was: Completely hide properties drawer in 9.6) Ihor Radchenko
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.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=25EC8C19-CFD9-4973-8F5B-896AF45C7002@gmail.com \
--to=hooten@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=yantar92@posteo.net \
/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/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).