commit | author | age
|
76bbd0
|
1 |
;ELC |
C |
2 |
;;; Compiled |
|
3 |
;;; in Emacs version 26.1 |
|
4 |
;;; with all optimizations. |
|
5 |
|
|
6 |
;;; This file uses dynamic docstrings, first added in Emacs 19.29. |
|
7 |
|
|
8 |
;;; This file does not contain utf-8 non-ASCII characters, |
|
9 |
;;; and so can be loaded in Emacs versions earlier than 23. |
|
10 |
|
|
11 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
12 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
13 |
|
|
14 |
|
|
15 |
(byte-code "\300\301!\210\300\302!\207" [require cl-lib org-macs] 2) |
|
16 |
#@70 Canonical time duration units. |
|
17 |
See `org-duration-units' for details. |
|
18 |
(defconst org-duration-canonical-units (byte-code "\300\301\302\303BE\207" [("min" . 1) ("h" . 60) "d" 1440] 4) (#$ . 477)) |
|
19 |
(byte-code "\300\301\302\303\304DD\305\306\307\310\311\312\313\314\315\316\317\320\321&\210\300\322\302\303\323DD\324\306\325\306\326\310\311\312\327\320\330&
\207" [custom-declare-variable org-duration-units funcall function #[0 "\300\301\302\303B\304\305B\306\307B\310\311B\257\207" [("min" . 1) ("h" . 60) "d" 1440 "w" 10080 "m" 43200 "y" 525960.0] 7] "Conversion factor to minutes for a duration.\n\nEach entry has the form (UNIT . MODIFIER).\n\nIn a duration string, a number followed by UNIT is multiplied by\nthe specified number of MODIFIER to obtain a duration in minutes.\n\nFor example, the following value\n\n \\=`((\"min\" . 1)\n (\"h\" . 60)\n (\"d\" . ,(* 60 8))\n (\"w\" . ,(* 60 8 5))\n (\"m\" . ,(* 60 8 5 4))\n (\"y\" . ,(* 60 8 5 4 10)))\n\nis meaningful if you work an average of 8 hours per day, 5 days\na week, 4 weeks a month and 10 months a year.\n\nWhen setting this variable outside the Customize interface, make\nsure to call the following command:\n\n \\[org-duration-set-regexps]" :group org-agenda :version "26.1" :package-version (Org . "9.1") :set #[514 "\300\"\210\301 \207" [set-default org-duration-set-regexps] 5 "\n\n(fn VAR VAL)"] :initialize custom-initialize-changed :type (choice (const :tag "H:MM" h:mm) (const :tag "H:MM:SS" h:mm:ss) (alist :key-type (string :tag "Unit") :value-type (number :tag "Modifier"))) org-duration-format #[0 "\300\207" [(("d") (special . h:mm))] 1] "Format definition for a duration.\n\nThe value can be set to, respectively, the symbols `h:mm:ss' or\n`h:mm', which means a duration is expressed as, respectively,\na \"H:MM:SS\" or \"H:MM\" string.\n\nAlternatively, the value can be a list of entries following the\npattern:\n\n (UNIT . REQUIRED?)\n\nUNIT is a unit string, as defined in `org-duration-units'. The\ntime duration is formatted using only the time components that\nare specified here.\n\nUnits with a zero value are skipped, unless REQUIRED? is non-nil.\nIn that case, the unit is always used.\n\nEventually, the list can contain one of the following special\nentries:\n\n (special . h:mm)\n (special . h:mm:ss)\n\n Units shorter than an hour are ignored. The hours and\n minutes part of the duration is expressed unconditionally\n with H:MM, or H:MM:SS, pattern.\n\n (special . PRECISION)\n\n A duration is expressed with a single unit, PRECISION being\n the number of decimal places to show. The unit chosen is the\n first one required or with a non-zero integer part. If there\n is no such unit, the smallest one is used.\n\nFor example,\n\n ((\"d\" . nil) (\"h\" . t) (\"min\" . t))\n\nmeans a duration longer than a day is expressed in days, hours\nand minutes, whereas a duration shorter than a day is always\nexpressed in hours and minutes, even when shorter than an hour.\n\nOn the other hand, the value\n\n ((\"d\" . nil) (\"min\" . nil))\n\nmeans a duration longer than a day is expressed in days and\nminutes, whereas a duration shorter than a day is expressed\nentirely in minutes, even when longer than an hour.\n\nThe following format\n\n ((\"d\" . nil) (special . h:mm))\n\nmeans that any duration longer than a day is expressed with both\na \"d\" unit and a \"H:MM\" part, whereas a duration shorter than\na day is expressed only as a \"H:MM\" string.\n\nEventually,\n\n ((\"d\" . nil) (\"h\" . nil) (special . 2))\n\nexpresses a duration longer than a day as a decimal number, with\na 2-digits fractional part, of \"d\" unit. A duration shorter\nthan a day uses \"h\" unit instead." org-time org-clock (Org . "9.1") (choice (const :tag "Use H:MM" h:mm) (const :tag "Use H:MM:SS" h:mm:ss) (repeat :tag "Use units" (choice (cons :tag "Use units" (string :tag "Unit") (choice (const :tag "Skip when zero" nil) (const :tag "Always used" t))) (cons :tag "Use a single decimal unit" (const special) (integer :tag "Number of decimals")) (cons :tag "Use both units and H:MM" (const special) (const h:mm)) (cons :tag "Use both units and H:MM:SS" (const special) (const h:mm:ss)))))] 16) |
|
20 |
#@161 Regexp matching a duration expressed with H:MM or H:MM:SS format. |
|
21 |
See `org-duration--h:mm:ss-re' to only match the latter. Hours |
|
22 |
can use any number of digits. |
|
23 |
(defconst org-duration--h:mm-re "\\`[ ]*[0-9]+\\(?::[0-9]\\{2\\}\\)\\{1,2\\}[ ]*\\'" (#$ . 4714)) |
|
24 |
#@148 Regexp matching a duration expressed H:MM:SS format. |
|
25 |
See `org-duration--h:mm-re' to also support H:MM format. Hours |
|
26 |
can use any number of digits. |
|
27 |
(defconst org-duration--h:mm:ss-re "\\`[ ]*[0-9]+\\(?::[0-9]\\{2\\}\\)\\{2\\}[ ]*\\'" (#$ . 4981)) |
|
28 |
#@168 Regexp matching a duration with an unit. |
|
29 |
Allowed units are defined in `org-duration-units'. Match group |
|
30 |
1 contains the bare number. Match group 2 contains the unit. |
|
31 |
(defvar org-duration--unit-re nil (#$ . 5236)) |
|
32 |
#@101 Regexp matching a duration expressed with units. |
|
33 |
Allowed units are defined in `org-duration-units'. |
|
34 |
(defvar org-duration--full-re nil (#$ . 5457)) |
|
35 |
#@210 Regexp matching a duration expressed with units and H:MM or H:MM:SS format. |
|
36 |
Allowed units are defined in `org-duration-units'. Match group |
|
37 |
1 contains units part. Match group 2 contains H:MM or H:MM:SS |
|
38 |
part. |
|
39 |
(defvar org-duration--mixed-re nil (#$ . 5611)) |
|
40 |
#@193 Return modifier associated to string UNIT. |
|
41 |
When optional argument CANONICAL is non-nil, refer to |
|
42 |
`org-duration-canonical-units' instead of `org-duration-units'. |
|
43 |
|
|
44 |
(fn UNIT &optional CANONICAL) |
|
45 |
(defalias 'org-duration--modifier #[513 "\302\203\n \202 \"A\206 \303\304\"\207" [org-duration-canonical-units org-duration-units assoc error "Unknown unit: %S"] 5 (#$ . 5875)]) |
|
46 |
#@31 Set duration related regexps. |
|
47 |
(defalias 'org-duration-set-regexps #[0 "\305\306\307\310\311 \"\"\312\"P\313\314\n\211#\313\315\n\211#\211\207" [org-duration-canonical-units org-duration-units org-duration--unit-re org-duration--full-re org-duration--mixed-re "\\([0-9]+\\(?:\\.[0-9]*\\)?\\)[ ]*" regexp-opt mapcar car append t format "\\`[ ]*%s\\(?:[ ]+%s\\)*[ ]*\\'" "\\`[ ]*\\(?1:%s\\(?:[ ]+%s\\)*\\)[ ]+\\(?2:[0-9]+\\(?::[0-9][0-9]\\)\\{1,2\\}\\)[ ]*\\'"] 7 (#$ . 6258) nil]) |
|
48 |
#@51 Non-nil when string S is a time duration. |
|
49 |
|
|
50 |
(fn S) |
|
51 |
(defalias 'org-duration-p #[257 "\211;\2052 \304\305\306#)\266\203\2062 \n\304\305\306#)\266\203\2062 \304\305\306#)\266\203\207" [org-duration--full-re inhibit-changing-match-data org-duration--mixed-re org-duration--h:mm-re nil t string-match] 8 (#$ . 6755)]) |
|
52 |
#@355 Return number of minutes of DURATION string. |
|
53 |
|
|
54 |
When optional argument CANONICAL is non-nil, ignore |
|
55 |
`org-duration-units' and use standard time units value. |
|
56 |
|
|
57 |
A bare number is translated into minutes. The empty string is |
|
58 |
translated into 0.0. |
|
59 |
|
|
60 |
Return value as a float. Raise an error if duration format is |
|
61 |
not recognized. |
|
62 |
|
|
63 |
(fn DURATION &optional CANONICAL) |
|
64 |
(defalias 'org-duration-to-minutes #[513 "\305\232\203 \306\207\247\203 \307!\207\310\311\312#)\266\203\203H \313\314\315\316\"\"\211@A\211@A\211@A\317\206> |