From 697bf63ffe7ee4cbbec6aaeba60d5766d3faf1e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20A=2E=20Gomes?= Date: Sat, 9 Oct 2021 16:26:12 +0300 Subject: [PATCH 53/76] Deprecate org-loop-over-headlines-in-active-region. --- lisp/org-agenda.el | 6 +++--- lisp/org-archive.el | 32 ++++++++++++++++---------------- lisp/org-compat.el | 2 ++ lisp/org-list.el | 6 +++--- lisp/org-refile.el | 2 +- lisp/org.el | 24 ++++++++++++------------ testing/lisp/test-org.el | 22 +++++++++++----------- 7 files changed, 48 insertions(+), 46 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index f935dbc01..94abd3f6b 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -9441,7 +9441,7 @@ the same tree node, and the heading of the tree node in the Org file." (hdmarker (org-get-at-bol 'org-hd-marker)) (todayp (org-agenda-today-p (org-get-at-bol 'day))) (inhibit-read-only t) - org-loop-over-headlines-in-active-region + org-loop-over-headings-in-active-region org-agenda-heading-snapshot-before-repeat newhead just-one) (org-with-remote-undo buffer (with-current-buffer buffer @@ -10460,7 +10460,7 @@ The list of commands is: `org-agenda-schedule', `org-agenda-deadline', `org-agenda-date-prompt', `org-agenda-todo', `org-agenda-archive*', `org-agenda-kill'. -See `org-loop-over-headlines-in-active-region' for the equivalent +See `org-loop-over-headings-in-active-region' for the equivalent option for Org buffers." :type '(choice (const :tag "Don't loop" nil) (const :tag "All headings in active region" t) @@ -10650,7 +10650,7 @@ The prefix arg is passed through to the command if possible." (progn (message "Skipping removed entry at %s" e) (cl-incf skipped)) (goto-char pos) - (let (org-loop-over-headlines-in-active-region) (funcall cmd)) + (let (org-loop-over-headings-in-active-region) (funcall cmd)) ;; `post-command-hook' is not run yet. We make sure any ;; pending log note is processed. (when org-log-setup (org-add-log-note)) diff --git a/lisp/org-archive.el b/lisp/org-archive.el index 24d4aad1b..b0d9930b8 100644 --- a/lisp/org-archive.el +++ b/lisp/org-archive.el @@ -211,14 +211,14 @@ cursor is not at a heading when these commands are called, try all level 1 trees. If the cursor is on a heading, only try the direct children of this heading." (interactive "P") - (if (and (org-region-active-p) org-loop-over-headlines-in-active-region) - (let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level) + (if (and (org-region-active-p) org-loop-over-headings-in-active-region) + (let ((cl (if (eq org-loop-over-headings-in-active-region 'start-level) 'region-start-level 'region)) - org-loop-over-headlines-in-active-region) + org-loop-over-headings-in-active-region) (org-map-entries `(progn (setq org-map-continue-from (progn (org-back-to-heading) (point))) (org-archive-subtree ,find-done)) - org-loop-over-headlines-in-active-region + org-loop-over-headings-in-active-region cl (if (org-invisible-p) (org-end-of-subtree nil t)))) (cond ((equal find-done '(4)) (org-archive-all-done)) @@ -426,10 +426,10 @@ sibling does not exist, it will be created at the end of the subtree. Archiving time is retained in the ARCHIVE_TIME node property." (interactive) - (if (and (org-region-active-p) org-loop-over-headlines-in-active-region) - (let ((cl (when (eq org-loop-over-headlines-in-active-region 'start-level) + (if (and (org-region-active-p) org-loop-over-headings-in-active-region) + (let ((cl (when (eq org-loop-over-headings-in-active-region 'start-level) 'region-start-level 'region)) - org-loop-over-headlines-in-active-region) + org-loop-over-headings-in-active-region) (org-map-entries '(progn (setq org-map-continue-from (progn (org-back-to-heading) @@ -438,7 +438,7 @@ Archiving time is retained in the ARCHIVE_TIME node property." (point)))) (when (org-at-heading-p) (org-archive-to-archive-sibling))) - org-loop-over-headlines-in-active-region + org-loop-over-headings-in-active-region cl (if (org-invisible-p) (org-end-of-subtree nil t)))) (save-restriction (widen) @@ -583,13 +583,13 @@ don't move trees, but mark them with the ARCHIVE tag." With prefix ARG, check all children of current heading and offer tagging the children that do not contain any open TODO items." (interactive "P") - (if (and (org-region-active-p) org-loop-over-headlines-in-active-region) - (let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level) + (if (and (org-region-active-p) org-loop-over-headings-in-active-region) + (let ((cl (if (eq org-loop-over-headings-in-active-region 'start-level) 'region-start-level 'region)) - org-loop-over-headlines-in-active-region) + org-loop-over-headings-in-active-region) (org-map-entries `(org-toggle-archive-tag ,find-done) - org-loop-over-headlines-in-active-region + org-loop-over-headings-in-active-region cl (if (org-invisible-p) (org-end-of-subtree nil t)))) (if find-done (org-archive-all-done 'tag) @@ -604,13 +604,13 @@ the children that do not contain any open TODO items." (defun org-archive-set-tag () "Set the ARCHIVE tag." (interactive) - (if (and (org-region-active-p) org-loop-over-headlines-in-active-region) - (let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level) + (if (and (org-region-active-p) org-loop-over-headings-in-active-region) + (let ((cl (if (eq org-loop-over-headings-in-active-region 'start-level) 'region-start-level 'region)) - org-loop-over-headlines-in-active-region) + org-loop-over-headings-in-active-region) (org-map-entries 'org-archive-set-tag - org-loop-over-headlines-in-active-region + org-loop-over-headings-in-active-region cl (if (org-invisible-p) (org-end-of-subtree nil t)))) (org-toggle-tag org-archive-tag 'on))) diff --git a/lisp/org-compat.el b/lisp/org-compat.el index e7e057a56..b55ae79da 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -404,6 +404,8 @@ Counting starts at 1." 'org-latex-heading "9.5") (define-obsolete-variable-alias 'org-link-search-must-match-exact-headline 'org-link-search-must-match-exact-heading "9.5") +(define-obsolete-variable-alias 'org-loop-over-headlines-in-active-region + 'org-loop-over-headings-in-active-region "9.5") (define-obsolete-face-alias 'org-headline-done 'org-heading-done "9.5") (define-obsolete-face-alias 'org-headline-todo 'org-heading-todo "9.5") diff --git a/lisp/org-list.el b/lisp/org-list.el index b8a62e355..90900f5ca 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -91,7 +91,7 @@ (defvar org-drawer-regexp) (defvar org-element-all-objects) (defvar org-inhibit-startup) -(defvar org-loop-over-headlines-in-active-region) +(defvar org-loop-over-headings-in-active-region) (defvar org-odd-levels-only) (defvar org-outline-regexp-bol) (defvar org-scheduled-string) @@ -3052,7 +3052,7 @@ With a prefix argument ARG, change the region in a single item." ;; Case 2. Start at an heading: convert to items. ((org-at-heading-p) ;; Remove metadata - (let (org-loop-over-headlines-in-active-region) + (let (org-loop-over-headings-in-active-region) (org-list--delete-metadata)) (let* ((bul (org-list-bullet-string "-")) (bul-len (length bul)) @@ -3075,7 +3075,7 @@ With a prefix argument ARG, change the region in a single item." ;; subtrees. (when (< level ref-level) (setq ref-level level)) ;; Remove metadata - (let (org-loop-over-headlines-in-active-region) + (let (org-loop-over-headings-in-active-region) (org-list--delete-metadata)) ;; Remove stars and TODO keyword. (let ((case-fold-search nil)) (looking-at org-todo-line-regexp)) diff --git a/lisp/org-refile.el b/lisp/org-refile.el index 69d459b98..9e56f72bc 100644 --- a/lisp/org-refile.el +++ b/lisp/org-refile.el @@ -561,7 +561,7 @@ prefix argument (`C-u C-u C-u C-c C-w')." (t (org-add-log-setup 'refile nil nil org-log-refile))) (and org-auto-align-tags - (let ((org-loop-over-headlines-in-active-region nil)) + (let ((org-loop-over-headings-in-active-region nil)) (org-align-tags))) (let ((bookmark-name (plist-get org-bookmark-names-plist :last-refile))) diff --git a/lisp/org.el b/lisp/org.el index e06fe6937..4e46d8104 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -909,7 +909,7 @@ will still edit the time stamp - this is just too good to give up." (const :tag "When outside special context" t) (const :tag "Everywhere except timestamps" always))) -(defcustom org-loop-over-headlines-in-active-region t +(defcustom org-loop-over-headings-in-active-region t "Shall some commands act upon headings in the active region? When set to t, some commands will be performed in all headings @@ -9735,10 +9735,10 @@ When called through ELisp, arg is also interpreted in the following way: \"WAITING\" -> switch to the specified keyword, but only if it really is a member of `org-todo-keywords'." (interactive "P") - (if (and (org-region-active-p) org-loop-over-headlines-in-active-region) - (let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level) + (if (and (org-region-active-p) org-loop-over-headings-in-active-region) + (let ((cl (if (eq org-loop-over-headings-in-active-region 'start-level) 'region-start-level 'region)) - org-loop-over-headlines-in-active-region) + org-loop-over-headings-in-active-region) (org-map-entries (lambda () (org-todo arg)) nil cl @@ -10686,11 +10686,11 @@ With two universal prefix arguments, prompt for a warning delay. With argument TIME, set the deadline at the corresponding date. TIME can either be an Org date like \"2011-07-24\" or a delta like \"+2d\"." (interactive "P") - (if (and (org-region-active-p) org-loop-over-headlines-in-active-region) + (if (and (org-region-active-p) org-loop-over-headings-in-active-region) (org-map-entries (lambda () (org--deadline-or-schedule arg 'deadline time)) nil - (if (eq org-loop-over-headlines-in-active-region 'start-level) + (if (eq org-loop-over-headings-in-active-region 'start-level) 'region-start-level 'region) (lambda () (when (org-invisible-p) (org-end-of-subtree nil t)))) @@ -10707,11 +10707,11 @@ With two universal prefix arguments, prompt for a delay cookie. With argument TIME, scheduled at the corresponding date. TIME can either be an Org date like \"2011-07-24\" or a delta like \"+2d\"." (interactive "P") - (if (and (org-region-active-p) org-loop-over-headlines-in-active-region) + (if (and (org-region-active-p) org-loop-over-headings-in-active-region) (org-map-entries (lambda () (org--deadline-or-schedule arg 'scheduled time)) nil - (if (eq org-loop-over-headlines-in-active-region 'start-level) + (if (eq org-loop-over-headings-in-active-region 'start-level) 'region-start-level 'region) (lambda () (when (org-invisible-p) (org-end-of-subtree nil t)))) @@ -12023,7 +12023,7 @@ unconditionally do not offer the fast tag selection interface. If a region is active, set tags in the region according to the -setting of `org-loop-over-headlines-in-active-region'. +setting of `org-loop-over-headings-in-active-region'. This function is for interactive use only; in Lisp code use `org-set-tags' instead." @@ -12032,12 +12032,12 @@ in Lisp code use `org-set-tags' instead." (unless (equal '(16) arg) org-use-fast-tag-selection))) (cond ((equal '(4) arg) (org-align-tags t)) - ((and (org-region-active-p) org-loop-over-headlines-in-active-region) - (let (org-loop-over-headlines-in-active-region) ; hint: infinite recursion. + ((and (org-region-active-p) org-loop-over-headings-in-active-region) + (let (org-loop-over-headings-in-active-region) ; hint: infinite recursion. (org-map-entries #'org-set-tags-command nil - (if (eq org-loop-over-headlines-in-active-region 'start-level) + (if (eq org-loop-over-headings-in-active-region 'start-level) 'region-start-level 'region) (lambda () (when (org-invisible-p) (org-end-of-subtree nil t)))))) diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 04d92314d..5b07a04a4 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -3494,7 +3494,7 @@ SCHEDULED: <2017-05-06 Sat> (should (equal "* TODO a1\n** TODO a2\n* b1\n" (org-test-with-temp-text "* a1\n** a2\n* DONE b1\n" - (let ((org-loop-over-headlines-in-active-region t)) + (let ((org-loop-over-headings-in-active-region t)) (transient-mark-mode 1) (push-mark (point) t t) (search-forward "* DONE b1") @@ -3503,7 +3503,7 @@ SCHEDULED: <2017-05-06 Sat> (should (equal "* TODO a1\n** a2\n* b1\n" (org-test-with-temp-text "* a1\n** a2\n* DONE b1\n" - (let ((org-loop-over-headlines-in-active-region 'start-level)) + (let ((org-loop-over-headings-in-active-region 'start-level)) (transient-mark-mode 1) (push-mark (point) t t) (search-forward "* DONE b1") @@ -5367,14 +5367,14 @@ Paragraph" (org-deadline '(16))) (buffer-string)))) ;; When a region is active and - ;; `org-loop-over-headlines-in-active-region' is non-nil, insert the + ;; `org-loop-over-headings-in-active-region' is non-nil, insert the ;; same value in all headings in region. (should (equal "* H1\nDEADLINE: <2012-03-29>\n* H2\nDEADLINE: <2012-03-29>" (org-test-with-temp-text "* H1\n* H2" (let ((org-adapt-indentation nil) (org-last-inserted-timestamp nil) - (org-loop-over-headlines-in-active-region t)) + (org-loop-over-headings-in-active-region t)) (transient-mark-mode 1) (push-mark (point) t t) (goto-char (point-max)) @@ -5386,7 +5386,7 @@ Paragraph" (org-test-with-temp-text "* H1\n* H2" (let ((org-adapt-indentation nil) (org-last-inserted-timestamp nil) - (org-loop-over-headlines-in-active-region nil)) + (org-loop-over-headings-in-active-region nil)) (transient-mark-mode 1) (push-mark (point) t t) (goto-char (point-max)) @@ -5481,14 +5481,14 @@ Paragraph" (org-schedule '(16))) (buffer-string)))) ;; When a region is active and - ;; `org-loop-over-headlines-in-active-region' is non-nil, insert the + ;; `org-loop-over-headings-in-active-region' is non-nil, insert the ;; same value in all headings in region. (should (equal "* H1\nSCHEDULED: <2012-03-29>\n* H2\nSCHEDULED: <2012-03-29>" (org-test-with-temp-text "* H1\n* H2" (let ((org-adapt-indentation nil) (org-last-inserted-timestamp nil) - (org-loop-over-headlines-in-active-region t)) + (org-loop-over-headings-in-active-region t)) (transient-mark-mode 1) (push-mark (point) t t) (goto-char (point-max)) @@ -5500,7 +5500,7 @@ Paragraph" (org-test-with-temp-text "* H1\n* H2" (let ((org-adapt-indentation nil) (org-last-inserted-timestamp nil) - (org-loop-over-headlines-in-active-region nil)) + (org-loop-over-headings-in-active-region nil)) (transient-mark-mode 1) (push-mark (point) t t) (goto-char (point-max)) @@ -7010,7 +7010,7 @@ Paragraph" (org-set-tags-command))) (org-at-heading-p)))) ;; When a region is active and - ;; `org-loop-over-headlines-in-active-region' is non-nil, insert the + ;; `org-loop-over-headings-in-active-region' is non-nil, insert the ;; same value in all headings in region. (should (equal "* H1 :foo:\nContents\n* H2 :foo:" @@ -7018,7 +7018,7 @@ Paragraph" (cl-letf (((symbol-function 'completing-read-multiple) (lambda (&rest args) '("foo")))) (let ((org-use-fast-tag-selection nil) - (org-loop-over-headlines-in-active-region t) + (org-loop-over-headings-in-active-region t) (org-tags-column 1)) (transient-mark-mode 1) (push-mark (point) t t) @@ -7031,7 +7031,7 @@ Paragraph" (cl-letf (((symbol-function 'completing-read-multiple) (lambda (&rest args) '("foo")))) (let ((org-use-fast-tag-selection nil) - (org-loop-over-headlines-in-active-region nil) + (org-loop-over-headings-in-active-region nil) (org-tags-column 1)) (transient-mark-mode 1) (push-mark (point) t t) -- 2.33.0