Comments (14)
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 org-super-agenda-groups
in a let
, and the value of the variable isn't being preserved for the redo command. I'm not sure if there's a way to fix that, because I don't think Org is designed to do that.
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 org-agenda-custom-commands
), it will persist for the redo.
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.
from org-super-agenda.
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 (let)
command. I've since added it as a custom command and this works (small snippet from my org-init.el
, taken from https://github.com/bascht/dotfiles-public/tree/master/home/.emacs.d/personal):
(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. 😄
from org-super-agenda.
Great, I'm glad you got it working! Here are a couple of FYIs:
- Since you used
:time-grid t
in the "Next Items" group, it will group everything that matches it, so none of those items will make it down to the "Today" group. Maybe that's what you want, in which case the one in "Today" is redundant. :) - No, I haven't added an
:effort
selector, because I've never used efforts before! :) But I think it should be easy to add, so I'll put that on my list.
If I censor away my own data a bit, I'd be happy to supply a screenshot with my example.
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)))))))
from org-super-agenda.
I just added effort selectors. They seem to be working, but please let me know if they work right for you. Thanks.
from org-super-agenda.
@alphapapa Thanks for the :effort
selector! Just updated to the latest version & it works! 😄
I cannot get (org-agenda-sharpie)
to work, though. I'm in Agenda mode, cursor on the agenda item, run the function with M-x
, can enter the new title in the Mini Buffer, but the actual item won't change. The *messages*
buffer is empty. Any hints? 😄
from org-super-agenda.
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!
from org-super-agenda.
@alphapapa We're one step further. The Sharpie will rewrite the very last tag (I've no idea why, though):
before
after
from org-super-agenda.
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.
from org-super-agenda.
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 :something::
).
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. 😬
Screenshot
My 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"))))
from org-super-agenda.
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 (:scheduled > "tomorrow")
selector won't work, it should be like (:scheduled future)
for anything after today, or (:scheduled (after "2017-08-03"))
for arbitrary dates.
Thanks for your help with this!
from org-super-agenda.
Thanks for the :scheduled future
hint! I didn't even notice that no filter did match. 😬
The Org issue itself is really weird. I found one headline where (org-agenda-sharpie)
would replace the first bit (the actual file) and after reloading the aganda everything was back to normal and it would replace the actual headline text.
Your search function did work for every headline, however. 😄
from org-super-agenda.
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!
from org-super-agenda.
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 org-agenda-custom-commands
and in the function my-org-agenda()
which brings you to your agenda right away:
- my-super-agenda
- defines a variable
my-super-agenda-groups
which holds my central definition of super-agenda - defines function
my-super-agenda()
which calls my super-agenda interactively or within other functions
- org-agenda-custom-commands
- includes my super-agenda as a small snippet which is using themy-super-agenda-groups
from above
- my-org-agenda
- a function which switches to the already generated agenda (which is waiting in a background buffer) or re-generates my agenda
- defines a variable
from org-super-agenda.
Thanks, Karl, that's awesome!
from org-super-agenda.
Related Issues (20)
- Showing the section name for an empty section? HOT 5
- Separating Deadline and Scheduled entries of the same task HOT 3
- Placing cursor on top of group heading changes the keymap and replaces the org-agenda buffer with a calendar when pressed `j ` both on Spacemacs and Doom Emacs HOT 3
- There is error -remove: Symbol’s function definition is void: s-blank-str? HOT 1
- Add explicit :or operator for use within :and operator? HOT 3
- Apply face transformation to item only if cheduled HOT 3
- How to use :property properly? HOT 2
- :property selector doesn't recognize properties set in a file's header HOT 1
- Is it possible to reuse blocks of org-super-agenda settings? HOT 1
- Org 9.7 `org-element` API changes break habit selector HOT 9
- question on using org-ql HOT 2
- Selector to match diary entries (was: how to exclude diary entries) HOT 1
- `:deadline nil` or/and `:scheduled nil` not working HOT 1
- Why does an agenda window automatically open every time I start emacs after installing the plug-in "org-super-agenda"? How can I prevent this behavior? HOT 2
- auto-group causes `wrong-type-argument buffer-or-string-p` with `org-todo-list` HOT 3
- `org-super-agenda-header-separator`/`org-super-agenda-final-group-separator` need to be considered as well when hiding empty groups HOT 3
- Sort order within a group: "Wrong type argument: sequencep, :auto-ts" HOT 5
- [ENH] add `:auto-matching-tags` or `:auto-tags-regex` HOT 5
- Root items of outline-path look like they're part of the previous group
- Add filename to outline-path
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from org-super-agenda.