Re: [O] org google weather

2011-03-06 Thread Konrad Hinsen

On 6 Mar 2011, at 00:51, Nick Dokos wrote:


Konrad Hinsen konrad.hin...@fastmail.net wrote:


What keeps me from writing that function right now is that I don't
know the internals of org-mode well enough to know how to check for a
propery or tag. I expect to spend an hour reading source code, and
that's for another day :-)


Before diving into the code, check out Appendix A, Hacking, and in
particular section A.9, Using the property API, in the Org manual.


Thanks for the useful hint! I am not used to code that comes with a  
hacker's manual.


BTW, I found a very simple solution to my original problem of having  
sunrise and sunset only in the day view:


%%(when (eq span 'day) (diary-sunrise))
%%(when (eq span 'day) (diary-sunset))

Fortunately, because apparently org-agenda-skip-function is not called  
for diary-style entries. But I'll continue exploring that approach for  
other types of entries.


Konrad.



Re: [O] org google weather

2011-03-06 Thread Konrad Hinsen

On 6 Mar 2011, at 11:33, Konrad Hinsen wrote:

Fortunately, because apparently org-agenda-skip-function is not  
called for diary-style entries. But I'll continue exploring that  
approach for other types of entries.


That was relatively easy as well:

(defun org-agenda-day-view-only-filter ()
  (let ((subtree-end   (save-excursion (org-end-of-subtree t)))
(day-view-only (org-entry-get nil day-view-only t)))
(if day-view-only
(if (eq span 'day)
nil
subtree-end)
 nil)))

(setq org-agenda-skip-function-global 'org-agenda-day-view-only-filter)

The agenda items eliminated from the week views are marked with:

:PROPERTIES:
:day-view-only: t
:END:

I put the filter on the global skip function, but others may prefer to  
use a custom agenda view.


Konrad.




Re: [O] org google weather

2011-03-05 Thread Bastien
Hi Nick,

Nick Dokos nicholas.do...@hp.com writes:

 Konrad Hinsen konrad.hin...@fastmail.net wrote:

 Is there a way to get this inserted only into the day view, but not
 into the week view? In fact, I would like to have that choice for
 agenda items in general. It makes sense (to me at least) to have more
 information in the day view than in the week view.

 Not that I know of, which means one of two things: it's there but I
 don't know about it (something that has happened many times in the past
 with org) or it's not there and Carsten will have it implemented by
 tomorrow morning :-)

A clever combination of org-agenda-span and org-agenda-skip-function
(checking against this span) in a custom agenda command should do.

HTH,

-- 
 Bastien



Re: [O] org google weather

2011-03-05 Thread Matthew Sauer
I put the diary-sunset and diary-sunrise functions in a file called
sunrisesunset.el in my elisp directory, it is part of my load path and put
'(require 'sunrisesunset)
in my .emacs
It only loads if I type
M-x load-library   RET   sunrisesunset RET
I am not sure why it isn't automatically loading like other files I have set
the same way, the same holds true for org-google-weather, I ran the git,
have it in my home directory and have it set up for require in my dotemacs
but i still have to
M-x load-library RET org-google-weather RET
to get it to work in my agenda.

I am running on cygwin with emacs 23.2 and with Org 7.4 (updated to make
sure), I ended up putting the diary-sunrise and diary-sunset functions in my
dot emacs and they work just fine but putting the contents of different .el
files in my dotemacs file isn't a good long term solution.  Any suggestions
as to what I might look at or for?

Matthew S


Re: [O] org google weather

2011-03-05 Thread Konrad Hinsen

On 5 Mar 2011, at 12:44, Matthew Sauer wrote:



I put the diary-sunset and diary-sunrise functions in a file called  
sunrisesunset.el in my elisp directory, it is part of my load path  
and put

'(require 'sunrisesunset)
in my .emacs


Did you put a

(provide 'sunrisesunset)

at the end of sunrisesunset.el? That's what tells Emacs that the  
requirement is now fulfilled.


Konrad.



Re: [O] org google weather

2011-03-05 Thread Konrad Hinsen

On 5 Mar 2011, at 11:19, Bastien wrote:


Is there a way to get this inserted only into the day view, but not
into the week view? In fact, I would like to have that choice for
agenda items in general. It makes sense (to me at least) to have  
more

information in the day view than in the week view.


Not that I know of, which means one of two things: it's there but I
don't know about it (something that has happened many times in the  
past

with org) or it's not there and Carsten will have it implemented by
tomorrow morning :-)


A clever combination of org-agenda-span and org-agenda-skip-function
(checking against this span) in a custom agenda command should do.


That sounds like a good plan. A property could be used to limit  
visibility to day or week views, and the skip-function would check for  
that property.


Konrad.




Re: [O] org google weather

2011-03-05 Thread Matthew Sauer
Konrad,

Being an elisp noob I had forgotten about the provide code in the .el file.
That fixed that problem, THANK YOU so much.   Now if I can figure out why I
have to
M-x load-library RET google-weather RET
M-x load-library RET org-google-weather RET
to get google weather to work with my agenda (though I am debating on
leaving it this way and having a function load these two files as I am not
always internet connected and it is annoying to wait for the network
connection attempt to timeout 4 times for each day it attempts to retrieve
the weather or maybe I should look and see if I can patch it to make it skip
the other attempts if the first fails? but then I need to figure out how to
get them to load automatically).  I should just need to use the code in my
dot emacs
'(require 'google-weather)
'(require 'org-google-weather)
for it to work but that doesn't seem to do the trick, maybe i need to look
in the code in those .el files.

