Straight.el: org-mode easy template expansion doesn't work

Created on 26 Jul 2018  路  5Comments  路  Source: raxod502/straight.el

If I install Org using straight.el, I can't get Easy Template Expansion to work.

Repro steps:

mv ~/.emacs.d ~/.emacs.d.bak
emacs -Q
(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(require 'subr-x)
(straight-use-package 'git)

(defun org-git-version ()
  "The Git version of org-mode.
Inserted by installing org-mode or when a release is made."
  (require 'git)
  (let ((git-repo (expand-file-name
                   "straight/repos/org/" user-emacs-directory)))
    (string-trim
     (git-run "describe"
              "--match=release\*"
              "--abbrev=6"
              "HEAD"))))

(defun org-release ()
  "The release version of org-mode.
Inserted by installing org-mode or when a release is made."
  (require 'git)
  (let ((git-repo (expand-file-name
                   "straight/repos/org/" user-emacs-directory)))
    (string-trim
     (string-remove-prefix
      "release_"
      (git-run "describe"
               "--match=release\*"
               "--abbrev=0"
               "HEAD")))))

(provide 'org-version)

(straight-use-package 'org)
M-x eval-buffer
M-x org-version
Org mode version 9.1.13 (release_9.1.13-894-gf79545 @ /Users/mnewt/.emacs.d/straight/build/org/)
M-x emacs-version
GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin17.7.0, NS appkit-1561.60 Version 10.13.6 (Build 17G65)) of 2018-07-24
M-x find-file RET test.org
<s

At that point, I hit <TAB> and nothing happens. I would expect the Org source code blocks to appear. org-insert-structure-template works as expected.

I don't see this problem if the same version of Org is installed using package-install.

Can anyone else reproduce this or is it just me?

external bug org-mode upstream

Most helpful comment

...the old behavior can be restored with (load-library "org-tempo")

All 5 comments

Oh, huh. I did notice that easy template expansion didn't work, but I assumed it was a bug in Org!

Since, as you've pointed out, it's not, I'll look into it.

This appears to be a regression in Org. If I use commit 5057e398911daada95958a907cc75285ceb09729 of Org (from master), then the behavior is as you describe. However, if I first check out release_9.1.13, then it works with straight.el. Maybe report this upstream?

Thanks very much for verifying this and pointing me in the right direction. I will investigate this a bit more and see if I can pinpoint the issue.

For what it's worth, looks like this might be intentional?

I ran a git bisect and found:

c04e357f3d5d93484277a7e439847b1233b872bd is the first bad commit
commit c04e357f3d5d93484277a7e439847b1233b872bd
Author: Eric Abrahamsen <[email protected]>
Date:   Sun Nov 5 09:25:15 2017 +0100

    Replace easy templates with org-insert-structure-template

    * lisp/org.el (org-insert-structure-template): New function for
      wrapping region (or element at point) in a begin/end block.
      (org-structure-predefined-blocks): New option holding predefined
      blocks, for completion.
      (org-try-structure-completion,
      org-complete-expand-structure-template): Remove functions.
    * doc/org.texi (Inserting structure templates): Document.
    * testing/lisp/test-org.el (test-org/insert-template): New test.

:040000 040000 d2b8c796a90f3496a4ac86abac1888f5b6cf8145 f741b53d9508b0d98859ddd2d1d7971296c12554 M      doc
:040000 040000 4bea1d23e6dfd8595367d146ac4ad656855bed4b cf54422346d0a8242c8f86810de43ed3c0034c66 M      etc
:040000 040000 9639f5348da4e8017d3c2db9d7fa98075b03db10 d9890e6fdc398e4b879ff12017696ac7737c6b1a M      lisp
:040000 040000 852c6719b1d366a1a2402e27ccdadba0d210988c 325fe921ba820c1fd2d25b9b24cd17a825102e29 M      testing

That commit can be seen on the org-mode git repo at https://code.orgmode.org/bzg/org-mode/commit/c04e357f3d5d93484277a7e439847b1233b872bd

References to <X + TAB style shortcuts have been removed.

Looks like the new way of working is to call org-insert-structure-template, which is bound to C-c C-, by default.

...the old behavior can be restored with (load-library "org-tempo")

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hlissner picture hlissner  路  3Comments

rsbowman picture rsbowman  路  3Comments

dertuxmalwieder picture dertuxmalwieder  路  3Comments

enko picture enko  路  4Comments

Fuco1 picture Fuco1  路  3Comments