dtk01 / dtk

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

Content is not installed error when it is installed #16

Closed Randy1Burrell closed 1 year ago

Randy1Burrell commented 3 years ago

I have been trying to set up this plugin to work with Emacs on MacOS. However, I get the following errors:

Testing for installed modules:

$ installmgr -l

I get:

Installed User Modules:

 [KJV]          (2.9)   - King James Version (1769) with Strongs Numbers and Morphology
 [NET]          (1.0.1)         - New English Translation with over 60,000 translator, study and text critical notes

Testing diatheke via the terminal:

$ diatheke -b KJV -o gei -k Jn 2:3

Yields:

John 2:3: <w  savlm="strong:G2532 lemma.TR:και" src="1">And</w> <w  savlm="strong:G5302 lemma.TR:υστερησαντος" src="2">when they wanted</w> <w  savlm="strong:G3631 lemma.TR:οινου" src="3">wine</w>, <w  savlm="strong:G3588 strong:G3384 lemma.TR:η lemma.TR:μητηρ" src="5 6">the mother</w> <w  savlm="strong:G3588 strong:G2424 lemma.TR:του lemma.TR:ιησου" src="7 8">of Jesus</w> <w  savlm="strong:G3004 lemma.TR:λεγει" src="4">saith</w> <w  savlm="strong:G4314 lemma.TR:προς" src="9">unto</w> <w  savlm="strong:G846 lemma.TR:αυτον" src="10">him</w>, <w  savlm="strong:G2192 lemma.TR:εχουσιν" src="13">They have</w> <w  savlm="strong:G3756 lemma.TR:ουκ" src="12">no</w> <w  savlm="strong:G3631 lemma.TR:οινον" src="11">wine</w>.
(KJV)

Here's my configuration:

(use-package dtk
  :bind (("C-c B" . dtk-bible))
  :custom
  (dtk-default-module "KJV")
  (dtk-default-module-category "Biblical Texts")
  (dtk-word-wrap t))

Here is my environment variable for SWORD_PATH

export SWORD_PATH="/Users/randyburrell/Library/Application Support/Sword"

Am I missing something?

thomp commented 3 years ago

Thank you -- the README has been neglected. dtk-default-module and dtk-default-module-category are no longer used.

If you set dtk-module-category and dtk-module, does the situation improve when you invoke dtk?

Example:

M-x ielm and then

(setq dtk-module-category "Biblical Texts")
(setq dtk-module "KJV")

and then try M-x dtk.

Randy1Burrell commented 3 years ago

No that doesn't to work either. Here are the documentation for the variables when I run C-h v

dtk-module’s value is "KJV"

Documentation:
Not documented as a variable.
dtk-module-category’s value is "Biblical Text"

Documentation:
Not documented as a variable.
thomp commented 3 years ago

Something has definitely gone awry. The Help buffer content should indicate where the variable is defined and should show the docstring for each variable. For example, the text for dtk-module should end with

…
Documentation:
Module currently in use.

I recognize that the "Content is not installed" messages suggest that dtk.el was loaded. However, the lack of docstrings for the variables suggest that dtk.el was not loaded. Would you be willing to reload dtk.el? (open the dtk.el file; then M-x load-file). What is the C-h v output for the variables once dtk.el is loaded?

Randy1Burrell commented 3 years ago

It seems something did go awry so I restarted emacs and I am still having the same problems. I'm using the use-package plugin so that have loaded the file for me. Here's new configuration and the current output when I run the C-h v.

(use-package dtk
  :bind (("C-c B" . dtk-bible))
  :init
  (setq dtk-module "KJV")
  (setq dtk-module-category "Biblical Text")
  (setq dtk-word-wrap t))
dtk-module is a variable defined in ‘dtk.el’.
Its value is "KJV"
Original value was nil

  You can customize this variable.

Documentation:
Module currently in use.

[forward]
dtk-module-category is a variable defined in ‘dtk.el’.
Its value is "Biblical Text"
Original value was nil

  You can customize this variable.

Documentation:
Module category last selected by the user.

[back]
thomp commented 3 years ago

I don't believe "Biblical Text" is used by diatheke. Try

  1. M-x ielm
  2. (setq dtk-module-category "Biblical Texts") (note the plural)
  3. (dtk-biblical-texts)

What is the output when dtk-biblical-texts is executed? It should be a list of string specifying the various texts available, e.g.

> (dtk-biblical-texts)
("ESV2001" "ESV2011" "KJV" "SpaRV" "WEB" "YLT")
Randy1Burrell commented 3 years ago

Changing dtk-module-category to "Biblical Texts" does not make a difference. Invoking dtk-biblical-texts outputs nil.

image
thomp commented 3 years ago

Makes me wonder if there is some quirk with MacOS and either executing diatheke or with diatheke output. Would you be willing to try out (dtk-diatheke-string "John 3:16" "KJV") and post the output?

Randy1Burrell commented 3 years ago

Sure

image
thomp commented 3 years ago

Invoking dtk-diatheke should signal an error if the diatheke executable is not found. Since this isn't occurring, let's continue to check possibilities:

Expected:

ELISP> dtk-program
"diatheke"
ELISP> (call-process "diatheke" nil t nil "-b" "KJV" "-k" "Ps 39:1")
0 (#o0, #x0, ?\C-@)
ELISP> Psalms 39:1: <w  savlm="strong:H0559">I said</w>, <w  savlm="strong:H08104">I will take heed</w> <w savlm="strong:H01870">to my ways</w>, <w  savlm="strong:H02398">that I sin</w> <w savlm="strong:H03956">not with my tongue</w>: <w  savlm="strong:H08104">I will keep</w> <w savlm="strong:H06310">my mouth</w> <w savlm="strong:H04269">with a bridle</w>, <w savlm="strong:H07563">while the wicked</w> is before me.
(KJV)
$ diatheke -b KJV -k Ps 39:1
Psalms 39:1: <w  savlm="strong:H0559">I said</w>, <w  savlm="strong:H08104">I will take heed</w> <w savlm="strong:H01870">to my ways</w>, <w  savlm="strong:H02398">that I sin</w> <w savlm="strong:H03956">not with my tongue</w>: <w  savlm="strong:H08104">I will keep</w> <w savlm="strong:H06310">my mouth</w> <w savlm="strong:H04269">with a bridle</w>, <w savlm="strong:H07563">while the wicked</w> is before me.
(KJV)
Randy1Burrell commented 3 years ago

Here goes:

image
thomp commented 3 years ago

The CALL-PROCESS output looks sane. I'm not familiar with the behavior of Emacs with MacOS and am wondering if you're experiencing a Mac-specific quirk. If you're up for it, let's try to troubleshoot a bit more. What is the output, return value, or value of each of the following? (# 2 is intended just to verify that the behavior you described earlier remains unchanged. # 6 is intended as a generic check of CALL-PROCESS behavior on planet Mac.)

  1. diatheke-output-format
  2. (dtk-diatheke-string "John 3:16" "KJV")
  3. (apply 'call-process '("diatheke" nil t t "-b" "KJV" "-k" "John 3:16"))
  4. (apply 'call-process '("diatheke" nil t t "-b" "KJV" "-o" "nfmslx" "-f" "OSIS" "-k" "John 3:16"))
  5. (apply 'call-process '("diatheke" nil t t "-b" "KJV" "-o" "n" "-f" "plain" "-k" "John 3:16"))
  6. (with-temp-buffer (apply 'call-process '("echo" nil t nil "123")) (buffer-string))
Randy1Burrell commented 3 years ago

Here goes:

image
thomp commented 3 years ago

Interesting that

(call-process "diatheke" nil t nil "-b" "KJV" "-k" "Ps 39:1")

yields output but

(apply 'call-process '("diatheke" nil t t "-b" "KJV" "-k" "John 3:16"))

does not yield output, although it completes without error. The DISPLAY argument is NIL in the former but T in the latter. Is it possible that this is the underlying issue? Would you be willing to post the output of the two forms below?

(with-temp-buffer (apply 'call-process '("diatheke" nil t nil "-b" "KJV" "-k" "John 3:16")) (buffer-string))

(with-temp-buffer (apply 'call-process '("diatheke" nil t t "-b" "KJV" "-k" "John 3:16")) (buffer-string))
Randy1Burrell commented 3 years ago

Here goes:

image
yiufung commented 3 years ago

@Randy1Burrell Can you check value of (executable-find "diatheke")? It should return full path of your diatheke executable. It should match that output by which diatheke in Mac terminal.

If (executable-find "diatheke") returns nil, then Emacs cannot find it. Please add it to path with (add-to-list 'exec-path "/path/to/diatheke/").

This seems a Mac-specific problem, where PATH environment variable set by ~/.bashrc etc is NOT inherited in Emacs. Check this related SO thread, the first answer gives some hints.

Randy1Burrell commented 3 years ago

(executable-find "diatheke")

image

which diatheke

image
Randy1Burrell commented 3 years ago

I use this plugin to get my path from bash https://github.com/purcell/exec-path-from-shell

yiufung commented 3 years ago

Apologies, I overlooked some previous discussion and led you in the wrong way.

Here goes:

image

I noticed unusual error output for (dtk-diatheke-string "John 3:16" "KJV"). If the package is correctly loaded, at lease the function name should already be defined.

Can you try add :demand t keyword to both dtk AND exec-path-from-shell? I wonder whether some of the empty output is due to the fact that either package is defer-loaded, so they're not in effect. If possible, please delete and fetch the latest version of dtk and exec-path-from-shell too.

(use-package dtk
  :bind (("C-c B" . dtk-bible))
  :demand t ;; do the same to exec-path-from-shell
  :custom
  (dtk-module "KJV")
  (dtk-module-category "Biblical Texts")
  (dtk-word-wrap t))

If that still doesn't work, please post output of these commands at the moment when you don't see output:

Randy1Burrell commented 3 years ago

@yiufung thanks for your help and sorry for the late reply. These past few weeks have been really busy and tiresome for me.

Here are the output you asked for:

(exec-path)

image

(emacs-version)

image

dtk

image

exec-path-from-shell

image
yiufung commented 3 years ago

I notice that you write dtk configuration as

:custom
(setq dtk-module "KJV")

instead of

:custom
(dtk-module "KJV")

From my understanding, it's not needed to use setq within :custom keyword. They are only needed in :config or :init. One suggestion is to retry with this fixed.

I observe that:

  1. You have a working diatheke binary installation: under /usr/local/bin
  2. You have already installed some modules for Biblical Texts: command line can output text correctly
  3. The path can be found in Emacs: based on output of exec-path

Usually this should work, but now dtk.el still cannot give you output. I would suggest that you:

  1. Make sure you are using the latest version of dtk.el. Try delete local copy under your machine, and download the latest version
  2. Check value of dtk-module, dtk-output-format, dtk-module-category when you run dtk-* commands.
thomp commented 1 year ago

Inactive for > 1 y. The underlying issue remains unclear.