Bastien,
to your question, I am trying to set some functions in other .el files so
that I can break up differnt parts of code for the different parts of my
.emacs file intsead of just adding more and more code.

Matthew

On Sat, Mar 5, 2011 at 7:26 AM, Konrad Hinsen konrad.hin...@fastmail.netwrote:

 On 5 Mar 2011, at 12:44, Matthew Sauer wrote:


 I put the diary-sunset and diary-sunrise functions in a file called
 sunrisesunset.el in my elisp directory, it is part of my load path and put
 '(require 'sunrisesunset)
 in my .emacs


 Did you put a

(provide 'sunrisesunset)

 at the end of sunrisesunset.el? That's what tells Emacs that the
 requirement is now fulfilled.

 Konrad.



Re: [O] org google weather

2011-03-05 Thread Michael Markert
On 5 Mar 2011, Matthew Sauer wrote:
 I should just need to use the code in my dot emacs
 '(require 'google-weather)
 '(require 'org-google-weather)
 for it to work but that doesn't seem to do the trick, maybe i need to
 look in the code in those .el files.

You should omit the leading '. With it the lines are equivalent to

(list 'require 'google-weather)
(list 'require 'org-google-weather)

Michael



Re: [O] org google weather

2011-03-05 Thread Nick Dokos
Matthew Sauer improv.philoso...@gmail.com wrote:

 '(require 'google-weather)
 '(require 'org-google-weather)

That should be

