mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2025-01-31 20:48:37 +00:00
org-element: Prepare signature change
* lisp/ob-exp.el: Declare signature change. * lisp/org-macro.el: Declare signature change. * lisp/org.el (org-backward-element, org-drag-element-backward): Avoid using optional argument from `org-element-at-point'. * testing/lisp/test-org-element.el: Update test.
This commit is contained in:
parent
0ae48c544b
commit
2b22886005
@ -43,7 +43,7 @@
|
||||
(declare-function org-link-search "org" (s &optional type avoid-pos stealth))
|
||||
(declare-function org-fill-template "org" (template alist))
|
||||
(declare-function org-split-string "org" (string &optional separators))
|
||||
(declare-function org-element-at-point "org-element" (&optional keep-trail))
|
||||
(declare-function org-element-at-point "org-element" ())
|
||||
(declare-function org-element-context "org-element" ())
|
||||
(declare-function org-element-property "org-element" (property element))
|
||||
(declare-function org-element-type "org-element" (element))
|
||||
|
@ -41,7 +41,7 @@
|
||||
;;; Code:
|
||||
(require 'org-macs)
|
||||
|
||||
(declare-function org-element-at-point "org-element" (&optional keep-trail))
|
||||
(declare-function org-element-at-point "org-element" ())
|
||||
(declare-function org-element-context "org-element" (&optional element))
|
||||
(declare-function org-element-property "org-element" (property element))
|
||||
(declare-function org-element-type "org-element" (element))
|
||||
|
33
lisp/org.el
33
lisp/org.el
@ -148,7 +148,7 @@ Stars are put in group 1 and the trimmed body in group 2.")
|
||||
|
||||
(declare-function org-element--parse-objects "org-element"
|
||||
(beg end acc restriction))
|
||||
(declare-function org-element-at-point "org-element" (&optional keep-trail))
|
||||
(declare-function org-element-at-point "org-element" ())
|
||||
(declare-function org-element-cache-reset "org-element" (&optional all))
|
||||
(declare-function org-element-contents "org-element" (element))
|
||||
(declare-function org-element-context "org-element" (&optional element))
|
||||
@ -23607,18 +23607,21 @@ Move to the previous element at the same level, when possible."
|
||||
(progn (goto-char origin)
|
||||
(user-error "Cannot move further up"))))))
|
||||
(t
|
||||
(let* ((trail (org-element-at-point 'keep-trail))
|
||||
(elem (car trail))
|
||||
(prev-elem (nth 1 trail))
|
||||
(let* ((elem (org-element-at-point))
|
||||
(beg (org-element-property :begin elem)))
|
||||
(cond
|
||||
;; Move to beginning of current element if point isn't
|
||||
;; there already.
|
||||
((null beg) (message "No element at point"))
|
||||
((/= (point) beg) (goto-char beg))
|
||||
(prev-elem (goto-char (org-element-property :begin prev-elem)))
|
||||
((org-before-first-heading-p) (goto-char (point-min)))
|
||||
(t (org-back-to-heading)))))))
|
||||
(t (goto-char beg)
|
||||
(skip-chars-backward " \r\t\n")
|
||||
(unless (bobp)
|
||||
(let ((prev (org-element-at-point)))
|
||||
(goto-char (org-element-property :begin prev))
|
||||
(while (and (setq prev (org-element-property :parent prev))
|
||||
(<= (org-element-property :end prev) beg))
|
||||
(goto-char (org-element-property :begin prev)))))))))))
|
||||
|
||||
(defun org-up-element ()
|
||||
"Move to upper element."
|
||||
@ -23652,9 +23655,19 @@ Move to the previous element at the same level, when possible."
|
||||
"Move backward element at point."
|
||||
(interactive)
|
||||
(if (org-with-limited-levels (org-at-heading-p)) (org-move-subtree-up)
|
||||
(let* ((trail (org-element-at-point 'keep-trail))
|
||||
(elem (car trail))
|
||||
(prev-elem (nth 1 trail)))
|
||||
(let* ((elem (org-element-at-point))
|
||||
(prev-elem
|
||||
(save-excursion
|
||||
(goto-char (org-element-property :begin elem))
|
||||
(skip-chars-backward " \r\t\n")
|
||||
(unless (bobp)
|
||||
(let* ((beg (org-element-property :begin elem))
|
||||
(prev (org-element-at-point))
|
||||
(up prev))
|
||||
(while (and (setq up (org-element-property :parent up))
|
||||
(<= (org-element-property :end prev) beg))
|
||||
(setq prev up))
|
||||
prev)))))
|
||||
;; Error out if no previous element or previous element is
|
||||
;; a parent of the current one.
|
||||
(if (or (not prev-elem) (org-element-nested-p elem prev-elem))
|
||||
|
@ -2875,12 +2875,6 @@ Paragraph \\alpha."
|
||||
(org-test-with-temp-text "- a"
|
||||
(end-of-line)
|
||||
(org-element-type (org-element-at-point)))))
|
||||
;; With an optional argument, return trail.
|
||||
(should
|
||||
(equal '(paragraph center-block)
|
||||
(org-test-with-temp-text "#+BEGIN_CENTER\nA\n#+END_CENTER\nZ"
|
||||
(progn (search-forward "Z")
|
||||
(mapcar 'org-element-type (org-element-at-point t))))))
|
||||
;; Parse a list within a block itself contained in a list.
|
||||
(should
|
||||
(eq 'plain-list
|
||||
|
Loading…
Reference in New Issue
Block a user