Doom-emacs: `overlayp` error when using `Org Capture` for the first time

Created on 10 May 2019  ·  33Comments  ·  Source: hlissner/doom-emacs

Hey,

I assume you must not encounter this error since you have your files set up already, but the first time you do <spc> X then enter something like a todo or a note, you get an overlayp is nil error when typing the note any time you press space (it also inserts a new line or returns to the beginning of the line).

You can still press C-c C-c to complete the note, which creates the todo.org or notes.org file, and from now on, the error does not happen.

So I guess steps to reproduce are:

  • nuke one of your todo.org or notes.org
  • then try to create a TODO or a note, depending on what you nuked
  • start typing the title of your TODO/note, press Space, see the error

Could be an upstream error in yasnippet, given the error in the messages log is:

yas--snapshot-overlay-location: Wrong type argument: overlayp, nil [2 times]
:editor file-templates :lang org bug resolved

All 33 comments

I can confirm. Further it also happened with the very first todo.org and the very first notes.org file with me, too. And never appeared again after the files are existent.

I think I've finally tracked down this issue. Could you try the following to see if it solves it?

(add-hook 'org-capture-mode-hook #'yas-abort-snippet)

21cf1c2 should resolve this issue. Let me know if that isn't the case and I will reopen this issue. Thanks for bringing to my attention!

@hlissner, I'll do, when @ home. Busy day at work...

Nope, didn't fix it.

Being on ae365272.

Hmm, in that case I can no longer reproduce it. Back to the drawing board!

It's wicked. I just

