Function: org-agenda-set-restriction-lock
org-agenda-set-restriction-lock is an autoloaded, interactive and
byte-compiled function defined in org-agenda.el.gz.
Signature
(org-agenda-set-restriction-lock &optional TYPE)
Documentation
Set restriction lock for agenda to current subtree or file.
When in a restricted subtree, remove it.
The restriction will span over the entire file if TYPE is file,
or if TYPE is (4), or if the cursor is before the first headline
in the file. Otherwise, only apply the restriction to the current
subtree.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-agenda.el.gz
;;;###autoload
(defun org-agenda-set-restriction-lock (&optional type)
"Set restriction lock for agenda to current subtree or file.
When in a restricted subtree, remove it.
The restriction will span over the entire file if TYPE is `file',
or if TYPE is (4), or if the cursor is before the first headline
in the file. Otherwise, only apply the restriction to the current
subtree."
(interactive "P")
(if (and org-agenda-overriding-restriction
(member org-agenda-restriction-lock-overlay
(overlays-at (point)))
(equal (overlay-start org-agenda-restriction-lock-overlay)
(point)))
(org-agenda-remove-restriction-lock 'noupdate)
(org-agenda-remove-restriction-lock 'noupdate)
(and (equal type '(4)) (setq type 'file))
(setq type (cond
(type type)
((org-at-heading-p) 'subtree)
((condition-case nil (org-back-to-heading t) (error nil))
'subtree)
(t 'file)))
(if (eq type 'subtree)
(progn
(setq org-agenda-restrict (current-buffer))
(setq org-agenda-overriding-restriction 'subtree)
(put 'org-agenda-files 'org-restrict
(list (buffer-file-name (buffer-base-buffer))))
(org-back-to-heading t)
(move-overlay org-agenda-restriction-lock-overlay
(point)
(if org-agenda-restriction-lock-highlight-subtree
(save-excursion (org-end-of-subtree t t) (point))
(line-end-position)))
(move-marker org-agenda-restrict-begin (point))
(move-marker org-agenda-restrict-end
(save-excursion (org-end-of-subtree t t)))
(message "Locking agenda restriction to subtree"))
(put 'org-agenda-files 'org-restrict
(list (buffer-file-name (buffer-base-buffer))))
(setq org-agenda-restrict t)
(setq org-agenda-overriding-restriction 'file)
(move-marker org-agenda-restrict-begin nil)
(move-marker org-agenda-restrict-end nil)
(message "Locking agenda restriction to file"))
(setq current-prefix-arg nil))
(org-agenda-maybe-redo))