mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-07-15 19:16:28 +00:00
org-agenda.el: Fix a bug about narrowing to wrong region boundaries
* org-agenda.el (org-agenda, org-search-view, org-tags-view) (org-agenda-get-day-entries, org-agenda-set-restriction-lock): Use (current-buffer) as the value of `org-agenda-restrict'. Fix a bug about narrowing to wrong region boundaries when `org-agenda-restrict' is non-nil. Thanks to Thomas Holst for reporting this bug.
This commit is contained in:
parent
c18468798f
commit
a9f590e7b1
|
@ -2737,12 +2737,12 @@ Pressing `<' twice means to restrict to the current subtree or region
|
||||||
(put 'org-agenda-files 'org-restrict (list bfn))
|
(put 'org-agenda-files 'org-restrict (list bfn))
|
||||||
(cond
|
(cond
|
||||||
((eq restriction 'region)
|
((eq restriction 'region)
|
||||||
(setq org-agenda-restrict t)
|
(setq org-agenda-restrict (current-buffer))
|
||||||
(move-marker org-agenda-restrict-begin (region-beginning))
|
(move-marker org-agenda-restrict-begin (region-beginning))
|
||||||
(move-marker org-agenda-restrict-end (region-end)))
|
(move-marker org-agenda-restrict-end (region-end)))
|
||||||
((eq restriction 'subtree)
|
((eq restriction 'subtree)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(setq org-agenda-restrict t)
|
(setq org-agenda-restrict (current-buffer))
|
||||||
(org-back-to-heading t)
|
(org-back-to-heading t)
|
||||||
(move-marker org-agenda-restrict-begin (point))
|
(move-marker org-agenda-restrict-begin (point))
|
||||||
(move-marker org-agenda-restrict-end
|
(move-marker org-agenda-restrict-end
|
||||||
|
@ -4557,7 +4557,7 @@ in `org-agenda-text-search-extra-files'."
|
||||||
(let ((case-fold-search t))
|
(let ((case-fold-search t))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(save-restriction
|
(save-restriction
|
||||||
(if org-agenda-restrict
|
(if (eq buffer org-agenda-restrict)
|
||||||
(narrow-to-region org-agenda-restrict-begin
|
(narrow-to-region org-agenda-restrict-begin
|
||||||
org-agenda-restrict-end)
|
org-agenda-restrict-end)
|
||||||
(widen))
|
(widen))
|
||||||
|
@ -4813,7 +4813,7 @@ The prefix arg TODO-ONLY limits the search to TODO entries."
|
||||||
(error "Agenda file %s is not in `org-mode'" file))
|
(error "Agenda file %s is not in `org-mode'" file))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(save-restriction
|
(save-restriction
|
||||||
(if org-agenda-restrict
|
(if (eq buffer org-agenda-restrict)
|
||||||
(narrow-to-region org-agenda-restrict-begin
|
(narrow-to-region org-agenda-restrict-begin
|
||||||
org-agenda-restrict-end)
|
org-agenda-restrict-end)
|
||||||
(widen))
|
(widen))
|
||||||
|
@ -5281,7 +5281,7 @@ the documentation of `org-diary'."
|
||||||
(let ((case-fold-search nil))
|
(let ((case-fold-search nil))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(save-restriction
|
(save-restriction
|
||||||
(if org-agenda-restrict
|
(if (eq buffer org-agenda-restrict)
|
||||||
(narrow-to-region org-agenda-restrict-begin
|
(narrow-to-region org-agenda-restrict-begin
|
||||||
org-agenda-restrict-end)
|
org-agenda-restrict-end)
|
||||||
(widen))
|
(widen))
|
||||||
|
@ -7085,7 +7085,7 @@ in the file. Otherwise, restriction will be to the current subtree."
|
||||||
(t 'file)))
|
(t 'file)))
|
||||||
(if (eq type 'subtree)
|
(if (eq type 'subtree)
|
||||||
(progn
|
(progn
|
||||||
(setq org-agenda-restrict t)
|
(setq org-agenda-restrict (current-buffer))
|
||||||
(setq org-agenda-overriding-restriction 'subtree)
|
(setq org-agenda-overriding-restriction 'subtree)
|
||||||
(put 'org-agenda-files 'org-restrict
|
(put 'org-agenda-files 'org-restrict
|
||||||
(list (buffer-file-name (buffer-base-buffer))))
|
(list (buffer-file-name (buffer-base-buffer))))
|
||||||
|
|
Loading…
Reference in a new issue