branch: externals/guess-language
commit 65dccb18df4d0c766d516c5f1423994bae445b51
Author: Titus von der Malsburg <[email protected]>
Commit: Titus von der Malsburg <[email protected]>

    Added workaround for bug in org mode.
    
    (org-in-list-p) gives non-nil outside of list, i.e. after the point
    returned by (org-end-of-item-list).
---
 guess-language.el | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/guess-language.el b/guess-language.el
index a4d15a0..cc8f877 100644
--- a/guess-language.el
+++ b/guess-language.el
@@ -169,11 +169,15 @@ most appropriate given the buffer mode."
   "Uses whatever method for moving to the previous paragraph is
 most appropriate given the buffer mode."
   (if (eq major-mode 'org-mode)
-      (if (org-in-item-p)
-          (while (org-in-item-p)
-            (org-end-of-item-list))
-        (org-forward-paragraph))
-    (forward-paragraph)))
+      (if (org-list-struct)
+          (let ((last-pos nil)
+                (new-pos (car (last (first (last (org-list-struct)))))))
+            (while (not (eq last-pos new-pos))
+              (setq last-pos new-pos)
+              (setq new-pos (car (last (first (last (org-list-struct)))))))
+            (goto-char new-pos))
+            (org-forward-paragraph))
+        (forward-paragraph)))
 
 (defun guess-language-region (beginning end)
   "Guess language in the specified region.

Reply via email to