Kungsgeten / yankpad

Paste snippets from an org-mode file
MIT License
216 stars 18 forks source link

how does one insert orgmode snippets that contain * ? #7

Closed zeltak closed 8 years ago

zeltak commented 8 years ago

Hi again

i was wondering how using yankpad one would insert snippets that have org headers in them (ie ***). in yas its not a problem ie to have a snippet like this

# -*- mode: snippet; require-final-newline: nil -*-
# name: projfile
# key: projfile
# binding: direct-keybinding
# --
** P0XX.$1
*** Aims
*** related papers
*** manuscript
*** work
**** data
**** model
*** results

yet in yankspad due to the fact that the snippets them selves are org mode headers/content this above snippet messes up things. anyway around this?

best

z

Kungsgeten commented 8 years ago

You can try indenting the whole snippet one space (mark the whole snippet and use M-x indent-rigidly). I believe this will work as long as you do not have lines with only one star, because then org-mode will convert it into a list. I should probably look into this...

Kungsgeten commented 8 years ago

I'm not quite sure on how to fix this. The snippet could be inserted as raw data, but then the snippet would have to be indented (and the indentation will be inserted too).

zeltak commented 8 years ago

hmmm just a wild thought. perhaps the use of orgmode code blocks/ babel can help here? for example for snippets with problematic characters such as * etc we could put that inside orgmode example blocks

#+BEGIN_EXAMPLE
* snip
#+END_EXAMPLE

would that help at all?

best

Z

Kungsgeten commented 8 years ago

It could work, but I think it would require the use of the flet function (or be really cumbersome to code), which is deprecated in Emacs lisp.

Kungsgeten commented 8 years ago

Okay, so I've submitted a solution: \* at the beginning of a line will be replaced by \*. So in your example:

\** P0XX.$1
\*** Aims
\*** related papers
\*** manuscript
\*** work
\**** data
\**** model
\*** results
zeltak commented 8 years ago

just to be clear this will insert the \* not just * so one still needs to go and delete the \ in the buffer when yanpad inserted the snippet right?

thx

Z

Kungsgeten commented 8 years ago

No, at the beginning of a line (column 0) should insert \ and nothing else.

On Mon, May 23, 2016, 13:39 zeltak notifications@github.com wrote:

just to be clear this will insert the not just \ so one still needs to go and delete the \ right?

thx

Z

— You are receiving this because you modified the open/close state.

Reply to this email directly or view it on GitHub https://github.com/Kungsgeten/yankpad/issues/7#issuecomment-220957056