[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-real b9af670298 129/188: Added is-plural
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-real b9af670298 129/188: Added is-plural |
Date: |
Sun, 5 May 2024 22:56:02 -0400 (EDT) |
branch: externals/org-real
commit b9af6702988040361ec61e93de9ef1a4e670687f
Author: Amy Grinn <grinn.amy@gmail.com>
Commit: Amy Grinn <grinn.amy@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 941d14ca3f..09571a4b0c 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 f94678b0b4 138/188: Refactoring, (continued)
- [elpa] externals/org-real f94678b0b4 138/188: Refactoring, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 8c032c1b9f 141/188: Updated readme, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real db9f38f413 142/188: Draw selected box last, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 760925984e 156/188: Changed cl-defmethod to defun; linting, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 668a60cb43 139/188: Merge display-rel-box, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real e7c6fb4c14 148/188: Add submodules during ci/cd pipeline, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real f93714689a 149/188: Regression: primary boxes should be highlighted, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 0eb43ca002 115/188: Redesigned tooltips, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 89a03be54a 119/188: Use original relationship for tooltip if changed, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real a325418d4a 122/188: Merge branch 'next' into 'main', ELPA Syncer, 2024/05/05
- [elpa] externals/org-real b9af670298 129/188: Added is-plural,
ELPA Syncer <=
- [elpa] externals/org-real 4d6fbc4364 053/188: Removed existing containers from completion candidates, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 0dfa33276e 052/188: More edge cases, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real f2837a4836 054/188: Added org-real-flex-width custom variable, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real f35ba82a6a 137/188: Merge branch 'next' into 'main', ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 2ef7476cc7 145/188: Bump version, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real d7ab6cc78f 151/188: Removed `org-real-headlines`, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real a0250ce600 153/188: Linting, rearranging, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 7e6871d940 164/188: Add ol to autoloads, added autoload plugin to eldev, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real c3c532f9ba 169/188: Added more autoloads, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real d9ec07c0e3 182/188: Updated version, ELPA Syncer, 2024/05/05