* The context I constantly perform searches in the Agenda, and sometimes I search for properties (which is currently supported by the search feature). For example, some of my headlines have :URL: property, so I can list all the headlines which contain a :URL: property that contain the string "github" with the following search. #+BEGIN_EXAMPLE +URL={.*github.*} #+END_EXAMPLE If viewing the content of the subtree is necessary, then I toggle =org-agenda-entry-text-mode=. * The problem The problem is that =org-agenda-entry-text-mode= doesn't show drawers (i.e. :PROPERTY: and :LOGBOOK:), and I would like drawers to be shown since thus, I would see the content of the :URL: property without leaving the Org Agenda buffer (which lists all the search matches.) * The question 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. Any help is appreciated. [[[ If you see a signature in spanish below this message, please ommit it, it has nothing to do with the content of this message. It is automatically inserted in all my messages because that's how the organization which owns the domain of my email address have set it up. ]]] -- 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 #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
Rodrigo Morales <rodrigo.morales@utec.edu.pe> writes:
> 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.
It is worth mentioning that another reason for considering this patch is
the fact that =org-search-view= (=s= command in the Agenda) also search
in drawers. This could make some some users think that =org-search-view=
is not working as expected since they would expect that the results
shown in the Agenda contain a match for the searched string when
toggling =org-agenda-entry-text-mode=. However, because
=org-agenda-entry-text-mode= doesn't show drawers, the match wouldn't be
visible.
--
[[[ If you see a signature in spanish below this message, please omit
it. It is automatically inserted in all my messages due to the internal
privacy policies of the organization that owns the domain of my email
address. ]]]
--
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.
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. Thanks! The patch looks useful. > +(defcustom org-agenda-entry-text-hide-drawers t > + "Non-nil means hide drawers in entry text in agenda buffers." > + :group 'org-agenda > + :type 'boolean) > + (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) I'd prefer if you reuse the KEEP argument to org-agenda-get-some-entry-text. It is already designed for such things. Best, Ihor