New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Super mode gone after refreshing agenda with g
#6
Comments
|
Hi Sebastian, Thanks for your kind words. If you have time, I'd love if you could share an example config and/or a screenshot that I could add to the examples page. :) I think the problem is that you're setting Have you tried using it as a custom agenda command? I think that if you set the variable as a setting in a custom agenda command (see help for Other than that, if you set the variable globally, it will definitely persist across redos. So I guess I should ask, can you show me an example of the code you're using, how you're setting the variable and running the command? Thanks. |
|
Hi @alphapapa. Thanks for your quick reply. I'm not that firm in Elisp – so it was indeed some kind of scoping issue with the (use-package org-super-agenda
:config (org-super-agenda-mode))
(setq org-agenda-custom-commands
'(("c" "Super Agenda" agenda
(org-super-agenda-mode)
((org-super-agenda-groups
'(
(:name "Next Items"
:time-grid t
:tag ("NEXT" "outbox"))
(:name "Important"
:priority "A")
(:name "Today"
:time-grid t
:scheduled today)
(:name "Quick Picks"
:effort < 00:30 ; ← that one doesn't seem to work, no?
)
(:priority<= "B"
:order 1)
)))
(org-agenda nil "a"))))If I censor away my own data a bit, I'd be happy to supply a screenshot with my example. 😄 |
|
Great, I'm glad you got it working! Here are a couple of FYIs:
That would be great! In fact, instead of having to use GIMP on a screenshot, you can use this function I happen to have handy, which just replaces the visible heading of the current item in the agenda view, without changing the heading of the actual item: (defun org-agenda-sharpie ()
"Censor the text of items in the agenda."
(interactive)
(let (regexp old-heading new-heading properties)
;; Save face properties of line in agenda to reapply to changed text
(setq properties (text-properties-at (point)))
;; Go to source buffer
(org-with-point-at (org-find-text-property-in-string 'org-marker
(buffer-substring (line-beginning-position)
(line-end-position)))
;; Save old heading text and ask for new text
(line-beginning-position)
(unless (org-at-heading-p)
;; Not sure if necessary...IT IS NECESSARY
(org-back-to-heading))
(setq old-heading (when (looking-at org-complex-heading-regexp)
(match-string 4))))
(setq new-heading (read-from-minibuffer "Overwrite visible heading with: "))
(add-text-properties 0 (length new-heading) properties new-heading)
;; Back to agenda buffer
(save-excursion
(when (and old-heading new-heading)
;; Replace agenda text
(let ((inhibit-read-only t))
(goto-char (line-beginning-position))
(when (search-forward old-heading (line-end-position))
(replace-match new-heading 'fixedcase 'literal))))))) |
|
I just added effort selectors. They seem to be working, but please let me know if they work right for you. Thanks. |
|
@alphapapa Thanks for the |
|
Great, glad it's working. So sorry about the function not working. That code that I commented out, that I wasn't sure if it was necessary...well apparently it is. Oops. :) This should work, I just tested it: (defun org-agenda-sharpie ()
"Censor the text of items in the agenda."
(interactive)
(let (regexp old-heading new-heading properties)
;; Save face properties of line in agenda to reapply to changed text
(setq properties (text-properties-at (point)))
;; Go to source buffer
(org-with-point-at (org-find-text-property-in-string 'org-marker
(buffer-substring (line-beginning-position)
(line-end-position)))
;; Save old heading text and ask for new text
(line-beginning-position)
(unless (org-at-heading-p)
;; Not sure if necessary...IT IS!
(org-back-to-heading))
(setq old-heading (when (looking-at org-complex-heading-regexp)
(match-string 4))))
(setq new-heading (read-from-minibuffer "Overwrite visible heading with: "))
(add-text-properties 0 (length new-heading) properties new-heading)
;; Back to agenda buffer
(save-excursion
(when (and old-heading new-heading)
;; Replace agenda text
(let ((inhibit-read-only t))
(goto-char (line-beginning-position))
(when (search-forward old-heading (line-end-position))
(replace-match new-heading 'fixedcase 'literal)))))))Thank you! |
|
@alphapapa We're one step further. The Sharpie will rewrite the very last tag (I've no idea why, though): beforeafter |
|
I'm stumped, I don't know how that could happen. You are using Org 9, right? I modified the code a bit and tested it again on several headings, and it works every time for me: (defun org-agenda-sharpie ()
"Censor the text of items in the agenda."
(interactive)
(let (regexp old-heading new-heading properties)
;; Save face properties of line in agenda to reapply to changed text
(setq properties (text-properties-at (point)))
;; Go to source buffer
(org-with-point-at (org-find-text-property-in-string 'org-marker
(buffer-substring (line-beginning-position)
(line-end-position)))
;; Save old heading text and ask for new text
(line-beginning-position)
(unless (org-at-heading-p)
;; Not sure if necessary
(org-back-to-heading))
(setq old-heading (when (looking-at org-complex-heading-regexp)
(match-string 4))))
(unless old-heading
(error "Can't find heading. How can this be?"))
;; Back to agenda buffer
(setq new-heading (read-from-minibuffer "Overwrite visible heading with: "))
(add-text-properties 0 (length new-heading) properties new-heading)
;; Replace agenda text
(save-excursion
(let ((inhibit-read-only t))
(goto-char (line-beginning-position))
(when (search-forward old-heading (line-end-position))
(replace-match new-heading 'fixedcase 'literal))))))I hope we can get it working, I really like the look of that screenshot. Thanks for your patience. |
|
Thanks again for debugging this & providing a new function. I'm on the latest org-mode, but I think there might be something off with my tags / the way they align. The function works in some cases and doesn't in some cases (the headlines tag shows a double colon like Long story sort: I cleaned up my items a bit and you can use the uncensored version, as there are (hopefully) no confidential or embarrassing tasks left. 😬 ScreenshotMy config (heavily inspired by yours ;))(setq org-agenda-custom-commands
'(("c" "Super Agenda" agenda
(org-super-agenda-mode)
((org-super-agenda-groups
'(
(:name "Next Items"
:time-grid t
:tag ("NEXT" "outbox"))
(:name "Important"
:priority "A")
(:name "Quick Picks"
:effort< "0:30"
)
(:priority<= "B"
:scheduled > "tomorrow"
:order 1)
)))
(org-agenda nil "a")))) |
|
Thanks, Sebastian, that screenshot looks great, I will add it and the config to the examples page. I'm perplexed by the problem with the function and the tags issue. I use code straight from Org to read the entry title, so I don't understand how it could be getting a tag instead. You might have actually found an obscure bug in Org itself, so you might look at some of the items it misbehaved on and see if the tag string is correct, and whether this code returns the title or a tag or something else (with point at the beginning of the heading line): (when (looking-at org-complex-heading-regexp)
(match-string 4))By the way, the Thanks for your help with this! |
|
Thanks for the Your search function did work for every headline, however. 😄 |
|
Hm, that is strange. Of course, this is my own little hack, and so it's not a big surprise that there are corner cases in the agenda's hidden text properties, haha. Thanks for your help! |
|
In case you're looking for an additional example configuration, I linked the relevant parts of my configuration. The advantage of my approach is the central definition of my super-agenda which is used as my default agenda defined in
|
|
Thanks, Karl, that's awesome! |



First of all: Thanks for creating this beautiful add-on to org-mode! I run into one simple problem: After starting emacs,
org-super-agenda-modeis enabled and everything is fine.However after refreshing the agenda with
gor starting the agenda later (C-a a) the agenda view is back to normal.I'm on Emacs 25.2.1 with Prelude.
Am I holding it wrong? 😃
The text was updated successfully, but these errors were encountered: