Let `org-agenda-set-restriction-lock' remove restriction at point
* lisp/org-compat.el (org-speedbar-set-agenda-restriction): * lisp/org-agenda.el (org-agenda-set-restriction-lock): If there is an agenda restriction at point, remove it. * doc/org-manual.org: * etc/ORG-NEWS: Document the new feature.
This commit is contained in:
parent
bc37b32580
commit
011f1c6181
|
@ -8338,20 +8338,20 @@ scope for an extended period, use the following commands:
|
|||
|
||||
#+kindex: C-c C-x <
|
||||
#+findex: org-agenda-set-restriction-lock
|
||||
Permanently restrict the agenda to the current subtree. When
|
||||
called with a prefix argument, or with the cursor before the
|
||||
first headline in a file, set the agenda scope to the entire
|
||||
file. This restriction remains in effect until removed with
|
||||
{{{kbd(C-c C-x >)}}}, or by typing either {{{kbd(<)}}} or
|
||||
{{{kbd(>)}}} in the agenda dispatcher. If there is a window
|
||||
displaying an agenda view, the new restriction takes effect
|
||||
immediately.
|
||||
Restrict the agenda to the current subtree. If there already is
|
||||
a restriction at point, remove it. When called with a universal
|
||||
prefix argument or with the cursor before the first headline in a
|
||||
file, set the agenda scope to the entire file. This restriction
|
||||
remains in effect until removed with {{{kbd(C-c C-x >)}}}, or by typing
|
||||
either {{{kbd(<)}}} or {{{kbd(>)}}} in the agenda dispatcher. If there is a
|
||||
window displaying an agenda view, the new restriction takes
|
||||
effect immediately.
|
||||
|
||||
- {{{kbd(C-c C-x >)}}} (~org-agenda-remove-restriction-lock~) ::
|
||||
|
||||
#+kindex: C-c C-x >
|
||||
#+findex: org-agenda-remove-restriction-lock
|
||||
Remove the permanent restriction created by {{{kbd(C-c C-x <)}}}.
|
||||
Remove the restriction created by {{{kbd(C-c C-x <)}}}.
|
||||
|
||||
#+texinfo: @noindent
|
||||
When working with =speedbar.el=, you can use the following commands in
|
||||
|
@ -8360,15 +8360,16 @@ the Speedbar frame:
|
|||
- {{{kbd(<)}}} (~org-speedbar-set-agenda-restriction~) ::
|
||||
|
||||
#+findex: org-speedbar-set-agenda-restriction
|
||||
Permanently restrict the agenda to the item---either an Org file
|
||||
or a subtree in such a file---at the cursor in the Speedbar
|
||||
frame. If there is a window displaying an agenda view, the new
|
||||
restriction takes effect immediately.
|
||||
Restrict the agenda to the item---either an Org file or a subtree
|
||||
in such a file---at the cursor in the Speedbar frame. If agenda
|
||||
is already restricted there, remove the restriction. If there is
|
||||
a window displaying an agenda view, the new restriction takes
|
||||
effect immediately.
|
||||
|
||||
- {{{kbd(>)}}} (~org-agenda-remove-restriction-lock~) ::
|
||||
|
||||
#+findex: org-agenda-remove-restriction-lock
|
||||
Lift the restriction.
|
||||
Remove the restriction.
|
||||
|
||||
** The Agenda Dispatcher
|
||||
:PROPERTIES:
|
||||
|
|
|
@ -298,6 +298,13 @@ parameters. See example bellow.
|
|||
,#+END_SRC
|
||||
#+END_SRC
|
||||
|
||||
*** ~org-agenda-set-restriction-lock~ toggle agenda restriction at point
|
||||
|
||||
You can set an agenda restriction lock with =C-x C-x <= or with =<= at the
|
||||
beginning of a headline when using Org speed commands. Now, if there
|
||||
is already a restriction at point, hitting =<= again (or =C-x C-x <=) will
|
||||
remove it.
|
||||
|
||||
** New functions
|
||||
|
||||
*** ~org-insert-structure-template~
|
||||
|
|
|
@ -7124,11 +7124,18 @@ Argument ARG is the prefix argument."
|
|||
|
||||
;;;###autoload
|
||||
(defun org-agenda-set-restriction-lock (&optional type)
|
||||
"Set restriction lock for agenda, to current subtree or file.
|
||||
Restriction will be the file if TYPE is `file', or if type is the
|
||||
universal prefix \\='(4), or if the cursor is before the first headline
|
||||
in the file. Otherwise, restriction will be to the current subtree."
|
||||
"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))))
|
||||
(org-agenda-remove-restriction-lock 'noupdate)
|
||||
(org-agenda-remove-restriction-lock 'noupdate)
|
||||
(and (equal type '(4)) (setq type 'file))
|
||||
(setq type (cond
|
||||
|
@ -7160,7 +7167,7 @@ in the file. Otherwise, restriction will be to the current subtree."
|
|||
(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)
|
||||
(setq current-prefix-arg nil))
|
||||
(org-agenda-maybe-redo))
|
||||
|
||||
(defun org-agenda-remove-restriction-lock (&optional noupdate)
|
||||
|
|
|
@ -688,6 +688,8 @@ This also applied for speedbar access."
|
|||
|
||||
(defun org-speedbar-set-agenda-restriction ()
|
||||
"Restrict future agenda commands to the location at point in speedbar.
|
||||
If there is already a restriction lock at the location, remove it.
|
||||
|
||||
To get rid of the restriction, use `\\[org-agenda-remove-restriction-lock]'."
|
||||
(interactive)
|
||||
(require 'org-agenda)
|
||||
|
@ -698,7 +700,11 @@ To get rid of the restriction, use `\\[org-agenda-remove-restriction-lock]'."
|
|||
(setq m (get-text-property p 'org-imenu-marker))
|
||||
(with-current-buffer (marker-buffer m)
|
||||
(goto-char m)
|
||||
(org-agenda-set-restriction-lock 'subtree)))
|
||||
(if (and org-agenda-overriding-restriction
|
||||
(member org-agenda-restriction-lock-overlay
|
||||
(overlays-at (point))))
|
||||
(org-agenda-remove-restriction-lock 'noupdate)
|
||||
(org-agenda-set-restriction-lock 'subtree))))
|
||||
((setq p (text-property-any (point-at-bol) (point-at-eol)
|
||||
'speedbar-function 'speedbar-find-file))
|
||||
(setq tp (previous-single-property-change
|
||||
|
|
Loading…
Reference in New Issue