mv org org_bak
  • Restart Emacs (A <Space> h R doesn't reproduce it!)

<Space> X>

Typing -> produces this weird behavior.

Reproduced it a 2nd time just now, to be 100% sure.

mv org_bak org fixes the problem. Just in case, here my config.el relevant part:

;;
;;; :lang org
(after! org
  (add-to-list 'org-modules 'org-habit t))

;; Pop-rule
(after! org
  (set-popup-rule! "^\\*Org Agenda.*\\*$" :size 0.5 :side 'right :vslot 1  :select t :quit t   :ttl nil :modeline nil :autosave t)
  (set-popup-rule! "^CAPTURE.*\\.org$"    :size 0.4 :side 'bottom          :select t                                  :autosave t))

;; automatically redisplay images generated by babel
(add-hook 'org-babel-after-execute-hook 'org-redisplay-inline-images)

;; place latex-captions below figures and tables
(setq org-latex-caption-above nil)

(setq org-directory "~/org/"
      org-agenda-files (list org-directory)
      org-ellipsis " ▼ "

      ;; The standard unicode characters are usually misaligned depending on the
      ;; font. This bugs me. Markdown #-marks for headlines are more elegant.
      org-bullets-bullet-list '("#"))

;; Org-Noter
(def-package! org-noter
  :defer t
  :after org-mode
  :config
  (map!
   (:leader
     (:prefix "n"
       :desc "Org-noter-insert" :n "i" #'org-noter-insert-note))))

;; Setup
(setq org-noter-always-create-frame nil
      org-noter-auto-save-last-location t)

@rscircus Did the same thing, to no effect. Can you supply your M-x doom/info?

```

  • OS: gnu/linux (x86_64-pc-linux-gnu)
  • Emacs: 25.3.2 (Apr 19, 2018)
  • Doom: 2.0.9 (HEAD -> develop, _upgrade/develop ae365272 2019-06-18 11:46:27 +0200)
  • Graphic display: t (daemon: nil)
  • System features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES
  • Details:
    elisp env bootstrapper: nil elc count: 0 uname -a: Linux 4.15.0-46-generic #49-Ubuntu SMP Wed Feb 6 09:33:07 UTC 2019 x86_64 modules: (:tools eval :editor evil file-templates :tools lookup :editor snippets :tools flyspell flycheck :ui workspaces :completion company helm :ui doom doom-dashboard modeline doom-quit ophints hl-todo nav-flash treemacs (popup +all +defaults) vc-gutter vi-tilde-fringe window-select :editor multiple-cursors rotate-text :emacs dired electric :editor fold :term term :emacs vc :tools editorconfig ein make magit tmux upload :lang clojure data emacs-lisp go (java +meghanada) javascript julia lua markdown (org +attach +babel +capture +habit +export +present) python rest (sh +fish) web :config default) packages: (emojify org-pomodoro org-noter writeroom-mode esh-autosuggest fish-completion) exec-path: (/home/linuxbrew/.linuxbrew/bin /home/linuxbrew/.linuxbrew/sbin ~/.cargo/bin ~/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games /snap/bin /usr/lib/x86_64-linux-gnu/emacs/25.3/x86_64-linux-gnu)

Further details on my config: https://github.com/rscircus/dotfiles/tree/master/config/doom.d - maybe an interaction. 🤷

To be honest, the fix is quite an easy and necessary step, so if you got more important things to do, the ones really wanting to dig into doom emacs will find this issue. ;)

I have the same problem and I don't quite understand the workaround offered here. How does org_bak come into play at all? I don't use ~/org as a directory org files, do I need a similar workaround?

@rgrinberg The way I understand it, when you invoke org-capture and your org-capture target file doesn't exist, it has to create one. Upon creating an empty org file, the org file template is expanded with yasnippet (by the :editor file-templates module). This normally creates overlays over all the editable regions in the snippet -- however, org-capture has its own ideas on how the user will interact with this org file: it narrows it, so that the expanded snippet (and consequently, those overlays) are no longer visible. Yasnippet tries to interact with these overlays that existed only a moment ago, to find that they're gone, and throws a type error complaining that it expected an overlay. Hence the error.

Unfortunately, the file-templates module can't do much about this because there is no way to detect "this org file will be used for an org-capture buffer" at the time its logic runs.

@rscircus Speaking of, are you still experiencing this issue?

@rgrinberg I think, you have to read the whole thread but it probably still is confusing. So basically this odd behavior vanishes the moment the directory specified via (setq org-directory "/path/to/org/") and todo.org or wherever your capture goes to exist. In the discussion above I moved org-directory around to check. The fix is, to create that directory and files manually and this undesirable behavior is gone. Hope, this answers your question, too, @hlissner?

@rscircus Does disabling the :editor file-templates module fix the issue?

OK, first things first:

On feb9799f (2017-07-12) the bug still exists. Moving org-directory and let emacs try to create it resulted in the same behavior as described by @Ptival .

On de85f67b (2017-07-14), too.

Disabling :editor file-templates in init.el doesn't help.

Again, what helped is to create the capture file.

@rscircus Could you produce a backtrace from your error? i.e. enable debug mode with SPC h d d (or M-x doom/toggle-debug-mode) then recreate the error.

image

The moment I hit <space>! Guess you added a breakpoint somewhere?

@rscircus Hmm, nothing amiss there. Could you also include your M-x doom/info?

```

  • OS: gnu/linux (x86_64-pc-linux-gnu)
  • Shell: /bin/zsh
  • Emacs: 26.2 (Apr 12, 2019)
  • Doom: 2.0.9 (HEAD -> develop, origin/develop de85f67b 2019-07-14 05:35:51 +0200)
  • Graphic display: t (daemon: nil)
  • System features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS LIBSYSTEMD LCMS2
  • Details:
    elisp env bootstrapper: envvar-file elc count: 0 uname -a: Linux 4.15.0-51-generic #55-Ubuntu SMP Wed May 15 14:27:21 UTC 2019 x86_64 modules: (:completion company ivy :ui doom doom-dashboard doom-quit hl-todo modeline nav-flash ophints (popup +all +defaults) treemacs vc-gutter vi-tilde-fringe window-select workspaces :editor evil file-templates fold multiple-cursors rotate-text snippets :emacs dired electric vc :tools eval flycheck (lookup +docsets) magit :lang data emacs-lisp markdown (org +dragndrop +ipython +pandoc +present) sh :config default) packages: (emojify org-pomodoro org-noter org-trello writeroom-mode esh-autosuggest fish-completion) exec-path: (~/.cargo/bin ~/.local/bin /home/linuxbrew/.linuxbrew/bin /home/linuxbrew/.linuxbrew/sbin ~/.emacs.d/bin ~/local/bin ~/local/bin ~/local/bin ~/local/bin ~/.cargo/bin ~/.local/share/umake/bin ~/.cargo/bin ~/.local/bin /home/linuxbrew/.linuxbrew/bin /home/linuxbrew/.linuxbrew/sbin ~/.emacs.d/bin ~/.local/share/anaconda3/bin ~/.sdkman/candidates/java/current/bin ~/local/bin ~/local/bin ~/.cargo/bin ~/.local/share/umake/bin ~/.cargo/bin /home/linuxbrew/.linuxbrew/bin /home/linuxbrew/.linuxbrew/sbin /home/linuxbrew/.linuxbrew/bin /home/linuxbrew/.linuxbrew/sbin ~/.local/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games /snap/bin ~/bin /usr/lib/jvm/java-11-openjdk-amd64/bin /usr/local/bin/ /usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/X11/bin /usr/local/sbin ~/dotfiles/bin /usr/local/bin/ /usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/X11/bin /usr/local/sbin ~/dotfiles/bin ~/.local/bin ~/local/src/go/bin ~/.fzf/bin /snap/bin /usr/local/bin/ /usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/X11/bin /usr/local/sbin ~/dotfiles/bin /usr/local/bin/ /usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/X11/bin /usr/local/sbin ~/dotfiles/bin ~/.local/bin ~/local/src/go/bin /usr/local/bin/ /usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/X11/bin /usr/local/sbin ~/dotfiles/bin /usr/local/bin/ /usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/X11/bin /usr/local/sbin ~/dotfiles/bin ~/.local/bin ~/local/src/go/bin /snap/bin /usr/lib/x86_64-linux-gnu/emacs/26.2/x86_64-linux-gnu/)

When you disabled :editor file-templates, did you run doom refresh before restarting Emacs and testing it?

Funny, how often I fired up vim to (search for a) fix emacs :joy: today.

Well, as you guessed right, I didn't doom refresh after modifying init.el.

Yep, without :editor file-template things work as designed.

I believe fb619bd presents a possible solution for this issue. Could someone test it out and let me know if that is the case?

I believe this is not fixed yet. Here's a fresh stacktrace:

Debugger entered--Lisp error: (wrong-type-argument overlayp nil)
  overlay-start(nil)
  yas--snapshot-overlay-location(nil 54 168)
  yas--auto-fill()
  internal-auto-fill()
  self-insert-command(1)
  newline(nil t)
  (if (and (sp-point-in-comment) comment-line-break-function) (funcall comment-line-break-function) (delete-horizontal-space t) (newline nil t) (indent-according-to-mode))
  +default--newline-indent-and-continue-comments-a()
  apply(+default--newline-indent-and-continue-comments-a nil)
  newline-and-indent()
  org-return(t)
  #f(compiled-function () (interactive nil) #<bytecode 0x404ac0d1>)()
  apply(#f(compiled-function () (interactive nil) #<bytecode 0x404ac0d1>) nil)
  org-return-indent()
  funcall-interactively(org-return-indent)
  call-interactively(org-return-indent nil nil)
  command-execute(org-return-indent)

@rgrinberg I still cannot reproduce this. Could you share your org-capture-templates?

(("t" "Personal todo" entry
  (file+headline +org-capture-todo-file "Inbox")
  "* TODO %?\n%i\n%a" :prepend t :kill-buffer t)
 ("n" "Personal notes" entry
  (file+headline +org-capture-notes-file "Inbox")
  "* %u %?\n%i\n%a" :prepend t :kill-buffer t)
 ("p" "Templates for projects")
 ("pt" "Project todo" entry
  (file+headline +org-capture-project-todo-file "Inbox")
  "* TODO %?\n%i\n%a" :prepend t :kill-buffer t)
 ("pn" "Project notes" entry
  (file+headline +org-capture-project-notes-file "Inbox")
  "* TODO %?\n%i\n%a" :prepend t :kill-buffer t)
 ("pc" "Project changelog" entry
  (file+headline +org-capture-project-notes-file "Unreleased")
  "* TODO %?\n%i\n%a" :prepend t :kill-buffer t))

I’m not sure if this is a matter of the tempaltes. I never customized my templates and this is not an issue I can reproduce consistently so the root seems to be something else.

No I’m not on Emacs 27. Emacs 26.3 here :)
On Oct 30, 2019 01:22 +0900, Henrik Lissner notifications@github.com, wrote:

@rgrinberg I still cannot reproduce this. Could you share your org-capture-templates?

You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

@rgrinberg fd00870 should finally address this. Let me know if that isn't the case and I'll reopen this issue.

Thanks for bearing with me on this. I’ll let you know if I can reproduce
On Nov 2, 2019, 2:21 AM +0900, Henrik Lissner notifications@github.com, wrote:

@rgrinberg fd00870 should finally address this. Let me know if that isn't the case and I'll reopen this issue.

You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

As of 037bcf3 I've implemented a new workaround for file-template expansion issues like these. This should also address this one, but let me know here if that isn't the case.

Was this page helpful?
0 / 5 - 0 ratings