(require 'google-weather)
(require 'org-google-weather)

without a quote.

Nick




Re: [O] org google weather

2011-03-05 Thread Bastien
Hi Konrad,

Konrad Hinsen konrad.hin...@fastmail.net writes:

 A clever combination of org-agenda-span and org-agenda-skip-function
 (checking against this span) in a custom agenda command should do.

 That sounds like a good plan. A property could be used to limit visibility
 to day or week views, and the skip-function would check for that property.

Sorry, not sure I was clear enough: my point was that you can *already*
select tasks you want to appear on the dayly agenda view and not on the
weekly agenda view. 

It's just a matter of writing an org-agenda-skip-function that react
differently depending on org-agenda-span.

I leave the homework to someone else :)

-- 
 Bastien



Re: [O] org google weather

2011-03-05 Thread Matthew Sauer
Thanks that worked, as I said Noob, somethings get the quote and some
don't.  Now if I can just get org-contacts to load correctly, void variable
value, life will be great.  I think I am starting to get the hang of this
language.
Matthew

On Sat, Mar 5, 2011 at 9:23 AM, Nick Dokos nicholas.do...@hp.com wrote:

 Matthew Sauer improv.philoso...@gmail.com wrote:

  '(require 'google-weather)
  '(require 'org-google-weather)

 That should be

 (require 'google-weather)
 (require 'org-google-weather)

 without a quote.

 Nick




Re: [O] org google weather

2011-03-05 Thread Nick Dokos
Matthew Sauer improv.philoso...@gmail.com wrote:

 Thanks that worked, as I said Noob, somethings get the quote and some don't.  
 Now if I can just get
 org-contacts to load correctly, void variable value, life will be great.  I 
 think I am starting to
 get the hang of this language.
 Matthew
 

The main thing to remember is that quote inhibits evaluation: 'a gives
you the symbol a whereas a without the quote gives you the *value* of
a. Remember also that in lisp, you call a function func with arguments x
and y like this: (func x y) - this calls the function func on the
*values* of x and y and returns a function value (which of course
depends on how the function is defined). OTOH, '(func x y) is a list of
three elements: func, x and y. So

'(require 'google-weather)

does nothing whereas

(require 'google-weather) 

calls the function require with the symbol google-weather as its argument.

OTOH, the incorrect

(require google-weather)

would call the same function with the *value* of the symbol google-weather
as its argument. Since the symbol has no value, you'd get an error.
Hope this makes things a bit clearer, but there is nothing like getting an
elementary book on Lisp (or the Emacs Lisp introductory tutorial which
should be available in your emacs or online).

As for org-contacts, I just did a git pull (from
git://git.naquadah.org/org-contacts.git) and I was able to load it with
no problems. Also I don't see a variable named value in the file, so
either your report of the error is inaccurate or your version is
older. Try the latest version and if you still have problems, checkout
out section 1.4, Feedback, of the Org manual to find out how to
produce a useful backtrace - then post that to the list.

Nick



Re: [O] org google weather

2011-03-05 Thread Konrad Hinsen

Hi Bastien,

On 5 Mar 2011, at 18:07, Bastien wrote:

Sorry, not sure I was clear enough: my point was that you can  
*already*
select tasks you want to appear on the dayly agenda view and not on  
the

weekly agenda view.

It's just a matter of writing an org-agenda-skip-function that react
differently depending on org-agenda-span.


Right, you just need to write a function ;-)

I guess I wasn't clear enough either, because that's what my proposal  
is about as well. My idea is


1) Use some property (or tag) to mark events in an org-file as day  
view only.
2) Write an org-agenda-skip-function that checks for that property/tag  
AND checks the value of org-agenda-span.


What keeps me from writing that function right now is that I don't  
know the internals of org-mode well enough to know how to check for a  
propery or tag. I expect to spend an hour reading source code, and  
that's for another day :-)


Konrad.



Re: [O] org google weather

2011-03-05 Thread brian powell
The sunrise and sunset strings have been available in the diary
functions for EMACS for a long time; and, the new code above you've
made for inserting them into the weather strings in OrgMode agendas is
great too.  Thanks and I look forward to using it.

