Skip to content

Commit

Permalink
Use org-element API to access standard properties
Browse files Browse the repository at this point in the history
  • Loading branch information
awth13 committed Jun 6, 2024
1 parent 81eba5d commit 54b2803
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions org-appear.el
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ nil if the cursor was not on an element.")
"This function is executed by `post-command-hook' in `org-appear-mode'.

Check warning on line 189 in org-appear.el

View workflow job for this annotation

GitHub Actions / check (27.2, melpa)

Disambiguate org-appear-mode by preceding w/ function,command,variable,option or symbol.

Check warning on line 189 in org-appear.el

View workflow job for this annotation

GitHub Actions / check (27.1, melpa)

Disambiguate org-appear-mode by preceding w/ function,command,variable,option or symbol.
It handles toggling elements depending on whether the cursor entered or exited them."
(let* ((prev-elem org-appear--prev-elem)
(prev-elem-start (org-element-property :begin prev-elem))
(prev-elem-start (org-element-begin prev-elem))

Check warning on line 192 in org-appear.el

View workflow job for this annotation

GitHub Actions / check (snapshot, melpa)

the function ‘org-element-begin’ is not known to be defined.

Check warning on line 192 in org-appear.el

View workflow job for this annotation

GitHub Actions / check (snapshot, byte-compile)

the function ‘org-element-begin’ is not known to be defined.
(current-elem (org-appear--current-elem))
(current-elem-start (org-element-property :begin current-elem)))
(current-elem-start (org-element-begin current-elem)))

;; After leaving an element
(when (and prev-elem
Expand Down Expand Up @@ -267,8 +267,8 @@ It hides elements before commands that modify the buffer based on column width."
Return nil if element is not supported by `org-appear-mode'."

Check warning on line 267 in org-appear.el

View workflow job for this annotation

GitHub Actions / check (27.2, melpa)

Disambiguate org-appear-mode by preceding w/ function,command,variable,option or symbol.

Check warning on line 267 in org-appear.el

View workflow job for this annotation

GitHub Actions / check (27.1, melpa)

Disambiguate org-appear-mode by preceding w/ function,command,variable,option or symbol.
(when-let ((elem (org-element-context)))
(let* ((elem-type (car elem))
(elem-end (- (org-element-property :end elem)
(1- (org-element-property :post-blank elem))))
(elem-end (- (org-element-end elem)

Check warning on line 270 in org-appear.el

View workflow job for this annotation

GitHub Actions / check (snapshot, melpa)

the function ‘org-element-end’ is not known to be defined.

Check warning on line 270 in org-appear.el

View workflow job for this annotation

GitHub Actions / check (snapshot, byte-compile)

the function ‘org-element-end’ is not known to be defined.
(1- (org-element-post-blank elem))))

Check warning on line 271 in org-appear.el

View workflow job for this annotation

GitHub Actions / check (snapshot, melpa)

the function ‘org-element-post-blank’ is not known to be defined.

Check warning on line 271 in org-appear.el

View workflow job for this annotation

GitHub Actions / check (snapshot, byte-compile)

the function ‘org-element-post-blank’ is not known to be defined.
(link-ignore-p (and (eq elem-type 'link)
(or (string-match-p "[Cc]ite"
(org-element-property :type elem))
Expand Down Expand Up @@ -313,13 +313,13 @@ Return nil if element cannot be parsed."
((memq elem-type '(latex-fragment latex-environment))
'latex-fragment)
(t nil)))
(elem-start (org-element-property :begin elem))
(elem-end (org-element-property :end elem))
(elem-content-start (org-element-property :contents-begin elem))
(elem-content-end (org-element-property :contents-end elem))
(elem-start (org-element-begin elem))
(elem-end (org-element-end elem))
(elem-content-start (org-element-contents-begin elem))

Check warning on line 318 in org-appear.el

View workflow job for this annotation

GitHub Actions / check (snapshot, melpa)

the function ‘org-element-contents-begin’ is not known to be defined.

Check warning on line 318 in org-appear.el

View workflow job for this annotation

GitHub Actions / check (snapshot, byte-compile)

the function ‘org-element-contents-begin’ is not known to be defined.
(elem-content-end (org-element-contents-end elem))

Check warning on line 319 in org-appear.el

View workflow job for this annotation

GitHub Actions / check (snapshot, melpa)

the function ‘org-element-contents-end’ is not known to be defined.

Check warning on line 319 in org-appear.el

View workflow job for this annotation

GitHub Actions / check (snapshot, byte-compile)

the function ‘org-element-contents-end’ is not known to be defined.
;; Some elements have extra spaces at the end
;; The number of spaces is stored in the post-blank property
(post-elem-spaces (org-element-property :post-blank elem))
(post-elem-spaces (org-element-post-blank elem))
(elem-end-real (- elem-end post-elem-spaces)))
;; Only sub/superscript elements are guaranteed to have
;; contents-begin and contents-end properties
Expand Down Expand Up @@ -378,8 +378,8 @@ When RENEW is non-nil, obtain element at point instead."
(setq org-appear--prev-elem elem)
(setq org-appear--timer nil))

(when-let ((elem-start (org-element-property :begin elem))
(elem-end (org-element-property :end elem)))
(when-let ((elem-start (org-element-begin elem))
(elem-end (org-element-end elem)))
;; Call `font-lock-ensure' before unhiding to prevent `jit-lock-mode'
;; from refontifying the element region after changes in buffer
(font-lock-ensure elem-start elem-end)
Expand Down

0 comments on commit 54b2803

Please sign in to comment.