]> code.delx.au - gnu-emacs/blobdiff - lisp/org/org-agenda.el
Simplify now that float-time etc. are built-in
[gnu-emacs] / lisp / org / org-agenda.el
index 3df9fb6d420d3a1b477f582ff6722a45df7fdda8..fd5253ab1b7f8fc08eda3bf721cc973bd95b94e6 100644 (file)
@@ -1,6 +1,6 @@
 ;;; org-agenda.el --- Dynamic task and appointment lists for Org
 
-;; Copyright (C) 2004-2015 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2016 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -433,7 +433,7 @@ This will be spliced into the custom type of
 
 
 (defcustom org-agenda-custom-commands
-  '(("n" "Agenda and all TODO's" ((agenda "") (alltodo ""))))
+  '(("n" "Agenda and all TODOs" ((agenda "") (alltodo ""))))
   "Custom commands for the agenda.
 These commands will be offered on the splash screen displayed by the
 agenda dispatcher \\[org-agenda].  Each entry is a list like this:
@@ -497,7 +497,7 @@ are prefix commands.  For the dispatcher to display useful information, you
 should provide a description for the prefix, like
 
  (setq org-agenda-custom-commands
-   '((\"h\" . \"HOME + Name tag searches\") ; describe prefix \"h\"
+   \\='((\"h\" . \"HOME + Name tag searches\") ; describe prefix \"h\"
      (\"hl\" tags \"+HOME+Lisa\")
      (\"hp\" tags \"+HOME+Peter\")
      (\"hk\" tags \"+HOME+Kim\")))"
@@ -1211,7 +1211,7 @@ For example, 9:30am would become 09:30 rather than  9:30."
   :type 'boolean)
 
 (defun org-agenda-time-of-day-to-ampm (time)
-  "Convert TIME of a string like '13:45' to an AM/PM style time string."
+  "Convert TIME of a string like `13:45' to an AM/PM style time string."
   (let* ((hour-number (string-to-number (substring time 0 -3)))
          (minute (substring time -2))
          (ampm "am"))
@@ -1932,7 +1932,7 @@ list as second element:
 For example, to display a 16px horizontal space for Emacs
 category, you can use:
 
-  (\"Emacs\" '(space . (:width (16))))"
+  (\"Emacs\" \\='(space . (:width (16))))"
   :group 'org-agenda-line-format
   :version "24.1"
   :type '(alist :key-type (string :tag "Regexp matching category")
@@ -1975,7 +1975,7 @@ estimate."
   :type 'boolean)
 
 (defcustom org-agenda-auto-exclude-function nil
-  "A function called with a tag to decide if it is filtered on '/ RET'.
+  "A function called with a tag to decide if it is filtered on `/ RET'.
 The sole argument to the function, which is called once for each
 possible tag, is a string giving the name of the tag.  The
 function should return either nil if the tag should be included
@@ -1990,8 +1990,8 @@ the lower-case version of all tags."
   "Alist of characters and custom functions for bulk actions.
 For example, this value makes those two functions available:
 
-  '((?R set-category)
-    (?C bulk-cut))
+  ((?R set-category)
+   (?C bulk-cut))
 
 With selected entries in an agenda buffer, `B R' will call
 the custom function `set-category' on the selected entries.
@@ -2538,7 +2538,7 @@ For example, if you have a custom agenda command \"p\" and you
 want this command to be accessible only from plain text files,
 use this:
 
-   '((\"p\" ((in-file . \"\\.txt\"))))
+   \\='((\"p\" ((in-file . \"\\.txt\"))))
 
 Here are the available contexts definitions:
 
@@ -2556,7 +2556,7 @@ accessible if there is at least one valid check.
 You can also bind a key to another agenda custom command
 depending on contextual rules.
 
-    '((\"p\" \"q\" ((in-file . \"\\.txt\"))))
+    \\='((\"p\" \"q\" ((in-file . \"\\.txt\"))))
 
 Here it means: in .txt files, use \"p\" as the key for the
 agenda command otherwise associated with \"q\".  (The command
@@ -3815,7 +3815,7 @@ FILTER-ALIST is an alist of filters we need to apply when
 (defvar org-depend-tag-blocked)
 
 (defun org-agenda-dim-blocked-tasks (&optional invisible)
-  "Dim currently blocked TODO's in the agenda display.
+  "Dim currently blocked TODOs in the agenda display.
 When INVISIBLE is non-nil, hide currently blocked TODO instead of
 dimming them."
   (interactive "P")
@@ -3903,7 +3903,7 @@ functions do."
 
 (defvar org-agenda-markers nil
   "List of all currently active markers created by `org-agenda'.")
-(defvar org-agenda-last-marker-time (org-float-time)
+(defvar org-agenda-last-marker-time (float-time)
   "Creation time of the last agenda marker.")
 
 (defun org-agenda-new-marker (&optional pos)
@@ -3911,7 +3911,7 @@ functions do."
 Org-mode keeps a list of these markers and resets them when they are
 no longer in use."
   (let ((m (copy-marker (or pos (point)))))
-    (setq org-agenda-last-marker-time (org-float-time))
+    (setq org-agenda-last-marker-time (float-time))
     (if org-agenda-buffer
        (with-current-buffer org-agenda-buffer
          (push m org-agenda-markers))
@@ -4603,7 +4603,8 @@ in `org-agenda-text-search-extra-files'."
                                             (goto-char (1- end))
                                             (throw :skip t)))
                              (if todo-only
-                                 (cons (concat "^\*+[ \t]+" org-not-done-regexp)
+                                 (cons (concat "^\\*+[ \t]+"
+                                                org-not-done-regexp)
                                        regexps+)
                                regexps+))
                        (goto-char beg)
@@ -4647,7 +4648,8 @@ in `org-agenda-text-search-extra-files'."
        (add-text-properties pos (1- (point)) (list 'face 'org-warning))
        (setq pos (point))
        (unless org-agenda-multi
-         (insert "Press `[', `]' to add/sub word, `{', `}' to add/sub regexp, `C-u r' to edit\n")
+         (insert (substitute-command-keys
+                  "Press `[', `]' to add/sub word, `{', `}' to add/sub regexp, `C-u r' to edit\n"))
          (add-text-properties pos (1- (point))
                               (list 'face 'org-agenda-structure))))
       (org-agenda-mark-header-line (point-min))
@@ -4741,7 +4743,7 @@ for a keyword.  A numeric prefix directly selects the Nth keyword in
                 org-select-this-todo-keyword))
        (setq pos (point))
        (unless org-agenda-multi
-         (insert "Available with `N r': (0)[ALL]")
+         (insert (substitute-command-keys "Available with `N r': (0)[ALL]"))
          (let ((n 0) s)
            (mapc (lambda (x)
                    (setq s (format "(%d)%s" (setq n (1+ n)) x))
@@ -4836,7 +4838,8 @@ The prefix arg TODO-ONLY limits the search to TODO entries."
        (add-text-properties pos (1- (point)) (list 'face 'org-warning))
        (setq pos (point))
        (unless org-agenda-multi
-         (insert "Press `C-u r' to search again with new search string\n"))
+         (insert (substitute-command-keys
+                  "Press `C-u r' to search again with new search string\n")))
        (add-text-properties pos (1- (point)) (list 'face 'org-agenda-structure)))
       (org-agenda-mark-header-line (point-min))
       (when rtnall
@@ -4935,13 +4938,13 @@ the `regexp' or `notregexp' element.
 `todo' and `nottodo' accept as an argument a list of todo
 keywords, which may include \"*\" to match any todo keyword.
 
-    (org-agenda-skip-entry-if 'todo '(\"TODO\" \"WAITING\"))
+    (org-agenda-skip-entry-if \\='todo \\='(\"TODO\" \"WAITING\"))
 
 would skip all entries with \"TODO\" or \"WAITING\" keywords.
 
 Instead of a list, a keyword class may be given.  For example:
 
-    (org-agenda-skip-entry-if 'nottodo 'done)
+    (org-agenda-skip-entry-if \\='nottodo \\='done)
 
 would skip entries that haven't been marked with any of \"DONE\"
 keywords.  Possible classes are: `todo', `done', `any'.
@@ -5228,7 +5231,7 @@ So the example above may also be written as
 The function expects the lisp variables `entry' and `date' to be provided
 by the caller, because this is how the calendar works.  Don't use this
 function from a program - use `org-agenda-get-day-entries' instead."
-  (when (> (- (org-float-time)
+  (when (> (- (float-time)
              org-agenda-last-marker-time)
           5)
     ;; I am not sure if this works with sticky agendas, because the marker
@@ -5240,7 +5243,7 @@ function from a program - use `org-agenda-get-day-entries' instead."
   (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry))
                    (list entry)
                  (org-agenda-files t)))
-        (time (org-float-time))
+        (time (float-time))
         file rtn results)
     (when (or (not org-diary-last-run-time)
              (> (- time
@@ -5909,9 +5912,9 @@ See also the user option `org-agenda-clock-consistency-checks'."
              (throw 'next t))
            (setq ts (match-string 1)
                  te (match-string 3)
-                 ts (org-float-time
+                 ts (float-time
                      (apply 'encode-time (org-parse-time-string ts)))
-                 te (org-float-time
+                 te (float-time
                      (apply 'encode-time (org-parse-time-string te)))
                  dt (- te ts))))
        (cond
@@ -7082,8 +7085,8 @@ their type."
 ;;;###autoload
 (defun org-agenda-set-restriction-lock (&optional type)
   "Set restriction lock for agenda, to current subtree or file.
-Restriction will be the file if TYPE is `file', or if type is the
-universal prefix '(4), or if the cursor is before the first headline
+Restriction will be the file if TYPE is `file', or if TYPE is the
+universal prefix `(4)', or if the cursor is before the first headline
 in the file.  Otherwise, restriction will be to the current subtree."
   (interactive "P")
   (and (equal type '(4)) (setq type 'file))
@@ -9594,7 +9597,7 @@ This is a command that has to be installed in `calendar-mode-map'."
             "Hebrew:     " (calendar-hebrew-date-string date) " (until sunset)\n"
             "Islamic:    " (calendar-islamic-date-string date) " (until sunset)\n"
             "French:     " (calendar-french-date-string date) "\n"
-            "Baha'i:     " (calendar-bahai-date-string date) " (until sunset)\n"
+            "Bahá’í:     " (calendar-bahai-date-string date) " (until sunset)\n"
             "Mayan:      " (calendar-mayan-date-string date) "\n"
             "Coptic:     " (calendar-coptic-date-string date) "\n"
             "Ethiopic:   " (calendar-ethiopic-date-string date) "\n"
@@ -10003,10 +10006,10 @@ calling the function returns nil.  This function takes one
 argument: an entry from `org-agenda-get-day-entries'.
 
 FILTER can also be an alist with the car of each cell being
-either 'headline or 'category.  For example:
+either `headline' or `category'.  For example:
 
-  '((headline \"IMPORTANT\")
-    (category \"Work\"))
+  ((headline \"IMPORTANT\")
+   (category \"Work\"))
 
 will only add headlines containing IMPORTANT or headlines
 belonging to the \"Work\" category.