Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Org source block babel expansion stopped working #11798

Closed
RockyRoad29 opened this issue Jan 5, 2019 · 25 comments
Closed

Org source block babel expansion stopped working #11798

RockyRoad29 opened this issue Jan 5, 2019 · 25 comments
Labels
- Bug tracker - Key Bindings Org stale marked as a stale issue/pr (usually by a bot)

Comments

@RockyRoad29
Copy link
Contributor

Description :octocat:

  • DISCLAIMER -- This report may seem wordy or redundant, but I hope it would add
    a few keywords to help users facing a similar issue.

According to "Easy-templates" section in orgmode manual

"< s TAB expands to a ‘src’ code block. "

When I do that, nothing happends anymore. No other template either 2

Reproduction guide 🪲

  • Start Emacs
  • Create a new file in org-mode, say /tmp/t.org
  • Type an "easy template", like "<s"
  • Press TAB to expand

Observed behaviour: 👀 💔
Not expansion, indentation instead.

Expected behaviour: ❤️ 😄
Replacement of "<s" with:

# +BEGIN_SRC

# +END_SRC

Investigations

Thanks to good documentation, it is rather easy:

In *Messages* you may read:

  File mode specification error: (wrong-type-argument stringp (#+BEGIN_NOTES
  ?
  #+END_NOTES))

and also an explanation in a *Warnings* buffer.

The customizable variable org-structure-template-alist is altered somewhere with a "NOTES" entry.

  - help:org-structure-template-alist

Displays the following:

  Hide org-structure-template-alist:
  '(("n" "#+BEGIN_NOTES\n?\n#+END_NOTES")
    ("a" . "export ascii")
    ("c" . "center")
    ("C" . "comment")
    ("e" . "example")
    ("E" . "export")
    ("h" . "export html")
    ("l" . "export latex")
    ("q" . "quote")
    ("s" . "src")
    ("v" . "verse"))
      State : CHANGED outside Customize. (mismatch**
    An alist of keys and block types

The "n" entry is absent from source definition (~/.emacs.d/elpa/26.1/develop/org-plus-contrib-20181230/org.el)

Suppressing the first entry (e.g. in customize) solves the problem.

Solution : PR in ox-reveal

This is related to a recent change in org-plus-contrib :
https://orgmode.org/Changes.html#outline-container-org1b5e967 .

For me, the responsible appears to be 'ox-reveal' .

It is actually added in
/.emacs.d/elpa/develop/ox-reveal-20161027.226/ox-reveal.el.

This is easy to fix:

@@ -1185,7 +1185,7 @@ Return output file name."
 ;; Register auto-completion for speaker notes.
 (when org-reveal-note-key-char
   (add-to-list 'org-structure-template-alist
-               (list org-reveal-note-key-char "#+BEGIN_NOTES\n\?\n#+END_NOTES")))
+               (cons org-reveal-note-key-char "notes")))

I was about to build a PR but somebody has already submitted an identical one which currently pending.
yjwen/org-reveal@21b1750

Workaround : fix the value in dotfile

To patiently wait until the PR is applied upstream, I tried this, in user-config():

  (with-eval-after-load 'ox-reveal
    (let ((entry (assoc "n" org-structure-template-alist)))
      (when (and entry  (string-match-p "BEGIN" (cdr tmp:entry)))
        (setcdr entry "notes")
      )
    )
  )

Unfortunately, though the inner code is working (fixes the problem in current session), with-eval-after-load doesn't seem
to be the way to do it. I also tried to wrap it in use-package :config and
in configure-layers org stanza, with no more success.

System Info 💻

  • OS: gnu/linux
  • Emacs: 26.1
  • Spacemacs: 0.300.0
  • Spacemacs branch: develop (rev. 2c28c7d)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
