diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index b2c9d7248..47efe1c92 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -64,7 +64,7 @@ list as their first argument. *** Agenda **** New variable : ~org-agenda-show-future-repeats~ **** New variable : ~org-agenda-prefer-last-repeat~ - +**** Binding C-c C-x < for ~org-agenda-set-restriction-lock-from-agenda~ *** New value for ~org-publish-sitemap-sort-folders~ The new ~ignore~ value effectively allows toggling inclusion of @@ -115,7 +115,7 @@ value of the code will be displayed in the results section. A new engine was added to support ~sqsh~ command line utility for use against Microsoft SQL Server or Sybase SQL server. -More information on ~sqsh~ can be found here: [[https://sourceforge.net/projects/sqsh/][sourceforge/sqsh]] +More information on ~sqsh~ can be found here: [[https://sourceforge.net/projects/sqsh/][sourceforge/sqsh]] To use ~sqsh~ in an *sql* =SRC_BLK= set the =:engine= like this: @@ -135,7 +135,7 @@ Where clue > 0 This new function is meant to be used in back-ends supporting images as descriptions of links, a.k.a. image links. See its docstring for details. -**** Add global macros through ~org-export-global-macros~ +**** Add global macros through ~org-export-global-macros~ With this variable, one can define macros available for all documents. **** New keyword ~#+EXPORT_FILE_NAME~ Simiralry to ~:EXPORT_FILE_NAME:~ property, this keyword allows the @@ -180,6 +180,10 @@ in addition to ~org-publish-find-title~ and ~org-publish-find-date~. It is the reciprocal of ~org-list-to-lisp~, which see. +*** ~org-agenda-set-restriction-lock-from-agenda~ + +Call ~org-agenda-set-restriction-lock~ from the agenda. + * Version 9.0 ** Incompatible changes @@ -518,7 +522,7 @@ If you want to use the *trusted connection* feature, omit *both* the If your Emacs is running in a Cygwin environment, the =ob-sql= library can pass the converted path to the =sqlcmd= tool. -**** Improved support of header arguments for postgresql +**** Improved support of header arguments for postgresql The postgresql engine in a sql code block supports now ~:dbport~ nd ~:dbpassword~ as header arguments. diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 79d6f904e..07e27217d 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -2320,6 +2320,7 @@ The following commands are available: (org-defkey org-agenda-mode-map "b" 'org-agenda-earlier) (org-defkey org-agenda-mode-map "\C-c\C-x\C-c" 'org-agenda-columns) (org-defkey org-agenda-mode-map "\C-c\C-x>" 'org-agenda-remove-restriction-lock) +(org-defkey org-agenda-mode-map "\C-c\C-x<" 'org-agenda-set-restriction-lock-from-agenda) (org-defkey org-agenda-mode-map "[" 'org-agenda-manipulate-query-add) (org-defkey org-agenda-mode-map "]" 'org-agenda-manipulate-query-subtract) @@ -7027,6 +7028,22 @@ their type." 'help-echo "Agendas are currently limited to this subtree.") (delete-overlay org-agenda-restriction-lock-overlay) +(defun org-agenda-set-restriction-lock-from-agenda (arg) + "Set the restriction lock to the agenda item at point from within the agenda. +When called with a `\\[universal-argument]' prefix, restrict to +the file which contains the item. +Argument ARG is the prefix argument." + (interactive "P") + (unless (derived-mode-p 'org-agenda-mode) + (user-error "Not in an Org agenda buffer")) + (let* ((marker (or (org-get-at-bol 'org-marker) + (org-agenda-error))) + (buffer (marker-buffer marker)) + (pos (marker-position marker))) + (with-current-buffer buffer + (goto-char pos) + (org-agenda-set-restriction-lock arg)))) + ;;;###autoload (defun org-agenda-set-restriction-lock (&optional type) "Set restriction lock for agenda, to current subtree or file.