31

Easy templates in Org 9.2 are not working for me on GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-30.

I have changed my elpa/ directory to smelpa/. I load emacs -q and switch to the *scratch* buffer and toggle M-x org-mode. A call to org-version returns

Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ c:/Program Files/emacs-26.1-x86_64/share/emacs/26.1/lisp/org/)

When I type <s TAB, the easy template expands as expected.

<s|<-----<press TAB here>

#+BEGIN_SRC 

#+END_SRC

Now, to upgrade to Org 9.2, I do list-packages and install org. (For some reason package-install doesn't return org). Returning to the *scratch* buffer, running org-version returns

Org mode version 9.2 (9.2-elpa @ c:/Users/%USERNAME%/.emacs.d/elpa/org-9.2/)

It seems like Org 9.2 installed correctly. The same is true if I just directly install Org 9.2 and create a new org buffer (i.e. don't load the default org first). Easy templates won't work in Org 9.2.

I looked around for a bug tracker, but I don't see anything on the official repo.

  • Did I install Org 9.2 correctly?
  • Is there perhaps some compiled file lingering somewhere from a bad install?
  • If this is a bug, how do I submit it? With report-emacs-bug?

Update

To address the side questions:

Did I install Org 9.2 correctly?

Yes. Installing org via list-packages will "override" the default version. This can be seen by running org-version. Note that it may be necessary to restart Emacs (or the Emacs server).

If this is a bug, how do I submit it? With report-emacs-bug?

According to the org-mode homepage (at the bottom), use M-x org-submit-bug-report. Make sure you Ask Questions the Smart Way so as not to spam the developers! This would include checking the release notes of the new version!

1
  • 1
    Could it be an org-mode dependency that needs an update?
    – wef
    Jan 8, 2019 at 22:14

5 Answers 5

61

They changed the template system in orgmode 9.2.

The new mechanism is called structured template. The command org-insert-structure-template bound to C-c C-, gives you a list of #+begin_-#+end_ pairs that narrows down while you type and you can use completion.

But, you can also get the old easy template system back, either

  • by adding (require 'org-tempo) to your init file or
  • by adding org-tempo to the list org-modules. You can do that by customizing org-modules.

Note that the answer is mostly a citation of two answers in the corresponding reddit article.

7

Others have stated that it's C-c C-, now to insert templates.

One cool thing is that you can paste some code, then visual-select it and do C-c C-, s and it will wrap your selection inside #+begin_src and #+end_src.

Before, when it was <s TAB, I had made a function to do that but now, I can do it with the native command. All I have to do is forget about <s TAB.

Edit: I installed yasnippet and yasnippet-snippets recently and it adds the completions with <s, <q etc.

(use-package yasnippet-snippets
  :ensure t)
(use-package yasnippet
  :ensure t
  :config (yas-global-mode 1))

I am however glad that I lost those <s completions since it lead me to discover C-c C-, which is useful with a visual selection.

3

As described by Tobias, I had to (require 'org-tempo) in .emacs.

Additionally, I had to remove any customization to org-structure-template-alist or revert it to standard. Then, C-c C-, triggers Org-Select menu for structure feature selection and <s triggers the usual src block directly.

For org-version 9.3.7, emacs 26.3

1

You can get completion back by adding org-tempo to org-modules like so

(add-to-list 'org-modules 'org-tempo t)

You will need to restart emacs so when orgmode is loaded it will load org-tempo as well.

Credit to agzam

0

you can use menu bar Org => Customize => Browse Org Group to add

1
  • 1
    Add what, to what? Please explain how you think this answers the question. Elaborate.
    – Drew
    May 19, 2020 at 23:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.