Commit graph

643 commits

Author SHA1 Message Date
Carsten Dominik 5726eb0676 Bind some local variables
* lisp/org-agenda.el (org-agenda-get-scheduled):
(org-agenda-get-timestamps): Bind local variable `show-all'.
2011-03-01 07:27:57 +01:00
Carsten Dominik aaf0e2d6bb Get rid of some compiler warnings
* Makefile (lisp/org-special-blocks.elc): Add dependency on org-compat.el
* lisp/ob-ref.el (org-at-item-p): Declare function.
* lisp/org-agenda.el (diary-time-regexp): defvar.
* lisp/org-archive.el (org-archive-subtree): Bind local variable `infile-p'.
* lisp/org-capture.el (org-capture-insert-template-here): Get template
text from property list, to avoid byte compiler message.
* lisp/org-latex.el (org-export-latex-tables): Bind local variable `width'.
* lisp/org-special-blocks.el (org-compat): Add require statement.
* lisp/org-table.el (orgtbl-ctrl-c-ctrl-c): Bind local variable `const-str'.
* lisp/org.el (org-eval): Moved function here from org-agenda.el.
2011-03-01 07:24:14 +01:00
Bastien Guerry 3655dcbd37 New command `org-agenda-append-agenda' to append agendas.
* org-agenda.el (org-agenda-append-agenda): New command.
(org-agenda-mode-map): New keybinding to this new command.
2011-02-19 12:13:42 +01:00
Bastien Guerry c6dbde1bab Fix bug when redoing a block agenda command.
* org-agenda.el (org-agenda): Set the 'last-args property to
nil when calling `org-agenda'.  Don't kill the local variable
`org-agenda-current-span'.
(org-run-agenda-series): Use the new property 'last-args.
(org-agenda-change-time-span): Use the dynamically set
`org-agenda-overriding-arguments' variable when non-nil.

Thanks to Matt Lundin and Michael Brand for reporting this.
2011-02-18 15:15:54 +01:00
Bastien Guerry fa9dfe52b6 Fix bug when scattering deadline and improve org-agenda-bulk-mark-regexp.
* org-agenda.el (org-agenda-date-later)
(org-agenda-date-earlier): Enhance docstrings.
(org-agenda-bulk-mark-regexp): Only match against headlines.
Send a message when no entry is marked.
(org-agenda-bulk-action): Fix bug about scattering deadlines.
Send an error when trying to scatter outside an agenda or a
timeline view.  Silently fail when trying to scatter sexp
entries.
2011-02-13 17:40:08 +01:00
Bastien Guerry 6132405d05 org-agenda.el: small stylish fix: always use equal. 2011-02-12 14:03:08 +01:00
Bastien Guerry 905d2f7489 Fix small docstring typo. 2011-02-12 14:00:26 +01:00
Bastien Guerry 6d6d24581d Put multiline diary entries on a single line.
* org-agenda.el (org-get-entries-from-diary): Put multiline
diary entries on a single line when lines don't start with a
diary time.

This was requested by Suvayu Ali.
2011-02-12 13:08:14 +01:00
Bastien Guerry e4b762af34 org-agenda.el: fix bug about wrong current span.
Locally kill org-agenda-current-span as a variable, otherwise
the current value of org-agenda-current-span is taken as the
default value when redoing the buffer or calling org-agenda
with a different view.

This might be a temporary fix, as Julien is looking for a
more general solution.  See his message here:

http://article.gmane.org/gmane.emacs.orgmode/37359
2011-02-10 15:30:09 +01:00
Bastien Guerry 7473e3cc78 Revert "Bug: Jumping to a date in the agenda changes view back to 'day' [7.4 (release_7.4.80.g0e5e5)]"
This reverts commit ca7aeada15.
2011-02-09 17:30:20 +01:00
Carsten Dominik ce217d153a Merge branch 'agenda-refresh-clocktable-on-filter-change' 2011-02-09 10:10:04 +01:00
Carsten Dominik 09c5ff8359 Refresh agenda when updating the filter while the clock report is following
* lisp/org-agenda.el (org-agenda-filter-by-tag): Refresh agenda when
updating the filter while the clock report is following the filter.

