• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/emacs-93/emacs/lisp/textmodes/

Lines Matching +defs:time +defs:stamp +defs:format

38 ;; table editor.  Org-mode supports ToDo items, deadlines, time stamps,
79 (require 'time-date)
94 (defconst org-format-transports-properties-p
97 (get-text-property 0 'test (format "%s" x)))
98 "Does format transport text properties?")
173 This option is only relevant at load-time of Org-mode, and must be set
215 A deadline is this string, followed by a time stamp. Should be a word,
224 A schedule is this string, followed by a time stamp. Should be a word,
470 The highlights will automatically disappear the next time the buffer is
482 :group 'org-time
529 When this is set, checkbox statistics is updated each time you either insert
613 (defcustom org-archive-stamp-time t
614 "Non-nil means, add a time stamp to entries moved to an archive file.
615 The time stamp will be added directly after the TODO state keyword in the
635 - Minimize the number of realigns. Normally, the table is aligned each time
793 calc-float-format (float 5)
797 calc-date-format (YYYY "-" MM "-" DD " " Www (" " HH ":" mm))
927 (defcustom org-email-link-description-format "Email %c: %.30s"
1256 %t time stamp, date only
1257 %T time stamp with date and time
1258 %u, %U like the above, but inactive time stamps
1319 :group 'org-time)
1358 "When set, insert a (non-active) time stamp when TODO entry is marked DONE.
1363 the time stamp recording the action should be annotated with a short note.
1404 %t in the heading will be replaced by a time stamp.
1420 to repeat themselves shifted by a certain amount of time, each time an
1442 (defgroup org-time nil
1443 "Options concerning time stamps and deadlines in Org-mode."
1449 When nil, these labeled time stamps are forces into the second line of an
1451 the time stamp will always be forced into the second line."
1452 :group 'org-time
1455 (defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>")
1456 "Formats for `format-time-string' which are used for time stamps.
1459 (defcustom org-time-stamp-rounding-minutes 0
1460 "Number of minutes to round time stamps to upon insertion.
1461 When zero, insert the time unmodified. Useful rounding numbers
1463 When this is not zero, you can still force an exact time-stamp by using
1464 a double prefix argument to a time-stamp command like `C-c .' or `C-c !'."
1465 :group 'org-time
1469 "Non-nil means, overlay custom formats over all time stamps.
1470 The formats are defined through the variable `org-time-stamp-custom-formats'.
1473 :group 'org-time
1478 (defcustom org-time-stamp-custom-formats
1480 "Custom formats for time stamps. See `format-time-string' for the syntax.
1481 These are overlayed over the default ISO format if the variable
1483 :group 'org-time
1486 (defun org-time-stamp-format (&optional long inactive)
1487 "Get the right format for a time string."
1488 (let ((f (if long (cdr org-time-stamp-formats)
1489 (car org-time-stamp-formats))))
1497 :group 'org-time
1505 :group 'org-time
1512 :group 'org-time
1730 (const :format "" tags)
1737 (const :format "" tags-todo)
1744 (const :format "" todo)
1892 dedicated-frame Create one new frame, and re-use it each time.
1893 new-frame Make a new frame each time."
1899 (const :tag "Each time a new frame" new-frame)
1927 (defcustom org-agenda-date-format "%A %d %B %Y"
1930 a format string understood by `format-time-string'.
1947 (defgroup org-agenda-time-grid nil
1948 "Options concerning the time grid in the Org-mode Agenda."
1952 (defcustom org-agenda-use-time-grid t
1953 "Non-nil means, show a time grid in the agenda schedule.
1954 A time grid is a set of lines for specific times (like every two hours between
1958 the variable `org-agenda-time-grid'."
1959 :group 'org-agenda-time-grid
1962 (defcustom org-agenda-time-grid
1967 "The settings for time grid for agenda display.
1974 require-timed show grid only if at least one item has a time specification
1976 The second item is a string which will be places behing the grid time.
1980 :group 'org-agenda-time-grid
2001 (const time-up) (const time-down)
2007 '((agenda time-up category-keep priority-down)
2015 time-up Put entries with time-of-day indications first, early first
2016 time-down Put entries with time-of-day indications first, late first
2028 '(time-up category-keep priority-down)
2029 means: Pull out all entries having a specified time of day and sort them,
2030 in order to make a time schedule for the current day the first thing in the
2031 agenda listing for the day. Of the entries without a time indication, keep
2050 "Non-nil means, items without time are considered late.
2052 time like 15:30 will be considered as 99:01, i.e. later than any items which
2053 do have a time. When nil, the default time is before 0:00. You can use this
2064 (defcustom org-agenda-prefix-format
2072 are format strings.
2073 This format works similar to a printf format, with the following meaning:
2079 %t the time-of-day specification if one applies to the entry, in the
2080 format HH:MM
2091 \"%?-12t\" will result in a 12 character time field if a time of the
2093 not contain a time.
2096 format letter, this character will be appended to the field value if
2097 the value is not empty. For example, the format \"%-12:c\" leads to
2106 - If there is a time-of-day, put it into a 12 chars wide field. If no
2107 time, don't put in an empty field, just skip it (because of '?').
2110 As another example, if you don't want the time-of-day of entries in
2113 (setq org-agenda-prefix-format \" %-11:c% s\")
2118 (string :tag "General format")
2126 (defvar org-prefix-format-compiled nil
2127 "The compiled version of the most recently used prefix format.
2128 See the variable `org-agenda-prefix-format'.")
2131 "Non-nil means, remove duplicate time specifications in agenda items.
2132 When the format `org-agenda-prefix-format' contains a `%t' specifier, a
2133 time-of-day specification in a headline or diary entry is extracted and
2135 \(a timestamp or -range, or just a plain time(range) specification like
2139 that the time should only be removed what it is located at the beginning of
2150 `org-agenda-prefix-format' contains a `%T' specifier."
2155 (const :tag "When prefix format contains %T" prefix)))
2167 (defcustom org-format-latex-options
2307 "If nil, do not export time stamps and associated keywords."
2537 (defcustom org-export-html-title-format "<h1 class=\"title\">%s</h1>\n"
3007 (defface org-time-grid ;; font-lock-variable-name-face
3012 "Face used for time grids."
3058 (defvar org-deadline-time-regexp nil
3059 "Matches the DEADLINE keyword together with a time stamp.")
3060 (make-variable-buffer-local 'org-deadline-time-regexp)
3067 (defvar org-scheduled-time-regexp nil
3068 "Matches the SCHEDULED keyword together with a time stamp.")
3069 (make-variable-buffer-local 'org-scheduled-time-regexp)
3070 (defvar org-closed-time-regexp nil
3071 "Matches the CLOSED keyword together with a time stamp.")
3072 (make-variable-buffer-local 'org-closed-time-regexp)
3074 (defvar org-keyword-time-regexp nil
3075 "Matches any of the 4 keywords, together with the time stamp.")
3076 (make-variable-buffer-local 'org-keyword-time-regexp)
3077 (defvar org-keyword-time-not-clock-regexp nil
3078 "Matches any of the 3 keywords, together with the time stamp.")
3079 (make-variable-buffer-local 'org-keyword-time-not-clock-regexp)
3080 (defvar org-maybe-keyword-time-regexp nil
3082 (make-variable-buffer-local 'org-maybe-keyword-time-regexp)
3251 org-deadline-time-regexp
3257 org-scheduled-time-regexp
3259 org-closed-time-regexp
3261 org-keyword-time-regexp
3267 org-keyword-time-not-clock-regexp
3272 org-maybe-keyword-time-regexp
3491 time stamps, which magically appear in the diary listing of the Emacs
3504 ;; the keymap so late. Still, it is a waste to call this each time
3590 (defun org-current-time ()
3591 "Current time, possibly rounded to `org-time-stamp-rounding-minutes'."
3592 (if (> org-time-stamp-rounding-minutes 0)
3593 (let ((r org-time-stamp-rounding-minutes)
3594 (time (decode-time)))
3595 (apply 'encode-time
3596 (append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r)))))
3597 (nthcdr 2 time))))
3598 (current-time)))
3685 (cons (length (format-time-string (car org-time-stamp-formats)))
3686 (length (format-time-string (cdr org-time-stamp-formats))))
3687 "This holds the lengths of the two different time formats.")
3689 "Regular expression for fast time stamp matching.")
3691 "Regular expression for fast time stamp matching.")
3693 "Regular expression matching time strings for analysis.")
3695 "Regular expression matching time stamps, with groups.")
3697 "Regular expression matching time stamps (also [..]), with groups.")
3699 "Regular expression matching a time stamp range.")
3702 "Regular expression matching a time stamp range.")
3705 "Regular expression matching a time stamp or time stamp range.")
3708 "Regular expression matching a time stamp or time stamp range.
3709 The time stamps may be either active or inactive.")
3755 We use a macro so that the test can happen at compilation time."
3799 (org-display-custom-time (match-beginning 3) (match-end 3)))
3800 (org-display-custom-time (match-beginning 1) (match-end 1)))
3953 (if org-format-transports-properties-p
4384 is kept so that you can work with several indirect buffers at the same time.
4909 Sorting can be alphabetically, numerically, and by date/time as given by
4910 the first time stamp in the entry. The command prompts for the sorting
4982 (if unique (format ", %d duplicates removed" nremoved) ""))))
5013 (time-to-seconds
5014 (org-time-string-to-time (match-string 0 x)))
5164 (format "[%d%%]" (/ (* 100 c-on) (max 1 (+ c-on c-off))))
5165 (format "[%d/%d]" c-on (+ c-on c-off))))))
5421 (insert (format "%d" (setq n (1+ n)))))))
5465 heading be marked DONE, and the current time will be added.
5496 (setq file (format (match-string 1 org-archive-location)
5523 (insert (format "\nArchived entries from file %s\n\n"
5564 (when org-archive-stamp-time
5568 (org-insert-time-stamp (org-current-time) t t "(" ")"))
5851 (setq re (format "^ *\\| *\t *\\| \\{%d,\\}"
5882 (y-or-n-p (format "Overwrite file %s? " file)))
5967 (setq narrow (and org-format-transports-properties-p
5976 ;; At the same time, we remove trailing space.
6042 ;; With invisible characters, `format' does not get the field width right
6058 (setq rfmt (concat rfmt (format rfmt1 ty l))
6059 hfmt (concat hfmt (format hfmt1 (make-string l ?-)))))
6065 (if l (apply 'format rfmt
6161 (setq f (format (if num " %%%ds %s" " %%-%ds %s")
6163 n (format f s))
6166 (setq n (format f new))
6280 (setq txt (format "%d" (+ (string-to-number txt) 1))))
6346 (ref (format "@%d$%d" dline col))
6697 alphabetically, numerically, or by time (as given in a time stamp
7094 If at least one number looks like a time HH:MM or HH:MM:SS, all other
7128 (format "%g" res)
7133 (format "%d:%02d:%02d" h m s))))
7138 (format "Sum of %d items: %-20s (\\[yank] will insert result into buffer)"
7170 (ref (format "@%d$%d" (org-table-current-dline) col))
7185 (ref (format "@%d$%d" (org-table-current-dline)
7203 (format "%s formula $%s=" (if named "Field" "Column") scol)
7276 (format "\\(@[0-9]+\\)?\\$%d=.*?\\(::\\|$\\)" remove)
7277 (format "@%d\\$[0-9]+=.*?\\(::\\|$\\)" remove))))
7531 ;; Parse the format string. Since we have a lot of modes, this is
7532 ;; a lot of work. However, I think calc still uses most of the time.
7544 'calc-float-format
7622 (princ (format "Substitution history of formula
7628 (princ (format " %s^\nError: %s"
7630 (princ (format "Result: %s\nFormat: %s\nFinal: %s"
7632 (if fmt (format fmt (string-to-number ev)) ev)))))
7644 (if fmt (format fmt (string-to-number ev)) ev))
8300 (setq str (if hline (format "I*%-2d" (setq ih (1+ ih)))
8301 (format "%4d" (setq id (1+ id)))))
8456 (mapconcat (lambda (x) (format "%s" x)) keys "' or `")
8804 "Convert the orgtbl-mode TABLE to some other format.
8829 :fmt A format to be used to wrap the field, should contain
8840 :efmt Use this format to print numbers with exponentials.
8841 The format should have %s twice for inserting mantissa
8877 (setq f (format
8879 (if fm (setq f (format fm f)))
8883 (push (apply 'format lfmt line) rtn)
8906 :fmt A format to be used to wrap the field, should contain %s for the
8911 :efmt Format for transforming numbers with exponentials. The format
8945 (setq html (org-format-org-table-html
8968 :fmt fmt A format to be used to wrap the field, should contain
8983 (lambda (x) (format "%.3f" (/ (float x) total)))
9057 (format-time-string
9058 (car org-time-stamp-formats)
9059 (apply 'encode-time
9166 (format "http://groups.google.com/groups?as_umsgid=%s"
9279 according to FMT (default from `org-email-link-description-format')."
9280 (setq fmt (or fmt org-email-link-description-format))
9323 "Concatenate STRINGS, format resulting string with `org-link-format'."
9755 (format "Execute \"%s\" in shell? "
9767 (format "Execute \"%s\" as elisp? "
10017 (setq t1 (time-to-days (org-time-string-to-time t1))
10018 t2 (time-to-days (org-time-string-to-time t2)))
10021 (org-agenda-list nil (time-to-days (org-time-string-to-time
10085 (setq folder (format "[%s@%s]%s" user host file))
10086 (setq folder (format "/%s@%s:%s" user host file))))
10090 (setq folder (format "/%s@%s:%s" user host file))))))
10114 (setq folder (format "%s#%s" folder (match-string 1 article))
10358 (setq cmd (format cmd (shell-quote-argument file)))
10387 (defvar ange-ftp-name-format) ; to silence the XEmacs compiler.
10398 ((and (boundp 'ange-ftp-name-format)
10399 (string-match (car ange-ftp-name-format) file))
10444 (v-t (format-time-string (car org-time-stamp-formats) (org-current-time)))
10445 (v-T (format-time-string (cdr org-time-stamp-formats) (org-current-time)))
10452 org-time-was-given x prompt char time)
10458 (format
10500 (setq org-time-was-given (equal (upcase char) char))
10501 (setq time (org-read-date (equal (upcase char) "U") t nil
10503 (org-insert-time-stamp time org-time-was-given
10588 ;; We need to add a headline: Use time and first buffer line
10590 first (concat "* " (current-time-string)
10661 (read-file-name (format "File name [%s]: " default)
10993 (org-add-planning-info 'closed (org-current-time)
11043 (setq re (concat "\\(" org-scheduled-time-regexp "\\)\\|\\("
11044 org-deadline-time-regexp "\\)"))
11092 (defun org-add-planning-info (what &optional time &rest remove)
11094 WHAT indicates what kind of time stamp to add. TIME indicated the time to use.
11099 (let (org-time-was-given)
11100 (when what (setq time (or time (org-read-date nil 'to-time))))
11105 (org-insert-time-stamp time org-time-was-given)
11116 (looking-at (concat "[^\r\n]*?" org-keyword-time-regexp
11130 (re-search-forward org-scheduled-time-regexp nil t))
11132 (re-search-forward org-deadline-time-regexp nil t))
11134 (re-search-forward org-closed-time-regexp nil t)))
11146 (org-insert-time-stamp time
11147 (or org-time-was-given (eq what 'closed))
11172 "\\(\n[^\r\n]*?" org-keyword-time-not-clock-regexp
11191 (insert (format "# Insert note for %s, finish with C-c C-c.\n\n"
11216 (cons "%t" (format-time-string
11217 (org-time-stamp-format 'long 'inactive)
11218 (current-time)))
11348 (defvar org-remove-priority-next-time nil)
11386 (setq news (format "%c" new))
11433 (format "mouse-2 or RET jump to org file %s"
11474 (setq txt (org-format-agenda-item
11692 (insert (format "%-12s" (concat kwd ":"))
11910 (defvar org-time-was-given) ; dynamically scoped parameter
11913 (defun org-time-stamp (arg)
11914 "Prompt for a date/time and insert a time stamp.
11915 If the user specifies a time like HH:MM, or if this command is called
11916 with a prefix argument, the time stamp will contain date and time.
11918 specified by the user will be filled in from the current date/time.
11919 So if you press just return without typing anything, the time stamp
11920 will represent the current date/time. If there is already a timestamp
11923 (let (org-time-was-given time)
11926 (eq last-command 'org-time-stamp)
11927 (eq this-command 'org-time-stamp))
11929 (setq time (let ((this-command this-command))
11931 (org-insert-time-stamp time (or org-time-was-given arg)))
11933 (setq time (let ((this-command this-command))
11938 (org-insert-time-stamp time (or org-time-was-given arg))))
11941 (setq time (let ((this-command this-command))
11943 (org-insert-time-stamp time (or org-time-was-given arg))))))
11945 (defun org-time-stamp-inactive (&optional arg)
11946 "Insert an inactive time stamp.
11947 An inactive time stamp is enclosed in square brackets instead of angle
11950 So these are more for recording a certain time/date."
11952 (let (org-time-was-given time)
11953 (setq time (org-read-date arg 'totime))
11954 (org-insert-time-stamp time (or org-time-was-given arg) 'inactive)))
11963 (defun org-read-date (&optional with-time to-time from-string prompt)
11966 which will at least partially be understood by `parse-time-string'.
11979 but this can be configured with the variables `parse-time-months' and
11980 `parse-time-weekdays'.
11989 to an internal time.
11991 insert a time. Note that when WITH-TIME is not set, you can still
11992 enter a time, and this function will inform the calling routine about
11993 this change. The calling routine may then choose to change the format
11994 used to insert the time stamp into the buffer to include the time."
11995 (require 'parse-time)
11996 (let* ((org-time-stamp-rounding-minutes
11997 (if (equal with-time '(16)) 0 org-time-stamp-rounding-minutes))
11998 (ct (org-current-time))
11999 (default-time
12000 ;; Default time is either today, or, when entering a range,
12007 'encode-time
12009 (parse-time-string (match-string 1))))
12014 (timestr (format-time-string
12015 (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") default-time))
12017 (format "YYYY-MM-DD [%s]: " timestr)))
12027 (calendar-forward-day (- (time-to-days default-time)
12085 (string-to-number (format-time-string "%Y")))
12089 (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day)
12091 (setq tl (parse-time-string ans)
12092 year (or (nth 5 tl) (string-to-number (format-time-string "%Y" ct)))
12093 month (or (nth 4 tl) (string-to-number (format-time-string "%m" ct)))
12094 day (or (nth 3 tl) (string-to-number (format-time-string "%d" ct)))
12095 hour (or (nth 2 tl) (string-to-number (format-time-string "%H" ct)))
12096 minute (or (nth 1 tl) (string-to-number (format-time-string "%M" ct)))
12103 (setq wday1 (nth 6 (decode-time (encode-time 0 0 0 day month year))))
12106 (if (and (boundp 'org-time-was-given)
12108 (setq org-time-was-given t))
12110 (if to-time
12111 (encode-time second minute hour day month year)
12113 (format "%04d-%02d-%02d %02d:%02d" year month day hour minute)
12114 (format "%04d-%02d-%02d" year month day)))))
12124 (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
12125 (setq org-ans2 (format-time-string "%Y-%m-%d" time))))
12135 (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
12136 (setq org-ans1 (format-time-string "%Y-%m-%d" time)))
12139 (defun org-insert-time-stamp (time &optional with-hm inactive pre post)
12140 "Insert a date stamp for the date given by the internal TIME.
12141 WITH-HM means, use the stamp format that includes the time of the day.
12143 stamp will not contribute to the agenda.
12145 stamp.
12146 The command returns the inserted time stamp."
12147 (let ((fmt (funcall (if with-hm 'cdr 'car) org-time-stamp-formats))
12148 stamp)
12151 (insert (setq stamp (format-time-string fmt time)))
12153 stamp))
12155 (defun org-toggle-time-stamp-overlays ()
12156 "Toggle the use of custom time stamp formats."
12173 (message "Time stamps are overlayed with custom format")
12174 (message "Time stamp overlays removed")))
12176 (defun org-display-custom-time (beg end)
12177 "Overlay modified time stamp format over timestamp between BED and END."
12179 (org-parse-time-string (buffer-substring beg end) t)))
12182 (tf (funcall (if with-hm 'cdr 'car) org-time-stamp-custom-formats))
12183 (time (org-fix-decoded-time t1))
12185 (format-time-string
12186 (substring tf 1 -1) (apply 'encode-time time))
12198 (defun org-translate-time (string)
12199 "Translate all timestamps in STRING to custom format.
12205 t1 with-hm inactive tf time str beg end)
12210 (org-parse-time-string (substring string beg end) t))
12214 org-time-stamp-custom-formats)
12215 time (org-fix-decoded-time t1)
12216 str (format-time-string
12220 (apply 'encode-time time))
12225 (defun org-fix-decoded-time (time)
12226 "Set 0 instead of nil for the first 6 elements of time.
12229 (mapcar (lambda (x) (if (< (setq n (1+ n)) 7) (or x 0) x)) time)))
12231 (defun org-days-to-time (timestamp-string)
12233 (- (time-to-days (org-time-string-to-time timestamp-string))
12234 (time-to-days (current-time))))
12237 "Is the time in TIMESTAMP-STRING close to the current date?"
12238 (and (< (org-days-to-time timestamp-string)
12249 (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
12250 (setq org-ans1 (format-time-string "%Y-%m-%d" time)))
12274 (defun org-evaluate-time-range (&optional to-buffer)
12275 "Evaluate a time range by computing the difference between start and end.
12277 TO-BUFFER, the result is inserted just after the date stamp into the buffer.
12278 If the time range is actually in a table, the result is inserted into the
12280 For time difference computation, a year is assumed to be exactly 365
12284 (org-clock-update-time-maybe)
12290 (error "Not at a time-stamp range, and none found in current line")))
12295 (time1 (org-time-string-to-time ts1))
12296 (time2 (org-time-string-to-time ts2))
12297 (t1 (time-to-seconds time1))
12298 (t2 (time-to-seconds time2))
12330 (if (> y 0) (insert " " (format (if havetime fy fy1) y d h m))
12331 (if (> d 0) (insert " " (format (if havetime fd fd1) d h m))
12332 (insert " " (format fh h m))))
12347 (apply 'format fmt (nreverse l))))
12349 (defun org-time-string-to-time (s)
12350 (apply 'encode-time (org-parse-time-string s)))
12352 (defun org-parse-time-string (s &optional nodefault)
12353 "Parse the standard Org-mode time string.
12354 This should be a lot faster than the normal `parse-time-string'.
12355 If time is not given, defaults to 0:00. However, with optional NODEFAULT,
12386 "Increase the date in the time stamp by one day.
12395 "Decrease the date in the time stamp by one day.
12432 "Change the date in the time stamp at point.
12439 ts time time0)
12454 (setq time0 (org-parse-time-string ts))
12455 (setq time
12456 (apply 'encode-time
12477 (setq time (apply 'encode-time time0))))
12479 (org-insert-time-stamp time with-hm inactive))
12480 (org-clock-update-time-maybe)
12486 (org-recenter-calendar (time-to-days time)))))
12501 If there is a time stamp in the current line, go to that date.
12512 (let ((d1 (time-to-days (current-time)))
12513 (d2 (time-to-days
12514 (org-time-string-to-time (match-string 1)))))
12521 "Insert time stamp corresponding to cursor date in *Calendar* buffer.
12522 If there is already a time stamp at the cursor position, update it."
12526 ;;; The clock for measuring work time.
12540 (when (and (looking-at (concat "[ \t]*" org-keyword-time-regexp))
12548 (setq ts (org-insert-time-stamp (current-time) 'with-hm 'inactive))
12564 (if (and (looking-at (concat "[ \t]*" org-keyword-time-regexp))
12567 (if fail-quietly (throw 'exit nil) (error "Clock start time is gone")))
12570 (setq te (org-insert-time-stamp (current-time) 'with-hm 'inactive))
12571 (setq s (- (time-to-seconds (apply 'encode-time (org-parse-time-string te)))
12572 (time-to-seconds (apply 'encode-time (org-parse-time-string ts))))
12577 (insert " => " (format "%2d:%02d" h m))
12594 "Holds the file total time in minutes, after a call to `org-clock-sum'.")
12610 time)
12616 ;; A time
12619 ts (time-to-seconds
12620 (apply 'encode-time (org-parse-time-string ts)))
12621 te (time-to-seconds
12622 (apply 'encode-time (org-parse-time-string te)))
12632 (setq t1 0 time (aref ltimes level))
12636 (put-text-property (point) (point-at-eol) :org-clock-minutes time))))
12642 If TOTAL-ONLY is non-nil, only show the total time for the entire file
12646 (let (time h m p)
12653 (when (setq time (get-text-property p :org-clock-minutes))
12654 (org-put-clock-overlay time (funcall outline-level))))
12661 (message "Total file time: %d:%02d (%d hours and %d minutes)" h m h m)))
12666 (defun org-put-clock-overlay (time &optional level)
12668 If LEVEL is given, prefix time with a corresponding number of stars.
12671 (let* ((c 60) (h (floor (/ time 60))) (m (- time (* 60 h)))
12681 (org-add-props (format "%s %2d:%02d%s"
12726 (y-or-n-p (format "Clock-out in buffer %s before killing it? "
12733 "Create a table containing a report about clocked time.
12751 (defun org-clock-update-time-maybe ()
12769 (setq s (- (time-to-seconds
12770 (apply 'encode-time (org-parse-time-string te)))
12771 (time-to-seconds
12772 (apply 'encode-time (org-parse-time-string ts))))
12777 (insert " => " (format "%2d:%02d" h m))
12780 (defun org-clock-special-range (key &optional time as-strings)
12781 "Return two times bordering a special time range.
12785 The range is determined relative to TIME. TIME defaults to the current time.
12787 returned by `current time' or `encode-time'. if AS-STRINGS is non-nil,
12789 (let* ((tm (decode-time (or time (current-time))))
12813 (t (error "No such time block %s" key)))
12814 (setq ts (encode-time s m h d month y)
12815 te (encode-time (or s1 s) (or m1 m) (or h1 h)
12817 (setq fm (cdr org-time-stamp-formats))
12819 (cons (format-time-string fm ts) (format-time-string fm te))
12827 ipos time h m p level hlc hdl maxlevel
12837 (if ts (setq ts (time-to-seconds
12838 (apply 'encode-time (org-parse-time-string ts)))))
12839 (if te (setq te (time-to-seconds
12840 (apply 'encode-time (org-parse-time-string te)))))
12845 (format-time-string (cdr org-time-stamp-formats))
12849 (format " Considered range is /%s/." block)
12855 (insert-before-markers "|-\n|0|" "*Total file time*| "
12856 (format "*%d:%02d*" h m)
12861 (when (setq time (get-text-property p :org-clock-minutes))
12869 h (/ time 60)
12870 m (- time (* 60 h)))
12877 (format "%d:%02d" h m)
12887 (defun org-collect-clock-time-entries ()
12903 (setq beg (apply 'encode-time (org-parse-time-string beg))
12904 end (apply 'encode-time (org-parse-time-string end)))
12915 (setq closedp (re-search-forward org-closed-time-regexp next t))
12941 "Mode for time-sorted view on action items in Org-mode files.
13022 (define-key org-agenda-mode-map "g" 'org-agenda-toggle-time-grid)
13121 ["Use Time Grid" org-agenda-toggle-time-grid
13122 :style toggle :selected org-agenda-use-time-grid :active (org-agenda-check-type nil 'agenda)])
13277 (insert (format "\n%-4s%-14s: %s"
13292 (format "set of %d commands" (length match))))))
13683 (defvar org-agenda-last-marker-time (time-to-seconds (current-time))
13684 "Creation time of the last agenda marker.")
13691 (setq org-agenda-last-marker-time (time-to-seconds (current-time)))
13698 (> (- (time-to-seconds (current-time))
13699 org-agenda-last-marker-time)
13727 (y-or-n-p (format "Save file %s? " file)))
13762 "Show a time-sorted view of the entries in the current org file.
13763 Only entries with a time stamp of today or later will be listed. With
13770 (org-compile-prefix-format 'timeline)
13782 (today (time-to-days (current-time)))
13803 (insert (format "\n[... %d empty days omitted]\n\n" (cdr d)))
13824 ; (insert (format-time-string org-agenda-date-format
13825 ; (calendar-time-from-absolute d 0))
13845 inactive time stamps (those in square brackets) are included.
13850 (setq dates (list (time-to-days (current-time)))))
13854 (setq day (time-to-days (org-time-string-to-time
13862 day1 (time-to-days (org-time-string-to-time ts1))
13863 day2 (time-to-days (org-time-string-to-time ts2)))
13908 (org-compile-prefix-format 'agenda)
13917 (today (time-to-days (current-time)))
13989 (insert (format "%-9s %2d %s %4d\n"
13995 ; (insert (format-time-string org-agenda-date-format
13996 ; (calendar-time-from-absolute d 0)) "\n")
14002 (org-agenda-add-time-grid-maybe
14036 (org-compile-prefix-format 'todo)
14038 (let* ((today (time-to-days (current-time)))
14079 (format "(%d)%s" (setq n (1+ n)) x))
14098 (org-compile-prefix-format 'tags)
14122 (format "ORG-AGENDA-ERROR: No such org-file %s" file))
14248 (setq x (org-format-agenda-item "" x "Diary" nil 'time))
14292 'help-echo (format "mouse-2 or RET jump to diary file %s"
14315 :timestamp List the headlines of items containing a date stamp or
14352 (org-compile-prefix-format 'agenda)
14385 (list (format "ORG-AGENDA-ERROR: No such org-file %s" file))
14453 (format "mouse-2 or RET jump to org file %s"
14470 (re-search-forward org-scheduled-time-regexp end t))
14472 (re-search-forward org-deadline-time-regexp end t)
14483 txt (org-format-agenda-item "" (match-string 1) category tags)
14504 "Return the date stamp information for agenda display."
14510 (format "mouse-2 or RET jump to org file %s"
14514 (format-time-string
14515 (car org-time-stamp-formats)
14516 (apply 'encode-time ; DATE bound by calendar
14540 ;; substring should only run to end of time stamp
14549 (setq txt (org-format-agenda-item
14550 (format "%s%s"
14579 (format "mouse-2 or RET jump to org file %s"
14585 (format-time-string
14586 (car org-time-stamp-formats)
14587 (apply 'encode-time ; DATE bound by calendar
14603 ;; substring should only run to end of time stamp
14612 (setq txt (org-format-agenda-item
14632 (format "mouse-2 or RET jump to org file %s"
14634 (regexp org-deadline-time-regexp)
14644 d2 (time-to-days
14645 (org-time-string-to-time (match-string 1)))
14648 ;; If the expiration is within wdays warning time.
14664 (setq txt (org-format-agenda-item
14665 (format "In %3d d.: " diff) head category tags))))
14689 (format "mouse-2 or RET jump to org file %s"
14691 (regexp org-scheduled-time-regexp)
14701 d2 (time-to-days
14702 (org-time-string-to-time (match-string 1)))
14719 (setq txt (org-format-agenda-item
14720 (format "Sched.%2dx: " (- 1 diff)) head
14739 (format "mouse-2 or RET jump to org file %s"
14752 d1 (time-to-days (org-time-string-to-time s1))
14753 d2 (time-to-days (org-time-string-to-time s2)))
14766 (setq txt (org-format-agenda-item
14767 (format (if (= d1 d2) "" "(%d/%d): ")
14783 (defconst org-plain-time-of-day-regexp
14791 "Regular expression to match a plain time or time range.
14795 1 the first time, range or not
14796 8 the second time, if it is a range.")
14798 (defconst org-stamp-time-of-day-regexp
14804 "Regular expression to match a timestamp time or time range.
14808 2 the first time, range or not
14809 4 the second time, if it is a range.")
14811 (defvar org-prefix-has-time nil
14812 "A flag, set by `org-compile-prefix-format'.
14813 The flag is set if the currently compiled format contains a `%t'.")
14815 "A flag, set by `org-compile-prefix-format'.
14816 The flag is set if the currently compiled format contains a `%T'.")
14818 (defun org-format-agenda-item (extra txt &optional category tags dotime
14822 must be a string and replaces the `%s' specifier in the prefix format.
14825 specifier in the format. DOTIME, when non-nil, indicates that a
14826 time-of-day should be extracted from TXT for sorting of this entry, and for
14827 the `%t' specifier in the format. When DOTIME is a string, this string is
14828 searched for a time before TXT is. NOPREFIX is a flag and indicates that
14841 time ; time and tag are needed for the eval of the prefix format
14843 (time-of-day (and dotime (org-get-time-of-day ts)))
14844 stamp plain s0 s1 s2 rtn)
14845 (when (and dotime time-of-day org-prefix-has-time)
14846 ;; Extract starting and ending time and move them to prefix
14847 (when (or (setq stamp (string-match org-stamp-time-of-day-regexp ts))
14848 (setq plain (string-match org-plain-time-of-day-regexp ts)))
14856 (if (and org-agenda-remove-times-when-in-prefix (or stamp plain)
14862 ;; Normalize the time(s) to 24 hour
14863 (if s1 (setq s1 (org-get-time-of-day s1 'string t)))
14864 (if s2 (setq s2 (org-get-time-of-day s2 'string t))))
14880 ;; Prepare the variables needed in the eval of the compiled format
14881 (setq time (cond (s2 (concat s1 "-" s2))
14886 ;; Evaluate the compiled format
14887 (setq rtn (concat (eval org-prefix-format-compiled) txt)))
14893 'time-of-day time-of-day
14899 (defun org-agenda-add-time-grid-maybe (list ndays todayp)
14901 (cond ((not org-agenda-use-time-grid) (throw 'exit list))
14902 ((and todayp (member 'today (car org-agenda-time-grid))))
14903 ((and (= ndays 1) (member 'daily (car org-agenda-time-grid))))
14904 ((member 'weekly (car org-agenda-time-grid)))
14907 (lambda (x) (get-text-property 1 'time-of-day x))
14909 (string (nth 1 org-agenda-time-grid))
14910 (gridtimes (nth 2 org-agenda-time-grid))
14911 (req (car org-agenda-time-grid))
14913 new time)
14917 (while (setq time (pop gridtimes))
14918 (unless (and remove (member time have))
14919 (setq time (int-to-string time))
14920 (push (org-format-agenda-item
14922 (concat (substring time 0 -2) ":" (substring time -2)))
14925 1 (length (car new)) 'face 'org-time-grid (car new))))
14926 (if (member 'time-up org-agenda-sorting-strategy-selected)
14930 (defun org-compile-prefix-format (key)
14931 "Compile the prefix format into a Lisp form that can be evaluated.
14933 `org-prefix-format-compiled'."
14934 (setq org-prefix-has-time nil org-prefix-has-tag nil)
14936 ((stringp org-agenda-prefix-format)
14937 org-agenda-prefix-format)
14938 ((assq key org-agenda-prefix-format)
14939 (cdr (assq key org-agenda-prefix-format)))
14946 '(("c" . category) ("t" . time) ("s" . extra)
14951 (if (equal var 'time) (setq org-prefix-has-time t))
14958 (format ,f (if (equal "" ,var) "" (concat ,var ,c)))))
14959 (setq varform `(format ,f (if (equal ,var "") "" (concat ,var ,c)))))
14963 (setq org-prefix-format-compiled `(format ,s ,@vars))))
14967 ;; the old format
14972 '(time-up category-keep priority-down)))))
14974 (defun org-get-time-of-day (s &optional string mod24)
14975 "Check string S for a time of day.
14976 If found, return it as a military time number between 0 and 2400.
15053 (defsubst org-cmp-time (a b)
15054 "Compare the time-of-day values of strings A and B."
15056 (ta (or (get-text-property 1 'time-of-day a) def))
15057 (tb (or (get-text-property 1 'time-of-day b) def)))
15066 (let* ((time-up (org-cmp-time a b))
15067 (time-down (if time-up (- time-up) nil))
15155 "Go forward in time by `org-agenda-ndays' days.
15167 "Go back in time by `org-agenda-ndays' days.
15212 ;; FIXME: this no longer works if user make date format that starts with a blank
15282 (defun org-agenda-toggle-time-grid ()
15283 "Toggle time grid in an agenda buffer."
15286 (setq org-agenda-use-time-grid (not org-agenda-use-time-grid))
15290 (if org-agenda-use-time-grid "on" "off")))
15300 (if org-agenda-use-time-grid " Grid" "")
15370 (format "Delete entry with %d lines in buffer \"%s\"? "
15541 `org-format-agenda-item'). HDMARKER is checked with
15558 new (org-format-agenda-item "x" newhead cat tags dotime 'noprefix)
15725 (error "Cannot find time stamp"))
15727 (org-agenda-show-new-time marker org-last-changed-timestamp))
15728 (message "Time stamp changed to %s" org-last-changed-timestamp)))
15735 (defun org-agenda-show-new-time (marker stamp)
15736 "Show new date stamp via text properties."
15739 (setq stamp (concat " => " stamp))
15744 (move-to-column (- (window-width) (length stamp)) t)
15748 (gl (make-glyph stamp)))
15755 (list 'display (org-add-props stamp nil
15762 The prefix ARG is passed to the `org-time-stamp' command and can therefore
15763 be used to request time specification in the time stamp."
15776 (error "Cannot find time stamp"))
15777 (org-time-stamp arg)
15778 (message "Time stamp changed to %s" org-last-changed-timestamp)))))
16028 (if (and p (member (car p) (plist-get org-format-latex-options :matchers)))
16049 inline math after \"$22.34\". The LaTeX fragment formatter will only format
16055 (dodollar (member "$" (plist-get org-format-latex-options :matchers)))
16159 (org-format-latex
16176 (defun org-format-latex (prefix &optional dir overlays msg at)
16182 (opt org-format-latex-options)
16204 linkfile (format "%s_%04d.png" prefix cnt)
16205 movefile (format "%s_%04d.png" absprefix cnt)
16843 (org-format-latex
16985 (date (format-time-string "%Y/%m/%d" (current-time)))
16986 (time (format-time-string "%X" (org-current-time)))
17029 (if (and date time)
17030 (insert (concat (nth 2 lang-words) ": " date " " time "\n")))
17072 (format (if todo "%s (*)\n" "%s\n") txt))
17090 (setq line (org-translate-time line)))
17250 (format
17298 ((cdr x) (format "%s(%c)" (car x) (cdr x)))
17388 (setq-default org-maybe-keyword-time-regexp org-maybe-keyword-time-regexp)
17425 (date (format-time-string "%Y/%m/%d" (current-time)))
17426 (time (format-time-string "%X" (org-current-time)))
17488 (insert (format
17503 date time author style))
17509 (if title (insert (format org-export-html-title-format
17515 (insert (format "<h%d>%s</h%d>\n"
17571 (format "sec-%d" head-count))
17576 (format
17650 (setq line (org-html-handle-time-stamps line))
17787 (insert (org-format-table-html table-buffer table-orig-buffer))))
17871 (when (and date time)
17874 date " " time "</p>\n")))
17893 (defun org-format-table-html (lines olines)
17897 (org-format-org-table-html lines)
17913 (org-format-table-table-html lines)
17915 (org-format-table-table-html-using-table-generate-source olines)))))
17917 (defun org-format-org-table-html (lines &optional splice)
17945 (setq head nil) ;; head ends here, first time around
17972 (format "<COL align=\"%s\">"
18011 (defun org-format-table-table-html (lines)
18053 (defun org-format-table-table-html-using-table-generate-source (lines)
18070 (defun org-html-handle-time-stamps (s)
18071 "Format time stamps in string S, or remove them."
18074 (while (string-match org-maybe-keyword-time-regexp s)
18085 (format "@<span class=\"timestamp-kwd\">%s @</span>"
18087 (format " @<span class=\"timestamp\">%s@</span>"
18089 (org-translate-time (match-string 3 s)) 1 -1)))
18091 ;; Line break if line started and ended with time stamp stuff
18112 "Remove tags and time staps from lines going into the toc."
18116 (while (string-match org-maybe-keyword-time-regexp s)
18263 (insert (format "\n<h%d><a name=\"sec-%d\">%s</a></h%d>\n"
18265 (insert (format "\n<h%d>%s</h%d>\n" level title level)))
18355 (format-time-string (cdr org-time-stamp-formats) (current-time))
18388 (princ (format "BEGIN:VEVENT
18415 (princ (format "BEGIN:VTODO
18429 (timezone (cadr (current-time-zone))))
18431 (format "BEGIN:VCALENDAR
18443 "Take a time string S and convert it to iCalendar format.
18445 When INC is non-nil, increase the hour by two (if time string contains
18446 a time), or the day by one (if it does not contain a time)."
18447 (let ((t1 (org-parse-time-string s 'nodefault))
18448 t2 fmt have-time time)
18450 (setq t2 t1 have-time t)
18451 (setq t2 (org-parse-time-string s)))
18455 (if have-time (setq h (+ 2 h)) (setq d (1+ d))))
18456 (setq time (encode-time s mi h d m y)))
18457 (setq fmt (if have-time ":%Y%m%dT%H%M%S" ";VALUE=DATE:%Y%m%d"))
18458 (concat keyword (format-time-string fmt time))))
18643 (define-key org-mode-map "\C-c\C-z" 'org-time-stamp) ; Alternative binding
18644 (define-key org-mode-map "\C-c." 'org-time-stamp) ; Minor-mode reserved
18645 (define-key org-mode-map "\C-c!" 'org-time-stamp-inactive) ; Minor-mode r.
18647 (define-key org-mode-map "\C-c\C-y" 'org-evaluate-time-range)
18680 (define-key org-mode-map "\C-c\C-x\C-t" 'org-toggle-time-stamp-overlays)
19222 ["Timestamp" org-time-stamp t]
19223 ["Timestamp (inactive)" org-time-stamp-inactive t]
19229 ["Compute Time Range" org-evaluate-time-range t]
19233 ["Custom time format" org-toggle-time-stamp-overlays
19245 ["Record DONE time"
19314 (Info-goto-node (format "(org)%s" (or node ""))))
19542 (setq rpl (format (concat (substring (match-string 0 string) 0 -1) "s")
19595 "\\|[ \t]*" org-keyword-time-regexp
19814 ;; So we have to use a one-time post-command-hook to do this.