From: Carsten Dominik <carsten.dominik@gmail.com>
To: David Maus <dmaus@ictsoc.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH 2/5] Immediately return if scope is region but no region is active
Date: Thu, 25 Aug 2011 07:43:48 +0200 [thread overview]
Message-ID: <E68F6573-6437-467A-ACB8-064A2B1AA515@gmail.com> (raw)
In-Reply-To: <1314246334-5053-3-git-send-email-dmaus@ictsoc.de>
On 25.8.2011, at 06:25, David Maus wrote:
> * org.el (org-map-entries): Immediately return if scope is region but
> no region is active.
> ---
> lisp/org.el | 116 ++++++++++++++++++++++++++++++-----------------------------
> 1 files changed, 59 insertions(+), 57 deletions(-)
>
> diff --git a/lisp/org.el b/lisp/org.el
> index b69b77c..27bad52 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -13608,65 +13608,67 @@ with `org-get-tags-at'. If your function gets properties with
> to t around the call to `org-entry-properties' to get the same speedup.
> Note that if your function moves around to retrieve tags and properties at
> a *different* entry, you cannot use these techniques."
> - (let* ((org-agenda-archives-mode nil) ; just to make sure
> - (org-agenda-skip-archived-trees (memq 'archive skip))
> - (org-agenda-skip-comment-trees (memq 'comment skip))
> - (org-agenda-skip-function
> - (car (org-delete-all '(comment archive) skip)))
> - (org-tags-match-list-sublevels t)
> - matcher file res
> - org-todo-keywords-for-agenda
> - org-done-keywords-for-agenda
> - org-todo-keyword-alist-for-agenda
> - org-drawers-for-agenda
> - org-tag-alist-for-agenda)
> + (unless (and (eq scope 'region)
> + (not (org-region-active-p)))
Would it be good to throw an error here?
(if (and (eq scope 'region) (not (org-region-active-p)))
(error "No active region")
...
> + (let* ((org-agenda-archives-mode nil) ; just to make sure
> + (org-agenda-skip-archived-trees (memq 'archive skip))
> + (org-agenda-skip-comment-trees (memq 'comment skip))
> + (org-agenda-skip-function
> + (car (org-delete-all '(comment archive) skip)))
> + (org-tags-match-list-sublevels t)
> + matcher file res
> + org-todo-keywords-for-agenda
> + org-done-keywords-for-agenda
> + org-todo-keyword-alist-for-agenda
> + org-drawers-for-agenda
> + org-tag-alist-for-agenda)
>
> - (cond
> - ((eq match t) (setq matcher t))
> - ((eq match nil) (setq matcher t))
> - (t (setq matcher (if match (cdr (org-make-tags-matcher match)) t))))
> + (cond
> + ((eq match t) (setq matcher t))
> + ((eq match nil) (setq matcher t))
> + (t (setq matcher (if match (cdr (org-make-tags-matcher match)) t))))
>
> - (save-excursion
> - (save-restriction
> - (cond ((eq scope 'tree)
> - (org-back-to-heading t)
> - (org-narrow-to-subtree)
> - (setq scope nil))
> - ((and (eq scope 'region) (org-region-active-p))
> - (let ((end (save-excursion
> - (goto-char (region-end))
> - (outline-next-heading)
> - (point))))
> - (narrow-to-region (region-beginning) end)
> - (setq scope nil))))
> -
> - (if (not scope)
> - (progn
> - (org-prepare-agenda-buffers
> - (list (buffer-file-name (current-buffer))))
> - (setq res (org-scan-tags func matcher)))
> - ;; Get the right scope
> - (cond
> - ((and scope (listp scope) (symbolp (car scope)))
> - (setq scope (eval scope)))
> - ((eq scope 'agenda)
> - (setq scope (org-agenda-files t)))
> - ((eq scope 'agenda-with-archives)
> - (setq scope (org-agenda-files t))
> - (setq scope (org-add-archive-files scope)))
> - ((eq scope 'file)
> - (setq scope (list (buffer-file-name))))
> - ((eq scope 'file-with-archives)
> - (setq scope (org-add-archive-files (list (buffer-file-name))))))
> - (org-prepare-agenda-buffers scope)
> - (while (setq file (pop scope))
> - (with-current-buffer (org-find-base-buffer-visiting file)
> - (save-excursion
> - (save-restriction
> - (widen)
> - (goto-char (point-min))
> - (setq res (append res (org-scan-tags func matcher))))))))))
> - res))
> + (save-excursion
> + (save-restriction
> + (cond ((eq scope 'tree)
> + (org-back-to-heading t)
> + (org-narrow-to-subtree)
> + (setq scope nil))
> + ((eq scope 'region)
> + (let ((end (save-excursion
> + (goto-char (region-end))
> + (outline-next-heading)
> + (point))))
> + (narrow-to-region (region-beginning) end)
> + (setq scope nil))))
> +
> + (if (not scope)
> + (progn
> + (org-prepare-agenda-buffers
> + (list (buffer-file-name (current-buffer))))
> + (setq res (org-scan-tags func matcher)))
> + ;; Get the right scope
> + (cond
> + ((and scope (listp scope) (symbolp (car scope)))
> + (setq scope (eval scope)))
> + ((eq scope 'agenda)
> + (setq scope (org-agenda-files t)))
> + ((eq scope 'agenda-with-archives)
> + (setq scope (org-agenda-files t))
> + (setq scope (org-add-archive-files scope)))
> + ((eq scope 'file)
> + (setq scope (list (buffer-file-name))))
> + ((eq scope 'file-with-archives)
> + (setq scope (org-add-archive-files (list (buffer-file-name))))))
> + (org-prepare-agenda-buffers scope)
> + (while (setq file (pop scope))
> + (with-current-buffer (org-find-base-buffer-visiting file)
> + (save-excursion
> + (save-restriction
> + (widen)
> + (goto-char (point-min))
> + (setq res (append res (org-scan-tags func matcher))))))))))
> + res)))
>
> ;;;; Properties
>
> --
> 1.7.2.5
>
>
next prev parent reply other threads:[~2011-08-25 6:58 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-18 8:32 New feature: loop over siblings for some commands Bastien
2011-07-19 18:27 ` David Maus
2011-07-20 19:46 ` David Maus
2011-07-27 15:28 ` Bastien
2011-07-27 18:47 ` David Maus
2011-07-28 8:54 ` Bastien
2011-08-10 8:34 ` David Maus
2011-08-12 7:58 ` David Maus
2011-08-16 16:36 ` Bastien
2011-08-25 4:25 ` [PATCH 0/5] loop over headlines in active region David Maus
2011-08-25 6:13 ` Carsten Dominik
2011-08-28 13:58 ` David Maus
2011-08-29 9:29 ` Carsten Dominik
2011-08-30 4:36 ` David Maus
2011-08-25 10:08 ` Štěpán Němec
2011-08-28 13:57 ` David Maus
2011-09-07 19:34 ` Štěpán Němec
2011-09-09 4:06 ` David Maus
2011-09-09 10:26 ` Štěpán Němec
2011-09-09 10:41 ` Bastien
2011-09-09 10:46 ` Štěpán Němec
2011-09-09 15:10 ` David Maus
2011-09-09 15:26 ` Štěpán Němec
2011-09-09 15:52 ` David Maus
2011-10-06 8:35 ` Carsten Dominik
2011-10-08 18:59 ` David Maus
2011-10-08 20:11 ` Carsten Dominik
2011-10-08 20:55 ` David Maus
2011-08-25 4:25 ` [PATCH 1/5] Extend scope 'region to include body of last headline " David Maus
2011-08-25 5:40 ` Carsten Dominik
2011-08-30 4:33 ` David Maus
2011-08-25 4:25 ` [PATCH 2/5] Immediately return if scope is region but no region is active David Maus
2011-08-25 5:43 ` Carsten Dominik [this message]
2011-08-28 14:00 ` David Maus
2011-08-29 9:31 ` Carsten Dominik
2011-08-30 4:40 ` David Maus
2011-08-25 4:25 ` [PATCH 3/5] New customization variable: Loop over headlines in active region David Maus
2011-08-25 4:25 ` [PATCH 4/5] Skip invisible headlines when mapping " David Maus
2011-08-25 4:25 ` [PATCH 5/5] Avoid conflict between bulk command and loop-over-headlines David Maus
2011-10-22 14:23 ` Bastien
2011-07-27 15:23 ` New feature: loop over siblings for some commands Bastien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E68F6573-6437-467A-ACB8-064A2B1AA515@gmail.com \
--to=carsten.dominik@gmail.com \
--cc=dmaus@ictsoc.de \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).