When the clock table in the agenda has been set up to respect the
current agenda tags filter, modifying the filter will now
automatically rebuild the agenda to make sure that also the clock
report is updated along with it.  Updating the entire agenda is not
strictly necessary - updating the table would be enough.  However,
right now we do not really have a function that will update only the
clock table, as inserting the table is currently part of building the
agenda itself.  Maybe someone can optimize this in the future.

This feature was requested by Sebastien Vauban.
2011-02-09 09:04:04 +01:00
Julien Danjou ca7aeada15 Bug: Jumping to a date in the agenda changes view back to 'day' [7.4 (release_7.4.80.g0e5e5)]
On Sat, Feb 05 2011, Matt Lundin wrote:

> This results in only a day view because org-agenda-current-span is still
> 'day.

Here's a proposal fix.

I could have setq org-agenda-current-span to nil as a work around, but
it seems more logical to just kill all the local variables. That is, a
custom agenda view would not keep any of the local variable of the
previous agenda, which seems logical to me.

>From b48fc7c395dffea60df20c23b26e362ac0354b01 Mon Sep 17 00:00:00 2001
From: Julien Danjou <julien@danjou.info>
Date: Mon, 7 Feb 2011 12:36:42 +0100
Subject: [PATCH] org-agenda: kill local variables in agenda view

* org-agenda.el (org-agenda): Kill all local variables. This
assures we are not keeping buffer variable from an old agenda view
when switching to a new custom agenda.

Signed-off-by: Julien Danjou <julien@danjou.info>
2011-02-08 18:05:31 +01:00
Carsten Dominik ca220e9c40 Merge branch 'fix-todo-list-with-extended-today' 2011-02-06 08:14:58 +01:00
Carsten Dominik 73be48bdf9 Fix bug that would show empty todo list on extended todays
* lisp/org-agenda.el (org-agenda-get-day-entries): Compare DATE with
modified today.

When a user sets org-extend-today-until, the agenda TODO list would
come up empty when requested in the extension period between midnight
and org-extend-today-until.  This problem is new, it was caused by a
patch that introduced the function org-today and used it also
in org-todo-list.

The reason why this caused a problem is a bit difficult.  The agenda
need a date to be defined, and getting todo entries is subject to the
current date being today.  This is a leftover condition from the times
when the TODO list was often part of the daily agenda listing, and the
test is there to avoid that the TODO list comes also up when looking
at the agenda for tomorrow.  Much of this is irrelevant now, because
people use either block agendas, or separate views - but the old
functionality is retained for backward compatibility.

This patch fixes the problem by making `org-agenda-get-day-entries'
check for the date computed by `org-today'.
2011-02-04 17:47:03 +01:00
Bastien Guerry a9d2e4240a Merge branch 'refine-org-agenda-repeating-timestamp-show-all' 2011-02-04 10:56:59 +01:00
Bastien Guerry 809b505ef0 Add a new command: org-agenda-bulk-mark-regexp
* org-agenda.el (org-agenda-bulk-mark-regexp): New command.
(org-agenda-menu): Add the new command to the menu.
(org-agenda-mode-map): Add % as the keybinding for the new
command.
2011-02-03 20:03:51 +01:00
Bastien Guerry f121bc5e72 Make org-agenda-repeating-timestamp-show-all aware of TODO keywords.
* org-agenda.el (org-agenda-repeating-timestamp-show-all):
Allow to use a list of TODO keywords as the value of this
variable.  The agenda will show repeating stamps for entries
matching these TODO keywords.
(org-agenda-get-timestamps, org-agenda-get-deadlines)
(org-agenda-get-scheduled): Allow the use of a list of
keywords in `org-agenda-repeating-timestamp-show-all'.

---
This was suggested by Jeff Horn and supported by Detlef Steuer.
2011-02-02 10:35:56 +01:00
Osamu Okano a017fca37f Various docstrings typo fixes by Osamu OKANO. 2011-02-01 13:05:13 +01:00
Julien Danjou bf46c32aad Bug: Jumping to a date in the agenda changes view back to 'day' [7.4 (release_7.4.80.g0e5e5)]
On Mon, Jan 17 2011, Carsten Dominik wrote:

> have you been following this thread?  I think this has to do with your
> rewrite of the dagenda span stuff.  Maybe you can find out better and
> faster that I why this goes wrong?  Please read the entire thread.

I've followed but not sure I understood what the bug is. But from my
various tries, I found a bug: when pressing 'j', the current span is
discarded.

Attached is a patch that should fix that, even for future use of
`org-agenda-list' with the span unspecified. :)

