Comments (7)
A little more poking reveals that by the point where org-super-agenda gets the timegrid, the lines from %%(diary commands do not have the "dotime" property at all. This is based on changing the test for time grid to include everything with the dotime property.
This is actually perhaps promising, since the %%(diary processing is fairly well isolated. I can experiment with modifying it to add a text property to part of the string.
from org-super-agenda.
Yes. I find that all diary types (and related types) are given a text-property 'type "sexp" during org-agenda processing after executing the sexp. This code works:
:test (let ((time (org-find-text-property-in-string 'dotime item))
(thetype (org-find-text-property-in-string 'type item)))
;; For this to match, the 'dotime property must be set, and
;; it must not be equal to 'time. If it is not set, or if
;; it is set and is equal to 'time, the item is not part of
;; the time-grid. Yes, this is confusing. :)
;; diary entries in the grid will have the 'type of "sexp"
(or (equal thetype "sexp") (and (not (equal time nil)) (not (equal time 'time)))))
You may find some better way that you prefer for this test. It turns out that org-agenda is already flagging the text for S-expressions, so this should be a stable bug fix for org-super-agenda.
from org-super-agenda.
Hi,
Thanks for reporting this and digging into it. I've hardly used diary-style sexps, so I'm not very familiar with them; I always have to refresh my memory about how they work.
I'm not sure that they should always be grouped with the time-grid entries. For sunrise/sunset, that makes sense, since they have a time associated. But entries without times associated probably shouldn't be in the time-grid.
I'm trying to test this now, but I don't see diary-sunrise
and diary-sunset
functions, only diary-sunrise-sunset
, which creates a single line listing both sunrise and sunset.
Here are all of the text properties I see for the sunrise/sunset line:
There are text properties here:
breadcrumbs nil
date (7 5 2017)
day 736515
dotime time
duration nil
extra ""
face org-agenda-calendar-sexp
format [Show]
help-echo "mouse-2 or RET jump to org file ~/src/org-super-agenda/test.org"
level " "
mouse-face highlight
org-agenda-type agenda
org-category "test"
org-day-cnt 1
org-heading t
org-highest-priority 65
org-last-args (nil nil day)
org-lowest-priority 67
org-marker [Show]
org-redo-cmd (org-agenda-list 'nil nil 'day nil)
org-series-cmd nil
tags nil
time " 1:02......"
time-of-day 102
todo-state nil
txt [Show]
type "sexp"
warntime nil
Maybe we could test for the time
or time-of-day
property, but I guess we'll have to investigate what other items have those properties too. Another possibility is to make a generic text-property matcher.
Of course, you could also add a :regexp
matcher that matches on sunrise
or sunset
, and put that in the group with the :time-grid
matcher, like:
:regexp (rx (or "sunrise" "sunset"))
I'm not sure what the best way to handle this is. What do you think?
Thanks.
from org-super-agenda.
Well, I did some more checking, and I think this might do it:
(org-super-agenda--defgroup time-grid
"Group items that appear on a time grid.
This matches the `dotime' text-property, which, if NOT set to
`time' (I know, this gets confusing), means it WILL appear in the
agenda time-grid. "
:section-name "Timed items" ; Note: this does not mean the item has a "SCHEDULED:" line
:test (or (--when-let (org-find-text-property-in-string 'time item)
;; This property is a string; if empty, it doesn't match
(not (string-empty-p it)))
;; This property is nil if it doesn't match
(org-find-text-property-in-string 'time-of-day item)
(--when-let (org-find-text-property-in-string 'dotime item)
;; For this to match, the 'dotime property must be set, and
;; it must not be equal to 'time. If it is not set, or if
;; it is set and is equal to 'time, the item is not part of
;; the time-grid. Yes, this is confusing. :)
(not (eql it 'time)))))
If you'd like to test this, just evaluate this form, and then run your agenda. It seems to work for me, and the sunrise/sunset line is properly sorted among other time-grid lines. It doesn't seem to have any adverse effects on other grouping, but I'd like it to be tested a bit more thoroughly before releasing it as an update.
from org-super-agenda.
I'll try it and get back to you.
I realized that sunrise/set are local extensions that I added from somewhere:
(defun diary-sunrise ()
(let ((dss (diary-sunrise-sunset)))
(with-temp-buffer
(insert dss)
(goto-char (point-min))
(search-forward ",")
(buffer-substring (point-min) (match-beginning 0)))))
(defun diary-sunset ()
(let ((dss (diary-sunrise-sunset))
start end)
(with-temp-buffer
(insert dss)
(goto-char (point-min))
(search-forward ", ")
(setq start (match-end 0))
(search-forward " at")
(setq end (match-beginning 0))
(goto-char start)
(capitalize-word 1)
(buffer-substring start end))))
I don't see anything there that would change properties.
from org-super-agenda.
That fix works, and I think it's the right one. Based on the principle of least astonishment, org-super-agenda should use the same rules as org-agenda. Looking through it's code I find:
- The %%(sexpr) must be at the beginning of the line, otherwise the (sexpr) is not evaluated,
- If the result does not contain something that looks like a date to org, it is not in the time grid
- If the date is not the right day, it is not in the time grid. The sexpr may do a lot of date calculations, repetitions, etc. By the time it reaches org-agenda it's resolved to a particular day.
- If there is nothing that looks like a time, the entry is not in the time grid. It might be elsewhere in the agenda results, but it's not in the grid.
- The first thing that looks like a time is used as the time in the time grid.
Step 4) corresponds to setting the properties time-of-day and time. The test for 'time-of-day is simpler, because that will either be nil or have a value. Nil means not in the grid.
from org-super-agenda.
Thanks, Robert. And thanks for the sunrise/sunset functions; I think I may use those in my agenda. Let me know if you find any other issues.
from org-super-agenda.
Related Issues (20)
- question: week-long view? HOT 1
- Customize group name ? HOT 7
- Group item by last modified state ? HOT 3
- Wrong parent headers HOT 2
- Cannot find file org-super-agenda-autoloads? HOT 1
- cond: Invalid org-super-agenda-groups selector: (:discard (:scheduled future)) HOT 7
- Can't use simple lisp expressions for :deadline HOT 4
- 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
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.