emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Mark Barton <mbarton98@gmail.com>
Cc: Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: [BUG] Warning (org-element): ‘org-element-at-point’ cannot be used in non-Org buffer #<buffer *Org Agenda*> (org-agenda-mode) [9.7.11 (release_9.7.11 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]
Date: Tue, 21 Jan 2025 20:48:26 +0000	[thread overview]
Message-ID: <87y0z3q4f9.fsf@localhost> (raw)
In-Reply-To: <3E946F08-E2AD-48B3-B63A-319343D50A97@gmail.com>

Mark Barton <mbarton98@gmail.com> writes:

> I had tried modifying Org agenda to display the repeater in tasks as Wai
> Hon's Blog documented a few weeks ago:
> https://whhone.com/posts/org-agenda-repeated-tasks/
>
> Below is the code that causes the org-element warning:
>
> (defun my/org-agenda-repeater ()
>   "The repeater shown in org-agenda-prefix for agenda."
>   (if (org-before-first-heading-p)
>       "-------"  ; fill the time grid
>     (format "%5s: " (or (org-get-repeat) ""))))
>
> ;; Add `my/org-agenda-repeater' to the agenda prefix.
> (setcdr (assoc 'agenda org-agenda-prefix-format)
>         " %i %-12:c%?-12t%s%(my/org-agenda-repeater)")

This code looks all right - org-agenda-prefix-format placeholders are
evaluated with current buffer being Org buffer (normally).

May you try to run M-x debug-on-entry RET display-warning RET and
try triggering the warning? Then, you will see a backtrace with the full
information about where the warning is triggered.

(you can later disable the debugger via M-x cancel-debug-on-entry RET RET)

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


  reply	other threads:[~2025-01-21 20:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-21 20:26 [BUG] Warning (org-element): ‘org-element-at-point’ cannot be used in non-Org buffer #<buffer *Org Agenda*> (org-agenda-mode) [9.7.11 (release_9.7.11 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)] Mark Barton
2025-01-21 20:48 ` Ihor Radchenko [this message]
2025-01-21 23:06   ` Mark Barton
2025-01-22  1:09     ` Mark Barton

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=87y0z3q4f9.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=mbarton98@gmail.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public 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).