I have a yasnippet that is intended to create a footnote in org-mode format and automatically insert the contents of the clipboard.
# -*- mode: snippet -*- # name: footnote # key: fn # -- [fn:: `(clipboard-yank)`]
This worked correctly until this week. Desired output is this:
But now when I do it, it truncates the contents and adds a Y, such that when the clipboard contains
fn <TAB> results in this output:
My yasnippet for org-mode footnotes actually uses not
clipboard-yank but my own custom function pasteboard-paste-no-spaces.
# -*- mode: snippet -*- # name: footnote # key: fn # -- [fn:: `(pasteboard-paste-no-spaces)`]
For simplicity, I mentioned
clipboard-yank since I tested it and it has the same problem. But since I use a custom function, switching to
current-kill won't work for me.
(defun pasteboard-paste-no-spaces () "Paste from OS X system pasteboard via `pbpaste' to point." (interactive) (let ((start (point)) (end (if mark-active (mark) (point)))) (shell-command-on-region start end "pbpaste | perl -p -e 's/\r$//' | tr '\r' '\n'" nil t) (save-excursion )))
Thanks for all the help. I'm having the same problem with tiny-expand. I tried using the
(with-temp-buffer) approach you suggested to create a new function
yas/tiny-expand, but it doesn't work:
(defun yas/tiny-expand (&rest args) "Return the string that `tiny-expand' would insert." (with-temp-buffer (apply #'tiny-expand args) (buffer-string)))
Here is the relevant yasnippet where I tried to use
Here's the original version: https://gist.github.com/1c947de20a1b7790d04d69ac39884f22