org-mode – Propiedad del modo de organización para hacer que la visibilidad del subárbol sea bimodal?

Pregunta:

¿Hay alguna propiedad que pueda establecer en un título que haga que Tab / (org-cycle) muestre todo en el subárbol (es decir, llame efectivamente a (outline-show-subtree) )?

Mientras que el ciclismo sub-árbol gira un subárbol entre los tres estados, FOLDED , CHILDREN , y SUBTREE , me gustaría limitar el espacio de estado a solo FOLDED y SUBTREE para seleccionar subárboles. Este mecanismo indica implícitamente que un subárbol en particular está destinado a ser visto como una unidad atómica, lo cual es útil para incorporar documentos completos dentro de un árbol en modo Org. La alternativa me distrae un poco, es decir, identificar el subárbol correcto para expandir, presionar Tab dos veces y confirmar visualmente si estoy en la ubicación correcta.

Respuesta:

Este es un buen trabajo de asesoramiento .

(advice-add 'org-cycle :around #'my/org-cycle)

(defun my/toggle-bimodal-cycling (&optional pos)
  "Enable/disable bimodal cycling behavior for the current heading."
  (interactive)
  (let* ((enabled (org-entry-get pos "BIMODAL-CYCLING")))
    (if enabled
        (org-entry-delete pos "BIMODAL-CYCLING")
      (org-entry-put pos "BIMODAL-CYCLING" "yes"))))

(defun my/org-cycle (fn &optional arg)
  "Make org outline cycling bimodal (FOLDED and SUBTREE) rather than trimodal (FOLDED, CHILDREN, and SUBTREE) when a heading has a :BIMODAL-CYCLING: property value."
  (interactive)
  (if (and (org-at-heading-p)
           (org-entry-get nil "BIMODAL-CYCLING"))
      (my/toggle-subtree)
    (funcall fn arg)))

(defun my/toggle-subtree ()
  "Show or hide the current subtree depending on its current state."
  (interactive)
  (save-excursion
    (outline-back-to-heading)
    (if (not (outline-invisible-p (line-end-position)))
        (outline-hide-subtree)
      (outline-show-subtree))))

Leave a Comment

Your email address will not be published. Required fields are marked *

web tasarım