In my org files, apparently I have an empty agenda item somewhere. This
causes org-agenda-to-appt to fail with this backtrace:
Debugger entered--Lisp error: (args-out-of-range 1 1)
get-text-property(1 txt "")
#f(compiled-function (x) #<bytecode -0x17bb48bdbfe28efb>)("")
org-agenda-to-appt()
I'm not sure where the empty-string item comes from, but this simple
patch to remove empty-string entries fixes it:
modified lisp/org-agenda.el
@@ -11206,7 +11206,7 @@ to override `appt-message-warning-time'."
(match-string 2 tod))))
(when (appt-add tod evt wrn)
(setq cnt (1+ cnt))))))
- entries)
+ (remq "" entries))
(org-release-buffers org-agenda-new-buffers)
(if (eq cnt 0)
(message "No event to add")
This is on Emacs master built a month ago from source on my M1 Macbook,
with org-mode loaded via the source repo using elpaca.
Emacs : GNU Emacs 31.0.50 (build 1, aarch64-apple-darwin24.5.0, NS
appkit-2575.60 Version 15.5 (Build 24F74))
of 2025-07-20
Package: Org mode version 9.8-pre (9.8-pre-n/a-ge8413b
@ /Users/garyo/.config/emacs/var/elpaca/builds/org/)
I could try to track down the empty string, but it seems to me best to make
org-agenda robust against such user errors.
current state:
==============
(setq
org-agenda-skip-scheduled-if-done t
org-refile-target-verify-function 'go/verify-refile-target
org-yank-image-file-name-function 'org-yank-image-autogen-filename
org-persist-before-write-hook '(org-element--cache-persist-before-write)
org-html-format-headline-function
'org-html-format-headline-default-function
org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
org-default-notes-file "/Users/garyo/Documents/org-agenda/journal.org"
org-directory "/Users/garyo/Documents/org-agenda"
org-latex-format-inlinetask-function
'org-latex-format-inlinetask-default-function
org-agenda-custom-commands '(("w" "At work"
((agenda "" ((org-agenda-span 2)))
(tags-todo "+PRIORITY=\"A\"")
(tags-todo "@work"))
((org-agenda-compact-blocks t)))
("h" "At home"
((agenda "" ((org-agenda-span 4)))
(tags-todo "+PRIORITY=\"A\"")
(tags-todo "@home"))
((org-agenda-compact-blocks t)))
("i" "Inbox" ((tags-todo
"+CATEGORY=\"Inbox\"")))
("u" "Uncategorized"
((tags-todo "-{.*}"
((org-agenda-overriding-header
"Uncategorized TODOs")))
)
)
("U" "Unscheduled"
((todo ""
((org-agenda-overriding-header
"Unscheduled TODOs")
(org-agenda-skip-function
'(org-agenda-skip-entry-if 'scheduled)))
)
)
)
)
org-babel-tangle-lang-exts '(("latex" . "tex") ("python" . "py") ("D" .
"d") ("C++" . "cpp")
("emacs-lisp" . "el") ("elisp" . "el")
("bibtex" . "bib"))
org-display-remote-inline-images 'cache
org-speed-command-hook '(org-speed-command-activate
org-babel-speed-command-activate)
org-persist-after-read-hook '(org-element--cache-persist-after-read)
org-export-with-sub-superscripts '{}
org-confirm-elisp-link-function 'yes-or-no-p
org-id-locations-file "/Users/garyo/.config/emacs/var/org/id-locations.el"
org-agenda-finalize-hook '(org-agenda-to-appt)
org-log-done 'time
org-latex-format-headline-function
'org-latex-format-headline-default-function
org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
org-mode-hook '(breadcrumb-mode org-imgtog-mode org-tempo-setup
#[0 "\300\301\302\303\304$\207"
[add-hook change-major-mode-hook org-fold-show-all
append local] 5]
#[0 "\300\301\302\303\304$\207"
[add-hook change-major-mode-hook
org-babel-show-result-all append local] 5]
org-babel-result-hide-spec org-babel-hide-all-hashes
#[0 "\301\211 \207" [imenu-create-index-function
org-imenu-get-tree] 2]
org-appear-mode
#[nil
((mixed-pitch-mode 1) (visual-line-mode 1) (setq
line-spacing 0.4)
(setq completion-at-point-functions
(delete #'ispell-completion-at-point
completion-at-point-functions))
)
(t)]
)
org-use-speed-commands t
org-ql-views '(("Overview: Agenda-like" :buffers-files org-agenda-files
:query
(and (not (done))
(or (habit) (deadline auto) (scheduled :to today)
(ts-active :on today)))
:sort (todo priority date) :super-groups
org-super-agenda-groups :title "Agenda-like")
("Overview: NEXT tasks" :buffers-files org-agenda-files
:query (todo "NEXT") :sort
(date priority) :super-groups org-super-agenda-groups
:title "Overview: NEXT tasks")
("Calendar: Today" :buffers-files org-agenda-files :query
(ts-active :on today) :title
"Today" :super-groups org-super-agenda-groups :sort
(priority))
("Review: Recently timestamped" . org-ql-view-recent-items)
(#("Review: Dangling tasks" 0 22 (help-echo "Tasks whose
ancestor is done"))
:buffers-files org-agenda-files :query (and (todo)
(ancestors (done))) :title
#("Review: Dangling tasks" 0 22 (help-echo "Tasks whose
ancestor is done")) :sort
(todo priority date) :super-groups ((:auto-parent t)))
(#("Review: Stale tasks" 0 19
(help-echo "Tasks without a timestamp in the past 2
weeks"))
:buffers-files org-agenda-files :query (and (todo) (not
(ts :from -14))) :title
#("Review: Stale tasks" 0 19
(help-echo "Tasks without a timestamp in the past 2
weeks"))
:sort (todo priority date) :super-groups ((:auto-parent
t)))
(#("Review: Stuck projects" 0 22
(help-echo "Tasks with sub-tasks but no NEXT sub-tasks"))
:buffers-files org-agenda-files :query
(and (todo) (descendants (todo)) (not (descendants (todo
"NEXT")))) :title
#("Review: Stuck projects" 0 22
(help-echo "Tasks with sub-tasks but no NEXT sub-tasks"))
:sort (date priority) :super-groups
org-super-agenda-groups)
("Recent Journal Entries" :buffers-files org-agenda-files
:query
(and (path "journal.org") (level 3) (ts-active :from -30))
:title
"Recent Journal Entries (Last 30 Days)" :sort (date
reverse))
)
org-export-with-toc nil
org-refile-targets '((nil :maxlevel . 4) (org-agenda-files :maxlevel . 4))
org-confirm-shell-link-function 'yes-or-no-p
org-archive-hook '(org-attach-archive-delete-maybe)
org-latex-src-block-backend t
org-metaup-hook '(org-babel-load-in-session-maybe)
org-occur-hook '(org-first-headline-recenter)
org-html-format-inlinetask-function
'org-html-format-inlinetask-default-function
org-table-convert-region-max-lines 9999
org-confirm-babel-evaluate nil
org-ascii-format-drawer-function #[771 " \207" [] 4 "\n\n(fn NAME CONTENTS
WIDTH)"]
org-appear-autoentities t
org-appear-autosubmarkers t
org-bibtex-headline-format-function 'org-bibtex-headline-format-default
org-link-parameters '(("helpful" :store helpful--org-link-store)
("attachment" :follow org-attach-follow :complete
org-attach-complete-link
:preview org-attach-preview-file)
("eww" :follow org-eww-open :store
org-eww-store-link)
("rmail" :follow org-rmail-open :store
org-rmail-store-link)
("mhe" :follow org-mhe-open :store
org-mhe-store-link)
("irc" :follow org-irc-visit :store
org-irc-store-link :export org-irc-export)
("info" :follow org-info-open :export
org-info-export :store org-info-store-link
:insert-description org-info-description-as-command)
("gnus" :follow org-gnus-open :store
org-gnus-store-link)
("docview" :follow org-docview-open :export
org-docview-export :store
org-docview-store-link)
("bibtex" :follow org-bibtex-open :store
org-bibtex-store-link)
("bbdb" :follow org-bbdb-open :export
org-bbdb-export :complete
org-bbdb-complete-link :store org-bbdb-store-link)
("w3m" :store org-w3m-store-link)
("doi" :follow org-link-doi-open :export
org-link-doi-export)
("treemacs" :store treemacs-store-org-link)
("org-ql-search" :follow org-ql-view--link-follow
:store org-ql-view--link-store)
("id" :follow org-id-open :store
org-id-store-link-maybe) ("file+sys")
("file+emacs") ("shell" :follow org-link--open-shell)
("news" :follow
#[514 "\301\300\302 Q \"\207" ["news" browse-url
":"] 6 "\n\n(fn URL ARG)"])
("mailto" :follow
#[514 "\301\300\302 Q \"\207" ["mailto" browse-url
":"] 6 "\n\n(fn URL ARG)"])
("https" :follow
#[514 "\301\300\302 Q \"\207" ["https" browse-url
":"] 6 "\n\n(fn URL ARG)"]
:image-data-fun org-remoteimg--fetch-image)
("http" :follow
#[514 "\301\300\302 Q \"\207" ["http" browse-url
":"] 6 "\n\n(fn URL ARG)"]
:image-data-fun org-remoteimg--fetch-image)
("ftp" :follow
#[514 "\301\300\302 Q \"\207" ["ftp" browse-url
":"] 6 "\n\n(fn URL ARG)"])
("shortdoc" :follow org-link--open-shortdoc :store
org-link--store-shortdoc
:complete org-link--complete-shortdoc)
("help" :follow helpful--org-link-follow :store
org-link--store-help)
("file" :complete org-link-complete-file :preview
org-link-preview-file)
("elisp" :follow org-link--open-elisp))
org-persist-directory "/Users/garyo/.config/emacs/var/org/persist/"
org-export-coding-system 'utf-8
org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
org-appear-autolinks t
org-todo-keywords '((sequence "TODO(t)" "WAITING(w)" "|" "DONE(d)"
"CANCELLED(c)"))
org-return-follows-link t
org-tag-faces '(("@work" . "#0066ff") ("@home" . "#bb0000") ("volunteer" .
"#005500"))
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-tab-before-tab-emulation-hook '(org-tempo-complete-tag)
org-publish-timestamp-directory
"/Users/garyo/.config/emacs/var/org/timestamps/"
org-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
org-sort-function 'string-collate-lessp
org-export-backends '(ascii html icalendar latex koma-letter)
org--warnings nil
org-startup-folded 'nofold
org-babel-pre-tangle-hook '(save-buffer)
org-indent-mode-turns-on-hiding-stars nil
org-export-before-parsing-hook '(org-attach-expand-links)
org-image-actual-width nil
org-startup-with-link-previews t
org-link-shell-confirm-function 'yes-or-no-p
org-fold-core-isearch-open-function 'org-fold-core--isearch-reveal
org-tags-exclude-from-inheritance '("project")
outline-isearch-open-invisible-function 'outline-isearch-open-invisible
org-latex-classes '(("default-koma-letter"
"\\documentclass[11pt]{scrlttr2}")
("article" "\\documentclass[11pt]{article}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("report" "\\documentclass[11pt]{report}"
("\\part{%s}" . "\\part*{%s}")
("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}"
. "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
("book" "\\documentclass[11pt]{book}" ("\\part{%s}" .
"\\part*{%s}")
("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}"
. "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
)
org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
org-appear-delay 0.1
org-babel-load-languages '((emacs-lisp . t) (C . t) (python . t) (js . t)
(dot . t) (ditaa . t)
(latex . t) (sql . t) (shell . t))
org-agenda-loop-over-headlines-in-active-region nil
org-agenda-start-on-weekday nil
org-latex-packages-alist '(("cm" "fullpage" nil) ("compact" "titlesec"
nil) ("" "paralist" nil)
("" "color" nil) ("" "tabularx" nil) (""
"enumitem" nil))
org-agenda-files '("/Users/garyo/Documents/org-agenda")
org-list-allow-alphabetical t
org-babel-python-command "uv run python"
org-link-elisp-confirm-function 'yes-or-no-p
org-startup-indented t
org-agenda-skip-deadline-if-done t
org-clock-persist-file
"/Users/garyo/.config/emacs/var/org/clock-persist.el"
org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-show-empty-lines
org-cycle-optimize-window-after-visibility-change
org-cycle-display-link-previews)
org-persist-before-read-hook '(org-element--cache-persist-before-read)
org-use-sub-superscripts '{}
org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id
)
--
Gary