Remember to cover the basics, that is, what you expected to happen and what in fact did happen. You don't know how to make a good report? See https://orgmode.org/manual/Feedback.html#Feedback Your bug report will be posted to the Org mailing list. ------------------------------------------------------------------------ I was simply entering an entry to my main bib file. I received an error message and was asked to submit this report. Thanks, Alejandro Emacs : GNU Emacs 28.0.90 (build 1, x86_64-apple-darwin19.6.0, NS appkit-1894.60 Version 10.15.7 (Build 19H1419)) of 2021-12-14 Package: Org mode version 9.5.2 (9.5.2-g072523 @ /Users/apc/.emacs.d/straight/build/org/) current state: ============== (setq org-archive-location "~/org/agenda/archives/%s_archive.org::datetree/" org-pomodoro-format "🍅:%s" org-roam-db-location "/Users/apc/.emacs.d/var/org/org-roam.db" org-link-elisp-confirm-function 'yes-or-no-p org-agenda-skip-deadline-prewarning-if-scheduled 2 org-cite-insert-processor 'citar org-after-refile-insert-hook '(org-gcal--refile-post) org-roam-db-gc-threshold 800000 org-bibtex-headline-format-function #[257 "\300%1\236A\207" [:title] 3 "\n\n(fn ENTRY)"] org-log-done 'time org-pomodoro-long-break-sound "/Users/apc/.emacs.d/straight/build/org-pomodoro/resources/bell_multiple.wav" org-roam-mode-hook '(my/read-mode-indicator) org-roam-dailies-capture-templates '(("d" "default" entry "* %?" :if-new (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>")) ) org-agenda-custom-commands '(("d" "Default (ignore @sched and @hold)" ((agenda "" ((org-agenda-span 'day) (org-super-agenda-groups '((:name none :time-grid t) (:name "To do" :and (:not (:tag ("@hold")) :not (:tag ("@sched"))) :discard (:anything t)) ) ) ) ) ) ) ("z" "Work: focused" ((agenda "" ((org-agenda-span 'day) (org-agenda-files `(,(concat my/agenda-dir "/work.org"))) (org-super-agenda-groups '((:name "First and foremost" :and (:tag ("@today") :priority "A")) (:name "The rest" :tag ("@today") :discard (:anything t))) ) ) ) ) ) ("p" "Planning view" ((agenda "" ((org-agenda-span 'day) (org-super-agenda-groups '((:name "Up next" :and (:todo "NEXT" :not (:scheduled past))) (:name "New today" :and (:not (:todo ("WAIT" "KILL")) :not (:tag ("@sched")) :scheduled today) :deadline today) (:name "In progress" :todo "STRT") (:name "Overdue" :and (:not (:todo ("DONE" "KILL" "WAIT")) :not (:tag ("@sched")) :deadline past) ) (:name "Backlog" :and (:not (:todo ("STRT" "DONE" "KILL" "WAIT")) :not (:tag ("@sched")) :scheduled past) :discard (:anything t)) ) ) ) ) (alltodo "" ((org-agenda-overriding-header "") (org-super-agenda-groups `((:name "Refile" :and (:not (:todo ("DONE" "KILL" "WAIT")) :tag ("refile") :not (:tag ("read" "gkry"))) ) (:name "Next available actions" :and (:todo "NEXT" :scheduled future) :and (:todo "NEXT" :deadline future)) (:name "Coming up" :and (:todo "TODO" :scheduled (before ,(org-read-date nil nil "+7d")) :scheduled future) ) (:name "Important and unscheduled" :and (:priority>= "B" :scheduled nil :not (:tag ("read")))) (:name "On hold" :todo "WAIT") (:name "Etc" :and (:scheduled nil :not (:tag ("read"))) :discard (:anything t)) ) ) ) ) ) ) ("x" "Refile" alltodo "" ((org-agenda-overriding-header "To refile") (org-super-agenda-groups '((:name "" :and (:tag ("refile") :not (:tag ("gkry")) :not (:tag ("read"))) :discard (:anything t)) ) ) ) ) ("r" "Reading list" alltodo "" ((org-agenda-overriding-header "Reading list") (org-super-agenda-groups '((:name "In progress" :and (:todo "STRT" :tag ("read"))) (:name "Next up" :and (:todo "NEXT" :tag ("read"))) (:name "Pending" :and (:not (:todo ("WAIT" "KILL" "DONE")) :tag ("read"))) (:name "On hold" :and (:todo "WAIT" :tag ("read"))) (:discard (:anything t))) ) ) ) ("w" "Work tasks" ((agenda "" ((org-agenda-span 'day) (org-super-agenda-groups '((:name none :and (:not (:todo ("DONE" "KILL" "WAIT")) :scheduled t :file-path "work.org") :discard (:anything t)) ) ) ) ) (alltodo "" ((org-super-agenda-groups `((:name "Scheduled soon" :and (:not (:todo ("DONE" "KILL" "WAIT")) :not (:tag "read") :scheduled (before ,(org-read-date nil nil "+7d")) :scheduled future :file-path "work.org") ) (:name "Unscheduled" :and (:not (:todo ("DONE" "KILL" "WAIT")) :not (:tag "read") :not (:tag "someday") :scheduled nil :file-path "work.org") ) (:name "On hold" :and (:todo ("WAIT") :file-path "work.org")) (:name "Someday" :and (:tag ("someday") :file-path "work.org")) (:name "Scheduled in the next three months" :and (:not (:todo ("DONE" "KILL" "WAIT")) :not (:tag "read") :scheduled (before ,(org-read-date nil nil "+90d")) :scheduled future :file-path "work.org") ) (:name "Other scheduled" :and (:not (:todo ("DONE" "KILL" "WAIT")) :not (:tag "read") :scheduled (before ,(org-read-date nil nil "+90d")) :scheduled future :file-path "work.org") :discard (:anything t)) ) ) ) ) ) ) ) org-log-into-drawer t org-startup-folded t org-agenda-files '("~/org/agenda") org-journal-dir "~/org/journal/" org-journal-date-format "%A, %d %B %Y" org-capture-templates '(("w" "Work task" entry (file+headline "~/org/agenda/work.org" "Inbox") "* TODO %?\n:LOGBOOK:\n- Added: %U\n:END:") ("h" "Home task" entry (file+headline "~/org/agenda/home.org" "Inbox") "* TODO %?\n:LOGBOOK:\n- Added: %U\n:END:") ("j" "Journal entry" entry #'org-journal-find-location "* %(format-time-string org-journal-time-format)%^{Title}\n%i%?") ("c" "Simple capture" entry (file+headline "~/org/agenda/refile.org" "Inbox") "* TODO %?\n:LOGBOOK:\n- Added: %U\n:END:") ("e" "Emacs note" entry (file+headline "~/org/agenda/emacs.org" "Inbox") "* TODO %?\n:LOGBOOK:\n- Added: %U\n:END:") ("i" "Interruption" entry (file+headline "~/org/agenda/refile.org" "Inbox") "* DONE %?" :clock-in t :clock-resume t) ("u" "UMass Website tasks") ("up" "New Publication" entry (file+headline "~/org/agenda/umassweb.org" "Publications") "* TODO %?\nSCHEDULED: <%(org-read-date nil nil \"+1w\")>\n:LOGBOOK:\n- Added: %U\n:END:") ("un" "News Item" entry (file+headline "~/org/agenda/umassweb.org" "News") "* TODO %?\nSCHEDULED: <%(org-read-date nil nil \"+1w\")>\n:LOGBOOK:\n- Added: %U\n:END:") ("um" "Misc Item" entry (file+headline "~/org/agenda/umassweb.org" "Inbox") "* TODO %?\n:LOGBOOK:\n- Added: %U\n:END:") ) org-persist-after-read-hook '(org-element--cache-persist-after-read) org-super-agenda-header-separator "" org-refile-targets '((nil :maxlevel . 4) (org-agenda-files :maxlevel . 4)) org-export-before-parsing-hook '(org-attach-expand-links) org-roam-find-file-hook '(org-roam-buffer--setup-redisplay-h org-roam--register-completion-functions-h org-roam--replace-roam-links-on-save-h org-roam-open-id-with-org-roam-db-h org-roam-db-autosync--setup-update-on-save-h) org-refile-use-outline-path t org-pomodoro-short-break-sound "/Users/apc/.emacs.d/straight/build/org-pomodoro/resources/bell.wav" org-archive-hook '(org-attach-archive-delete-maybe) org-cite-follow-processor 'citar org-pomodoro-long-break-sound-args "-volume 0.01" org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers org-cycle-show-empty-lines org-optimize-window-after-visibility-change) org-mac-grab-Outlook-app-p nil org-catch-invisible-edits 'show-and-error org-persist-before-read-hook '(org-element--cache-persist-before-read) org-agenda-sticky t org-mode-hook '(#[0 "\301\211%10\207" [imenu-create-index-function org-imenu-get-tree] 2] org-clock-load #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-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 org-eldoc-load) org-agenda-skip-deadline-if-done t org-ctrl-k-protect-subtree t outline-minor-mode-hook '(outline-minor-faces-add-font-lock-keywords my/outline-change-prefix-key) org-id-locations-file "/Users/apc/.emacs.d/var/org/id-locations.el" org-archive-subtree-add-inherited-tags t org-gcal-client-id "17193603999-hfblflcfaromv97f5lgde3puq63en7gn.apps.googleusercontent.com" org-mac-grab-qutebrowser-app-p nil org-agenda-todo-list-sublevels nil org-roam-ref-annotation-function 'org-roam-ref-read--annotation org-roam-directory "~/org/notebook" org-agenda-span 'day org-ellipsis " ▼" org-roam-db-node-include-function '(lambda nil (not (cdr (assoc "NOTER_PAGE" (org-entry-properties))))) org-pomodoro-overtime-sound "/Users/apc/.emacs.d/straight/build/org-pomodoro/resources/bell.wav" org-confirm-shell-link-function 'yes-or-no-p org-reveal-start-hook '(org-decrypt-entry) org-agenda-compact-blocks t outline-isearch-open-invisible-function 'outline-isearch-open-invisible org-super-agenda-mode t org-roam-dailies-directory "dailies/" org-startup-indented t org-journal-carryover-items "TODO=”TODO|NEXT|STRT|SEED|ROAM|READ”" org-mac-grab-Chrome-app-p nil org-roam-verbose nil org-agenda-mode-hook '(my/org-agenda-mode-hook org-super-agenda-mode my/read-mode-indicator) org-roam-capture-preface-hook '(org-roam-dailies--override-capture-time-h) org-agenda-before-write-hook '(org-agenda-add-entry-text) org-agenda-after-show-hook '(god-local-mode) org-capture-prepare-finalize-hook '(org-roam-capture--install-finalize-h) org-src-preserve-indentation t org-log-redeadline t org-roam-preview-function 'org-roam-preview-default-function org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-roam-db-autosync-mode t org-confirm-elisp-link-function 'yes-or-no-p org-clock-heading-function '(lambda nil (let ((str (nth 4 (org-heading-components)))) (if (> (length str) 15) (concat (substring str 0 15) "…"))) ) org-cycle-separator-lines 0 org-todo-state-tags-triggers '(("WAIT" ("@hold" . t) ("@today")) ("TODO" ("@hold")) ("NEXT" ("@hold")) ("STRT" ("@hold")) ("DONE" ("@hold") ("@today")) ("KILL" ("@hold") ("@today"))) org-clock-out-remove-zero-time-clocks t org-cite-activate-processor 'citar org-pomodoro-ticking-sound "/Users/apc/.emacs.d/straight/build/org-pomodoro/resources/tick.wav" org-todo-keywords '((type "TODO(t)" "NEXT(n!)" "STRT(s!)" "WAIT(w@/!)" "READ(r)" "ROAM(z)" "SEED(f)" "|" "DONE(d!)" "KILL(k@/!)") ) org-deadline-warning-days 7 org-support-shift-select 'always org-blocker-hook '(org-block-todo-from-children-or-siblings-or-parent) org-speed-command-hook '(org-speed-command-activate org-babel-speed-command-activate) org-clock-persist-file "/Users/apc/.emacs.d/var/org/clock-persist.el" org-pomodoro-start-sound-args "-volume 0.01" org-super-agenda-groups '((:name none :time-grid t) (:name "To do" :not (:todo "WAIT" :tag "@hold")) (:name "Waiting" :todo "WAIT" :tag "@hold")) org-journal-mode-hook nil org-persist-directory "/Users/apc/.emacs.d/var/org/persist/" org-export-backends '(md ascii html icalendar latex odt) org-enforce-todo-dependencies t org-pomodoro-finished-sound-args "-volume 0.01" org-pomodoro-finished-sound "/Users/apc/.emacs.d/straight/build/org-pomodoro/resources/bell.wav" org-M-RET-may-split-line '((item)) org-clock-persist t org-persist-before-write-hook '(org-element--cache-persist-before-write) org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-link-shell-confirm-function 'yes-or-no-p org-generic-id-locations-file "/Users/apc/.emacs.d/var/org/org-generic-id-locations" org-babel-pre-tangle-hook '(save-buffer) org-gcal-dir "/Users/apc/.emacs.d/var/org/gcal/" org-agenda-loop-over-headlines-in-active-region nil org-cite-global-bibliography '("~/bib/apcmain.bib") org-capture-mode-hook '(my/god--toggle-on-capture) org-occur-hook '(org-first-headline-recenter) org-capture-after-finalize-hook '(org-gcal--capture-post) org-metadown-hook '(org-babel-pop-to-session-maybe) org-roam-node-annotation-function 'org-roam-node-read--annotation org-link-parameters '(("attachment" :follow org-attach-follow :complete org-attach-complete-link) ("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) ("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) ("roam" :follow org-roam-link-follow-link) ("id" :follow org-id-open) ("message" :follow org-mac-message-open) ("x-devonthink-item" :follow org-devonthink-item-open) ("mac-evernote" :follow org-mac-evernote-note-open) ("mac-outlook" :follow org-mac-outlook-message-open) ("acrobat" :follow org-mac-acrobat-open) ("skim" :follow org-mac-skim-open) ("addressbook" :follow org-mac-addressbook-item-open) ("x-together-item" :follow org-mac-together-item-open) ("file+sys") ("file+emacs") ("shell" :follow org-link--open-shell) ("news" :follow #[514 "\301\300\302%4Q%2\"\207" ["news" browse-url ":"] 6 "\n\n(fn URL ARG)"]) ("mailto" :follow #[514 "\301\300\302%4Q%2\"\207" ["mailto" browse-url ":"] 6 "\n\n(fn URL ARG)"] ) ("https" :follow #[514 "\301\300\302%4Q%2\"\207" ["https" browse-url ":"] 6 "\n\n(fn URL ARG)"] ) ("http" :follow #[514 "\301\300\302%4Q%2\"\207" ["http" browse-url ":"] 6 "\n\n(fn URL ARG)"]) ("ftp" :follow #[514 "\301\300\302%4Q%2\"\207" ["ftp" browse-url ":"] 6 "\n\n(fn URL ARG)"]) ("help" :follow org-link--open-help :store org-link--store-help) ("file" :complete org-link-complete-file) ("elisp" :follow org-link--open-elisp)) org-roam-capture-templates '(("d" "default" plain "%?" :target (file+head "%<%Y%m%d%H%M%S>.org" "#+title: ${title}") :unnarrowed t) ) org-metaup-hook '(org-babel-load-in-session-maybe) org-refile-allow-creating-parent-nodes 'confirm org-agenda-restore-windows-after-quit t org-use-fast-todo-selection 'expert org-gcal-auto-archive nil org-agenda-dim-blocked-tasks 'invisible org-return-follows-link t org-gcal-client-secret "3vLycWZtNRkakiV0Xto_sdS_" org-outline-path-complete-in-steps nil org-special-ctrl-a/e t org-pomodoro-start-sound "/Users/apc/.emacs.d/straight/build/org-pomodoro/resources/bell.wav" org-tags-column -93 org-src-lang-modes '(("redis" . redis) ("php" . php) ("arduino" . arduino) ("C" . c) ("C++" . c++) ("asymptote" . asy) ("bash" . sh) ("beamer" . latex) ("calc" . fundamental) ("cpp" . c++) ("ditaa" . artist) ("dot" . fundamental) ("elisp" . emacs-lisp) ("ocaml" . tuareg) ("screen" . shell-script) ("shell" . sh) ("sqlite" . sql)) org-gcal-fetch-file-alist '(("apcarballo@gmail.com" . "~/org/agenda/gcal.org") ("4r1amsea4s4uis39faoco88qf8@group.calendar.google.com" . "~/org/agenda/gcal-joint.org") ) org-refile-target-verify-function 'my/org--verify-refile-target org-mac-grab-Firefox-app-p nil org-journal-file-format "%Y%m%d.org" org-pomodoro-short-break-sound-args "-volume 0.01" org-agenda-use-time-grid nil )
Alejandro Pérez Carballo <apcarballo@gmail.com> writes:
> I was simply entering an entry to my main bib file. I received an error message and was asked to submit this report.
Thanks for the report!
Do I understand correctly that you got:
1. An error message
2. A warning popup
Did it happen when you were _not_ in Org buffer and you did not use
minibuffer completion?
Do you recall the error/warning text?
Best,
Ihor
Sorry about the unclear report. I was indeed _not_ in an org buffer. I do not think I was using minibuffer completion, but I cannot remember. I now just got a similar error message, this time when working on an Elisp buffer. The error message says:
Warning (org-element-cache): org-element--cache: Org parser error in setup-biblio.el::5918. Resetting.
The error was: (error "rx ‘**’ range error")
Backtrace:
" backtrace-to-string(nil)
org-element-at-point()
org-in-src-block-p()
run-hook-with-args-until-success(org-in-src-block-p)
electric-quote-post-self-insert-function()
self-insert-command(1 34)
funcall-interactively(self-insert-command 1 34)
call-interactively(self-insert-command nil nil)
command-execute(self-insert-command)
"
Best,
Alejandro
> On Feb 22, 2022, at 9:06 PM, Ihor Radchenko <yantar92@gmail.com> wrote:
>
> Alejandro Pérez Carballo <apcarballo@gmail.com> writes:
>
>> I was simply entering an entry to my main bib file. I received an error message and was asked to submit this report.
>
> Thanks for the report!
> Do I understand correctly that you got:
> 1. An error message
> 2. A warning popup
>
> Did it happen when you were _not_ in Org buffer and you did not use
> minibuffer completion?
>
> Do you recall the error/warning text?
>
> Best,
> Ihor
Alejandro Pérez Carballo <apcarballo@gmail.com> writes:
> Sorry about the unclear report. I was indeed _not_ in an org buffer. I do not think I was using minibuffer completion, but I cannot remember. I now just got a similar error message, this time when working on an Elisp buffer. The error message says:
>
> Warning (org-element-cache): org-element--cache: Org parser error in setup-biblio.el::5918. Resetting.
> The error was: (error "rx ‘**’ range error")
> Backtrace:
> " backtrace-to-string(nil)
> org-element-at-point()
> org-in-src-block-p()
> run-hook-with-args-until-success(org-in-src-block-p)
> electric-quote-post-self-insert-function()
> self-insert-command(1 34)
> funcall-interactively(self-insert-command 1 34)
> call-interactively(self-insert-command nil nil)
> command-execute(self-insert-command)
> "
Thanks for the backtrace! It is very clear that something in
electric-quote-mode-hook (or maybe in electric-quote-inhibit-functions)
is calling org-in-src-block-p.
org-in-src-block-p does not work outside Org mode. It used to (at least,
it did not throw an error), but it is not the case anymore and it was
never guaranteed that Org functions can reliably work outside Org mode.
I do not see explicit customisation adding org-in-src-block-p in your
config from the first email. I presume that some third-party package is
adding org-in-src-block-p to electric-quote-mode. I would first try to
check the values of electric-quote-inhibit-functions and
electric-quote-mode-hook and check if they contain org-* staff. Then, I
would bisect the config to find out which package is doing it. What you
are seeing is a bug in that package and should be reported.
Best,
Ihor
I found the source of the problem. I was trying to disable `electric-quote-mode' when in a src block, and found this snippet somewhere:
```
(add-hook 'electric-quote-inhibit-functions #'org-in-src-block-p)
```
Any thoughts on alternative ways of achieving similar behavior? Presumably I'd need to find a way to make `electric-quote-inhibit-functions` vary depending on whether I am in org-mode. But I'm very much an Elisp illiterate, so I'd appreciate any suggestions here.
Best,
Alejandro
> On Feb 24, 2022, at 5:39 AM, Ihor Radchenko <yantar92@gmail.com> wrote:
>
> Alejandro Pérez Carballo <apcarballo@gmail.com> writes:
>
>> Sorry about the unclear report. I was indeed _not_ in an org buffer. I do not think I was using minibuffer completion, but I cannot remember. I now just got a similar error message, this time when working on an Elisp buffer. The error message says:
>>
>> Warning (org-element-cache): org-element--cache: Org parser error in setup-biblio.el::5918. Resetting.
>> The error was: (error "rx ‘**’ range error")
>> Backtrace:
>> " backtrace-to-string(nil)
>> org-element-at-point()
>> org-in-src-block-p()
>> run-hook-with-args-until-success(org-in-src-block-p)
>> electric-quote-post-self-insert-function()
>> self-insert-command(1 34)
>> funcall-interactively(self-insert-command 1 34)
>> call-interactively(self-insert-command nil nil)
>> command-execute(self-insert-command)
>> "
>
> Thanks for the backtrace! It is very clear that something in
> electric-quote-mode-hook (or maybe in electric-quote-inhibit-functions)
> is calling org-in-src-block-p.
>
> org-in-src-block-p does not work outside Org mode. It used to (at least,
> it did not throw an error), but it is not the case anymore and it was
> never guaranteed that Org functions can reliably work outside Org mode.
>
> I do not see explicit customisation adding org-in-src-block-p in your
> config from the first email. I presume that some third-party package is
> adding org-in-src-block-p to electric-quote-mode. I would first try to
> check the values of electric-quote-inhibit-functions and
> electric-quote-mode-hook and check if they contain org-* staff. Then, I
> would bisect the config to find out which package is doing it. What you
> are seeing is a bug in that package and should be reported.
>
> Best,
> Ihor
One more question: wouldn't replacing `org-in-src-block-p' with a function that calls `org-in-src-block-p' only when in org-mode and returns `nil' elsewhere suffice to make something that's like `org-in-src-block-p' but that will work outside org-mode? E.g.:
(defun my/org-in-src-block-p (&optional arg)
(if (derived-mode-p 'org-mode)
(org-in-src-block-p)
nil))
I'm using this for now as a replacement and it seems to do the trick, at least for my present purposes.
Best,
Alejandro
> On Feb 24, 2022, at 11:27 AM, Alejandro Pérez Carballo <apcarballo@gmail.com> wrote:
>
> I found the source of the problem. I was trying to disable `electric-quote-mode' when in a src block, and found this snippet somewhere:
>
> ```
> (add-hook 'electric-quote-inhibit-functions #'org-in-src-block-p)
> ```
>
> Any thoughts on alternative ways of achieving similar behavior? Presumably I'd need to find a way to make `electric-quote-inhibit-functions` vary depending on whether I am in org-mode. But I'm very much an Elisp illiterate, so I'd appreciate any suggestions here.
>
> Best,
>
> Alejandro
>
>> On Feb 24, 2022, at 5:39 AM, Ihor Radchenko <yantar92@gmail.com> wrote:
>>
>> Alejandro Pérez Carballo <apcarballo@gmail.com> writes:
>>
>>> Sorry about the unclear report. I was indeed _not_ in an org buffer. I do not think I was using minibuffer completion, but I cannot remember. I now just got a similar error message, this time when working on an Elisp buffer. The error message says:
>>>
>>> Warning (org-element-cache): org-element--cache: Org parser error in setup-biblio.el::5918. Resetting.
>>> The error was: (error "rx ‘**’ range error")
>>> Backtrace:
>>> " backtrace-to-string(nil)
>>> org-element-at-point()
>>> org-in-src-block-p()
>>> run-hook-with-args-until-success(org-in-src-block-p)
>>> electric-quote-post-self-insert-function()
>>> self-insert-command(1 34)
>>> funcall-interactively(self-insert-command 1 34)
>>> call-interactively(self-insert-command nil nil)
>>> command-execute(self-insert-command)
>>> "
>>
>> Thanks for the backtrace! It is very clear that something in
>> electric-quote-mode-hook (or maybe in electric-quote-inhibit-functions)
>> is calling org-in-src-block-p.
>>
>> org-in-src-block-p does not work outside Org mode. It used to (at least,
>> it did not throw an error), but it is not the case anymore and it was
>> never guaranteed that Org functions can reliably work outside Org mode.
>>
>> I do not see explicit customisation adding org-in-src-block-p in your
>> config from the first email. I presume that some third-party package is
>> adding org-in-src-block-p to electric-quote-mode. I would first try to
>> check the values of electric-quote-inhibit-functions and
>> electric-quote-mode-hook and check if they contain org-* staff. Then, I
>> would bisect the config to find out which package is doing it. What you
>> are seeing is a bug in that package and should be reported.
>>
>> Best,
>> Ihor
>
Alejandro Pérez Carballo <apcarballo@gmail.com> writes:
> One more question: wouldn't replacing `org-in-src-block-p' with a function that calls `org-in-src-block-p' only when in org-mode and returns `nil' elsewhere suffice to make something that's like `org-in-src-block-p' but that will work outside org-mode? E.g.:
>
> (defun my/org-in-src-block-p (&optional arg)
> (if (derived-mode-p 'org-mode)
> (org-in-src-block-p)
> nil))
From the docstring of electric-quote-inhibit-functions, a function
returning nil will have no effect. So, you should be safe to use your
function.
A slightly more concise version would be using when instead of if.
Also, unused function arguments are defined as "_" by convention.
Adding a docstring to all your function is a good habit to cultivate.
(defun my/org-in-src-block-p (&optional _)
"Call `org-in-src-block-p' when in `org-mode' and return nil otherwise."
(when (derived-mode-p 'org-mode)
(org-in-src-block-p)))
Best,
Ihor