From 01d8b1d57ebf79af68f0d76e578fbdbeee883951 Mon Sep 17 00:00:00 2001 From: nik gaffney Date: Sat, 2 Jan 2021 17:12:54 +0100 Subject: [PATCH] =?UTF-8?q?=E4=B7=BD=20Small=20Preponderance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There will be progress and attainment in small affairs, but not in great affairs. --- i-ching.el | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/i-ching.el b/i-ching.el index 6cfa3de..ef8ebc2 100644 --- a/i-ching.el +++ b/i-ching.el @@ -521,16 +521,21 @@ c.f. ‘The Superior man’ (Legge, Wilhem), ‘Noble young one’ (Hatcher), 't (let ((hexagrams i-ching-hexagram-summary)) (nth 4 (alist-get number hexagrams)))) -(defun i-ching-describe-hexagram (point) - "Show the name of a HEXAGRAM at (before) POINT based on it's unicode name." - (interactive "d") - (let* ((hexagrams i-ching-hexagram-summary) - (hexagram - (nth 4 (alist-get (char-before point) hexagrams)))) - (message "%s" - (if hexagram - (capitalize (seq-drop hexagram 13)) - "Not a hexagram")))) + +(defun i-ching-describe-hexagram (point mark) + "Show the name of a HEXAGRAM (between POINT and MARK) based on it's unicode name." + (interactive "r") + (if (use-region-p) + (let* ((hexagrams i-ching-hexagram-summary) + (selection (buffer-substring point mark)) + (hexagram + (nth 4 (alist-get + (i-ching-hexagram-to-number selection) + hexagrams)))) + (message "%s" (if hexagram + (capitalize (seq-drop hexagram 13)) + "Not a hexagram"))) + (message "Nothing selected"))) ;;;;; ; ; ; ; @@ -677,10 +682,10 @@ Provided by Randomness and Integrity Services Ltd. via https://www.random.org/" ;; Each function should produce a binary pair corresponding to a line of a hexagram ;; as follows... ;; -;; (0 1)) is yin changing to yang -;; (1 1)) is yang -;; (0 0)) is yin -;; (1 0)) is yang changing to yinn +;; (0 1) is yin changing to yang +;; (1 1) is yang +;; (0 0) is yin +;; (1 0) is yang changing to yinn ;; ;;;;;;; ; ; ;