>From 9dd2fe6650b858a4083ebc083bb8d10a0d6ac7f2 Mon Sep 17 00:00:00 2001
From: Julien Danjou <julien@danjou.info>
Date: Mon, 17 Jan 2011 16:05:28 +0100
Subject: [PATCH] Fix agenda span on date jump

* org-agenda.el (org-agenda-list): Use org-agenda-current-span as a
possible default span if it is set.

Signed-off-by: Julien Danjou <julien@danjou.info>
2011-02-01 12:52:00 +01:00
Julien Danjou 2d747caeab org-agenda: fix regexp in progress for state logging
* org-agenda.el (org-agenda-get-progress): Fix regexp for statep: it
must has \\ at the end of the line. This avoid matching the following
heading when there's no newline between the logged state and the next
heading.

Signed-off-by: Julien Danjou <julien@danjou.info>
2011-01-26 18:24:19 +01:00
Julien Danjou 9658a9909f org-agenda: simplify start/stop/duration time computing
* org-agenda.el (org-format-agenda-item): Simplify time comuting.

Signed-off-by: Julien Danjou <julien@danjou.info>
2011-01-26 11:16:27 +01:00
Matt Lundin 156e6b1466 Add new option for ignoring past or future items in the global todo list
* lisp/org-agenda.el: (org-agenda-todo-ignore-deadlines): New option.
(org-agenda-todo-ignore-scheduled): New option.
(org-agenda-todo-ignore-timestamp): New option.
(org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item): Allow user
to specify custom distance to ignore (future or past).
(org-agenda-todo-custom-ignore-p): New function.

This patch gives users greater control over which past or future items
they would like to ignore in the global todo list. By setting
org-agenda-todo-ignore-scheduled to 7, for instance, a user can ignore
all items scheduled 7 or more days in the future. Similarly, by
setting org-agenda-todo-ignore-scheduled to -1, a user can ignore all
items that are truly in the past (unlike the 'past setting, which
ignores items scheduled today). Thanks to Paul Sexton for the idea for
this new functionality.
2011-01-26 10:59:58 +01:00
Julien Danjou c78bf704ed org-agenda: fix start/end time in timerange
* org-agenda.el (org-agenda-get-blocks): Fix time of start/end
of events with range. This display things like:
<2011-01-22 Sat 14:00>--<2011-01-23 Sun 20:00>
correctly, with the event starting at 14:00 and ending at 20:00.

Signed-off-by: Julien Danjou <julien@danjou.info>
2011-01-25 06:47:09 +01:00
Julien Danjou dc55710b60 Add command to reset agenda time span
* org-agenda.el (org-agenda-reset-view): New function.
(org-agenda-view-mode-dispatch): Bind space to org-agenda-reset-view.

Signed-off-by: Julien Danjou <julien@danjou.info>

