emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/greader 077c8261e3 04/23: Functions `greader-get-senten


From: ELPA Syncer
Subject: [elpa] externals/greader 077c8261e3 04/23: Functions `greader-get-sentence' and `greader-forward-sentence'
Date: Wed, 26 Oct 2022 05:57:47 -0400 (EDT)

branch: externals/greader
commit 077c8261e395f8c95bbbe3454179874cde3e128c
Author: Michelangelo Rodriguez <michelangelo.rodriguez@gmail.com>
Commit: Michelangelo Rodriguez <michelangelo.rodriguez@gmail.com>

    Functions `greader-get-sentence' and `greader-forward-sentence'
    rewritten and semplified.
---
 greader.el | 37 ++++++++++---------------------------
 1 file changed, 10 insertions(+), 27 deletions(-)

diff --git a/greader.el b/greader.el
index 4e81ad971e..1228b95841 100644
--- a/greader.el
+++ b/greader.el
@@ -523,34 +523,17 @@ which search for."
     (funcall point-limit)))
 
 (defun greader-forward-sentence ()
-  "Bring point at start of next sentence to read."
-  (goto-char (greader-next-sentence)))
+  (forward-sentence))
 
-(defun greader-get-sentence (&optional direction)
-  "Get next sentence to read.
-Optional argument DIRECTION is actually not used."
-  (if (not direction)
-      (setq direction 1))
-  (if (< direction 0)
-      (progn
-       (setq direction '-)
-       (setq point-limit 'point-min)
-       (setq greader-differs '>))
-    (progn
-      (setq direction '+)
-      (setq point-limit 'point-max)
-      (setq greader-differs '<)))
-
-  (let (sentence)
-    (catch 'afterloop
-      (save-excursion
-       (while (funcall greader-differs (point) (funcall point-limit))
-         (setq sentence (concat sentence (string (following-char))))
-         (cond
-          ((greader-end-sentence-p)
-           (throw 'afterloop sentence)))
-         (goto-char (funcall direction (point) 1)))
-       sentence))))
+(defun greader-get-sentence ()
+  (let ((sentence-start (make-marker)))
+    (setq sentence-start (point))
+    (save-excursion
+      (when (not (eobp))
+       (forward-sentence))
+      (if (> (point) sentence-start)
+         (buffer-substring-no-properties sentence-start (point))
+       nil))))
 
 (defun greader-sentence-at-point ()
   "Get sentence starting from point."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]