summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorSébastien Delafond <sdelafond@gmail.com>2016-12-28 09:22:34 +0100
committerSébastien Delafond <sdelafond@gmail.com>2016-12-28 09:22:34 +0100
commit22e20457f23e72d264227a96e6f4888cd967f028 (patch)
tree88537844e5a562fae7dfdfa1f0e51af4e7b90703 /lisp
parent3c1786756e434dae5960b1eed5cf1f84e4bd3a07 (diff)
Imported Upstream version 9.0.3
Diffstat (limited to 'lisp')
-rw-r--r--lisp/org-agenda.el12
-rw-r--r--lisp/org-clock.el6
-rw-r--r--lisp/org-info.el26
-rw-r--r--lisp/org-list.el16
-rw-r--r--lisp/org-macs.el8
-rw-r--r--lisp/org-version.el4
-rw-r--r--lisp/org.el6
-rw-r--r--lisp/ox-ascii.el127
-rw-r--r--lisp/ox-beamer.el10
-rw-r--r--lisp/ox.el9
10 files changed, 136 insertions, 88 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index da748af..ce16473 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6098,7 +6098,9 @@ specification like [h]h:mm."
((eq org-agenda-skip-deadline-prewarning-if-scheduled
'pre-scheduled)
;; Set pre-warning to no earlier than SCHEDULED.
- (min (- deadline scheduled) org-deadline-warning-days))
+ (min (- deadline
+ (org-agenda--timestamp-to-absolute scheduled))
+ org-deadline-warning-days))
;; Set pre-warning to deadline.
(t 0))))
(wdays (if suppress-prewarning
@@ -6265,10 +6267,10 @@ scheduled items with an hour specification like [h]h:mm."
(- org-agenda-skip-scheduled-delay-if-deadline))
((eq org-agenda-skip-scheduled-delay-if-deadline
'post-deadline)
- ;; Set delay to no later than DEADLINE. If
- ;; DEADLINE has a repeater, compare last schedule
- ;; repeat and last deadline repeat.
- (min (- schedule deadline) org-scheduled-delay-days))
+ ;; Set delay to no later than DEADLINE.
+ (min (- schedule
+ (org-agenda--timestamp-to-absolute deadline))
+ org-scheduled-delay-days))
(t 0))))
(ddays
(cond
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 65c13fd..6e58ce9 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -2962,9 +2962,9 @@ The details of what will be saved are regulated by the variable
(defun org-clock-load ()
"Load clock-related data from disk, maybe resuming a stored clock."
(when (and org-clock-persist (not org-clock-loaded))
- (if (file-readable-p org-clock-persist-file)
- (message "Restoring clock data")
- (message "Not restoring clock data; %S not found" org-clock-persist-file)
+ (if (not (file-readable-p org-clock-persist-file))
+ (message "Not restoring clock data; %S not found" org-clock-persist-file)
+ (message "Restoring clock data")
;; Load history.
(load-file org-clock-persist-file)
(setq org-clock-loaded t)
diff --git a/lisp/org-info.el b/lisp/org-info.el
index d82168e..b6e8e09 100644
--- a/lisp/org-info.el
+++ b/lisp/org-info.el
@@ -97,21 +97,21 @@ Taken from <http://www.gnu.org/software/emacs/manual/html_mono/.>")
(defconst org-info-other-documents
'(("libc" . "http://www.gnu.org/software/libc/manual/html_mono/libc.html")
("make" . "http://www.gnu.org/software/make/manual/make.html"))
- "Alist of documents generated from texinfo source.
-
-When converting info links to html, links to any one of these manuals are
-converted to use these URL's.")
+ "Alist of documents generated from Texinfo source.
+When converting info links to HTML, links to any one of these manuals are
+converted to use these URL.")
(defun org-info-map-html-url (filename)
- "Given info FILENAME, either return it (plus '.html' suffix added) or convert
-it to URL pointing to the official page on internet, e.g., use gnu.org for all
-emacs related documents. See `org-info-official-gnu-document' and
-`org-info-other-documents' for details."
- (if (member filename org-info-emacs-documents)
- (format "http://www.gnu.org/software/emacs/manual/html_mono/%s.html"
- filename)
- (let ((url (cdr (assoc filename org-info-other-documents))))
- (or url (concat filename ".html")))))
+ "Return URL or HTML file associated to Info FILENAME.
+If FILENAME refers to an official GNU document, return a URL pointing to
+the official page for that document, e.g., use \"gnu.org\" for all Emacs
+related documents. Otherwise, append \".html\" extension to FILENAME.
+See `org-info-emacs-documents' and `org-info-other-documents' for details."
+ (cond ((member filename org-info-emacs-documents)
+ (format "http://www.gnu.org/software/emacs/manual/html_mono/%s.html"
+ filename))
+ ((cdr (assoc filename org-info-other-documents)))
+ (t (concat filename ".html"))))
(defun org-info-export (path desc format)
"Export an info link.
diff --git a/lisp/org-list.el b/lisp/org-list.el
index bb39b6e..1eb1b50 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -2097,11 +2097,19 @@ Possible values are: `folded', `children' or `subtree'. See
"Return column at which body of ITEM should start."
(save-excursion
(goto-char item)
- (looking-at "[ \t]*\\(\\S-+\\)\\(.*[ \t]+::\\)?\\([ \t]+\\|$\\)")
- (if (match-beginning 2)
- (let ((start (1+ (match-end 2)))
+ (if (save-excursion
+ (end-of-line)
+ (re-search-backward
+ "[ \t]::\\([ \t]\\|$\\)" (line-beginning-position) t))
+ ;; Descriptive list item. Body starts after item's tag, if
+ ;; possible.
+ (let ((start (1+ (- (match-beginning 1) (line-beginning-position))))
(ind (org-get-indentation)))
- (if (> start (+ ind org-list-description-max-indent)) (+ ind 5) start))
+ (if (> start (+ ind org-list-description-max-indent))
+ (+ ind 5)
+ start))
+ ;; Regular item. Body starts after bullet.
+ (looking-at "[ \t]*\\(\\S-+\\)")
(+ (progn (goto-char (match-end 1)) (current-column))
(if (and org-list-two-spaces-after-bullet-regexp
(string-match-p org-list-two-spaces-after-bullet-regexp
diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index 6c0abcb..b7da6c6 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -194,11 +194,11 @@ program is needed for, so that the error message can be more informative."
(<= (match-beginning n) pos)
(>= (match-end n) pos)))
-(defun org-match-line (re)
- "Looking-at at the beginning of the current line."
+(defun org-match-line (regexp)
+ "Match REGEXP at the beginning of the current line."
(save-excursion
- (goto-char (point-at-bol))
- (looking-at re)))
+ (beginning-of-line)
+ (looking-at regexp)))
(defun org-plist-delete (plist property)
"Delete PROPERTY from PLIST.
diff --git a/lisp/org-version.el b/lisp/org-version.el
index cd5f875..bae032b 100644
--- a/lisp/org-version.el
+++ b/lisp/org-version.el
@@ -5,13 +5,13 @@
(defun org-release ()
"The release version of Org.
Inserted by installing Org mode or when a release is made."
- (let ((org-release "9.0.2"))
+ (let ((org-release "9.0.3"))
org-release))
;;;###autoload
(defun org-git-version ()
"The Git version of org-mode.
Inserted by installing Org or when a release is made."
- (let ((org-git-version "9.0.2-dist"))
+ (let ((org-git-version "9.0.3-dist"))
org-git-version))
;;;###autoload
(defvar org-odt-data-dir "/usr/share/emacs/etc/org"
diff --git a/lisp/org.el b/lisp/org.el
index 08b3f3a..68befe3 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -21157,8 +21157,8 @@ This command does many different things, depending on context:
;; Limit to supported contexts.
'(babel-call clock dynamic-block footnote-definition
footnote-reference inline-babel-call inline-src-block
- item keyword node-property paragraph plain-list
- property-drawer radio-target src-block
+ inlinetask item keyword node-property paragraph
+ plain-list property-drawer radio-target src-block
statistics-cookie table table-cell table-row
timestamp)
t))
@@ -22773,7 +22773,7 @@ be set to a buffer or a buffer name. `shell-command' then uses
it for output."
(let* ((base-name (file-name-base source))
(full-name (file-truename source))
- (out-dir (file-name-directory source))
+ (out-dir (or (file-name-directory source) "./"))
(output (expand-file-name (concat base-name "." ext) out-dir))
(time (current-time))
(err-msg (if (stringp err-msg) (concat ". " err-msg) "")))
diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el
index 43808aa..430c2cc 100644
--- a/lisp/ox-ascii.el
+++ b/lisp/ox-ascii.el
@@ -896,41 +896,71 @@ is a plist used as a communication channel."
(car (org-element-contents element))))
'link unique-link-p info nil 'headline t)))
+(defun org-ascii--describe-datum (datum info)
+ "Describe DATUM object or element.
+If DATUM is a string, consider it to be a file name, per
+`org-export-resolve-id-link'. INFO is the communication channel,
+as a plist."
+ (pcase (org-element-type datum)
+ (`plain-text (format "See file %s" datum)) ;External file
+ (`headline
+ (format (org-ascii--translate "See section %s" info)
+ (if (org-export-numbered-headline-p datum info)
+ (mapconcat #'number-to-string
+ (org-export-get-headline-number datum info)
+ ".")
+ (org-export-data (org-element-property :title datum) info))))
+ (_
+ (let ((number (org-export-get-ordinal
+ datum info nil #'org-ascii--has-caption-p))
+ ;; If destination is a target, make sure we can name the
+ ;; container it refers to.
+ (enumerable
+ (org-element-lineage datum '(headline paragrah src-block table) t)))
+ (pcase (org-element-type enumerable)
+ (`headline
+ (format (org-ascii--translate "See section %s" info)
+ (if (org-export-numbered-headline-p enumerable info)
+ (mapconcat #'number-to-string number ".")
+ (org-export-data
+ (org-element-property :title enumerable) info))))
+ ((guard (not number))
+ (org-ascii--translate "Unknown reference" info))
+ (`paragraph
+ (format (org-ascii--translate "See figure %s" info) number))
+ (`src-block
+ (format (org-ascii--translate "See listing %s" info) number))
+ (`table
+ (format (org-ascii--translate "See table %s" info) number))
+ (_ (org-ascii--translate "Unknown reference" info)))))))
+
(defun org-ascii--describe-links (links width info)
"Return a string describing a list of links.
-
LINKS is a list of link type objects, as returned by
`org-ascii--unique-links'. WIDTH is the text width allowed for
the output string. INFO is a plist used as a communication
channel."
(mapconcat
(lambda (link)
- (let ((type (org-element-property :type link))
- (anchor (let ((desc (org-element-contents link)))
- (if desc (org-export-data desc info)
- (org-element-property :raw-link link)))))
+ (let* ((type (org-element-property :type link))
+ (description (org-element-contents link))
+ (anchor (org-export-data
+ (or description (org-element-property :raw-link link))
+ info)))
(cond
- ;; Coderefs, radio links and fuzzy links are ignored.
- ((member type '("coderef" "radio" "fuzzy")) nil)
- ;; Id and custom-id links: Headlines refer to their numbering.
- ((member type '("custom-id" "id"))
- (let ((dest (org-export-resolve-id-link link info)))
- (concat
- (org-ascii--fill-string
- (format
- "[%s] %s"
- anchor
- (if (stringp dest) ; External file.
- dest
- (format
- (org-ascii--translate "See section %s" info)
- (if (org-export-numbered-headline-p dest info)
- (mapconcat #'number-to-string
- (org-export-get-headline-number dest info)
- ".")
- (org-export-data (org-element-property :title dest) info)))))
- width info)
- "\n\n")))
+ ((member type '("coderef" "radio")) nil)
+ ((member type '("custom-id" "fuzzy" "id"))
+ ;; Only links with a description need an entry. Other are
+ ;; already handled in `org-ascii-link'.
+ (when description
+ (let ((dest (if (equal type "fuzzy")
+ (org-export-resolve-fuzzy-link link info)
+ (org-export-resolve-id-link link info))))
+ (concat
+ (org-ascii--fill-string
+ (format "[%s] %s" anchor (org-ascii--describe-datum dest info))
+ width info)
+ "\n\n"))))
;; Do not add a link that cannot be resolved and doesn't have
;; any description: destination is already visible in the
;; paragraph.
@@ -1541,24 +1571,33 @@ INFO is a plist holding contextual information."
;; Do not apply a special syntax on radio links. Though, use
;; transcoded target's contents as output.
((string= type "radio") desc)
- ;; Do not apply a special syntax on fuzzy links pointing to
- ;; targets.
- ((string= type "fuzzy")
- (let ((destination (org-export-resolve-fuzzy-link link info)))
- (if (org-string-nw-p desc) desc
- (when destination
- (let ((number
- (org-export-get-ordinal
- destination info nil 'org-ascii--has-caption-p)))
- (if number
- (if (atom number) (number-to-string number)
- (mapconcat #'number-to-string number "."))
- ;; Unnumbered headline.
- (when (eq 'headline (org-element-type destination))
- (format "[%s]"
- (org-export-data
- (org-element-property :title destination)
- info)))))))))
+ ((member type '("custom-id" "fuzzy" "id"))
+ (let ((destination (if (string= type "fuzzy")
+ (org-export-resolve-fuzzy-link link info)
+ (org-export-resolve-id-link link info))))
+ (pcase (org-element-type destination)
+ ((guard desc)
+ (if (plist-get info :ascii-links-to-notes)
+ (format "[%s]" desc)
+ (concat desc
+ (format " (%s)"
+ (org-ascii--describe-datum destination info)))))
+ ;; External file.
+ (`plain-text destination)
+ (`headline
+ (if (org-export-numbered-headline-p destination info)
+ (mapconcat #'number-to-string
+ (org-export-get-headline-number destination info)
+ ".")
+ (org-export-data (org-element-property :title destination) info)))
+ ;; Handle enumerable elements and targets within them.
+ ((and (let number (org-export-get-ordinal
+ destination info nil #'org-ascii--has-caption-p))
+ (guard number))
+ (if (atom number) (number-to-string number)
+ (mapconcat #'number-to-string number ".")))
+ ;; Don't know what to do. Signal it.
+ (_ "???"))))
(t
(let ((raw-link (org-element-property :raw-link link)))
(if (not (org-string-nw-p desc)) (format "[%s]" raw-link)
diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index d566516..257ff3f 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -260,7 +260,6 @@ Return overlay specification, as a string, or nil."
(link . org-beamer-link)
(plain-list . org-beamer-plain-list)
(radio-target . org-beamer-radio-target)
- (target . org-beamer-target)
(template . org-beamer-template)))
@@ -780,15 +779,6 @@ contextual information."
text))
-;;;; Target
-
-(defun org-beamer-target (target _contents info)
- "Transcode a TARGET object into Beamer code.
-CONTENTS is nil. INFO is a plist holding contextual
-information."
- (format "\\label{%s}" (org-export-get-reference target info)))
-
-
;;;; Template
;;
;; Template used is similar to the one used in `latex' back-end,
diff --git a/lisp/ox.el b/lisp/ox.el
index 5c72fb5..5b3ce83 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -5744,6 +5744,12 @@ them."
("fr" :ascii "References" :default "Références")
("de" :default "Quellen")
("es" :default "Referencias"))
+ ("See figure %s"
+ ("fr" :default "cf. figure %s"
+ :html "cf.&nbsp;figure&nbsp;%s" :latex "cf.~figure~%s"))
+ ("See listing %s"
+ ("fr" :default "cf. programme %s"
+ :html "cf.&nbsp;programme&nbsp;%s" :latex "cf.~programme~%s"))
("See section %s"
("da" :default "jævnfør afsnit %s")
("de" :default "siehe Abschnitt %s")
@@ -5756,6 +5762,9 @@ them."
("ru" :html "&#1057;&#1084;. &#1088;&#1072;&#1079;&#1076;&#1077;&#1083; %s"
:utf-8 "См. раздел %s")
("zh-CN" :html "&#21442;&#35265;&#31532;%s&#33410;" :utf-8 "参见第%s节"))
+ ("See table %s"
+ ("fr" :default "cf. tableau %s"
+ :html "cf.&nbsp;tableau&nbsp;%s" :latex "cf.~tableau~%s"))
("Table"
("de" :default "Tabelle")
("es" :default "Tabla")