Rodrigo Morales <rodrigo.mora...@utec.edu.pe> writes:

>
> For this reason, I am wondering whether there is a way to make
> =org-agenda-entry-text-mode= to show the drawers without much
> tinkering.
> 

After inspecting the source code of Org Mode, I managed to do what I was
searching by deleting the relevant part of the function
=org-agenda-get-some-entry-text=. This function unconditionally removes
drawers from subtrees in order for the remaining content be shown in
text entries.

I've created the following patch which adds a defcustom that would allow
the user to decide whether drawers must be hidden or shown in text
entries. Hope this helps.


-- 
La información contenida en este e-mail y sus anexos es confidencial, 
privilegiada y está dirigida exclusivamente a su destinatario, en 
consecuencia, solo puede ser utilizada por aquel. Si usted no es el 
destinatario original, no deberá examinar, usar, copiar o distribuir este 
mensaje o la información que contiene. Si lo recibe por error, por favor 
reenvíelo a la persona que se lo envió y elimínelo. Cualquier retención o 
uso total o parcial no autorizada de este mensaje está estrictamente 
prohibida y sancionada por ley.
-- 
[[[ If you see a signature in spanish below this message, please omit
it, it has to do with the internal privacy policies of the organization
that owns the domain of my email address. ]]]
>From 389ac7b8029d9ed4d0b862481465e3edfa8515de Mon Sep 17 00:00:00 2001
From: Rodrigo Morales <rodrigo.mora...@utec.edu.pe>
Date: Tue, 6 Jul 2021 06:26:11 -0500
Subject: [PATCH] org-agenda.el: Added defcustom for visiblity of drawers in
 text entries

* lisp/org-agenda.el: Added boolean defcustom for visibility of
drawers in text entries in Org Agenda buffers.
---
 lisp/org-agenda.el | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 44acd035a..c558e7fcd 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1074,6 +1074,11 @@ removed from entry text before it is shown in the agenda."
   :group 'org-agenda
   :type 'string)
 
+(defcustom org-agenda-entry-text-hide-drawers t
+  "Non-nil means hide drawers in entry text in agenda buffers."
+  :group 'org-agenda
+  :type 'boolean)
+
 (defvar org-agenda-entry-text-cleanup-hook nil
   "Hook that is run after basic cleanup of entry text to be shown in agenda.
 This cleanup is done in a temporary buffer, so the function may inspect and
@@ -3676,12 +3681,13 @@ removed from the entry content.  Currently only `planning' is allowed here."
 	       (set-text-properties (match-beginning 0) (match-end 0)
 				    nil))
 	     (goto-char (point-min))
-	     (while (re-search-forward drawer-re nil t)
-	       (delete-region
-		(match-beginning 0)
-		(progn (re-search-forward
-			"^[ \t]*:END:.*\n?" nil 'move)
-		       (point))))
+             (when org-agenda-entry-text-hide-drawers
+               (while (re-search-forward drawer-re nil t)
+                 (delete-region
+                  (match-beginning 0)
+                  (progn (re-search-forward
+                          "^[ \t]*:END:.*\n?" nil 'move)
+                         (point)))))
 	     (unless (member 'planning keep)
 	       (goto-char (point-min))
 	       (while (re-search-forward kwd-time-re nil t)
-- 
2.32.0

Reply via email to