Date and Time in Emacs

8.1 Timestamps, Deadlines and Scheduling

A timestamp is a specification of a date (possibly with a time or a range of times) in a special format, either ‘<2003-09-16 tue>’ or ‘<2003-09-16 tue 09:39>’ or ‘<2003-09-16 tue 12:00-12:30>’[^1] A timestamp can appear anywhere in the headline or body of an Org tree entry. Its presence causes entries to be shown on specific dates in the agenda (see Weekly/daily agenda). We distinguish:

timestamp, 几个基本概念与变量,
时间戳的顺序,appointment(schedule),  repeater, 还有time range.
所以此处是时间戳, appointment(scheduel)

  1. Plain timestamp; Event; Appointment

    A simple timestamp just assigns a date/time to an item. This is just like writing down an appointment or event in a paper agenda. In the agenda display, the headline of an entry associated with a plain timestamp is shown exactly on that date.

    1
    2
    3
    <2006-11-01 Wed 19:15> 
    * Discussion on climate change
    <2006-11-02 Thu 20:00-22:00> `
    1. Tmestamp with repeater interval(repeater)

    A timestamp may contain a repeater interval, indicating that it applies not only on the given date, but again and again after a certain interval of N days (d), weeks (w), months (m), or years (y). The following shows up in the agenda every Wednesday:

    1
    2
    * Pick up Sam at school   
    <2007-05-16 Wed 12:30 +1w>q
  2. Diary-style sexp entries (这一项可以去掉)

    For more complex date specifications, Org mode supports using the special sexp diary entries implemented in the Emacs calendar/diary package. For example, with optional time:

​ <%%(diary-float t 4 2)>

  1. Time/Date range

    Two timestamps connected by ‘–’ denote a range. The headline is shown on the first and last day of the range, and on any dates that are displayed and fall in the range. Here is an example:

    1
    2
    ** Meeting in Amsterdam
    <2004-08-23 Mon>--<2004-08-26 Thu>
  2. Inactive timestamp

    Just like a plain timestamp, but with square brackets instead of angular ones. These timestamps are inactive in the sense that they do not trigger an entry to show up in the agenda.

    1
    2
    * Gillian comes late for the fifth time   
    [2006-11-01 Wed]

interval(range), repeater,

8.2 Creating Timestamps

For Org mode to recognize timestamps, they need to be in the specific format. All commands listed below produce timestamps in the correct format.

  • C-c . (org-time-stamp)

    Prompt for a date and insert a corresponding timestamp. When point is at an existing timestamp in the buffer, the command is used to modify this timestamp instead of inserting a new one. When this command is used twice in succession, a time range is inserted.When called with a prefix argument, use the alternative format which contains date and time. The default time can be rounded to multiples of 5 minutes. See the option org-time-stamp-rounding-minutes.With two prefix arguments, insert an active timestamp with the current time without prompting.

  • C-c > (org-goto-calendar)

    Access the Emacs calendar for the current date. If there is a timestamp in the current line, go to the corresponding date instead.

只有以上两个常用的快捷键,

<2019-05-16 thu> C-c C-.

<2019-05-16 thu 15:45> #C-u C-c C-.

<2019-05-16 thu 15:46>–<2019-05-16 thu 15:46> #Consecutive

另外还有两节无关紧要的内容.

8.2.1 The Org Manual: The date/time prompt

8.2.2 The Org Manual: Custom time format

q

8.3 Deadlines and Scheduling

A timestamp may be preceded by special keywords to facilitate planning. Both the timestamp and the keyword have to be positioned immediately after the task they refer to.

  • ‘DEADLINE’

    Meaning: the task (most likely a TODO item, though not necessarily) is supposed to be finished on that date.

    On the deadline date, the task is listed in the agenda. In addition, the agenda for today carries a warning about the approaching or missed deadline, starting org-deadline-warning-daysbefore the due date, and continuing until the entry is marked DONE. An example:

    1
    2
    3
    *** TODO write article about the Earth for the Guide
    DEADLINE: <2004-02-29 Sun>
    The editor in charge is [[bbdb:Ford Prefect]]

    You can specify a different lead time for warnings for a specific deadlines using the following syntax. Here is an example with a warning period of 5 days

    1
    DEADLINE: <2004-02-29 Sun -5d>

    宕开一笔, 这里的-5d与find中处理时间的思路是一致的.

    1
    2
    3
    4
    >      +n     for greater than n,
    > - n for less than n,
    > n for exactly n.
    >

    This warning is deactivated if the task gets scheduled and you set org-agenda-skip-deadline-prewarning-if-scheduled to t.

  • ‘SCHEDULED’

    Meaning: you are planning to start working on that task on the given date.

    The headline is listed under the given date66. In addition, a reminder that the scheduled date has passed is present in the compilation for today, until the entry is marked DONE, i.e., the task is automatically forwarded until completed.

    1
    2
    *** TODO Call Trillian for a date on New Years Eve.
    SCHEDULED: <2004-12-25 Sat>

    If you want to delay the display of this task in the agenda, use SCHEDULED: <2004-12-25 Sat -2d>: the task is still scheduled on the 25th but will appear two days later. In case the task contains a repeater, the delay is considered to affect all occurrences; if you want the delay to only affect the first scheduled occurrence of the task, use ‘–2d’ instead. See org-scheduled-delay-days and org-agenda-skip-scheduled-delay-if-deadline for details on how to control this globally or per agenda.

    Important:

    Setting a date for a meeting is just a simple appointment, you should mark this entry with a simple plain timestamp, to get this item shown on the date where it applies. This is a frequent misunderstanding by Org users. In Org mode, scheduling means setting a date when you want to start working on an action item.

    区别schedule and appointments.

You may use timestamps with repeaters in scheduling and deadline entries. Org mode issues early and late warnings based on the assumption that the timestamp represents the nearest instance of the repeater. However, the use of diary S-exp entries like

1
<%%(diary-float t 42)>

in scheduling and deadline timestamps is limited. Org mode does not know enough about the internals of each S-exp function to issue early and late warnings. However, it shows the item on each day where the S-exp entry matches.

总结
核心收获一是区别appointment and schedule, 二是对deadline和schedule的准确定义.

8.3.1 Inserting deadlines or schedules

The following commands allow you to quickly insert a deadline or to schedule an item:67

  • C-c C-d (org-deadline)

    Insert ‘DEADLINE’ keyword along with a stamp. The insertion happens in the line directly following the headline. Remove any ‘CLOSED’ timestamp . When called with a prefix argument, also remove any existing deadline from the entry. Depending on the variable org-log-redeadline, take a note when changing an existing deadline68.

  • C-c C-s (org-schedule)

    Insert ‘SCHEDULED’ keyword along with a stamp. The insertion happens in the line directly following the headline. Remove any ‘CLOSED’ timestamp. When called with a prefix argument, also remove the scheduling date from the entry. Depending on the variable org-log-reschedule, take a note when changing an existing scheduling time69.

  • C-c C-x C-k (org-mark-entry-for-agenda-action)

    Mark the current entry for agenda action. After you have marked the entry like this, you can open the agenda or the calendar to find an appropriate date. With point on the selected date, pressk s or k d to schedule the marked item.

  • C-c / d (org-check-deadlines)

    Create a sparse tree with all deadlines that are either past-due, or which will become due within org-deadline-warning-days. With C-u prefix, show all deadlines in the file. With a numeric prefix, check that many days. For example, C-1 C-c / d shows all deadlines due tomorrow.

  • C-c / b (org-check-before-date)

    Sparse tree for deadlines and scheduled items before a given date.

  • C-c / a (org-check-after-date)

    Sparse tree for deadlines and scheduled items after a given date.

Note that org-schedule and org-deadline supports setting the date by indicating a relative time e.g., ‘+1d’ sets the date to the next day after today, and ‘–1w’ sets the date to the previous week before any current timestamp.

注意事项, 在headline与schedule, deadline之间不要插入任何内容.Do not put any text between this line and the headline.

8.3.2 Repeated tasks

Some tasks need to be repeated again and again. Org mode helps to organize such tasks using a so-called repeater in a ‘DEADLINE’, ‘SCHEDULED’, or plain timestamps70. In the following example:

1
2
** TODO Pay the rent
DEADLINE: <2005-10-01 Sat +1m>

the ‘+1m’ is a repeater; the intended interpretation is that the task has a deadline on ‘<2005-10-01>’ and repeats itself every (one) month starting from that time. You can use yearly, monthly, weekly, daily and hourly repeat cookies by using the ‘y’, ‘w’, ‘m’, ‘d’ and ‘h’ letters. If you need both a repeater and a special warning period in a deadline entry, the repeater should come first and the warning period last

1
DEADLINE: <2005-10-01 Sat +1m -3d>

Deadlines and scheduled items produce entries in the agenda when they are over-due, so it is important to be able to mark such an entry as DONE once you have done so. When you mark a ‘DEADLINE’ or a ‘SCHEDULED’ with the TODO keyword ‘DONE’, it no longer produces entries in the agenda. The problem with this is, however, is that then also the next instance of the repeated entry will not be active. Org mode deals with this in the following way: when you try to mark such an entry DONE, using C-c C-t, it shifts the base date of the repeating timestamp by the repeater interval, and immediately sets the entry state back to TODO71. In the example above, setting the state to DONE would actually switch the date like this:

1
2
** TODO Pay the rent
DEADLINE: <2005-11-01 Tue +1m>

To mark a task with a repeater as DONE, use C– 1 C-c C-t, i.e., org-todo with a numeric prefix argument of ‘-1’

prefix argument是终极的done

A timestamp72 is added under the deadline, to keep a record that you actually acted on the previous instance of this deadline.

As a consequence of shifting the base date, this entry is no longer visible in the agenda when checking past dates, but all future instances will be visible.

With the ‘+1m’ cookie, the date shift is always exactly one month. So if you have not paid the rent for three months, marking this entry DONE still keeps it as an overdue deadline. Depending on the task, this may not be the best way to handle it. For example, if you forgot to call your father for 3 weeks, it does not make sense to call him 3 times in a single day to make up for it. Finally, there are tasks like changing batteries which should always repeat a certain time after the last time you did it. For these tasks, Org mode has special repeaters ‘++’ and ‘.+’. For example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
** TODO Call Father
DEADLINE: <2008-02-10 Sun ++1w>
Marking this DONE shifts the date by at least one week, but also
by as many weeks as it takes to get this date into the future.
However, it stays on a Sunday, even if you called and marked it
done on Saturday.

** TODO Empty kitchen trash
DEADLINE: <2008-02-08 Fri 20:00 ++1d>
Marking this DONE shifts the date by at least one day, and also
by as many days as it takes to get the timestamp into the future.
Since there is a time in the timestamp, the next deadline in the
future will be on today's date if you complete the task before
20:00.

** TODO Check the batteries in the smoke detectors
DEADLINE: <2005-11-01 Tue .+1m>
Marking this DONE will shift the date to one month after today.

这里的两个选项好有意思呀.
还有一点只有appointment的meeting使用plain.

You may have both scheduling and deadline information for a specific task. If the repeater is set for the scheduling information only, you probably want the repeater to be ignored after the deadline. If so, set the variable org-agenda-skip-scheduled-if-deadline-is-shown to repeated-after-deadline. However, any scheduling information without a repeater is no longer relevant once the task is done, and thus, removed upon repeating the task. If you want both scheduling and deadline information to repeat after the same interval, set the same repeater for both timestamps.

An alternative to using a repeater is to create a number of copies of a task subtree, with dates shifted in each copy. The command C-c C-x c was created for this purpose; it is described inStructure Editing.

8.4 Clocking Work Time

Org mode allows you to clock the time you spend on specific tasks in a project. When you start working on an item, you can start the clock. When you stop working on that task, or when you mark the task done, the clock is stopped and the corresponding time interval is recorded. It also computes the total time spent on each subtree73 of a project. And it remembers a history or tasks recently clocked, to that you can jump quickly between a number of tasks absorbing your time.

To save the clock history across Emacs sessions, use:

1
2
(setq org-clock-persist 'history)
(org-clock-persistence-insinuate)

When you clock into a new task after resuming Emacs, the incomplete clock74 is retrieved (see Resolving idle time (1)) and you are prompted about what to do with it.

8.4.1 Clocking commands

  • C-c C-x C-i (org-clock-in)

    Start the clock on the current item (clock-in). This inserts the CLOCK keyword together with a timestamp. If this is not the first clocking of this item, the multiple CLOCK lines are wrapped into a ‘LOGBOOK’ drawer (see also the variable org-clock-into-drawer). You can also overrule the setting of this variable for a subtree by setting a ‘CLOCK_INTO_DRAWER’ or ‘LOG_INTO_DRAWER’ property. When called with a C-u prefix argument, select the task from a list of recently clocked tasks. With two C-u C-u prefixes, clock into the task at point and mark it as the default task; the default task is always be available with letter d when selecting a clocking task. With three C-u C-u C-u prefixes, force continuous clocking by starting the clock when the last clock stopped.While the clock is running, Org shows the current clocking time in the mode line, along with the title of the task. The clock time shown is all time ever clocked for this task and its children. If the task has an effort estimate (see Effort Estimates), the mode line displays the current clocking time against it75. If the task is a repeating one (see Repeated tasks), show only the time since the last reset of the task76. You can exercise more control over show time with the ‘CLOCK_MODELINE_TOTAL’ property. It may have the values ‘current’ to show only the current clocking instance, ‘today’ to show all time clocked on this tasks today—see also the variable org-extend-today-until, all to include all time, or auto which is the default77. Clicking with mouse-1 onto the mode line entry pops up a menu with clocking options.

  • C-c C-x C-o (org-clock-out)

    Stop the clock (clock-out). This inserts another timestamp at the same location where the clock was last started. It also directly computes the resulting time in inserts it after the time range as ‘=>HH:MM’. See the variable org-log-note-clock-out for the possibility to record an additional note together with the clock-out timestamp78.

  • C-c C-x C-x (org-clock-in-last)

    Re-clock the last clocked task. With one C-u prefix argument, select the task from the clock history. With two C-u prefixes, force continuous clocking by starting the clock when the last clock stopped.

  • C-c C-x C-e (org-clock-modify-effort-estimate)

    Update the effort estimate for the current clock task.

  • C-c C-c or C-c C-y (org-evaluate-time-range)

    Recompute the time interval after changing one of the timestamps. This is only necessary if you edit the timestamps directly. If you change them with S- keys, the update is automatic.

  • C-S-UP (org-clock-timestamps-up)

  • C-S-DOWN (org-clock-timestamps-down)

    On CLOCK log lines, increase/decrease both timestamps so that the clock duration keeps the same value.

  • S-M-UP (org-timestamp-up)

  • S-M-DOWN (org-timestamp-down)

    On ‘CLOCK’ log lines, increase/decrease the timestamp at point and the one of the previous, or the next, clock timestamp by the same duration. For example, if you hit S-M-UP to increase a clocked-out timestamp by five minutes, then the clocked-in timestamp of the next clock is increased by five minutes.

  • C-c C-t (org-todo)

    Changing the TODO state of an item to DONE automatically stops the clock if it is running in this same item.

  • C-c C-x C-q (org-clock-cancel)

    Cancel the current clock. This is useful if a clock was started by mistake, or if you ended up working on something else.

  • C-c C-x C-j (org-clock-goto)

    Jump to the headline of the currently clocked in task. With a C-u prefix argument, select the target task from a list of recently clocked tasks.

  • C-c C-x C-d (org-clock-display)

    Display time summaries for each subtree in the current buffer. This puts overlays at the end of each headline, showing the total time recorded under that heading, including the time of any subheadings. You can use visibility cycling to study the tree, but the overlays disappear when you change the buffer (see variable org-remove-highlights-with-change) or press C-c C-c.

The l key may be used in the agenda (see Weekly/daily agenda) to show which tasks have been worked on or closed during a day.

Important: note that both org-clock-out and org-clock-in-last can have a global keybinding and do not modify the window disposition.

这里的命令有点多, 只要先看clock-in和clock-out便可.

8.4.2 The clock table

这一章全部都是没用的,只有前面的三个命令有用.
org-clock-report, org-dbclok-update, C-u C-c C-x C-u全部更新.

Org mode can produce quite complex reports based on the time clocking information. Such a report is called a clock table, because it is formatted as one or several Org tables.

  • C-c C-x C-r (org-clock-report)
    Insert a dynamic block (see Dynamic Blocks) containing a clock report as an Org mode table into the current file. When point is at an existing clock table, just update it. When called with a prefix argument, jump to the first clock report in the current document and update it. The clock table includes archived trees.

  • C-c C-c or C-c C-x C-u (org-dblock-update)
    Update dynamic block at point. Point needs to be in the ‘BEGIN’ line of the dynamic block.

  • C-u C-c C-x C-u

    Update all dynamic blocks (see Dynamic Blocks). This is useful if you have several clock table blocks in a buffer.

  • S-LEFT

  • S-RIGHT (org-clocktable-try-shift)

    Shift the current ‘:block’ interval and update the table. Point needs to be in the ‘#+BEGIN: clocktable’ line for this command. If ‘:block’ is ‘today’, it is shifted to ‘today-1’, etc.

Here is an example of the frame for a clock table as it is inserted into the buffer with the C-c C-x C-r command:

1
2
#+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
#+END: clocktable

The ‘#+BEGIN’ line and specify a number of options to define the scope, structure, and formatting of the report. Defaults for all these options can be configured in the variable org-clocktable-defaults.

First there are options that determine which clock entries are to be selected:

  • ‘:maxlevel’

    Maximum level depth to which times are listed in the table. Clocks at deeper levels are summed into the upper level.

  • ‘:scope’

    The scope to consider. This can be any of the following:‘nil’the current buffer or narrowed region‘file’the full current buffer‘subtree’the subtree where the clocktable is located‘treeN’the surrounding level N tree, for example ‘tree3’‘tree’the surrounding level 1 tree‘agenda’all agenda files‘(“file” …)’scan these files‘FUNCTION’scan files returned by calling FUNCTION with no argument‘file-with-archives’current file and its archives‘agenda-with-archives’all agenda files, including archives

  • ‘:block’

    The time block to consider. This block is specified either absolutely, or relative to the current time and may be any of these formats:‘2007-12-31’New year eve 2007‘2007-12’December 2007‘2007-W50’ISO-week 50 in 2007‘2007-Q2’2nd quarter in 2007‘2007’the year 2007‘today’, ‘yesterday’, ‘today-N’a relative day‘thisweek’, ‘lastweek’, ‘thisweek-N’a relative week‘thismonth’, ‘lastmonth’, ‘thismonth-N’a relative month‘thisyear’, ‘lastyear’, ‘thisyear-N’a relative year‘untilnow’79all clocked time everWhen this option is not set, Org falls back to the value in org-clock-display-default-range, which defaults to the current year.Use S-LEFT or S-RIGHT to shift the time interval.

  • ‘:tstart’

    A time string specifying when to start considering times. Relative times like ‘“<-2w>“’ can also be used. See Matching tags and properties for relative time syntax.

  • ‘:tend’

    A time string specifying when to stop considering times. Relative times like ‘““’ can also be used. See Matching tags and properties for relative time syntax.

  • ‘:wstart’

    The starting day of the week. The default is 1 for Monday.

  • ‘:mstart’

    The starting day of the month. The default is 1 for the first.

  • ‘:step’

    Set to week or day to split the table into chunks. To use this, :block or :tstart, :tend are needed.

  • ‘:stepskip0’

    When non-nil, do not show steps that have zero time.

  • ‘:fileskip0’

    When non-nil, do not show table sections from files which did not contribute.

  • ‘:match’

    A tags match to select entries that should contribute. See Matching tags and properties for the match syntax.

Then there are options that determine the formatting of the table. There options are interpreted by the function org-clocktable-write-default, but you can specify your own function using the ‘:formatter’ parameter.

  • ‘:emphasize’

    When non-nil, emphasize level one and level two items.

  • ‘:lang’

    Language80 to use for descriptive cells like “Task”.

  • ‘:link’

    Link the item headlines in the table to their origins.

  • ‘:narrow’

    An integer to limit the width of the headline column in the Org table. If you write it like ‘50!’, then the headline is also shortened in export.

  • ‘:indent’

    Indent each headline field according to its level.

  • ‘:tcolumns’

    Number of columns to be used for times. If this is smaller than ‘:maxlevel’, lower levels are lumped into one column.

  • ‘:level’

    Should a level number column be included?

  • ‘:sort’

    A cons cell containing the column to sort and a sorting type. E.g., ‘:sort (1 . ?a)’ sorts the first column alphabetically.

  • ‘:compact’

    Abbreviation for ‘:level nil :indent t :narrow 40! :tcolumns 1’. All are overwritten except if there is an explicit ‘:narrow’.

  • ‘:timestamp’

    A timestamp for the entry, when available. Look for ‘SCHEDULED’, ‘DEADLINE’, ‘TIMESTAMP’ and ‘TIMESTAMP_IA’ special properties (see Special Properties), in this order.

  • ‘:tags’

    When this flag is non-nil, show the headline’s tags.

  • ‘:properties’

    List of properties shown in the table. Each property gets its own column.

  • ‘:inherit-props’

    When this flag is non-nil, the values for ‘:properties’ are inherited.

  • ‘:formula’

    Content of a ‘TBLFM’ keyword to be added and evaluated. As a special case, ‘:formula %’ adds a column with % time. If you do not specify a formula here, any existing formula below the clock table survives updates and is evaluated.

  • ‘:formatter’

    A function to format clock data and insert it into the buffer.

To get a clock summary of the current level 1 tree, for the current day, you could write:

1
2
#+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
#+END: clocktable

To use a specific time range you could write81

1
2
3
#+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
:tend "<2006-08-10 Thu 12:00>"
#+END: clocktable

A range starting a week ago and ending right now could be written as

1
2
#+BEGIN: clocktable :tstart "<-1w>" :tend "<now>"
#+END: clocktable

A summary of the current subtree with % times would be

1
2
#+BEGIN: clocktable :scope subtree :link t :formula %
#+END: clocktable

A horizontally compact representation of everything clocked during last week would be

1
2
#+BEGIN: clocktable :scope agenda :block lastweek :compact t
#+END: clocktable

8.4.3 Resolving idle time and continuous clocking

Resolving idle time

本章中的有用信息是可以通过 M-x org-resolve-clocks调出来时间调整的页面.

If you clock in on a work item, and then walk away from your computer—perhaps to take a phone call—you often need to “resolve” the time you were away by either subtracting it from the current clock, or applying it to another one.

By customizing the variable org-clock-idle-time to some integer, such as 10 or 15, Emacs can alert you when you get back to your computer after being idle for that many minutes82, and ask what you want to do with the idle time. There will be a question waiting for you when you get back, indicating how much idle time has passed constantly updated with the current amount, as well as a set of choices to correct the discrepancy:

  • k

    To keep some or all of the minutes and stay clocked in, press k. Org asks how many of the minutes to keep. Press RET to keep them all, effectively changing nothing, or enter a number to keep that many minutes.

  • K

    If you use the shift key and press K, it keeps however many minutes you request and then immediately clock out of that task. If you keep all of the minutes, this is the same as just clocking out of the current task.

  • s

    To keep none of the minutes, use s to subtract all the away time from the clock, and then check back in from the moment you returned.

  • S

    To keep none of the minutes and just clock out at the start of the away time, use the shift key and press S. Remember that using shift always leave you clocked out, no matter which option you choose.

  • C

    To cancel the clock altogether, use C. Note that if instead of canceling you subtract the away time, and the resulting clock amount is less than a minute, the clock is still canceled rather than cluttering up the log with an empty entry.

What if you subtracted those away minutes from the current clock, and now want to apply them to a new clock? Simply clock in to any task immediately after the subtraction. Org will notice that you have subtracted time “on the books”, so to speak, and will ask if you want to apply those minutes to the next task you clock in on.

There is one other instance when this clock resolution magic occurs. Say you were clocked in and hacking away, and suddenly your cat chased a mouse who scared a hamster that crashed into your UPS’s power button! You suddenly lose all your buffers, but thanks to auto-save you still have your recent Org mode changes, including your last clock in.

If you restart Emacs and clock into any task, Org will notice that you have a dangling clock which was never clocked out from your last session. Using that clock’s starting time as the beginning of the unaccounted-for period, Org will ask how you want to resolve that time. The logic and behavior is identical to dealing with away time due to idleness; it is just happening due to a recovery event rather than a set amount of idle time.

You can also check all the files visited by your Org agenda for dangling clocks at any time using M-x org-resolve-clocks RET (or C-c C-x C-z).

Continuous clocking

You may want to start clocking from the time when you clocked out the previous task. To enable this systematically, set org-clock-continuously to non-nil. Each time you clock in, Org retrieves the clock-out time of the last clocked entry for this session, and start the new clock from there.

If you only want this from time to time, use three universal prefix arguments with org-clock-in and two C-u C-u with org-clock-in-last.

8.5 Effort Estimates

If you want to plan your work in a very detailed way, or if you need to produce offers with quotations of the estimated work effort, you may want to assign effort estimates to entries. If you are also clocking your work, you may later want to compare the planned effort with the actual working time, a great way to improve planning estimates. Effort estimates are stored in a special property ‘EFFORT’. You can set the effort for an entry with the following commands:

  • C-c C-x e (org-set-effort)

    Set the effort estimate for the current entry. With a prefix argument, set it to the next allowed value—see below. This command is also accessible from the agenda with the e key.

  • C-c C-x C-e (org-clock-modify-effort-estimate)

    Modify the effort estimate of the item currently being clocked.

Clearly the best way to work with effort estimates is through column view (see Column View). You should start by setting up discrete values for effort estimates, and a ‘COLUMNS’ format that displays these values together with clock sums—if you want to clock your time. For a specific buffer you can use:

1
2
#+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00
#+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort){:} %CLOCKSUM

or, even better, you can set up these values globally by customizing the variables org-global-properties and org-columns-default-format. In particular if you want to use this setup also in the agenda, a global setup may be advised.

The way to assign estimates to individual items is then to switch to column mode, and to use S-RIGHT and S-LEFT to change the value. The values you enter are immediately summed up in the hierarchy. In the column next to it, any clocked time is displayed.

If you switch to column view in the daily/weekly agenda, the effort column summarizes the estimated work effort for each day83, and you can use this to find space in your schedule. To get an overview of the entire part of the day that is committed, you can set the option org-agenda-columns-add-appointments-to-effort-sum. The appointments on a day that take place over a specified time interval are then also added to the load estimate of the day.

Effort estimates can be used in secondary agenda filtering that is triggered with the / key in the agenda (see Agenda Commands). If you have these estimates defined consistently, two or three key presses narrow down the list to stuff that fits into an available time slot.

参考资料

find中的时间, atime, ctime, mtime (-n * 24hours)
amin, cmin, min (n minutes)