Now, is there any simple way, maybe with the (require 'google-weather)
that one can get the twilight times too--the 6 degrees of earth
rotation before sunrise and after sunset when there is still sunlight
outside but no sun to be seen? (I like to play soccer at that time
sometimes.)

(I think twilight depends on lat-lon location too though)



Re: [O] org google weather

2011-03-04 Thread Ian Barton

On 03/03/11 21:37, Simon Brown wrote:

Evening all,

Has anybody tried adding the functionality of %%(diary-sunrise-sunset)
(sunrise, sunset time and daylight hours) to the google weather code?

Simon


I just have something like:

#+CATEGORY: Day/Year
%%(diary-day-of-year)
#+CATEGORY: Sunrise
%%(diary-sunrise-sunset)

in one of my Agenda files. Sunrise then appears at sunrise time in my 
Agenda like:


  Sunrise: 6:53.. Sunrise (GMT), sunset 5:52pm (GMT) at 
Wilkesley (10:58 hours daylight)


You need to have some magic fu like:

#+BEGIN_SRC emacs-lisp
  (setq calendar-latitude 53)
  (setq calendar-longitude -2.6)
  (setq calendar-location-name Wilkesley)
#+END_SRC

in your .emacs so Emacs knows where you are.

Ian.



Re: [O] org google weather

2011-03-04 Thread Sébastien Vauban
Hi Ian,

Ian Barton wrote:
 Has anybody tried adding the functionality of %%(diary-sunrise-sunset)
 (sunrise, sunset time and daylight hours) to the google weather code?

 I just have something like:

 #+CATEGORY: Day/Year
 %%(diary-day-of-year)
 #+CATEGORY: Sunrise
 %%(diary-sunrise-sunset)

 in one of my Agenda files. Sunrise then appears at sunrise time in my Agenda
 like:

Sunrise: 6:53.. Sunrise (GMT), sunset 5:52pm (GMT) at 
 Wilkesley (10:58 hours daylight)

Do you have a way to get the sunset located on a line on its own (different
line from the sunrise one)?  That'd be even much nicer...

Best regards,
  Seb

-- 
Sébastien Vauban




Re: [O] org google weather

2011-03-04 Thread Ian Barton



Hi Ian,

Ian Barton wrote:

Has anybody tried adding the functionality of %%(diary-sunrise-sunset)
(sunrise, sunset time and daylight hours) to the google weather code?


I just have something like:

#+CATEGORY: Day/Year
%%(diary-day-of-year)
#+CATEGORY: Sunrise
%%(diary-sunrise-sunset)

in one of my Agenda files. Sunrise then appears at sunrise time in my Agenda
like:

Sunrise: 6:53.. Sunrise (GMT), sunset 5:52pm (GMT) at
Wilkesley (10:58 hours daylight)


Do you have a way to get the sunset located on a line on its own (different
line from the sunrise one)?  That'd be even much nicer...

No, but I would like one:) If there were separate diary functions for 
sunrise and sunset it would be easy. Maybe I need to look at the diary 
elisp and write my own separate functions.


Ian.



Re: [O] org google weather

2011-03-04 Thread brian powell
FWIW/YMMV I use RUBY: I like the twilight info too--not sure emacs does
twilight info too--maybe you can reuse some of the code and put into
OrgMode: I do:

emacs -l .bja-sunrise-sunset-twilight.el

--where .bja-sunrise-sunset-twilight.el is:

(defun bja-sunrise ()
  Display sunrise, sunset amp; twilight information.
  (interactive)
  (shell-command ~/sunrise_http_post.rb))

--excerption of sunrise_http_post.rb (available somewhere on the web)
...
require 'net/http'

YOUR_ID = 'BGPOWELL' # A unique ID per comment above
YOUR_CITY = 'Fairfax' # The name of your city
YOUR_STATE = 'VA' # Two letter state abbreviation

now = Time.now
month = now.month
day = now.day + 1 # Tomorrow
year = now.year

Net::HTTP.start('aa.usno.navy.mil') do |query|
  response = query.post('/cgi-bin/aa_pap.pl',
FFX=1ID=#{YOUR_ID}xxy=#{year}xxm=#{month}xxd=#{day}st=#{YOUR_STATE}place=#{YOUR_CITY}ZZZ=END)
  if response.body =~ /Begin civil twilight[^0-9]*(\d+:\d{2}
[ap].m.).*Sunrise[^0-9]*(\d+:\d{2} [ap].m.).*Sunset[^0-9]*(\d+:\d{2}
[ap].m.).*End civil twilight[^0-9]*(\d+:\d{2} [ap].m.)/m
puts #{month}/#{day}/#{year}
puts Begin Twilight: #{$1}
puts Sunrise : #{$2}
puts Sunset : #{$3}
puts End Twilight : #{$4}
  end
end



On Fri, Mar 4, 2011 at 6:27 AM, Ian Barton li...@manor-farm.org wrote:


  Hi Ian,

 Ian Barton wrote:

 Has anybody tried adding the functionality of %%(diary-sunrise-sunset)
 (sunrise, sunset time and daylight hours) to the google weather code?


 I just have something like:

 #+CATEGORY: Day/Year
 %%(diary-day-of-year)
 #+CATEGORY: Sunrise
 %%(diary-sunrise-sunset)

 in one of my Agenda files. Sunrise then appears at sunrise time in my
 Agenda
 like:

Sunrise: 6:53.. Sunrise (GMT), sunset 5:52pm (GMT) at
 Wilkesley (10:58 hours daylight)


 Do you have a way to get the sunset located on a line on its own
 (different
 line from the sunrise one)?  That'd be even much nicer...

  No, but I would like one:) If there were separate diary functions for
 sunrise and sunset it would be easy. Maybe I need to look at the diary elisp
 and write my own separate functions.

 Ian.




