holy-books
An Emacs interface to the Quran and the Bible: Interactive lookup, Org-mode links, tooltips, and Lisp look-ups


AlBasmala Archive Tags RSS About

holy-books

Abstract

Let's use Org-mode links to look-up Quranic and Biblical verses!

Links such as quran:chapter:verse will, upon export, retrieve the requested verse and inline it in the resulting text.

For now, only the Quran and the Bible are supported.

Table of Contents

Super short example…

Source

  Sometimes I start a task with the Lord's name--- basmala:darkgreen|20px|span
---which means quran:1:1|darkgreen.
My friends like to say bible:Genesis:1:3|darkblue.

Result

Sometimes I start a task with the Lord's name— —which means In the Name of Allah—the Most Compassionate, Most Merciful.﴿ Quran 1:1, Al-fatihah The Opener . My friends like to say  And God said, "Let there be light," and there was light. ﴿ Genesis 1:3 .

Tooltips: Using Capitalisation ‘Quran:⋯’ and ‘Bible:⋯’

Sometimes I start a task with the Lord's name— —which means Quran 1:1  . My friends like to say Genesis 1:3  .

1 Longer Example

Source

 Sometimes I want to remember the words of the God of Abraham. In English Bibles,
His name is “Elohim”, whereas in Arabic Bibles and the Quran, His name is
“Allah”. We can use links to quickly access them, such as quran:7:157|darkgreen
and bible:Deuteronomy:18:18-22|darkblue.  Arab-speaking Christians and Muslims
use the Unicode symbol [[green:ﷲ]] to refer to Him ---e.g., they would write ﷲ ﷳ ,
“Allah akbar”, to declare the greatness of God-- and, as the previous passage
says “in the name of the Lord”, there is a nice calligraphic form that is used
by Arabic speakers when starting a task, namely [[basmala:darkgreen|20px|span]]
---this is known as the ‘basmalallah’, which is Arabic for “name of God”.
(Using capitalised ‘Quran:⋯’ and ‘Bible:⋯’ results in tooltips.)

Result

Sometimes I want to remember the words of the God of Abraham. In English Bibles, His name is “Elohim”, whereas in Arabic Bibles and the Quran, His name is “Allah”. We can use links to quickly access them, such as “˹They are˺ the ones who follow the Messenger, the unlettered Prophet, whose description they find in their Torah and the Gospel. He commands them to do good and forbids them from evil, permits for them what is lawful and forbids to them what is impure, and relieves them from their burdens and the shackles that bound them. ˹Only˺ those who believe in him, honour and support him, and follow the light sent down to him will be successful.”﴿ Quran 7:157, Al-a'raf The Heights and  I will raise up for them a prophet like you from among their fellow Israelites, and I will put my words in his mouth. He will tell them everything I command him.  I myself will call to account anyone who does not listen to my words that the prophet speaks in my name.  But a prophet who presumes to speak in my name anything I have not commanded, or a prophet who speaks in the name of other gods, is to be put to death."  You may say to yourselves, "How can we know when a message has not been spoken by the Lord?"  If what a prophet proclaims in the name of the Lord does not take place or come true, that is a message the Lord has not spoken. That prophet has spoken presumptuously, so do not be alarmed. ﴿ Deuteronomy 18:18-22 . Arab-speaking Christians and Muslims use the Unicode symbol to refer to Him —e.g., they would write ﷲ ﷳ , “Allah akbar”, to declare the greatness of God– and, as the previous passage says “in the name of the Lord”, there is a nice calligraphic form that is used by Arabic speakers when starting a task, namely —this is known as the ‘basmalallah’, which is Arabic for “name of God”. (Using capitalised ‘Quran:⋯’ and ‘Bible:⋯’ results in tooltips.)

Tooltips: Using Capitalisation ‘Quran:⋯’ and ‘Bible:⋯’

Sometimes I want to remember the words of the God of Abraham. In English Bibles, His name is “Elohim”, whereas in Arabic Bibles and the Quran, His name is “Allah”. We can use links to quickly access them, such as Quran 7:157   and Deuteronomy 18:18-22  . Arab-speaking Christians and Muslims use the Unicode symbol to refer to Him —e.g., they would write ﷲ ﷳ , “Allah akbar”, to declare the greatness of God– and, as the previous passage says “in the name of the Lord”, there is a nice calligraphic form that is used by Arabic speakers when starting a task, namely —this is known as the ‘basmalallah’, which is Arabic for “name of God”. (Using capitalised ‘Quran:⋯’ and ‘Bible:⋯’ results in tooltips.)

2 Yet Another Example

Alif-Lãm-Ra. These are the verses of the clear Book.﴿ Quran 12:1, Yusuf Joseph Indeed, We have sent it down as an Arabic Quran﴿ Quran 12:2, Yusuf Joseph We relate to you ˹O Prophet˺ the best of stories through Our revelation of this Quran, though before this you were totally unaware ˹of them˺.﴿ Quran 12:3, Yusuf Joseph ˹Remember˺ when Joseph said to his father, “O my dear father! Indeed I dreamt of eleven stars, and the sun, and the moon—I saw them prostrating to me!”﴿ Quran 12:4, Yusuf Joseph He replied, “O my dear son! Do not relate your vision to your brothers, or they will devise a plot against you. Surely Satan is a sworn enemy to humankind.﴿ Quran 12:5, Yusuf Joseph


Quran 12:1 Quran 12:2 Quran 12:3 Quran 12:4 Quran 12:5

3 basmala ﷽

The basmala is Arabic for “in the name of God”, and the Unicode symbol ﷽ says “In the name of Allah, the most gracious, the most merciful”.

One could wrap this up in HTML tags to get the desired style, as in

#+html: <center style="color:darkgreen;font-size:60px;padding:25px">
﷽
#+html: </center>

