emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rodrigo Morales <rodrigo.morales@utec.edu.pe>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Show drawers in text entries in Org Agenda
Date: Tue, 06 Jul 2021 06:40:10 -0500	[thread overview]
Message-ID: <87o8bfisbp.fsf@utec.edu.pe> (raw)
In-Reply-To: <871r8cmfdt.fsf@utec.edu.pe> (Rodrigo Morales's message of "Mon,  05 Jul 2021 19:53:50 -0500")

[-- Attachment #1: Type: text/plain, Size: 1221 bytes --]

Rodrigo Morales <rodrigo.morales@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.

[-- Attachment #2: Type: text/plain, Size: 193 bytes --]


-- 
[[[ 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. ]]]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0001-org-agenda.el-Added-defcustom-for-visiblity-of-drawe.patch --]
[-- Type: text/x-patch, Size: 1940 bytes --]

From 389ac7b8029d9ed4d0b862481465e3edfa8515de Mon Sep 17 00:00:00 2001
From: Rodrigo Morales <rodrigo.morales@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	other threads:[~2021-07-06 11:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-06  0:53 [Q] Show drawers in Org Agenda search buffer with org-agenda-entry-text-mode Rodrigo Morales
2021-07-06 11:40 ` Rodrigo Morales [this message]
2021-07-14  8:58   ` [PATCH] Show drawers in text entries in Org Agenda Rodrigo Morales
2022-04-30  5:11   ` 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=87o8bfisbp.fsf@utec.edu.pe \
    --to=rodrigo.morales@utec.edu.pe \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: [PATCH] Show drawers in text entries in Org Agenda' \
    /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

Code repositories for project(s) associated with this 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).