(auto-completion c-c++ csv
                 (dash :variables helm-dash-docset-newpath "~/.local/share/Zeal/Zeal/docsets")
                 docker emacs-lisp erc git graphviz gtags ...
                 (org :variables org-enable-reveal-js-support t org-reveal-root "file:///usr/local/src/reveal.js")
                 ...
  • System configuration features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES THREADS LIBSYSTEMD LCMS2
@dqdinh
Copy link

dqdinh commented Jan 9, 2019

This temp workaround worked for me - yjwen/org-reveal#340 (comment)

Add the following to dotspacemacs/user-config:

(setq org-reveal-note-key-char nil)

Afterwords, one can use C-c C , s to insert a src block.

@dqdinh
Copy link

dqdinh commented Jan 14, 2019

FYI - this has been fixed. So if you added the work around above, you'll need to remove it.

@BobCromwell
Copy link

FYI - this has been fixed. So if you added the work around above, you'll need to remove it.

Which branch? I update develop branch and still meet the same issue.

@yssource
Copy link
Contributor

(setq org-reveal-note-key-char nil), does not work for me.
But,
comment out org-enable-reveal-js-support t in org layer, works for me.

@dqdinh
Copy link

dqdinh commented Jan 15, 2019

I am using the stable branch and updated my layers. This resolved the issue I had.

@srgkoshelev
Copy link

The template expansion works in master (stable) and doesn't work in develop branch.
Blindly adding

  (with-eval-after-load 'ox-reveal
    (setq org-reveal-note-key-char nil)
  )

to user-config didn't help.

@agirdler-sonder
Copy link

@srgkoshelev
On develop it seems the version of org-mode has templating separated and org-tempo module is not loaded. I was able to resolve this by adding the following lines to my dotfile to load org-tempo for version of org >= 9.2 (the abstraction seems to be a part of the 9.2 release):

  (when (version<= "9.2" (org-version))
    (require 'org-tempo))

@BobCromwell
Copy link

on develop branch disable ox-reveal makes C-c C-, works
org-enable-reveal-js-support nil

@srgkoshelev
Copy link

@agirdler-sonder Thank you, it works!

@igor-kupczynski
Copy link
Contributor

I'm on develop. Adding the snippet suggested by @agirdler-sonder works for me:

  ;; FIXME: workaround
  ;; https://github.com/syl20bnr/spacemacs/issues/11798
  (when (version<= "9.2" (org-version))
    (require 'org-tempo))

By works I mean that I can use < s TAB.

With (setq org-reveal-note-key-char nil) < s TAB wasn't working for me, but C-c C-, s worked.

caioaao added a commit to caioaao/emacs.d that referenced this issue Feb 13, 2019
@Anton-Latukha
Copy link
Contributor

Anton-Latukha commented Feb 19, 2019

Instead of <s[TAB} you can also use Spacemacs menu SPC m i b s (for current develop branch / Org-mode >= 9.2).

Special thanks for submission of so informative bug report and having so good discussion here.

@rdbeni0
Copy link

rdbeni0 commented Feb 19, 2019

it seems that we need to use (require 'org-tempo)

please check at
https://orgmode.org/Changes.html
"Change in the structure template expansion"

so this is official change in org template system. And now <sTAB is optional, but it is still working

btw. i am also fan of "good old" templates and i am using (require 'org-tempo). But from consistence point of view, it will be better for emacs to leave org templates/snippets to common and centralized mechanism like company-mode or/and yasnippets

@practicalli-johnny
Copy link
Contributor

practicalli-johnny commented Mar 11, 2019

I upgraded org-reveal package to org-re-reveal package using the basic instructions in the issue:
#11935

If you do not wish to use org-reveal, you can simply set org-enable-reveal-js-support to nil to nil in the org layer or remove it as a variable.

@pnyccz
Copy link

pnyccz commented Mar 13, 2019

I have the same problem, or-re-reveal package has helped, however, it broke org-mode-agenda completely.

Using Linux, Emacs 26.1, Spacemacs 0.200.13.

@shanesveller
Copy link

@pnyccz what sort of problems are you seeing with org-agenda, so I know what to look out for after I switched to org-re-reveal?

@pnyccz
Copy link

pnyccz commented Apr 2, 2019

@shanesveller Agenda and clocking stopped working. Report tables for time spent on various tasks also stopped working. I don't recall seeing other issues.

@ColeWunderlich
Copy link

I am on the stable branch and this is still broken for me.

@xx299x
Copy link

xx299x commented Jun 23, 2019

I am on the stable branch and this is still broken for me.

@ColeWunderlich

Adding (require 'org-tempo) to user-config solves the problem of <s <TAB> not working

@xx299x
Copy link

xx299x commented Jun 23, 2019

You can also use Spacemacs menu SPC m i b s instead of <s[TAB}.

Special thanks for submission of so informative bug report and having so good discussion here.

@Anton-Latukha
I don't think I found this shortcut in my evil-org-mode

@Anton-Latukha
Copy link
Contributor

Anton-Latukha commented Jun 23, 2019

@ColeWunderlich @ZythonNera
collector1871 in answer #11798 (comment) already gave a full quality report&response&solution. I personally asked him to post it here, and he did. Please read the thread, or at least look at most liked responses in thread before writing. This issue open for people to see the solution and read the explanation.

@ColeWunderlich
Since everything seems provided: docs, explanation & simple solution - you can real easy fix it in your stable, integrate fix & submit the changes to stable upstream to show that you appreciate people back.
I provided some additional info that can be helpful for you right below.

@ZythonNera
In Emacs "Org major mode" - SPC m i b - org-insert-structure-template "is an interactive Lisp closure in org.el", since 9.2 Org-mode.
Which means it is present in new Org-mode, and in Spacemasc develop branch.

Since there seems to be duality of understanding of my old comment, updated it with precise info, and by-the-way created an issue.

strawberryjello added a commit to strawberryjello/dotfiles that referenced this issue Aug 24, 2019
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Jun 22, 2020
@RockyRoad29
Copy link
Contributor Author

RockyRoad29 commented Jun 22, 2020

Well, it's over a year now I'm trying to get used to "the new way" e.g. to insert a source block : [SPC m i b s] . I still find it less convenient than [< s TAB]. So as a user, I'd prefer to see org-tempo style staying around if possible.

@Anton-Latukha
Copy link
Contributor

Anton-Latukha commented Jun 22, 2020

The real solution is mentioned in the 1 year ago, I am using it in that timespan.

@Anton-Latukha
Copy link
Contributor

Anton-Latukha commented Jun 22, 2020

It is #11798 (comment).

Since the cause is Org-mode change, it became obvious it is not a Spacemacs question.
So official Org-mode now does not include <s ways. So it is even debatable should org-tempo be included in Spacemacs org layer.
If someone wants the <s to return by default - it is Org-mode mail list discussion, or org layer discussion.

@maxsatula
Copy link

There seems to be a problem with C-, combination. While it works fine in

  1. GNOME terminal
  2. GUI non-terminal version of Emacs

It does not work (either simple comma entered or nothing happens) on

  1. lxterminal
  2. any terminal over ssh
  3. in PuTTY

I know, that is not Emacs problem, but I'm not sure about whether it is a good idea to assign troublesome keys in default configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- Bug tracker - Key Bindings Org stale marked as a stale issue/pr (usually by a bot)
Projects
None yet
Development

No branches or pull requests