dtk01 / dtk

Read the Bible or other diatheke-accessible material in emacs
GNU General Public License v3.0
24 stars 10 forks source link

Is it possible to just paste passages on a document? #2

Closed vonpupp closed 5 years ago

vonpupp commented 5 years ago

Hello,

Congratulations on dtk. It looks very promising!

I am quite new to emacs (spacemacs). I would like to know if it is possible to paste a passage in-place on the current document that I am writing (cursor position)?

I am not sure if you have considered this use case, but I think it would be tremendously beneficial for writing studies in org-mode and include passages directly using dtk (assuming it would be possible).

Thank you very much. Blessings!

thomp commented 5 years ago

https://github.com/dtk01/dtk/commit/77f65b1dc0b9ba0cdf9813e9a19420b27975a9b9 (hopefully...) addresses this. You should now be able to invoke dtk-bible (M-x dtk-bible) in an arbitrary buffer.

vonpupp commented 5 years ago

Thank you very much!

I tried with https://github.com/dtk01/dtk/commit/5082aeb4cd5e8dff5cfbac55bc8166ebd7ed09b5, however when I invoke the dtk-bible function, it deletes all the content under the same headline level. This happens when using org mode while editing an org file on spacemacs (devel branch).

I am not that experienced with emacs, so I am unsure if it is an error of mine or a bug.

Thank you again.

thomp commented 5 years ago

I'm unable to reproduce. When I open an org file, dtk-bible seems to insert the content wherever requested w/o deleting anything.

Would you be willing to provide more detail in order to facilitate reproducing the issue on my end? Perhaps attach an org file which exhibits the issue and then describe specifically where to place the point, while in org mode, to observe the deletion of content, noting whether any of the surrounding content is folded or not.

yiufung commented 5 years ago

You can reproduce the issue by adding any line starting with :. For example, :PROPERTIES:, :LOGBOOK:, etc, and then call dtk-bible after it.

It is caused by this part in dtk-bible--insert-using-diatheke, which is called by dtk-bible:

;; Search back and remove duplicate text of last verse and the preceding colon
        (let ((end-point (point)))
          (re-search-backward "^:" nil t 1)
          (delete-region (point) end-point))
yiufung commented 5 years ago

I have pushed a commit that fixes this issue by processing diatheke output in a temporary buffer. See #3.