Much better would be basmala:darkgreen|20px|span, resulting in the inline ; whereas just basmala:darkgreen results in the centred form:

.

 1: (org-link-set-parameters
 2:   "basmala"
 3:   :follow (lambda (label) nil)
 4:   :export (lambda (label description backend)
 5:             (-let [(color size html-tag) (s-split "|" label)]
 6:               (format
 7:                "<%s style=\"color:%s;font-size:%s;padding:25px\">
 8: 
 9:                 </%s>"
10:                (or html-tag "center")
11:                (or color 'darkgreen)
12:                (or size '60px)
13:                (or html-tag "center"))))
14:   :face '(:foreground "green" :weight bold))
Tests
(ert-deftest basmala/empty ()
(should (equal
(org-export-string-as "[[basmala:]]" 'html :body-only)
(unindent
"<p>
<center style=\"color:;font-size:60px;padding:25px\">

</center></p>
"))))

(ert-deftest basmala/empty ()
(should (equal
(org-export-string-as "basmala:green" 'html :body-only)
(unindent
"<p>
<center style=\"color:green;font-size:60px;padding:25px\">

</center></p>
"))))

4 holy-books-quran

Test: The third verse of each chapter of the Quran

(s-join "\n\n<hr>" (--map (format "%s ∷ %s"
(cl-getf (cl-getf holy-books-quran-cache it) :name)
(holy-books-quran it 3)) (number-sequence 1 114)))
Al-fatihah The Opener ∷ the Most Compassionate, Most Merciful,
Al-baqarah The Cow ∷ who believe in the unseen, establish prayer, and donate from what We have provided for them,
Ali 'imran Family Of Imran آل ∷ He has revealed to you ˹O Prophet˺ the Book in truth, confirming what came before it, as He revealed the Torah and the Gospel
An-nisa The Women ∷ If you fear you might fail to give orphan women their ˹due˺ rights ˹if you were to marry them˺, then marry other women of your choice—two, three, or four. But if you are afraid you will fail to maintain justice, then ˹content yourselves with˺ one This way you are less likely to commit injustice.
Al-ma'idah The Table Spread ∷ Forbidden to you are carrion, blood, and swine; what is slaughtered in the name of any other than Allah; what is killed by strangling, beating, a fall, or by being gored to death; what is partly eaten by a predator unless you slaughter it; and what is sacrificed on altars. You are also forbidden to draw lots for decisions. This is all evil. Today the disbelievers have given up all hope of ˹undermining˺ your faith. So do not fear them; fear Me! Today I have perfected your faith for you, completed My favour upon you, and chosen Islam as your way. But whoever is compelled by extreme hunger—not intending to sin—then surely Allah is All-Forgiving, Most Merciful.
Al-an'am The Cattle ∷ He is the Only True God in the heavens and the earth. He knows whatever you conceal and whatever you reveal, and knows whatever you do.
Al-a'raf The Heights ∷ Follow what has been sent down to you from your Lord, and do not take others as guardians besides Him. How seldom are you mindful!
Al-anfal The Spoils Of War ∷ ˹They are˺ those who establish prayer and donate from what We have provided for them.
At-tawbah The Repentance ∷ A declaration from Allah and His Messenger ˹is made˺ to all people on the day of the greater pilgrimage that Allah and His Messenger are free of the polytheists. So if you ˹pagans˺ repent, it will be better for you. But if you turn away, then know that you will have no escape from Allah. And give good news ˹O Prophet˺ to the disbelievers of a painful punishment.
Yunus Jonah ∷ Surely your Lord is Allah Who created the heavens and the earth in six Days, then established Himself on the Throne, conducting every affair. None can intercede except by His permission. That is Allah—your Lord, so worship Him ˹alone˺. Will you not then be mindful?
Hud Hud ∷ And seek your Lord’s forgiveness and turn to Him in repentance. He will grant you a good provision for an appointed term and graciously reward the doers of good. But if you turn away, then I truly fear for you the torment of a formidable Day.
Yusuf Joseph ∷ We relate to you ˹O Prophet˺ the best of stories through Our revelation of this Quran, though before this you were totally unaware ˹of them˺.
Ar-ra'd The Thunder ∷ And He is the One Who spread out the earth and placed firm mountains and rivers upon it, and created fruits of every kind in pairs. He covers the day with night. Surely in this are signs for those who reflect.
Ibrahim Abraham ∷ ˹They are˺ the ones who favour the life of this world over the Hereafter and hinder ˹others˺ from the Way of Allah, striving to make it ˹appear˺ crooked. It is they who have gone far astray.
Al-hijr The Rocky Tract ∷ ˹So˺ let them eat and enjoy themselves and be diverted by ˹false˺ hope, for they will soon know.
An-nahl The Bee ∷ He created the heavens and the earth for a purpose. Exalted is He above what they associate with Him ˹in worship˺!
Al-isra The Night Journey ∷ ˹O˺ descendants of those We carried with Noah ˹in the Ark˺! He was indeed a grateful servant.”
Al-kahf The Cave ∷ in which they will remain forever;
Maryam Mary ∷ when he cried out to his Lord privately,
Taha Ta-ha ∷ but as a reminder to those in awe ˹of Allah˺.
Al-anbya The Prophets ∷ with their hearts ˹totally˺ distracted. The evildoers would converse secretly, ˹saying,˺ “Is this ˹one˺ not human like yourselves? Would you fall for ˹this˺ witchcraft, even though you can ˹clearly˺ see?”
Al-hajj The Pilgrimage ∷ ˹Still˺ there are some who dispute about Allah without knowledge, and follow every rebellious devil.
Al-mu'minun The Believers ∷ those who avoid idle talk;
An-nur The Light ∷ A male fornicator would only marry a female fornicator or idolatress. And a female fornicator would only be married to a fornicator or idolater. This is ˹all˺ forbidden to the believers.
Al-furqan The Criterion ∷ Yet they have taken besides Him gods who cannot create anything but are themselves created. Nor can they protect or benefit themselves. Nor can they control life, death, or resurrection.
Ash-shu'ara The Poets ∷ Perhaps you ˹O Prophet˺ will grieve yourself to death over their disbelief.
An-naml The Ant ∷ ˹those˺ who establish prayer, pay alms-tax, and have sure faith in the Hereafter.
Al-qasas The Stories ∷ We narrate to you ˹O Prophet˺ part of the story of Moses and Pharaoh in truth for people who believe.
Al-'ankabut The Spider ∷ We certainly tested those before them. And ˹in this way˺ Allah will clearly distinguish between those who are truthful and those who are liars.
∷ in a nearby land. Yet following their defeat, they will triumph
Luqman Luqman ∷ ˹It is˺ a guide and mercy for the good-doers—
As-sajdah The Prostration ∷ Or do they say, “He has fabricated it!”? No! It is the truth from your Lord in order for you to warn a people to whom no warner has come before you, so they may be ˹rightly˺ guided.
Al-ahzab The Combined Forces ∷ And put your trust in Allah, for Allah is sufficient as a Trustee of Affairs.
Saba Sheba ∷ The disbelievers say, “The Hour will never come to us.” Say, ˹O Prophet,˺ “Yes—by my Lord, the Knower of the unseen—it will certainly come to you!” Not ˹even˺ an atom’s weight is hidden from Him in the heavens or the earth; nor anything smaller or larger than that, but is ˹written˺ in a perfect Record.
Fatir Originator ∷ O humanity! Remember Allah’s favours upon you. Is there any creator other than Allah who provides for you from the heavens and the earth? There is no god ˹worthy of worship˺ except Him. How can you then be deluded ˹from the truth˺?
Ya-sin Ya Sin ∷ You ˹O Prophet˺ are truly one of the messengers
As-saffat Those Who Set The Ranks ∷ and those who recite the Reminder!
Sad The Letter "saad" ∷ ˹Imagine˺ how many peoples We destroyed before them, and they cried out when it was too late to escape.
Az-zumar The Troops ∷ Indeed, sincere devotion is due ˹only˺ to Allah. As for those who take other lords besides Him, ˹saying,˺ “We worship them only so they may bring us closer to Allah,” surely Allah will judge between all regarding what they differed about. Allah certainly does not guide whoever persists in lying and disbelief.
Ghafir The Forgiver ∷ the Forgiver of sin and Accepter of repentance, the Severe in punishment, and Infinite in bounty. There is no god ˹worthy of worship˺ except Him. To Him ˹alone˺  is the final return.
Fussilat Explained In Detail ∷ ˹It is˺ a Book whose verses are perfectly explained—a Quran in Arabic for people who know,
Ash-shuraa The Consultation ∷ And so you ˹O Prophet˺ are sent revelation, just like those before you, by Allah—the Almighty, All-Wise.
Az-zukhruf The Ornaments Of Gold ∷ Certainly, We have made it a Quran in Arabic so perhaps you will understand.
Ad-dukhan The Smoke ∷ Indeed, We sent it down on a blessed night, for We always warn ˹against evil˺.
Al-jathiyah The Crouching ∷ Surely in ˹the creation of˺ the heavens and the earth are signs for the believers.
Al-ahqaf The Wind-curved Sandhills ∷ We only created the heavens and the earth and everything in between for a purpose and an appointed term. Yet the disbelievers are turning away from what they have been warned about.
Muhammad Muhammad ∷ This is because the disbelievers follow falsehood, while the believers follow the truth from their Lord. This is how Allah shows people their true state ˹of faith˺.
Al-fath The Victory ∷ and so that Allah will help you tremendously.
Al-hujurat The Rooms ∷ Indeed, those who lower their voices in the presence of Allah’s Messenger are the ones whose hearts Allah has refined for righteousness. They will have forgiveness and a great reward.
Qaf The Letter "qaf" ∷ ˹Will we be returned to life,˺ when we are dead and reduced to dust? Such a return is impossible.”
Adh-dhariyat The Winnowing Winds ∷ and ˹the ships˺ gliding with ease,
At-tur The Mount ∷ on open pages ˹for all to read˺!
An-najm The Star ∷ Nor does he speak of his own whims.
Al-qamar The Moon ∷ They rejected ˹the truth˺ and followed their own desires—and every matter will be settled—
Ar-rahman The Beneficent ∷ created humanity,
Al-waqi'ah The Inevitable ∷ It will debase ˹some˺ and elevate ˹others˺.
Al-hadid The Iron ∷ He is the First and the Last, the Most High and Most Near, and He has ˹perfect˺ knowledge of all things.
Al-mujadila The Pleading Woman ∷ Those who divorce their wives in this manner, then ˹wish to˺ retract what they said, must free a slave before they touch each other. This ˹penalty˺ is meant to deter you. And Allah is All-Aware of what you do.
Al-hashr The Exile ∷ Had Allah not decreed exile for them, He would have certainly punished them in this world. And in the Hereafter they will suffer the punishment of the Fire.
Al-mumtahanah She That Is To Be Examined ∷ Neither your relatives nor children will benefit you on Judgment Day—He will decide between you ˹all˺. For Allah is All-Seeing of what you do.
As-saf The Ranks ∷ How despicable it is in the sight of Allah that you say what you do not do!
Al-jumu'ah The Congregation, Friday ∷ along with others of them who have not yet joined them ˹in faith˺. For He is the Almighty, All-Wise.
Al-munafiqun The Hypocrites ∷ This is because they believed and then abandoned faith. Therefore, their hearts have been sealed, so they do not comprehend.
At-taghabun The Mutual Disillusion ∷ He created the heavens and the earth for a purpose. He shaped you ˹in the womb˺, perfecting your form. And to Him is the final return.
At-talaq The Divorce ∷ and provide for them from sources they could never imagine. And whoever puts their trust in Allah, then He ˹alone˺ is sufficient for them. Certainly Allah achieves His Will. Allah has already set a destiny for everything.
At-tahrim The Prohibition ∷ ˹Remember˺ when the Prophet had ˹once˺ confided something to one of his wives, then when she disclosed it ˹to another wife˺ and Allah made it known to him, he presented ˹to her˺ part of what was disclosed and overlooked a part. So when he informed her of it, she exclaimed, “Who told you this?” He replied, “I was informed by the All-Knowing, All-Aware.”
Al-mulk The Sovereignty ∷ ˹He is the One˺ Who created seven heavens, one above the other. You will never see any imperfection in the creation of the Most Compassionate. So look again: do you see any flaws?
Al-qalam The Pen ∷ You will certainly have a never-ending reward.
Al-haqqah The Reality ∷ And what will make you realize what the Inevitable Hour is?
Al-ma'arij The Ascending Stairways ∷ from Allah, Lord of pathways of ˹heavenly˺ ascent,
Nuh Noah ∷ worship Allah ˹alone˺, fear Him, and obey me.
Al-jinn The Jinn ∷ ˹Now, we believe that˺ our Lord—Exalted is His Majesty—has neither taken a mate nor offspring,
Al-muzzammil The Enshrouded One ∷ ˹pray˺ half the night, or a little less,
Al-muddaththir The Cloaked One ∷ Revere your Lord ˹alone˺.
Al-qiyamah The Resurrection ∷ Do people think We cannot reassemble their bones?
Al-insan The Man ∷ We already showed them the Way, whether they ˹choose to˺ be grateful or ungrateful.
Al-mursalat The Emissaries ∷ and those scattering ˹rainclouds˺ widely!
An-naba The Tidings ∷ over which they disagree.
An-nazi'at Those Who Drag Forth ∷ and those gliding ˹through heavens˺ swiftly,
'abasa He Frowned ∷ You never know ˹O Prophet˺, perhaps he may be purified,
At-takwir The Overthrowing ∷ and when the mountains are blown away,
Al-infitar The Cleaving ∷ and when the seas burst forth,
Al-mutaffifin The Defrauding ∷ but give less when they measure or weigh for buyers.
Al-inshiqaq The Sundering ∷ and when the earth is flattened out,
Al-buruj The Mansions Of The Stars ∷ and the witness and what is witnessed!
At-tariq The Nightcommer ∷ ˹It is˺ the star of piercing brightness.
Al-a'la The Most High ∷ and Who ordained precisely and inspired accordingly,
Al-ghashiyah The Overwhelming ∷ ˹totally˺ overburdened, exhausted,
Al-fajr The Dawn ∷ and the even and the odd,
Al-balad The City ∷ and by every parent and ˹their˺ child!
Ash-shams The Sun ∷ and the day as it unveils it,
Al-layl The Night ∷ And by ˹the One˺ Who created male and female!
Ad-duhaa The Morning Hours ∷ Your Lord ˹O Prophet˺ has not abandoned you, nor has He become hateful ˹of you˺.
Ash-sharh The Relief ∷ which weighed so heavily on your back,
At-tin The Fig ∷ and this secure city ˹of Mecca˺!
Al-'alaq The Clot ∷ Read! And your Lord is the Most Generous,
Al-qadr The Power ∷ The Night of Glory is better than a thousand months.
Al-bayyinah The Clear Proof ∷ containing upright commandments.
Az-zalzalah The Earthquake ∷ and humanity cries, “What is wrong with it?”—
Al-'adiyat The Courser ∷ launching raids at dawn,
Al-qari'ah The Calamity ∷ And what will make you realize what the Striking Disaster is?
At-takathur The Rivalry In World Increase ∷ But no! You will soon come to know.
Al-'asr The Declining Day ∷ except those who have faith, do good, and urge each other to the truth, and urge each other to perseverance.
Al-humazah The Traducer ∷ thinking that their wealth will make them immortal!
Al-fil The Elephant ∷ For He sent against them flocks of birds,
Quraysh Quraysh ∷ let them worship the Lord of this ˹Sacred˺ House,
Al-ma'un The Small Kindnesses ∷ and does not encourage the feeding of the poor.
Al-kawthar The Abundance ∷ Only the one who hates you is truly cut off ˹from any goodness˺.
Al-kafirun The Disbelievers ∷ nor do you worship what I worship.
An-nasr The Divine Support ∷ then glorify the praises of your Lord and seek His forgiveness, for certainly He is ever Accepting of Repentance.
Al-masad The Palm Fiber ∷ He will burn in a flaming Fire,
Al-ikhlas The Sincerity ∷ He has never had offspring, nor was He born.
Al-falaq The Daybreak ∷ and from the evil of the night when it grows dark,
An-nas The Mankind ∷ the God of humankind,
Tests
(ert-deftest quran/lisp/1:1 ()
(should (equal
(holy-books-quran 1 1)
"  In the Name of Allah—the Most Compassionate, Most Merciful.")))

(ert-deftest quran/link/1:1 ()
(should (equal
(org-export-string-as "quran:1:1" 'html :body-only)
(unindent "
<p>
<span style=\"color:nil;font-size:nil;\">
﴾<em>   In the Name of Allah—the Most Compassionate, Most Merciful.</em>﴿ <small><a href=\"https://quran.com/chapter_info/1?local=en\">Quran 1:1, Al-fatihah The Opener</a></small>
</span></p>
"))))

4.1 holy-books-quran-cache

(defvar holy-books-quran-cache nil
  "A plist storing the verses looked up by ‘holy-books-quran’ for faster reuse.

Each key in the plist refers to a chapter, and the values are plists:
Keys are verses numbers and values are the actual verses ---but there is
a special key ‘:name’ whose value is the Arabic-English name of the chapter.")

4.2 holy-books-quran-translation

(defvar holy-books-quran-translation "131"
  "The translation code of the Quran; a string.

Possible codes include

Code  Translation
--------------------
131   Dr.  Mustafa Khattab, the Clear Quran (Default)
20    Sahih International
85    Abdul Haleem
19    Picktall
22    Yusuf Ali
95    Abul Ala Maududi
167   Maarif-ul-Quran
57    Transliteration

A longer list of translations can be found here:
https://api.quran.com/api/v3/options/translations")

4.3 holy-books-quran

(defun holy-books-quran (chapter verse)
  "Lookup a verse, as a string, from the Quran.

CHAPTER and VERSE are both numbers, referring to a chapter in the Quran
and a verse it contains.
In the associated Org link, both are treated as strings.

+ Lookups are stored in the variable `holy-books-quran-cache' for faster reuse.
+ Quran lookup is based on https://quran.com .
+ Examples:

    ;; Get verse 2 of chapter 7 of the Quran
    (holy-books-quran 7 2)

    ;; Get English-Arabic name of 7th chapter
    (cl-getf (cl-getf holy-books-quran 7) :name)

The particular translation can be selected by altering the
HOLY-BOOKS-QURAN-TRANSLAITON variable.

--------------------------------------------------------------------------------

There is an Org link form: “quran:chapter:verse|color|size|no-info-p”
Only ‘chapter’ and ‘verse’ are mandatory; when ‘no-info-p’ is given,
the chapter and verse numbers are not mentioned in the resulting output.

Examples:
           quran:7:157|darkgreen|30px|t

           quran:7:157

For now, only Org HTML export is supported.

--------------------------------------------------------------------------------

Finally, there is also an HTML tooltip version with a captial ‘Q’;
it takes the same arguments but only the chapter and verse are actually used.
E.g. Quran:7:157 results in text “Quran 7:157” with a tooltip showing the verse."
  (let (start result)
    ;; get info about the current chapter
    (unless (cl-getf (cl-getf holy-books-quran-cache chapter) :name)
      (switch-to-buffer
       (url-retrieve-synchronously
        (format "https://quran.com/%s/%s?translations=%s"
                chapter verse holy-books-quran-translation)))
      (re-search-forward (format "\"%s " chapter))
      (setq start (point))
      (end-of-line)
      (setq result (buffer-substring-no-properties start (point)))
      (kill-buffer)
      (thread-last (decode-coding-string result 'utf-8)
        (s-chop-suffix "\">")
        (s-split " ")
        (-drop-last 1)
        (mapcar #'s-capitalize)
        (s-join " ")
        (setf (cl-getf (cl-getf holy-books-quran-cache chapter) :name))))

    ;; get the actual verse requested
    (--if-let (cl-getf (cl-getf holy-books-quran-cache chapter) verse)
        it
      (switch-to-buffer
       (url-retrieve-synchronously
        (format "https://quran.com/%s/%s?translations=%s"
                chapter verse holy-books-quran-translation)))
      (re-search-forward "d-block resource")
      (forward-line -2)
      (beginning-of-line)
      (setq start (point))
      (end-of-line)
      (setq result (buffer-substring-no-properties start (point)))
      (kill-buffer)
      (thread-last (decode-coding-string result 'utf-8)
        (s-replace-regexp "<sup.*sup>" "")
        (setf (cl-getf (cl-getf holy-books-quran-cache chapter) verse))))))

4.5 holy-books-insert-quran

(defun holy-books-insert-quran ()
 "Insert a Quranic verse at point; prompt user for details."
 (interactive)
 (let ((chapter (string-to-number (read-string "Quran Chapter: ")))
       (verse   (string-to-number (read-string "Quran Verse: "))))
   (if (member 0 (list chapter verse))
       (error (concat "holy-books ∷ There seems to be a typo;"
                      "please enter appropriate numbers."))
     (insert (holy-books-quran chapter verse))
     (fill-paragraph))))

5 holy-books-bible

Test: The first verse of the first chapter of each book of the Bible

; (holy-books-bible "Genesis" 1 "2-5")
; (holy-books-bible "Exodus" 1 "2-5") ;; Joseph!

(setq books '(
;; Old Testament
Genesis Exodus Leviticus Numbers Joshua Judges Ruth
1+Samuel 2+Samuel 1+Kings 2+Kings 1+Chronicles 2+Chronicles Ezra
Nehemiah Esther Job Psalms Proverbs Ecclesiastes Song+of+Solomon
Isaiah Jeremiah Lamentations Ezekiel Daniel Hosea Joel Amos
Obadiah Jonah Micah Nahum Habakkuk Zephaniah Haggai Zechariah
Malachi
;; New Testament
Matthew Mark Luke John Acts Romans 1+Corinthians 2+Corinthians
Galatians Ephesians Philippians Colossians 1+Thessalonians
2+Thessalonians 1+Timothy 2+Timothy Titus Philemon Hebrews James
1+Peter 2+Peter 1+John 2+John 3+John Jude Revelation))

(s-join "\n\n<hr>" (--map (format "%s ∷ %s" it (holy-books-bible it 1 1)) books))
Genesis ∷ In the beginning God created the heavens and the earth.
Exodus ∷ These are the names of the sons of Israel who went to Egypt with Jacob, each with his family:
Leviticus ∷ The Lord called to Moses and spoke to him from the tent of meeting. He said,
Numbers ∷ The Lord spoke to Moses in the tent of meeting in the Desert of Sinai on the first day of the second month of the second year after the Israelites came out of Egypt. He said:
Joshua ∷ After the death of Moses the servant of the Lord, the Lord said to Joshua son of Nun, Moses' aide:
Judges ∷ After the death of Joshua, the Israelites asked the Lord, "Who of us is to go up first to fight against the Canaanites?"
Ruth ∷ In the days when the judges ruled, there was a famine in the land. So a man from Bethlehem in Judah, together with his wife and two sons, went to live for a while in the country of Moab.
1+Samuel ∷ There was a certain man from Ramathaim, a Zuphite from the hill country of Ephraim, whose name was Elkanah son of Jeroham, the son of Elihu, the son of Tohu, the son of Zuph, an Ephraimite.
2+Samuel ∷ After the death of Saul, David returned from striking down the Amalekites and stayed in Ziklag two days.
1+Kings ∷ When King David was very old, he could not keep warm even when they put covers over him.
2+Kings ∷ After Ahab's death, Moab rebelled against Israel.
1+Chronicles ∷ Adam, Seth, Enosh,
2+Chronicles ∷ Solomon son of David established himself firmly over his kingdom, for the Lord his God was with him and made him exceedingly great.
Ezra ∷ In the first year of Cyrus king of Persia, in order to fulfill the word of the Lord spoken by Jeremiah, the Lord moved the heart of Cyrus king of Persia to make a proclamation throughout his realm and also to put it in writing:
Nehemiah ∷ The words of Nehemiah son of Hakaliah: In the month of Kislev in the twentieth year, while I was in the citadel of Susa,
Esther ∷ This is what happened during the time of Xerxes, the Xerxes who ruled over 127 provinces stretching from India to Cush :
Job ∷ In the land of Uz there lived a man whose name was Job. This man was blameless and upright; he feared God and shunned evil.
Psalms ∷ Blessed is the one who does not walk in step with the wicked or stand in the way that sinners take or sit in the company of mockers,
Proverbs ∷ The proverbs of Solomon son of David, king of Israel:
Ecclesiastes ∷ The words of the Teacher, son of David, king in Jerusalem:
Song+of+Solomon ∷ Solomon's Song of Songs.
Isaiah ∷ The vision concerning Judah and Jerusalem that Isaiah son of Amoz saw during the reigns of Uzziah, Jotham, Ahaz and Hezekiah, kings of Judah.
Jeremiah ∷ The words of Jeremiah son of Hilkiah, one of the priests at Anathoth in the territory of Benjamin.
Lamentations ∷ How deserted lies the city, once so full of people! How like a widow is she, who once was great among the nations! She who was queen among the provinces has now become a slave.
Ezekiel ∷ In my thirtieth year, in the fourth month on the fifth day, while I was among the exiles by the Kebar River, the heavens were opened and I saw visions of God.
Daniel ∷ In the third year of the reign of Jehoiakim king of Judah, Nebuchadnezzar king of Babylon came to Jerusalem and besieged it.
Hosea ∷ The word of the Lord that came to Hosea son of Beeri during the reigns of Uzziah, Jotham, Ahaz and Hezekiah, kings of Judah, and during the reign of Jeroboam son of Jehoash king of Israel:
Joel ∷ The word of the Lord that came to Joel son of Pethuel.
Amos ∷ The words of Amos, one of the shepherds of Tekoa-the vision he saw concerning Israel two years before the earthquake, when Uzziah was king of Judah and Jeroboam son of Jehoash was king of Israel.
Obadiah ∷ The vision of Obadiah. This is what the Sovereign Lord says about Edom- We have heard a message from the Lord: An envoy was sent to the nations to say, "Rise, let us go against her for battle"-
Jonah ∷ The word of the Lord came to Jonah son of Amittai:
Micah ∷ The word of the Lord that came to Micah of Moresheth during the reigns of Jotham, Ahaz and Hezekiah, kings of Judah-the vision he saw concerning Samaria and Jerusalem.
Nahum ∷ A prophecy concerning Nineveh. The book of the vision of Nahum the Elkoshite.
Habakkuk ∷ The prophecy that Habakkuk the prophet received.
Zephaniah ∷ The word of the Lord that came to Zephaniah son of Cushi, the son of Gedaliah, the son of Amariah, the son of Hezekiah, during the reign of Josiah son of Amon king of Judah:
Haggai ∷ In the second year of King Darius, on the first day of the sixth month, the word of the Lord came through the prophet Haggai to Zerubbabel son of Shealtiel, governor of Judah, and to Joshua son of Jozadak, the high priest:
Zechariah ∷ In the eighth month of the second year of Darius, the word of the Lord came to the prophet Zechariah son of Berekiah, the son of Iddo:
Malachi ∷ A prophecy: The word of the Lord to Israel through Malachi.
Matthew ∷ This is the genealogy of Jesus the Messiah the son of David, the son of Abraham:
Mark ∷ The beginning of the good news about Jesus the Messiah, the Son of God,
Luke ∷ Many have undertaken to draw up an account of the things that have been fulfilled among us,
John ∷ In the beginning was the Word, and the Word was with God, and the Word was God.
Acts ∷ In my former book, Theophilus, I wrote about all that Jesus began to do and to teach
Romans ∷ Paul, a servant of Christ Jesus, called to be an apostle and set apart for the gospel of God-
1+Corinthians ∷ Paul, called to be an apostle of Christ Jesus by the will of God, and our brother Sosthenes,
2+Corinthians ∷ Paul, an apostle of Christ Jesus by the will of God, and Timothy our brother, To the church of God in Corinth, together with all his holy people throughout Achaia:
Galatians ∷ Paul, an apostle-sent not from men nor by a man, but by Jesus Christ and God the Father, who raised him from the dead-
Ephesians ∷ Paul, an apostle of Christ Jesus by the will of God, To God's holy people in Ephesus, the faithful in Christ Jesus:
Philippians ∷ Paul and Timothy, servants of Christ Jesus, To all God's holy people in Christ Jesus at Philippi, together with the overseers and deacons :
Colossians ∷ Paul, an apostle of Christ Jesus by the will of God, and Timothy our brother,
1+Thessalonians ∷ Paul, Silas and Timothy, To the church of the Thessalonians in God the Father and the Lord Jesus Christ: Grace and peace to you.
2+Thessalonians ∷ Paul, Silas and Timothy, To the church of the Thessalonians in God our Father and the Lord Jesus Christ:
1+Timothy ∷ Paul, an apostle of Christ Jesus by the command of God our Savior and of Christ Jesus our hope,
2+Timothy ∷ Paul, an apostle of Christ Jesus by the will of God, in keeping with the promise of life that is in Christ Jesus,
Titus ∷ Paul, a servant of God and an apostle of Jesus Christ to further the faith of God's elect and their knowledge of the truth that leads to godliness-
Philemon ∷ Paul, a prisoner of Christ Jesus, and Timothy our brother, To Philemon our dear friend and fellow worker-
Hebrews ∷ In the past God spoke to our ancestors through the prophets at many times and in various ways,
James ∷ James, a servant of God and of the Lord Jesus Christ, To the twelve tribes scattered among the nations: Greetings.
1+Peter ∷ Peter, an apostle of Jesus Christ, To God's elect, exiles scattered throughout the provinces of Pontus, Galatia, Cappadocia, Asia and Bithynia,
2+Peter ∷ Simon Peter, a servant and apostle of Jesus Christ, To those who through the righteousness of our God and Savior Jesus Christ have received a faith as precious as ours:
1+John ∷ That which was from the beginning, which we have heard, which we have seen with our eyes, which we have looked at and our hands have touched-this we proclaim concerning the Word of life.
2+John ∷ The elder, To the lady chosen by God and to her children, whom I love in the truth-and not I only, but also all who know the truth-
3+John ∷ The elder, To my dear friend Gaius, whom I love in the truth.
Jude ∷ Jude, a servant of Jesus Christ and a brother of James, To those who have been called, who are loved in God the Father and kept for Jesus Christ:
Revelation ∷ The revelation from Jesus Christ, which God gave him to show his servants what must soon take place. He made it known by sending his angel to his servant John,
Tests
(ert-deftest bible/lisp/Genesis:1:2 ()
(should (equal
(holy-books-bible  "Genesis" 1 "1")

"
In the beginning God created the heavens and the earth.                        "
)))

(ert-deftest bible/link/Genesis:1:2 ()
(should (equal
(org-export-string-as "bible:Genesis:1:2" 'html :body-only)
"<p>
<span style=\"color:nil;font-size:nil;\">
﴾<em>
&nbsp;Now the earth was formless and empty, darkness was over the surface of the deep, and the Spirit of God was hovering over the waters.                        </em>﴿ <small><a href=\"https://www.christianity.com/bible/bible.php?q=Genesis+1&ver=niv\">Genesis 1:2</a></small>
</span></p>
")))

5.1 holy-books-bible-version

(defvar holy-books-bible-version 'niv
  "The version code of the Holy Bible; a symbol or string.

Possible version codes include:

Code   Version
---------------------------------------
niv    New International Version, DEFAULT
asv    American Standard Version
bbe    Bible in Basic English
drb    Darby's Translation
esv    English Standard Version
kjv    King James Version
nas    New American Standard
nkjv   New King James Version
nlt    New Living Translation
nrs    New Revised Standard Version
rsv    Revised Standard Version
msg    The Message Bible
web    World English Bible
ylt    Young's Literal")

5.2 holy-books-bible

(defun holy-books-bible (book chapter verses)
  "Retrive a verse from the Christian Bible.

CHAPTER is a number.
VERSES is either a number or a string “x-y” of numbers.
BOOK is any of the books of the Bible, with ‘+’ instead of spaces!

Examples:

        (holy-books-bible \"Deuteronomy\" 18 \"18-22\")  ;; Lisp

        bible:Deuteronomy:18:18-22|darkblue   ;; Org-mode

        Bible:Deuteronomy:18:18-22            ;; Tooltip

There is also an Org HTML export link, “bible:book:chapter:verse”
sharing the same optional arguments and variations as the “quran:” link;
see the documentation of the method HOLY-BOOKS-QURAN for details.

The particular version can be selected by altering the
HOLY-BOOKS-BIBLE-VERSION variable.

Currently, Bible lookups are not cached and Quran lookups do not support the
“x-y” verse lookup style.

Possible books include:

 ;; Old Testament
 Genesis Exodus Leviticus Numbers Joshua Judges Ruth
 1+Samuel 2+Samuel 1+Kings 2+Kings 1+Chronicles 2+Chronicles Ezra
 Nehemiah Esther Job Psalms Proverbs Ecclesiastes Song+of+Solomon
 Isaiah Jeremiah Lamentations Ezekiel Daniel Hosea Joel Amos
 Obadiah Jonah Micah Nahum Habakkuk Zephaniah Haggai Zechariah
 Malachi
 ;; New Testament
 Matthew Mark Luke John Acts Romans 1+Corinthians 2+Corinthians
 Galatians Ephesians Philippians Colossians 1+Thessalonians
 2+Thessalonians 1+Timothy 2+Timothy Titus Philemon Hebrews James
 1+Peter 2+Peter 1+John 2+John 3+John Jude Revelation

For example, the following incantation yields the first verse of
the first chapter of each book.

   (s-join \"\n\n<hr>\" (--map (holy-books-bible it 1 1) '(...above list...)))"
  (let (start result)
    (switch-to-buffer
     (url-retrieve-synchronously
      (format "https://www.christianity.com/bible/bible.php?q=%s+%s%%3A%s&ver=%s"
              book chapter verses holy-books-bible-version)))
    (re-search-forward (format "<blockquote>"))
    (setq start (point))
    (re-search-forward (format "</blockquote>"))
    (backward-word)
    (setq result (buffer-substring-no-properties start (point)))
    (kill-buffer)
    (thread-last (decode-coding-string result 'utf-8)
      (s-replace-regexp
       "<span class=\"verse-num\"><strong><a href=\".*?\">.*?</strong> </a>"
       "")
      (s-replace-regexp "<h4>.*?big-chapter-num.*?&nbsp;" "")
      (s-replace-regexp "<a href=\".*?\">.*?</a>" "")
      (s-replace-all '(("</p>" . "") ("<p>" . "") ("</span>" . "")))
      (s-chop-suffix "</")
      (s-chop-suffix "\">"))))

5.4 holy-books-insert-bible

(defun holy-books-insert-bible ()
 "Insert a Biblical verse at point; prompt user for details.

See the documentation of HOLY-BOOKS-BIBLE for the appropriate
names of books."
 (interactive)
 (let ((book    (read-string "Bible Book: "))
       (chapter (string-to-number (read-string "Bible Chapter: ")))
       (verse   (string-to-number (read-string "Bible Verse: "))))
   (if (member 0 (list chapter verse))
       (error (concat "holy-books ∷ There seems to be a typo;"
                      "please enter appropriate numbers."))
     (insert (s-trim (holy-books-bible book chapter verse)))
     (fill-paragraph))))

6 Summary

The full article may be read as —or visit the repo .

Link Action
quran:chapter:verse Retrive a verse from the Quran
bible:book:chapter:verse Retrive a verse from the Bible
[[basmala:]] Produce the Basmala ligature

These each take optional arguments separated by ‘|’; see holy-books-quran and holy-books-bible or see the full documentation online at .

There are also holy-books-insert-quran and holy-books-insert-bible to inject verses in the current Emacs buffer ;-)

Moreover, the Quran's translation and the Bible's version can both be selected…

‘holy-books-quran’ details
Lookup a verse, as a string, from the Quran.

CHAPTER and VERSE are both numbers, referring to a chapter in the Quran
and a verse it contains.
In the associated Org link, both are treated as strings.

+ Lookups are stored in the variable ‘holy-books-quran-cache’ for faster reuse.
+ Quran lookup is based on https://quran.com .
+ Examples:

;; Get verse 2 of chapter 7 of the Quran
(holy-books-quran 7 2)

;; Get English-Arabic name of 7th chapter
(cl-getf (cl-getf holy-books-quran 7) :name)

The particular translation can be selected by altering the
HOLY-BOOKS-QURAN-TRANSLAITON variable.

--------------------------------------------------------------------------------

There is an Org link form: “quran:chapter:verse|color|size|no-info-p”
Only ‘chapter’ and ‘verse’ are mandatory; when ‘no-info-p’ is given,
the chapter and verse numbers are not mentioned in the resulting output.

Examples:
quran:7:157|darkgreen|30px|t

quran:7:157

For now, only Org HTML export is supported.

--------------------------------------------------------------------------------

Finally, there is also an HTML tooltip version with a captial ‘Q’;
it takes the same arguments but only the chapter and verse are actually used.
E.g. Quran:7:157 results in text “Quran 7:157” with a tooltip showing the verse.
‘holy-books-bible’ details
Retrive a verse from the Christian Bible.

CHAPTER is a number.
VERSES is either a number or a string “x-y” of numbers.
BOOK is any of the books of the Bible, with ‘+’ instead of spaces!

Examples:

(holy-books-bible "Deuteronomy" 18 "18-22")  ;; Lisp

bible:Deuteronomy:18:18-22|darkblue   ;; Org-mode

Bible:Deuteronomy:18:18-22            ;; Tooltip

There is also an Org HTML export link, “bible:book:chapter:verse”
sharing the same optional arguments and variations as the “quran:” link;
see the documentation of the method HOLY-BOOKS-QURAN for details.

The particular version can be selected by altering the
HOLY-BOOKS-BIBLE-VERSION variable.

Currently, Bible lookups are not cached and Quran lookups do not support the
“x-y” verse lookup style.

Possible books include:

;; Old Testament
Genesis Exodus Leviticus Numbers Joshua Judges Ruth
1+Samuel 2+Samuel 1+Kings 2+Kings 1+Chronicles 2+Chronicles Ezra
Nehemiah Esther Job Psalms Proverbs Ecclesiastes Song+of+Solomon
Isaiah Jeremiah Lamentations Ezekiel Daniel Hosea Joel Amos
Obadiah Jonah Micah Nahum Habakkuk Zephaniah Haggai Zechariah
Malachi
;; New Testament
Matthew Mark Luke John Acts Romans 1+Corinthians 2+Corinthians
Galatians Ephesians Philippians Colossians 1+Thessalonians
2+Thessalonians 1+Timothy 2+Timothy Titus Philemon Hebrews James
1+Peter 2+Peter 1+John 2+John 3+John Jude Revelation

For example, the following incantation yields the first verse of
the first chapter of each book.

(s-join "

<hr>" (--map (holy-books-bible it 1 1) ’(...above list...)))

6.1 Installation Instructions

Manually or using quelpa:

;; ⟨0⟩ Download the holy-books.el file manually or using quelpa
(quelpa '(holy-books :fetcher github :repo
"alhassy/holy-books"))

;; ⟨1⟩ Have this always active in Org buffers
(add-hook #'org-mode-hook #'holy-books-mode)

;; ⟨1′⟩ Or use: “M-x holy-books-mode” to turn it on/off

;; ⟨2⟩ Configure the Quranic translation and Bible version
;;     Press ‘C-h o’ to get more info on each variable.
(setq holy-books-quran-translation "131"  ;; The Clear Quran
      holy-books-bible-version     "niv") ;; New International Version

6.2 Bye!

Author: Musa Al-hassy

Created: 2021-02-27 Sat 17:15

Validate