[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-real 900f96a 129/160: Added is-plural
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-real 900f96a 129/160: Added is-plural |
Date: |
Wed, 6 Oct 2021 16:58:31 -0400 (EDT) |
branch: externals/org-real
commit 900f96aead7d6ee69e60b5522aa29971b3cffac4
Author: Tyler Grinn <tylergrinn@gmail.com>
Commit: Tyler Grinn <tylergrinn@gmail.com>
Added is-plural
---
org-real.el | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 61 insertions(+), 2 deletions(-)
diff --git a/org-real.el b/org-real.el
index 941d14c..09571a4 100644
--- a/org-real.el
+++ b/org-real.el
@@ -55,6 +55,7 @@
(require 'org-element)
(require 'org-colview)
(require 'cl-lib)
+(require 'ispell)
;;;; Patch! 0.0.1 -> 0.1.0+
;;;; Will be removed in version 1.0.0+
@@ -536,7 +537,7 @@ visibility."
(put-text-property 0 (length primary-name) 'face 'org-real-primary
primary-name)
(insert primary-name)
- (if reversed (insert " is"))
+ (if reversed (insert (if (org-real--is-plural primary-name) " are" " is")))
(while reversed
(insert " ")
(insert (plist-get container :rel))
@@ -1226,7 +1227,9 @@ If INCLUDE-ON-TOP is non-nil, also include height on top
of box."
(setq tooltip-timer
(org-real--tooltip
(with-temp-buffer
- (insert (format "The %s is %s the %s."
+ (insert (format (concat "The %s "
+ (if
(org-real--is-plural name) "are" "is")
+ " %s the %s.")
name
(if (slot-boundp box
:display-rel)
display-rel
@@ -1972,6 +1975,62 @@ set to the :loc slot of each box."
containers
"/")))
+(defun org-real--is-plural (noun)
+ "Determine if any word in NOUN has a base (root) word.
+
+Uses either Ispell, aspell, or hunspell based on user settings."
+ (condition-case err
+ (progn
+ (ispell-set-spellchecker-params)
+ (let* ((words (split-string noun))
+ (orig-args (ispell-get-ispell-args))
+ (args (append
+ (if (and ispell-current-dictionary
+ (not (member "-d" orig-args)))
+ (list "-d" ispell-current-dictionary))
+ orig-args
+ (if ispell-current-personal-dictionary
+ (list "-p" ispell-current-personal-dictionary))
+ (if ispell-encoding8-command
+ (if ispell-really-hunspell
+ (list ispell-encoding8-command
+ (upcase (symbol-name
(ispell-get-coding-system))))
+ (list
+ (concat ispell-encoding8-command
+ (symbol-name
(ispell-get-coding-system))))))
+ ispell-extra-args))
+ (mode (cond (ispell-really-aspell "munch")
+ ((or ispell-really-hunspell
+ (not (not (string-match-p "ispell"
ispell-program-name))))
+ "-m")
+ (t (error (concat ispell-program-name " is not
supported.")))))
+ (program (concat ispell-program-name " " mode " " (string-join
args " ")))
+ (results (mapcar
+ (lambda (word)
+ (shell-command-to-string (concat "echo " word " | "
program)))
+ words)))
+ (cond
+ (ispell-really-aspell
+ (seq-some
+ (lambda (result)
+ (not (not (string-match-p "/S" result))))
+ results))
+ (ispell-really-hunspell
+ (seq-some
+ (lambda (result)
+ (not (not (string-match-p "fl:[[:alnum:]]*S[[:alnum:]]*"
result))))
+ results))
+ ((not (not (string-match-p "ispell" ispell-program-name)))
+ (seq-some
+ (lambda (result)
+ (not (not (string-match-p "(derives from root" result))))
+ results))
+ (t
+ (error (concat ispell-program-name " is not supported."))))))
+ (error (progn
+ (message (error-message-string err))
+ nil))))
+
(provide 'org-real)
;;; org-real.el ends here
- [elpa] externals/org-real af8744b 151/160: Removed `org-real-headlines`, (continued)
- [elpa] externals/org-real af8744b 151/160: Removed `org-real-headlines`, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real d95d469 156/160: Changed cl-defmethod to defun; linting, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 80799f6 150/160: Linting, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 791ed99 157/160: Added url-parse, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 0d25274 084/160: Passing edge cases, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 8f7ef62 085/160: Updated readme, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 87dfecc 081/160: Org real headlines switched to add-next, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real e0d81ab 098/160: Bump version, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real a8e336d 095/160: Typo in flex-adjust, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 5fb78c3 108/160: Skip adding box if it already exists, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 900f96a 129/160: Added is-plural,
ELPA Syncer <=
- [elpa] externals/org-real fb056dc 078/160: Reuse window if org real diagram already visible, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 4cc110c 086/160: Added document container to org-real-headlines, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 4246089 096/160: Rotate locations of box when cycling, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 193f14d 138/160: Refactoring, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 7e51167 128/160: Linting/documentation, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 0c93bd8 141/160: Updated readme, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 186830b 060/160: Detect return and backspace without gui, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real f80251e 116/160: Merge branch 'next' into 'main', ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 20d9631 147/160: Added boxy dependency, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 639ee73 069/160: Using save-excursion when applying changes, ELPA Syncer, 2021/10/06