* doc/org.texi (Agenda commands): Document `v SPC'.

* doc/orgcard.tex: Document v SPC
2011-01-18 11:14:20 +01:00
Julien Danjou f4984b3205 Bug: Jumping to a date in the agenda changes view back to 'day' [7.4 (release_7.4.80.g0e5e5)]
On Mon, Jan 17 2011, Bernt Hansen wrote:
>
> Thanks for this patch.  I think this fixes the issue I was having with
> 'j' in the agenda switching from week-view back to single-day view when
> org-agenda-ndays is set to 1.
>
> There is still a (new?) problem with jumping to today.
>
> Set the following variable
>
> (setq org-agenda-start-on-weekday 6)
>
> | Key Sequence | Notes                                          |
> |--------------+------------------------------------------------|
> | C-c a a      | Display weekly agenda                          |
> | f            | Go forward a week                              |
> | d            | Display day agenda                             |
> | .            | Go to to day - but it goes to Saturday instead |
>
> This should go to today and not the first day of the week.

Attached is a fix for that.

>From f566a5612560f997f4760144ca850dda5c06bc5e Mon Sep 17 00:00:00 2001
From: Julien Danjou <julien@danjou.info>
Date: Mon, 17 Jan 2011 18:09:30 +0100
Subject: [PATCH] Fix org-agenda-goto-today not respecting the current span.

* org-agenda.el (org-agenda-goto-today): Respect current span.

Signed-off-by: Julien Danjou <julien@danjou.info>
2011-01-17 19:27:09 +01:00
Carsten Dominik a2ec41c79a Implement a global skipping condition
* lisp/org-agenda.el (org-agenda-skip-function-global): New option.
(org-agenda-skip-eval): New function.
(org-agenda-skip): Use `org-agenda-skip-eval' and also check for the
global skipping condition.

This was a request by John Wiegley
2011-01-14 11:28:41 +01:00
Bernt Hansen 8dc6733a2a Display invisible entry text at point when visiting a task from the agenda
* lisp/org-agenda.el (org-agenda-goto): Display invisible entry text
* lisp/org-agenda.el (org-agenda-switch-to): Display invisible entry text

Visiting clock lines with RET or TAB in the agenda can put point on a
folded clock drawer.  This means you are editing invisible/hidden text
inside the task entry.  Now when moving to invisible regions show the
entry so point is always visible.
2011-01-03 13:16:43 +01:00
John Wiegley 3922c2cbc1 Fixed the interval for day scattering
It was [0,LIM), now it's [1,LIM]
2010-12-27 03:34:40 -05:00
Carsten Dominik ce157879de Fix typo 2010-12-21 08:26:34 +01:00
Julien Danjou 2be22d9aa4 org-agenda: allow %() in prefix format
* org-agenda.el (org-compile-prefix-format): Allow %() expression.

Signed-off-by: Julien Danjou <julien@danjou.info>
2010-12-20 13:13:13 +01:00
Julien Danjou 2c1925f2a5 Add org-eval
* org-agenda.el (org-eval): New function.