Re: [O] org google weather

2011-03-04 Thread Nick Dokos
Ian Barton li...@manor-farm.org wrote:

 
  Hi Ian,
 
  Ian Barton wrote:
  Has anybody tried adding the functionality of %%(diary-sunrise-sunset)
  (sunrise, sunset time and daylight hours) to the google weather code?
 
  I just have something like:
 
  #+CATEGORY: Day/Year
  %%(diary-day-of-year)
  #+CATEGORY: Sunrise
  %%(diary-sunrise-sunset)
 
  in one of my Agenda files. Sunrise then appears at sunrise time in my 
  Agenda
  like:
 
  Sunrise: 6:53.. Sunrise (GMT), sunset 5:52pm (GMT) at
  Wilkesley (10:58 hours daylight)
 
  Do you have a way to get the sunset located on a line on its own (different
  line from the sunrise one)?  That'd be even much nicer...
 
 No, but I would like one:) If there were separate diary functions for
 sunrise and sunset it would be easy. Maybe I need to look at the diary
 elisp and write my own separate functions.
 

Quick hack just parsing the output of diary-sunrise-sunset.

I added this early in my org-config file (which is sourced by .emacs)
- modify latitude, longitude to taste:

--8---cut here---start-8---
;;; diary supplement - rich in Ca
(setq calendar-latitude 42.3)
(setq calendar-longitude -71.0)
(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
--8---cut here---end---8---

and this to one of my agenda files:

--8---cut here---start-8---
#+CATEGORY: Weather
%%(diary-sunrise)
%%(diary-sunset)
--8---cut here---end---8---

and I get:

,
| Friday  4 March 2011
|   Weather: 6:16.. Sunrise (EST)
|8:00.. 
|   10:00.. 
|   12:00.. 
|   14:00.. 
|   16:00.. 
|   Weather:17:36.. Sunset (EST)
|   18:00.. 
|   20:00.. 
`

Nick



Re: [O] org google weather

2011-03-04 Thread Bastien
Hi Nick,

Nick Dokos nicholas.do...@hp.com writes:

 Quick hack just parsing the output of diary-sunrise-sunset.

Nice one -- a good candidate for Worg/org-hacks.org ;)

-- 
 Bastien



Re: [O] org google weather

2011-03-04 Thread Konrad Hinsen

On 4 Mar 2011, at 17:38, Nick Dokos wrote:


Quick hack just parsing the output of diary-sunrise-sunset.

...

Nice!

Is there a way to get this inserted only into the day view, but not  
into the week view? In fact, I would like to have that choice for  
agenda items in general. It makes sense (to me at least) to have more  
information in the day view than in the week view.


Konrad.



Re: [O] org google weather

2011-03-04 Thread Nick Dokos
Konrad Hinsen konrad.hin...@fastmail.net wrote:


 Is there a way to get this inserted only into the day view, but not
 into the week view? In fact, I would like to have that choice for
 agenda items in general. It makes sense (to me at least) to have more
 information in the day view than in the week view.
 

Not that I know of, which means one of two things: it's there but I
don't know about it (something that has happened many times in the past
with org) or it's not there and Carsten will have it implemented by
tomorrow morning :-)

Nick

PS. FWIW, I'd like that feature too...





Re: [O] org google weather

2011-03-04 Thread Simon Brown
At Fri, 04 Mar 2011 08:40:23 +,
Ian Barton wrote:
 On 03/03/11 21:37, Simon Brown wrote:
  Has anybody tried adding the functionality of %%(diary-sunrise-sunset)
  (sunrise, sunset time and daylight hours) to the google weather code?
 I just have something like:
 
 #+CATEGORY: Day/Year
 %%(diary-day-of-year)
 #+CATEGORY: Sunrise
 %%(diary-sunrise-sunset)

That's where I am at the moment, with the weather forecast, sunrise
and sunset times on different lines. I was wondering if the two could
be integrated to make a one line weather forecast, sunrise and sunset
times. ?

eg.
Location: (icon) Chance of Rain, [-1,6] ℃, Sunrise 0658 Sunset 1759 1101 hrs of 
daylight

Simon



Re: [O] org google weather

2011-03-04 Thread Nick Dokos
Simon Brown li...@700c.org wrote:

 At Fri, 04 Mar 2011 08:40:23 +,
 Ian Barton wrote:
  On 03/03/11 21:37, Simon Brown wrote:
   Has anybody tried adding the functionality of %%(diary-sunrise-sunset)
   (sunrise, sunset time and daylight hours) to the google weather code?
  I just have something like:
  
  #+CATEGORY: Day/Year
  %%(diary-day-of-year)
  #+CATEGORY: Sunrise
  %%(diary-sunrise-sunset)
 
 That's where I am at the moment, with the weather forecast, sunrise
 and sunset times on different lines. I was wondering if the two could
 be integrated to make a one line weather forecast, sunrise and sunset
 times. ?
 
 eg.
 Location: (icon) Chance of Rain, [-1,6] ℃, Sunrise 0658 Sunset 1759 1101 hrs 
 of daylight
 

Just write your own function to take the individual results and concatenate 
them, e.g.

--8---cut here---start-8---
(defun full-catastrophe ()
  (format %s :: %s (org-google-weather) (diary-sunrise-sunset)))
--8---cut here---end---8---

and add 

--8---cut here---start-8---
%%(full-catastrophe)
--8---cut here---end---8---

to some agenda file.

Nick



Re: [O] org google weather

2011-03-04 Thread Nick Dokos
Nick Dokos nicholas.do...@hp.com wrote:

 
 Just write your own function to take the individual results and concatenate=
  them, e.g.
 
 (defun full-catastrophe ()
   (format %s :: %s (org-google-weather) (diary-sunrise-sunset)))
 
 and add
 
 %%(full-catastrophe)
 
 to some agenda file.
 

BTW, I noticed that semicolons followed by spaces cause trouble:

--8---cut here---start-8---
(defun full-catastrophe ()
  (format a; b))
--8---cut here---end---8---

puts a on one agenda line and b in another. It does not happen
if there is no space after the semicolon. And in case you are wondering,
I saw it when trying Ian's (diary-day-of-year) example, which includes ;  in
its output.

Nick





Re: [O] org google weather

2011-03-04 Thread Simon Brown
At Fri, 04 Mar 2011 17:05:55 -0500,
Nick Dokos wrote:
 Simon Brown li...@700c.org wrote:
  At Fri, 04 Mar 2011 08:40:23 +,
  Ian Barton wrote:
   On 03/03/11 21:37, Simon Brown wrote:
Has anybody tried adding the functionality of %%(diary-sunrise-sunset)
(sunrise, sunset time and daylight hours) to the google weather code?
   I just have something like:
   
   #+CATEGORY: Day/Year
   %%(diary-day-of-year)
   #+CATEGORY: Sunrise
   %%(diary-sunrise-sunset)
  
  That's where I am at the moment, with the weather forecast, sunrise
  and sunset times on different lines. I was wondering if the two could
  be integrated to make a one line weather forecast, sunrise and sunset
  times. ?
  
  eg.
  Location: (icon) Chance of Rain, [-1,6] ℃, Sunrise 0658 Sunset 1759 1101 
  hrs of daylight
  
 
 Just write your own function to take the individual results and concatenate 
 them, e.g.
 
 --8---cut here---start-8---
 (defun full-catastrophe ()
   (format %s :: %s (org-google-weather) (diary-sunrise-sunset)))
 --8---cut here---end---8---
 
 and add 
 
 --8---cut here---start-8---
 %%(full-catastrophe)
 --8---cut here---end---8---

Excellent, I like your style :-)

Simon



Re: [O] org google weather

2011-03-04 Thread Sébastien Vauban
Hi Nick,

Nick Dokos wrote:
 Ian Barton li...@manor-farm.org wrote:
  Ian Barton wrote:
  Has anybody tried adding the functionality of %%(diary-sunrise-sunset)
  (sunrise, sunset time and daylight hours) to the google weather code?
 
  I just have something like:
 
  #+CATEGORY: Day/Year
  %%(diary-day-of-year)
  #+CATEGORY: Sunrise
  %%(diary-sunrise-sunset)
 
  in one of my Agenda files. Sunrise then appears at sunrise time in my
  Agenda like:
 
  Sunrise: 6:53.. Sunrise (GMT), sunset 5:52pm (GMT) at
  Wilkesley (10:58 hours daylight)
 
  Do you have a way to get the sunset located on a line on its own
  (different line from the sunrise one)? That'd be even much nicer...

 No, but I would like one:) If there were separate diary functions for
 sunrise and sunset it would be easy. Maybe I need to look at the diary
 elisp and write my own separate functions.

 Quick hack just parsing the output of diary-sunrise-sunset.

Excellent hack, for at least 2 reasons: the feature itself, and showing us the
way how to enhance the agenda... Thanks a lot.

 I added this early in my org-config file (which is sourced by .emacs)
 [...] and this to one of my agenda files:

 #+CATEGORY: Weather
 %%(diary-sunrise)
 %%(diary-sunset)

 and I get:

 ,
 | Friday  4 March 2011
 |   Weather: 6:16.. Sunrise (EST)
 |8:00.. 
 |   10:00.. 
 |   12:00.. 
 |   14:00.. 
 |   16:00.. 
 |   Weather:17:36.. Sunset (EST)
 |   18:00.. 
 |   20:00.. 
 `

Because of this:

#+begin_src emacs-lisp
(setq org-agenda-default-appointment-duration 60)
#+end_src

I get:

,
| 2011-03-05 Sat
|0:01-1:01  now 
|   Weather: 7:18-8:18  Sunrise (+0100)
|8:00-9:00  
|   10:00-11:00 
|   12:00-13:00 
|   14:00-15:00 
|   16:00-17:00 
|   18:00-19:00 
|   Weather:18:24-19:24 Sunset (+0100)
`

i.e, a not-that-clear indication of when the sunrise/sunset is supposed to
happen.

In this case, it's clearly a one-minute event. Is there, then, a way to avoid
the + 1 hour range computation for it, while keeping the above variable for
other common tasks?

Best regards,
  Seb

-- 
Sébastien Vauban




Re: [O] org google weather

2011-03-04 Thread Nick Dokos
Sébastien Vauban wxhgmqzgw...@spammotel.com wrote:


 Because of this:
 
 #+begin_src emacs-lisp
 (setq org-agenda-default-appointment-duration 60)
 #+end_src
 
 I get:
 
 ,
 | 2011-03-05 Sat
 |0:01-1:01  now 
 |   Weather: 7:18-8:18  Sunrise (+0100)
 |8:00-9:00  
 |   10:00-11:00 
 |   12:00-13:00 
 |   14:00-15:00 
 |   16:00-17:00 
 |   18:00-19:00 
 |   Weather:18:24-19:24 Sunset (+0100)
 `
 
 i.e, a not-that-clear indication of when the sunrise/sunset is supposed to
 happen.
 
 In this case, it's clearly a one-minute event. Is there, then, a way to avoid
 the + 1 hour range computation for it, while keeping the above variable for
 other common tasks?
 

Not that I know of, but maybe a generalization of the feature that
Konrad was looking for might be what's needed: give properties to agenda
entry generators, so e.g. they cause the agenda entry to be only
displayed today, or to be of a given duration (0 in this case, 10 mins
in some other case, 1 hour by default), etc.  The difficult thing is to
make it general enough, concise enough and undestandable enough for mere
mortals to have a chance.

Nick



[O] org google weather

2011-03-03 Thread Simon Brown
Evening all,

Has anybody tried adding the functionality of %%(diary-sunrise-sunset)
(sunrise, sunset time and daylight hours) to the google weather code?

Simon