Ver código fonte

org-element: Fix `org-element-at-point' shortcut

* lisp/org-element.el (org-element-at-point): Correctly move from
  blank line to blank line in order to find a known element above.
Nicolas Goaziou 11 anos atrás
pai
commit
398dbd91ed
1 arquivos alterados com 4 adições e 5 exclusões
  1. 4 5
      lisp/org-element.el

+ 4 - 5
lisp/org-element.el

@@ -5219,16 +5219,15 @@ first row."
 	   ;; position.  Give up after 10 tries or when we hit
 	   ;; a headline (or beginning of buffer).
 	   (beginning-of-line)
-	   (skip-chars-backward " \r\t\n")
 	   (dotimes (i 10)
+	     (skip-chars-backward " \r\t\n")
 	     (cond ((not (re-search-backward "^\\(?:\\*+ \\|[ \t]*$\\)" nil t))
 		    (throw 'loop (goto-char (point-min))))
 		   ((/= (char-after) ?*)
 		    (when (bobp) (throw 'loop nil))
-		    ;; An element cannot start at a headline, so check
-		    ;; first non-blank line below.
-		    (skip-chars-forward " \r\t\n" origin)
-		    (beginning-of-line))
+		    ;; An element cannot start at a blank line, so
+		    ;; check line below.
+		    (forward-line))
 		   ((org-with-limited-levels (org-at-heading-p))
 		    ;; Tough luck: we're back at a headline above.
 		    ;; Move to beginning of section.