mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 20:37:51 +00:00
org-at-heading-p: Accept optional argument
* lisp/org.el (org-at-heading-p): Use second argument to allow checking for visible headings. Note that by default, unlike `outline-on-heading-p', `org-at-heading-p' returns non-nil for invisible headings. Passing second argument is just like `(outline-on-heading-p)'. (org-indent-line): * lisp/org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file): * lisp/org-colview.el (org-columns--call): (org-columns-store-format): Update arguments in `org-at-heading-p' calls.
This commit is contained in:
parent
b7dae51dbb
commit
bc0caec6eb
|
@ -10524,7 +10524,7 @@ the resulting entry will not be shown. When TEXT is empty, switch to
|
|||
(anniversary
|
||||
(or (re-search-forward "^\\*[ \t]+Anniversaries" nil t)
|
||||
(progn
|
||||
(or (org-at-heading-p t)
|
||||
(or (org-at-heading-p)
|
||||
(progn
|
||||
(outline-next-heading)
|
||||
(insert "* Anniversaries\n\n")
|
||||
|
|
|
@ -699,7 +699,7 @@ FUN is a function called with no argument."
|
|||
(let ((hide-body (and (/= (line-end-position) (point-max))
|
||||
(save-excursion
|
||||
(move-beginning-of-line 2)
|
||||
(org-at-heading-p t)))))
|
||||
(org-at-heading-p)))))
|
||||
(unwind-protect (funcall fun)
|
||||
(when hide-body (outline-hide-entry)))))
|
||||
|
||||
|
@ -1026,7 +1026,7 @@ the current buffer."
|
|||
;; No COLUMNS keyword in the buffer. Insert one at the
|
||||
;; beginning, right before the first heading, if any.
|
||||
(goto-char (point-min))
|
||||
(unless (org-at-heading-p t) (outline-next-heading))
|
||||
(unless (org-at-heading-p) (outline-next-heading))
|
||||
(let ((inhibit-read-only t))
|
||||
(insert-before-markers "#+COLUMNS: " fmt "\n"))))
|
||||
(setq-local org-columns-default-format fmt))))))
|
||||
|
|
14
lisp/org.el
14
lisp/org.el
|
@ -17260,7 +17260,7 @@ number of stars to add."
|
|||
;; Case 1. Started at an heading: de-star headings.
|
||||
((org-at-heading-p)
|
||||
(while (< (point) end)
|
||||
(when (org-at-heading-p t)
|
||||
(when (org-at-heading-p)
|
||||
(looking-at org-outline-regexp) (replace-match "")
|
||||
(setq toggled t))
|
||||
(forward-line)))
|
||||
|
@ -17862,7 +17862,7 @@ and :keyword."
|
|||
(p (point)) clist o)
|
||||
;; First the large context
|
||||
(cond
|
||||
((org-at-heading-p t)
|
||||
((org-at-heading-p)
|
||||
(push (list :headline (point-at-bol) (point-at-eol)) clist)
|
||||
(when (progn
|
||||
(beginning-of-line 1)
|
||||
|
@ -19612,9 +19612,13 @@ Respect narrowing."
|
|||
(end-of-line)
|
||||
(null (re-search-backward org-outline-regexp-bol nil t))))))
|
||||
|
||||
(defun org-at-heading-p (&optional _)
|
||||
"Non-nil when on a headline."
|
||||
(outline-on-heading-p t))
|
||||
(defun org-at-heading-p (&optional invisible-not-ok)
|
||||
"Return t if point is on a (possibly invisible) heading line.
|
||||
If INVISIBLE-NOT-OK is non-nil, an invisible heading line is not ok."
|
||||
(save-excursion
|
||||
(beginning-of-line)
|
||||
(and (bolp) (or (not invisible-not-ok) (not (org-fold-folded-p)))
|
||||
(looking-at outline-regexp))))
|
||||
|
||||
(defun org-in-commented-heading-p (&optional no-inheritance element)
|
||||
"Non-nil if point is under a commented heading.
|
||||
|
|
Loading…
Reference in a new issue