emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Visuwesh <visuweshm@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: [PATCH] Re: [BUG] org-agenda-remove-restriction-lock does not remove file lock [9.5.2 (release_9.5.2-17-gea6b74 @ /nix/store/iqqk7iqfwmfc6r78xg2knyq7hww2mhs4-emacs-git-20220225.0/share/emacs/29.0.50/lisp/org/)]
Date: Sat, 26 Mar 2022 17:04:50 +0800	[thread overview]
Message-ID: <87ee2pythp.fsf@localhost> (raw)
In-Reply-To: <87v8w2qdgp.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 595 bytes --]

Visuwesh <visuweshm@gmail.com> writes:

> C-u C-c C-x < followed by C-c C-x > does not remove the file restriction
> lock.  
>
> `org-agenda-remove-restriction-lock' checks for non-nil value of
> `org-agenda-restriction' but `org-agenda-set-restriction-lock' explicitly
> sets it to nil when TYPE is 'file.  Setting `org-agenda-restriction' to
> a dummy value like 'dummy gets the job done.

Confirmed.

The fix is attached.
Setting org-agenda-restriction to non-nil appears to be risky since
org-agenda-set-restriction-lock explicitly sets it to nil. So, I use
different approach.

Best,
Ihor


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-agenda-remove-restriction-lock-Remove-file-restr.patch --]
[-- Type: text/x-patch, Size: 1670 bytes --]

From 65aa484f15a8ebbd14161978e1e9a881048e0715 Mon Sep 17 00:00:00 2001
Message-Id: <65aa484f15a8ebbd14161978e1e9a881048e0715.1648285356.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Sat, 26 Mar 2022 16:57:05 +0800
Subject: [PATCH] org-agenda-remove-restriction-lock: Remove 'file restriction

* lisp/org-agenda.el (org-agenda-remove-restriction-lock): Remove
agenda restriction set by `org-agenda-set-restriction-lock' called
with prefix argument.  `org-agenda-restrict' may be nil while
`org-agenda-overriding-restriction' is non-nil.

Fixes https://list.orgmode.org/87v8w2qdgp.fsf@gmail.com
---
 lisp/org-agenda.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 9f13f0749..6a2eb18e7 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -7446,11 +7446,14 @@ (defun org-agenda-set-restriction-lock (&optional type)
 (defun org-agenda-remove-restriction-lock (&optional noupdate)
   "Remove agenda restriction lock."
   (interactive "P")
-  (if (not org-agenda-restrict)
+  (if (not (or org-agenda-restrict org-agenda-overriding-restriction))
       (message "No agenda restriction to remove.")
     (delete-overlay org-agenda-restriction-lock-overlay)
     (delete-overlay org-speedbar-restriction-lock-overlay)
     (setq org-agenda-overriding-restriction nil)
+    (unless org-agenda-keep-restricted-file-list
+      ;; There is a request to keep the file list in place
+      (put 'org-agenda-files 'org-restrict nil))
     (setq org-agenda-restrict nil)
     (put 'org-agenda-files 'org-restrict nil)
     (move-marker org-agenda-restrict-begin nil)
-- 
2.34.1


  reply	other threads:[~2022-03-26  9:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-25 15:05 [BUG] org-agenda-remove-restriction-lock does not remove file lock [9.5.2 (release_9.5.2-17-gea6b74 @ /nix/store/iqqk7iqfwmfc6r78xg2knyq7hww2mhs4-emacs-git-20220225.0/share/emacs/29.0.50/lisp/org/)] Visuwesh
2022-03-26  9:04 ` Ihor Radchenko [this message]
2022-07-17 12:09   ` [PATCH] " Ihor Radchenko
  -- strict thread matches above, loose matches on Subject: below --
2022-10-09  7:14 Liu Hui
2022-10-11  2:33 ` Ihor Radchenko
2022-10-12  6:11   ` Liu Hui
2022-10-12  7:44     ` Ihor Radchenko

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=87ee2pythp.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=visuweshm@gmail.com \
    /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).