;;; org.el --- Outline-based notes management and organizer
;; Carstens outline-mode for keeping track of everything.
-;; Copyright (C) 2004-2015 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2016 Free Software Foundation, Inc.
;;
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Maintainer: Carsten Dominik <carsten at orgmode dot org>
to the end of the list. If the package is called org-xyz.el, then you need
to add the symbol `xyz', and the package must have a call to:
- \(provide 'org-xyz)
+ (provide \\='org-xyz)
For export specific modules, see also `org-export-backends'."
:group 'org
interface or run the following code, where VAL stands for the new
value of the variable, after updating it:
- \(progn
- \(setq org-export--registered-backends
- \(org-remove-if-not
- \(lambda (backend)
- \(let ((name (org-export-backend-name backend)))
- \(or (memq name val)
- \(catch 'parentp
- \(dolist (b val)
- \(and (org-export-derived-backend-p b name)
- \(throw 'parentp t)))))))
+ (progn
+ (setq org-export--registered-backends
+ (org-remove-if-not
+ (lambda (backend)
+ (let ((name (org-export-backend-name backend)))
+ (or (memq name val)
+ (catch \\='parentp
+ (dolist (b val)
+ (and (org-export-derived-backend-p b name)
+ (throw \\='parentp t)))))))
org-export--registered-backends))
- \(let ((new-list (mapcar 'org-export-backend-name
+ (let ((new-list (mapcar \\='org-export-backend-name
org-export--registered-backends)))
- \(dolist (backend val)
- \(cond
- \((not (load (format \"ox-%s\" backend) t t))
- \(message \"Problems while trying to load export back-end `%s'\"
+ (dolist (backend val)
+ (cond
+ ((not (load (format \"ox-%s\" backend) t t))
+ (message \"Problems while trying to load export back-end \\=`%s\\='\"
backend))
- \((not (memq backend new-list)) (push backend new-list))))
- \(set-default 'org-export-backends new-list)))
+ ((not (memq backend new-list)) (push backend new-list))))
+ (set-default \\='org-export-backends new-list)))
Adding a back-end to this list will also pull the back-end it
depends on, if any."
When a string, use that string instead.
When a face, use the standard 3 dots, but with the specified face.
The change affects only Org-mode (which will then use its own display table).
-Changing this requires executing `M-x org-mode RET' in a buffer to become
+Changing this requires executing `\\[org-mode]' in a buffer to become
effective."
:group 'org-startup
:type '(choice (const :tag "Default" nil)
[[linkkey:tag][description]]
-The 'linkkey' must be a word word, starting with a letter, followed
-by letters, numbers, '-' or '_'.
+The `linkkey' must be a word word, starting with a letter, followed
+by letters, numbers, `-' or `_'.
If REPLACE is a string, the tag will simply be appended to create the link.
If the string contains \"%s\", the tag will be inserted there. If the string
filename matches the regexp. If you want to
use groups here, use shy groups.
- Example: (\"\\.x?html\\'\" . \"firefox %s\")
+ Example: (\"\\.x?html\\\\='\" . \"firefox %s\")
(\"\\(?:xhtml\\|html\\)\" . \"firefox %s\")
to open *.html and *.xhtml with firefox.
In a custom lisp form, you can access the group matches with
(match-string n link).
- Example: (\"\\.pdf::\\(\\d+\\)\\'\" . \"evince -p %1 %s\")
+ Example: (\"\\.pdf::\\(\\d+\\)\\\\='\" . \"evince -p %1 %s\")
to open [[file:document.pdf::5]] with evince at page 5.
`directory' Matches a directory
:type 'boolean)
(defcustom org-refile-allow-creating-parent-nodes nil
- "Non-nil means allow to create new nodes as refile targets.
+ "Non-nil means allow the creation of new nodes as refile targets.
New nodes are then created by adding \"/new node name\" to the completion
of an existing node. When the value of this variable is `confirm',
new node creation must be confirmed by the user (recommended).
------------------
:type todo-state-change
:from previous state (keyword as a string), or nil, or a symbol
- 'todo' or 'done', to indicate the general type of state.
+ `todo' or `done', to indicate the general type of state.
:to new state, like in :from")
(defcustom org-enforce-todo-dependencies nil
For example,
- \(:days \"%dd\" :hours \"%d\" :require-hours t :minutes \":%02d\"
+ (:days \"%dd\" :hours \"%d\" :require-hours t :minutes \":%02d\"
:require-minutes t)
means durations longer than a day will be expressed in days,
The value
- \(:days \"%dd\" :minutes \"%dm\")
+ (:days \"%dd\" :minutes \"%dm\")
means durations longer than a day will be expressed in days and
minutes, and durations less than a day will be expressed entirely
set it locally for capture buffers, because there no list of
tags in that file can be created dynamically (there are none).
- (add-hook 'org-capture-mode-hook
+ (add-hook \\='org-capture-mode-hook
(lambda ()
(set (make-local-variable
- 'org-complete-tags-always-offer-all-agenda-tags)
+ \\='org-complete-tags-always-offer-all-agenda-tags)
t)))"
:group 'org-tags
:version "24.1"
(defcustom org-format-latex-header "\\documentclass{article}
\\usepackage[usenames]{color}
-\[PACKAGES]
-\[DEFAULT-PACKAGES]
+[PACKAGES]
+[DEFAULT-PACKAGES]
\\pagestyle{empty} % do not remove
% The settings below are copied from fullpage.sty
\\setlength{\\textwidth}{\\paperwidth}
A cell is of the format:
- \( \"options\" \"package\" SNIPPET-FLAG).
+ ( \"options\" \"package\" SNIPPET-FLAG).
If SNIPPET-FLAG is non-nil, the package also needs to be included
when compiling LaTeX snippets into images for inclusion into
A cell is of the format:
- \(\"options\" \"package\" SNIPPET-FLAG)
+ (\"options\" \"package\" SNIPPET-FLAG)
SNIPPET-FLAG, when non-nil, indicates that this package is also
needed when turning LaTeX snippets into images for inclusion into
(defcustom org-hidden-keywords nil
"List of symbols corresponding to keywords to be hidden the org buffer.
-For example, a value '(title) for this list will make the document's title
+For example, a value \\='(title) for this list will make the document's title
appear in the buffer without the initial #+TITLE: keyword."
:group 'org-appearance
:version "24.1"
;; Other stuff we need.
(require 'time-date)
-(unless (fboundp 'time-subtract) (defalias 'time-subtract 'subtract-time))
(require 'easymenu)
(require 'overlay)
(apply 'encode-time
(append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r)))))
(nthcdr 2 time))))
- (if (and past (< (org-float-time (time-subtract (current-time) res)) 0))
- (seconds-to-time (- (org-float-time res) (* r 60)))
+ (if (and past (< (float-time (time-subtract (current-time) res)) 0))
+ (seconds-to-time (- (float-time res) (* r 60)))
res))))
(defun org-today ()
;; Table: enter it or move to the next field.
((org-at-table-p 'any)
(if (org-at-table.el-p)
- (message "Use C-c ' to edit table.el tables")
+ (message "%s" "Use C-c ' to edit table.el tables")
(if arg (org-table-edit-field t)
(org-table-justify-field-maybe)
(call-interactively 'org-table-next-field))))
(org-flag-drawer t))))))
(defun org-cycle-hide-inline-tasks (state)
- "Re-hide inline tasks when switching to 'contents or 'children
+ "Re-hide inline tasks when switching to `contents' or `children'
visibility state."
(case state
(contents
(defconst org-goto-help
"Browse buffer copy, to find location or copy text.%s
RET=jump to location C-g=quit and return to previous location
-\[Up]/[Down]=next/prev headline TAB=cycle visibility [/] org-occur")
+[Up]/[Down]=next/prev headline TAB=cycle visibility [/] org-occur")
(defvar org-goto-start-pos) ; dynamically scoped parameter
unchanged. After RET it will also jump to the location selected
in the indirect buffer and expose the headline hierarchy above.
-With a prefix argument, use the alternative interface: e.g. if
-`org-goto-interface' is 'outline use 'outline-path-completion."
+With a prefix argument, use the alternative interface: e.g., if
+`org-goto-interface' is `outline' use `outline-path-completion'."
(interactive "P")
(org-goto-map)
(let* ((org-refile-targets `((nil . (:maxlevel . ,org-goto-max-level))))
(re-search-forward org-outline-regexp-bol)
(beginning-of-line 0))
(skip-chars-backward " \r\n")
- (and (not (looking-back "^\*+" (line-beginning-position)))
+ (and (not (looking-back "^\\*+" (line-beginning-position)))
(looking-at "[ \t]+") (replace-match ""))
(unless (eobp) (forward-char 1))
(when (looking-at "^\\*")
(if (or (re-search-forward org-ts-regexp end t)
(re-search-forward org-ts-regexp-both end t))
(org-time-string-to-seconds (match-string 0))
- (org-float-time now))))
+ (float-time now))))
((= dcst ?c)
(let ((end (save-excursion (outline-next-heading) (point))))
(if (re-search-forward
(concat "^[ \t]*\\[" org-ts-regexp1 "\\]")
end t)
(org-time-string-to-seconds (match-string 0))
- (org-float-time now))))
+ (float-time now))))
((= dcst ?s)
(let ((end (save-excursion (outline-next-heading) (point))))
(if (re-search-forward org-scheduled-time-regexp end t)
(org-time-string-to-seconds (match-string 1))
- (org-float-time now))))
+ (float-time now))))
((= dcst ?d)
(let ((end (save-excursion (outline-next-heading) (point))))
(if (re-search-forward org-deadline-time-regexp end t)
(org-time-string-to-seconds (match-string 1))
- (org-float-time now))))
+ (float-time now))))
((= dcst ?p)
(if (re-search-forward org-priority-regexp (point-at-eol) t)
(string-to-char (match-string 2))
(lambda (x)
(if (or (string-match org-ts-regexp x)
(string-match org-ts-regexp-both x))
- (org-float-time
+ (float-time
(org-time-string-to-time (match-string 0 x)))
0))
comparefun (if (= dcst sorting-type) '< '>)))
It assumes that is the case when the entry uses a regular
expression which has at least one grouping construct and the
action is either a lisp form or a command string containing
-'%1', i.e. using at least one subexpression match as a
+`%1', i.e. using at least one subexpression match as a
parameter."
(let ((selector (car entry))
(action (cdr entry)))
(setq level (org-reduced-level
(- (match-end 1) (match-beginning 1)))
txt (org-link-display-format (match-string 4))
- txt (replace-regexp-in-string "\\( *\[[0-9]+/?[0-9]*%?\]\\)+$" "" txt)
+ txt (replace-regexp-in-string "\\( *[[0-9]+/?[0-9]*%?]\\)+$" "" txt)
re (format org-complex-heading-regexp-format
(regexp-quote (match-string 4))))
(when org-refile-use-outline-path
With a numeric prefix arg of 0, inhibit note taking for the change.
For calling through lisp, arg is also interpreted in the following way:
-'none -> empty state
-\"\"(empty string) -> switch to empty state
-'done -> switch to DONE
-'nextset -> switch to the next set of keywords
-'previousset -> switch to the previous set of keywords
-\"WAITING\" -> switch to the specified keyword, but only if it
- really is a member of `org-todo-keywords'."
+`none' -> empty state
+\"\" (empty string) -> switch to empty state
+`done' -> switch to DONE
+`nextset' -> switch to the next set of keywords
+`previousset' -> switch to the previous set of keywords
+\"WAITING\" -> switch to the specified keyword, but only if it
+ really is a member of `org-todo-keywords'."
(interactive "P")
(if (and (org-region-active-p) org-loop-over-headlines-in-active-region)
(let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level)
(if (not scope)
(progn
(org-agenda-prepare-buffers
- (list (buffer-file-name (current-buffer))))
+ (and buffer-file-name (list buffer-file-name)))
(setq res (org-scan-tags func matcher todo-only start-level)))
;; Get the right scope
(cond
(setq scope (org-agenda-files t))
(setq scope (org-add-archive-files scope)))
((eq scope 'file)
- (setq scope (list (buffer-file-name))))
+ (setq scope (and buffer-file-name (list buffer-file-name))))
((eq scope 'file-with-archives)
(setq scope (org-add-archive-files (list (buffer-file-name))))))
(org-agenda-prepare-buffers scope)
date with the mouse (button 1). The calendar shows a period of three
months. To scroll it to other months, use the keys `>' and `<'.
If you don't like the calendar, turn it off with
- \(setq org-read-date-popup-calendar nil)
+ (setq org-read-date-popup-calendar nil)
With optional argument TO-TIME, the date will immediately be converted
to an internal time.
(defun org-time-stamp-to-now (timestamp-string &optional seconds)
"Difference between TIMESTAMP-STRING and now in days.
If SECONDS is non-nil, return the difference in seconds."
- (let ((fdiff (if seconds 'org-float-time 'time-to-days)))
+ (let ((fdiff (if seconds 'float-time 'time-to-days)))
(- (funcall fdiff (org-time-string-to-time timestamp-string))
(funcall fdiff (current-time)))))
(match-end (match-end 0))
(time1 (org-time-string-to-time ts1))
(time2 (org-time-string-to-time ts2))
- (t1 (org-float-time time1))
- (t2 (org-float-time time2))
+ (t1 (float-time time1))
+ (t2 (float-time time2))
(diff (abs (- t2 t1)))
(negative (< (- t2 t1) 0))
;; (ys (floor (* 365 24 60 60)))
(error (error "Bad timestamp `%s'%s\nError was: %s"
s (if (not (and buffer pos))
""
- (format " at %d in buffer `%s'" pos buffer))
+ (format-message " at %d in buffer `%s'" pos buffer))
(cdr errdata)))))
(defun org-time-string-to-seconds (s)
"Convert a timestamp string to a number of seconds."
- (org-float-time (org-time-string-to-time s)))
+ (float-time (org-time-string-to-time s)))
(defun org-time-string-to-absolute (s &optional daynr prefer show-all buffer pos)
"Convert a time stamp to an absolute day number.
(error (error "Bad timestamp `%s'%s\nError was: %s"
s (if (not (and buffer pos))
""
- (format " at %d in buffer `%s'" pos buffer))
+ (format-message " at %d in buffer `%s'" pos buffer))
(cdr errdata))))))))
(defun org-days-to-iso-week (days)
(+ (if (eq org-ts-what 'hour) n 0) (nth 2 time0))
(+ (if (eq org-ts-what 'day) n 0) (nth 3 time0))
(+ (if (eq org-ts-what 'month) n 0) (nth 4 time0))
- (+ (if (eq org-ts-what 'year) n 0) (nth 5 time0))
- (nthcdr 6 time0)))
+ (+ (if (eq org-ts-what 'year) n 0) (nth 5 time0))))
(when (and (member org-ts-what '(hour minute))
extra
(string-match "-\\([012][0-9]\\):\\([0-5][0-9]\\)" extra))
((eq predicate 'files)
(lambda (b) (with-current-buffer b (derived-mode-p 'org-mode))))
((eq predicate 'export)
- (lambda (b) (string-match "\*Org .*Export" (buffer-name b))))
+ (lambda (b) (string-match "\\*Org .*Export" (buffer-name b))))
((eq predicate 'agenda)
(lambda (b)
(with-current-buffer b
(member (file-truename bfn) agenda-files)))))
(t (lambda (b) (with-current-buffer b
(or (derived-mode-p 'org-mode)
- (string-match "\*Org .*Export"
+ (string-match "\\*Org .*Export"
(buffer-name b)))))))))
(delq nil
(mapcar
;; a `table.el' type, just give up. At a table row or
;; cell, maybe recalculate line but always align table.
(if (eq (org-element-property :type context) 'table.el)
- (message "Use C-c ' to edit table.el tables")
+ (message "%s" "Use C-c ' to edit table.el tables")
(let ((org-enable-table-editor t))
(if (or (eq type 'table)
;; Check if point is at a TBLFM line.
For example, in this alist:
-\(org-uniquify-alist '((a 1) (b 2) (a 3)))
- => '((a 1 3) (b 2))
+\(org-uniquify-alist \\='((a 1) (b 2) (a 3)))
+ => \\='((a 1 3) (b 2))
merge (a 1) and (a 3) into (a 1 3).
"Non-nil when TIMESTAMP has a time specified."
(org-element-property :hour-start timestamp))
-(defun org-timestamp-format (timestamp format &optional end utc)
+(defun org-timestamp-format (timestamp format &optional end zone)
"Format a TIMESTAMP element into a string.
FORMAT is a format specifier to be passed to
When optional argument END is non-nil, use end of date-range or
time-range, if possible.
-When optional argument UTC is non-nil, time will be expressed as
-Universal Time."
+The optional ZONE is omitted or nil for Emacs local time, t for
+Universal Time, `wall' for system wall clock time, or a string as
+in the TZ environment variable. It can also be a list (as from
+`current-time-zone') or an integer (as from `decode-time')
+applied without consideration for daylight saving time."
(format-time-string
format
(apply 'encode-time
(if end '(:minute-end :hour-end :day-end :month-end :year-end)
'(:minute-start :hour-start :day-start :month-start
:year-start)))))
- utc))
+ zone))
(defun org-timestamp-split-range (timestamp &optional end)
"Extract a timestamp object from a date or time range.
will just
plainly yank the text as it is.
-\[1] The test checks if the first non-white line is a heading
+[1] The test checks if the first non-white line is a heading
and if there are no other headings with fewer stars."
(interactive "P")
(org-yank-generic 'yank arg))