alhassy / org-special-block-extras

A number of new custom blocks and link types for Emacs' Org-mode ^_^

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong type argument on `margin`, `kbd` links

weavermarquez opened this issue · comments

This is a wonderful package! I am hoping to take this and make a nice blog.

Reproduce:

  1. Doom Emacs (largely default doom)
  2. Open an Org File
  3. Type in a double-bracketed link for a deflink where :display full, e.g. [[margin:bluhhh]]
  4. Now, many evil-mode functions will no longer work, and the org buffer will slowly degrade in rendering consistency.
  5. This issue will be resolved only after deleting the offending link, closing, then re-opening the buffer.

Whenever I DD delete a line, x delete a char, org-export-dispatch, this appears in *Messages* buffer:

org-fold-core--property-symbol-get-create:` Wrong type argument: symbolp, 'full

This issue is unique to the double-bracketed link form. it DOES NOT affect:

  • implicit links e.g. margin:bluhh or kbd:C-x
  • begin_X style blocks e.g.
#+begin_margin red
green blue
#+end_margin

GNU Emacs 28.2 (build 2, x86_64-w64-mingw32) of 2022-09-13
Doom core v3.0.0-pre HEAD -> master 07fca786 2023-05-30 19:39:04 -0400
Doom modules v23.03.0-pre HEAD -> master 07fca786 2023-05-30 19:39:04 -0400
Org mode version 9.6.1 (9.6.1-??-fe92a3c @ $HOME/.emacs.d/.local/straight/build-28.2/org/)

I also had a quick look, and this issue also affects [[fortune:arst]] and [[badge:hello]] as expected due to these also having :display 'full in their org-deflink definitions. Whether the issue is in :display or a misconfiguration, I'm not sure.

I just had a quick scan in org-fold-core.el which may have some relevant information. I wonder if the buffer-local variable org-fold-core--specs is relevant at all, since I see it mentioned in the docstring for that file.


org-fold-core--specs...
BEFORE adding a link:

Value in #<buffer example.org>
((org-fold-outline
  (:visible)
  (:ellipsis . "...")
  (:isearch-ignore)
  (:global)
  (:isearch-open . t)
  (:front-sticky . t)
  (:rear-sticky)
  (:fragile . org-fold--reveal-outline-maybe)
  (:alias headline heading outline inlinetask plain-list))
 (org-fold-block
  (:visible)
  (:ellipsis . "...")
  (:isearch-ignore)
  (:global)
  (:isearch-open . t)
  (:front-sticky . t)
  (:rear-sticky)
  (:fragile . org-fold--reveal-drawer-or-block-maybe)
  (:alias block center-block comment-block dynamic-block example-block export-block quote-block special-block src-block verse-block))
 (org-fold-drawer
  (:visible)
  (:ellipsis . "...")
  (:isearch-ignore)
  (:global)
  (:isearch-open . t)
  (:front-sticky . t)
  (:rear-sticky)
  (:fragile . org-fold--reveal-drawer-or-block-maybe)
  (:alias drawer property-drawer))
 (org-link-description
  (:visible . t)
  (:ellipsis)
  (:isearch-ignore)
  (:global t)
  (:isearch-open)
  (:front-sticky)
  (:rear-sticky)
  (:fragile . org-link--reveal-maybe)
  (:alias))
 (org-link
  (:visible)
  (:ellipsis)
  (:isearch-ignore)
  (:global t)
  (:isearch-open . t)
  (:front-sticky)
  (:rear-sticky)
  (:fragile . org-link--reveal-maybe)
  (:alias)))

AFTER typing [[fortune:bluh]]:

Value in #<buffer example.org>
((org-fold-outline
  (:visible)
  (:ellipsis . "...")
  (:isearch-ignore)
  (:global)
  (:isearch-open . t)
  (:front-sticky . t)
  (:rear-sticky)
  (:fragile . org-fold--reveal-outline-maybe)
  (:alias headline heading outline inlinetask plain-list))
 (org-fold-block
  (:visible)
  (:ellipsis . "...")
  (:isearch-ignore)
  (:global)
  (:isearch-open . t)
  (:front-sticky . t)
  (:rear-sticky)
  (:fragile . org-fold--reveal-drawer-or-block-maybe)
  (:alias block center-block comment-block dynamic-block example-block export-block quote-block special-block src-block verse-block))
 (org-fold-drawer
  (:visible)
  (:ellipsis . "...")
  (:isearch-ignore)
  (:global)
  (:isearch-open . t)
  (:front-sticky . t)
  (:rear-sticky)
  (:fragile . org-fold--reveal-drawer-or-block-maybe)
  (:alias drawer property-drawer))
 (org-link-description
  (:visible . t)
  (:ellipsis)
  (:isearch-ignore)
  (:global t)
  (:isearch-open)
  (:front-sticky)
  (:rear-sticky)
  (:fragile . org-link--reveal-maybe)
  (:alias))
 (org-link
  (:visible)
  (:ellipsis)
  (:isearch-ignore)
  (:global t)
  (:isearch-open . t)
  (:front-sticky)
  (:rear-sticky)
  (:fragile . org-link--reveal-maybe)
  (:alias))
 ('full
  (:visible)
  (:ellipsis)
  (:isearch-ignore)
  (:global t)
  (:isearch-open . t)
  (:front-sticky)
  (:rear-sticky)
  (:fragile . org-link--reveal-maybe)
  (:alias)))

Hey @weavermarquez 👋🏽

This is a wonderful package!

I'm glad to hear it 😀

I am hoping to take this and make a nice blog.

That's actually why I made this package to begin with 😅

Whether the issue is in :display or a misconfiguration, I'm not sure.
Wrong type argument: symbolp, 'full

It seems org-deflink assumes a raw name full rather than a quoted name 'full and so adds on the missing quote. However, there was no check for this and so some calls passed in full whereas others passed in 'full ---resulting in ''full which is not a symbol! The fix was to assert :display, for org-deflink, always obtains a symbol and so no need to add on any missing quotes.

@weavermarquez If you have the time, please consider writing a regression test ----sadly I don't have the bandwidth for this right now.

Anyhow, thanks for bringing this up and hope it works well for you going forward 🥳