emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Completely hide properties drawer in 9.6


From: Sterling Hooten
Subject: Re: Completely hide properties drawer in 9.6
Date: Wed, 14 Dec 2022 15:27:55 -0300

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'.




reply via email to

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