Signed-off-by: Julien Danjou <julien@danjou.info>
2010-12-20 13:12:25 +01:00
Julien Danjou 3b9822f1a9 Fix org-agenda-prefix-format docstring
* org-agenda.el (org-agenda-prefix-format): Add missing `search' item
  in docstring.

Signed-off-by: Julien Danjou <julien@danjou.info>
2010-12-17 18:23:56 +01:00
John Wiegley c61cdced2f Undid one of the scatter-related changes 2010-12-15 23:31:19 -05:00
John Wiegley 48b11c4420 Fixed an improper use of org-today 2010-12-14 02:02:41 -05:00
Carsten Dominik 98015f3748 Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode 2010-12-13 15:11:14 +01:00
Carsten Dominik fbe3eb4d2a Fix display of current time to show up only today
* lisp/org-agenda.el (org-agenda-add-time-grid-maybe): Show time only
when grid is being made for today.

Patch by Matt Lundin
2010-12-13 10:43:37 +01:00
John Wiegley 3542f0eed9 Scattering tasks first resets them to "today" 2010-12-13 01:20:04 -05:00
Matt Lundin bca4ac9998 Optimize calls to org-is-habit-p
* lisp/org-agenda.el: (org-agenda-get-scheduled) Don't call
  org-is-habit-p until after checking for for
  org-agenda-skip-scheduled-if-done.

Org-agenda-get-scheduled was calling org-is-habit-p on every scheduled
item (including DONE items when org-agenda-skip-scheduled-if-done was
set to t). Tweaking the timing of the test shaves some time off of
agenda construction when org-habit is loaded and
org-agenda-skip-scheduled-if-done is t.

Before:  org-is-habit-p  478         0.2434439999  0.0005092970
After:   org-is-habit-p	 81          0.057944      0.0007153580
2010-12-12 22:26:23 +01:00
Carsten Dominik 1495bc6b08 Add current time to time grid in agenda
* lisp/org-faces.el (org-agenda-current-time): New face.
* lisp/org-agenda.el (org-agenda-show-current-time-in-grid):
(org-agenda-current-time-string): New options.
(org-agenda-add-time-grid-maybe): Add current time to time grid.
2010-12-12 09:26:01 +01:00
Łukasz Stelmach ad006dea13 sexp can set its face (was: Including current time in agenda)
suvayu ali <fatkasuvayu+linux@gmail.com> writes:

> I actually tried to set the text properties for the string instead,
> but looks like org-agenda is ignoring that.
>
> (defun jd:org-current-time ()
>   "Return current-time if date is today."
>   (when (equal date (calendar-current-date))
>     (propertize (format-time-string "%H:%M Current time") 'font-lock-face
> 		'(:weight bold :foreground "DodgerBlue4" :background "snow"))))

To accomplish this you'd have to apply the following patch and use 'face
property rather than font-lock-face.

Why can't a sexp choose its 'face after all?

--8<---------------cut here---------------start------------->8---
--8<---------------cut here---------------end--------------->8---
2010-12-12 08:38:38 +01:00
Carsten Dominik 7666ba421f Version number back to 7.4 2010-12-10 18:49:40 +01:00
Carsten Dominik 76a25715c9 Bump version number to 7.5 2010-12-10 18:43:10 +01:00
John Wiegley 4d575c8a03 C-u B S now scatters tasks across weekdays only 2010-12-06 00:22:55 -05:00
John Wiegley 384e4f08e4 Added a bulk "scattering" command
B S will cause tasks to be rescheduled a random number of days into the
future, with 7 as the default.  This is useful if you've got a ton of
tasks scheduled for today, you realize you'll never deal with them all,
and you just want them to be distributed across the next N days.
2010-12-03 17:52:46 -05:00
John Wiegley beedff9a49 `org-agenda-bulk-mark' now accepts a numerical prefix arg 2010-12-03 17:52:46 -05:00
Carsten Dominik e10e6197e7 Fix forgotten function renaming
* lisp/org-agenda.el (org-agenda-list):
(org-agenda-goto-today): Use `org-today'.
2010-12-03 23:37:55 +01:00
Carsten Dominik 316e7e5fbc Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode
Conflicts:
	lisp/org-agenda.el
2010-12-03 22:03:06 +01:00
Julien Danjou 0d0edd6d21 org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.

* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.

* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.

This patch is pretty huge, so I'll give a bit of context about it.

I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.

On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)

So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
 Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
 I think the name is better choosen. You can set it to a symbol instead of
 only a numeric value. That means you can set it to 'month and it will show
 you the number of days of the current month in your agenda. Better than
 30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
 That means if you press 'f', it will shows you really the next
 org-agenda-current-span ndays, and not something based on "I think you
 want a weekly view".
2010-12-03 13:07:31 +01:00
Robert Pluim c3b2977de6 Fix a docstring
* lisp/org-agenda.el (org-agenda-toggle-deadlines): Fix docstring.

TINYCHANGE
2010-12-03 11:45:03 +01:00