Skip to content

Commit

Permalink
Added workaround for bug in org mode.
Browse files Browse the repository at this point in the history
(org-in-list-p) gives non-nil outside of list, i.e. after the point
returned by (org-end-of-item-list).
  • Loading branch information
tmalsburg committed May 21, 2017
1 parent 2bc0e1f commit 65dccb1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions guess-language.el
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 65dccb1

Please sign in to comment.