org.el (org-end-of-meta-data): Allow to skip only standard drawers
* lisp/org.el (org-end-of-meta-data): Allow to skip only standard
drawers, i.e. properties and logbook drawers.
* lisp/org-crypt.el (org-at-encrypted-entry-p)
(org-encrypt-entry): Use `org-end-of-meta-data' so that standard
drawers are all skipped, including logbook drawers.
Reported-by: Nicolas Goaziou <mail@nicolasgoaziou.fr>
See https://orgmode.org/list/87d02qgj6u.fsf@nicolasgoaziou.fr
and https://debbugs.gnu.org/cgi/bugreport.cgi?bug=43094 for the reason
of the previous fix c93983613d
.
This commit is contained in:
parent
8efec3d4cd
commit
755367f362
|
@ -145,7 +145,7 @@ and END are buffer positions delimiting the encrypted area."
|
||||||
(org-with-wide-buffer
|
(org-with-wide-buffer
|
||||||
(unless (org-before-first-heading-p)
|
(unless (org-before-first-heading-p)
|
||||||
(org-back-to-heading t)
|
(org-back-to-heading t)
|
||||||
(org-end-of-meta-data t)
|
(org-end-of-meta-data 'standard)
|
||||||
(let ((case-fold-search nil)
|
(let ((case-fold-search nil)
|
||||||
(banner-start (rx (seq bol
|
(banner-start (rx (seq bol
|
||||||
(zero-or-more (any "\t "))
|
(zero-or-more (any "\t "))
|
||||||
|
@ -215,7 +215,7 @@ Assume `epg-context' is set."
|
||||||
(let ((start-heading (point))
|
(let ((start-heading (point))
|
||||||
(crypt-key (org-crypt-key-for-heading))
|
(crypt-key (org-crypt-key-for-heading))
|
||||||
(folded? (org-invisible-p (line-beginning-position))))
|
(folded? (org-invisible-p (line-beginning-position))))
|
||||||
(org-end-of-meta-data t)
|
(org-end-of-meta-data 'standard)
|
||||||
(let ((beg (point))
|
(let ((beg (point))
|
||||||
(folded-heading
|
(folded-heading
|
||||||
(and folded?
|
(and folded?
|
||||||
|
|
32
lisp/org.el
32
lisp/org.el
|
@ -20495,26 +20495,40 @@ If there is no such heading, return nil."
|
||||||
|
|
||||||
(defun org-end-of-meta-data (&optional full)
|
(defun org-end-of-meta-data (&optional full)
|
||||||
"Skip planning line and properties drawer in current entry.
|
"Skip planning line and properties drawer in current entry.
|
||||||
When optional argument FULL is non-nil, also skip empty lines,
|
|
||||||
clocking lines and regular drawers at the beginning of the
|
When optional argument FULL is t, also skip planning information,
|
||||||
entry."
|
clocking lines and any kind of drawer.
|
||||||
|
|
||||||
|
When FULL is non-nil but not t, skip planning information,
|
||||||
|
clocking lines and only non-regular drawers, i.e. properties and
|
||||||
|
logbook drawers."
|
||||||
(org-back-to-heading t)
|
(org-back-to-heading t)
|
||||||
(forward-line)
|
(forward-line)
|
||||||
|
;; Skip planning information.
|
||||||
(when (looking-at-p org-planning-line-re) (forward-line))
|
(when (looking-at-p org-planning-line-re) (forward-line))
|
||||||
|
;; Skip property drawer.
|
||||||
(when (looking-at org-property-drawer-re)
|
(when (looking-at org-property-drawer-re)
|
||||||
(goto-char (match-end 0))
|
(goto-char (match-end 0))
|
||||||
(forward-line))
|
(forward-line))
|
||||||
|
;; When FULL is not nil, skip more.
|
||||||
(when (and full (not (org-at-heading-p)))
|
(when (and full (not (org-at-heading-p)))
|
||||||
(catch 'exit
|
(catch 'exit
|
||||||
(let ((end (save-excursion (outline-next-heading) (point)))
|
(let ((end (save-excursion (outline-next-heading) (point)))
|
||||||
(re (concat "[ \t]*$" "\\|" org-clock-line-re)))
|
(re (concat "[ \t]*$" "\\|" org-clock-line-re)))
|
||||||
(while (not (eobp))
|
(while (not (eobp))
|
||||||
(cond ((looking-at-p org-drawer-regexp)
|
(cond ;; Skip clock lines.
|
||||||
(if (re-search-forward "^[ \t]*:END:[ \t]*$" end t)
|
((looking-at-p re) (forward-line))
|
||||||
(forward-line)
|
;; Skip logbook drawer.
|
||||||
(throw 'exit t)))
|
((looking-at-p org-logbook-drawer-re)
|
||||||
((looking-at-p re) (forward-line))
|
(if (re-search-forward "^[ \t]*:END:[ \t]*$" end t)
|
||||||
(t (throw 'exit t))))))))
|
(forward-line)
|
||||||
|
(throw 'exit t)))
|
||||||
|
;; When FULL is t, skip regular drawer too.
|
||||||
|
((and (eq full t) (looking-at-p org-drawer-regexp))
|
||||||
|
(if (re-search-forward "^[ \t]*:END:[ \t]*$" end t)
|
||||||
|
(forward-line)
|
||||||
|
(throw 'exit t)))
|
||||||
|
(t (throw 'exit t))))))))
|
||||||
|
|
||||||
(defun org--line-fully-invisible-p ()
|
(defun org--line-fully-invisible-p ()
|
||||||
"Return non-nil if the current line is fully invisible."
|
"Return non-nil if the current line is fully invisible."
|
||||||
|
|
Loading…
Reference in New Issue