summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2017-12-05 13:14:44 -0500
committerKyle Meyer <kyle@kyleam.com>2017-12-05 13:14:44 -0500
commit319e3174b557ccb3d5a09fbf4e7a4cfd3968cb66 (patch)
treebe0c5d056c5f4b0c7991c73f69fccbeb6e9ae72c
parentd4af7a6fc35bb6d880e3109306a59522bdc0deec (diff)
parent0e7e3bc6df812229aa87a39b07f9eb7b1ca2ea16 (diff)
downloadorg-mode-319e3174b557ccb3d5a09fbf4e7a4cfd3968cb66.tar.gz
Merge branch 'maint' into emacs-sync
-rw-r--r--doc/org.texi13
-rw-r--r--etc/ORG-NEWS5
-rw-r--r--lisp/ob-core.el60
-rw-r--r--lisp/ob-gnuplot.el2
-rw-r--r--lisp/org-agenda.el6
-rw-r--r--lisp/org-archive.el5
-rw-r--r--lisp/org-capture.el17
-rw-r--r--lisp/org-clock.el23
-rw-r--r--lisp/org-colview.el2
-rw-r--r--lisp/org-feed.el2
-rw-r--r--lisp/org-gnus.el24
-rw-r--r--lisp/org-irc.el14
-rw-r--r--lisp/org-list.el2
-rw-r--r--lisp/org-table.el26
-rw-r--r--lisp/org.el131
-rw-r--r--lisp/ox-html.el33
-rw-r--r--lisp/ox-odt.el2
-rw-r--r--lisp/ox-publish.el18
-rw-r--r--lisp/ox.el16
-rw-r--r--testing/lisp/test-ob.el47
-rw-r--r--testing/lisp/test-org-clock.el16
-rw-r--r--testing/lisp/test-org-colview.el18
-rw-r--r--testing/lisp/test-org.el89
-rw-r--r--testing/lisp/test-ox-publish.el27
-rw-r--r--testing/lisp/test-ox.el26
25 files changed, 355 insertions, 269 deletions
diff --git a/doc/org.texi b/doc/org.texi
index f2a3a6f..a5aab97 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -1299,7 +1299,7 @@ level, all sibling headings. With a double prefix argument, also show the
entire subtree of the parent.
@cindex show branches, command
@orgcmd{C-c C-k,outline-show-branches}
-Expose all the headings of the subtree, CONTENT view for just one subtree.
+Expose all the headings of the subtree, CONTENTS view for just one subtree.
@cindex show children, command
@orgcmd{C-c @key{TAB},outline-show-children}
Expose all direct children of the subtree. With a numeric prefix argument N,
@@ -5818,8 +5818,7 @@ The following commands insert or update the dynamic block:
Insert a dynamic block capturing a column view. You will be prompted
for the scope or ID of the view.
@orgcmdkkc{C-c C-c,C-c C-x C-u,org-dblock-update}
-Update dynamic block at point. The cursor needs to be in the
-@code{#+BEGIN} line of the dynamic block.
+Update dynamic block at point.
@orgcmd{C-u C-c C-x C-u,org-update-all-dblocks}
Update all dynamic blocks (@pxref{Dynamic blocks}). This is useful if
you have several clock table blocks, column-capturing blocks or other dynamic
@@ -6604,8 +6603,7 @@ argument, jump to the first clock report in the current document and
update it. The clock table always includes also trees with
@code{:ARCHIVE:} tag.
@orgcmdkkc{C-c C-c,C-c C-x C-u,org-dblock-update}
-Update dynamic block at point. The cursor needs to be in the
-@code{#+BEGIN} line of the dynamic block.
+Update dynamic block at point.
@orgkey{C-u C-c C-x C-u}
Update all dynamic blocks (@pxref{Dynamic blocks}). This is useful if
you have several clock table blocks in a buffer.
@@ -10791,8 +10789,9 @@ Toggle inclusion of inlinetasks (@code{org-export-with-inlinetasks}).
@cindex property, UNNUMBERED
Toggle section-numbers (@code{org-export-with-section-numbers}). When set to
number @samp{n}, Org numbers only those headlines at level @samp{n} or above.
-Set @code{UNNUMBERED} property to non-@code{nil} to disable numbering of
-heading and subheadings entirely.
+Setting @code{UNNUMBERED} property to non-@code{nil} disables numbering of
+a heading. Since subheadings inherit from this property, it affects their
+numbering, too.
@item p:
@vindex org-export-with-planning
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index d6f550d..7ed839a 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -492,9 +492,6 @@ It used to be ~@samp~ but ~@asis~ is neutral and, therefore, more
suitable as a default value.
*** Texinfo default process includes ~--no-split~ option
*** New entities : ~\dollar~ and ~\USD~
-*** ~org-parse-time-string~ accepts a new optional argument
-=ZONE= specifies the current time zone.
-*** ~org-time-string-to-seconds~ now accepts an optional =ZONE= argument
*** Support for date style URLs in =org-protocol://open-source=
URLs like =https://cool-blog.com/2017/05/20/cool-post/= are
covered by rewrite rules.
@@ -1992,7 +1989,7 @@ This enables SVG generation from latex code blocks.
*** New option: [[doc:org-habit-show-done-always-green][org-habit-show-done-always-green]]
-See [[https://lists.gnu.org/archive/html/emacs-orgmode/2013-05/msg00214.html][this message]] from Max Mikhanosha.
+See [[https://lists.gnu.org/r/emacs-orgmode/2013-05/msg00214.html][this message]] from Max Mikhanosha.
*** New option: [[doc:org-babel-inline-result-wrap][org-babel-inline-result-wrap]]
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index c7c0384..17aae68 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -1765,15 +1765,17 @@ to `org-babel-named-src-block-regexp'."
(defun org-babel-src-block-names (&optional file)
"Returns the names of source blocks in FILE or the current buffer."
- (when file (find-file file))
- (save-excursion
- (goto-char (point-min))
- (let* ((re (org-babel-named-src-block-regexp-for-name))
- (names (and (looking-at re)
- (list (match-string-no-properties 9)))))
- (while (ignore-errors (org-next-block 1 nil re))
- (push (match-string-no-properties 9) names))
- names)))
+ (with-current-buffer (if file (find-file-noselect file) (current-buffer))
+ (org-with-point-at 1
+ (let ((regexp "^[ \t]*#\\+begin_src ")
+ (case-fold-search t)
+ (names nil))
+ (while (re-search-forward regexp nil t)
+ (let ((element (org-element-at-point)))
+ (when (eq 'src-block (org-element-type element))
+ (let ((name (org-element-property :name element)))
+ (when name (push name names))))))
+ names))))
;;;###autoload
(defun org-babel-goto-named-result (name)
@@ -2416,8 +2418,11 @@ INFO may provide the values of these header arguments (in the
(goto-char location)
(when (looking-at (concat org-babel-result-regexp ".*$"))
(delete-region
- (if keep-keyword (1+ (match-end 0)) (1- (match-beginning 0)))
- (progn (forward-line 1) (org-babel-result-end))))))))
+ (if keep-keyword (line-beginning-position 2)
+ (save-excursion
+ (skip-chars-backward " \r\t\n")
+ (line-beginning-position 2)))
+ (progn (forward-line) (org-babel-result-end))))))))
(defun org-babel-remove-inline-result (&optional datum)
"Remove the result of the current inline-src-block or babel call.
@@ -2454,24 +2459,21 @@ in the buffer."
(defun org-babel-result-end ()
"Return the point at the end of the current set of results."
- (save-excursion
- (cond
- ((org-at-table-p) (progn (goto-char (org-table-end)) (point)))
- ((org-at-item-p) (let* ((struct (org-list-struct))
- (prvs (org-list-prevs-alist struct)))
- (org-list-get-list-end (point-at-bol) struct prvs)))
- ((let ((case-fold-search t)) (looking-at "^\\([ \t]*\\):results:"))
- (progn (re-search-forward (concat "^" (match-string 1) ":END:"))
- (forward-char 1) (point)))
- (t
- (let ((case-fold-search t))
- (if (looking-at (concat "[ \t]*#\\+begin_\\([^ \t\n\r]+\\)"))
- (progn (re-search-forward (concat "[ \t]*#\\+end_" (match-string 1))
- nil t)
- (forward-char 1))
- (while (looking-at "[ \t]*\\(: \\|:$\\|\\[\\[\\)")
- (forward-line 1))))
- (point)))))
+ (cond ((looking-at-p "^[ \t]*$") (point)) ;no result
+ ((looking-at-p (format "^[ \t]*%s[ \t]*$" org-bracket-link-regexp))
+ (line-beginning-position 2))
+ (t
+ (let ((element (org-element-at-point)))
+ (if (memq (org-element-type element)
+ ;; Possible results types.
+ '(drawer example-block export-block fixed-width item
+ plain-list src-block table))
+ (save-excursion
+ (goto-char (min (point-max) ;for narrowed buffers
+ (org-element-property :end element)))
+ (skip-chars-backward " \r\t\n")
+ (line-beginning-position 2))
+ (point))))))
(defun org-babel-result-to-file (result &optional description)
"Convert RESULT into an `org-mode' link with optional DESCRIPTION.
diff --git a/lisp/ob-gnuplot.el b/lisp/ob-gnuplot.el
index 7633862..b0743f6 100644
--- a/lisp/ob-gnuplot.el
+++ b/lisp/ob-gnuplot.el
@@ -40,7 +40,7 @@
;;; Code:
(require 'ob)
-(declare-function org-time-string-to-time "org" (s &optional zone))
+(declare-function org-time-string-to-time "org" (s))
(declare-function org-combine-plists "org" (&rest plists))
(declare-function orgtbl-to-generic "org-table" (table params))
(declare-function gnuplot-mode "ext:gnuplot-mode" ())
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index cf7a4db..ad811ce 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -606,8 +606,8 @@ subtree to see if any of the subtasks have project status.
See also the variable `org-tags-match-list-sublevels' which applies
to projects matched by this search as well.
-After defining this variable, you may use `\\[org-agenda-list-stuck-projects]'
-\(bound to `C-c a #') to produce the list."
+After defining this variable, you may use `org-agenda-list-stuck-projects'
+\(bound to `\\[org-agenda] #') to produce the list."
:group 'org-agenda-custom-commands
:type '(list
(string :tag "Tags/TODO match to identify a project")
@@ -2520,7 +2520,7 @@ The following commands are available:
("MobileOrg"
["Push Files and Views" org-mobile-push t]
["Get Captured and Flagged" org-mobile-pull t]
- ["Find FLAGGED Tasks" (org-agenda nil "?") :active t :keys "C-c a ?"]
+ ["Find FLAGGED Tasks" (org-agenda nil "?") :active t :keys "\\[org-agenda] ?"]
["Show note / unflag" org-agenda-show-the-flagging-note t]
"--"
["Setup" (progn (require 'org-mobile) (customize-group 'org-mobile)) t])
diff --git a/lisp/org-archive.el b/lisp/org-archive.el
index 0337617..01514d7 100644
--- a/lisp/org-archive.el
+++ b/lisp/org-archive.el
@@ -381,10 +381,7 @@ direct children of this heading."
(point)
(concat "ARCHIVE_" (upcase (symbol-name item)))
value))))
- (widen)
- ;; Save and kill the buffer, if it is not the same
- ;; buffer.
- (unless (eq this-buffer buffer) (save-buffer)))))
+ (widen))))
;; Here we are back in the original buffer. Everything seems
;; to have worked. So now run hooks, cut the tree and finish
;; up.
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 2222bf4..0321021 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -79,6 +79,12 @@
(defvar org-capture-is-refiling nil
"Non-nil when capture process is refiling an entry.")
+(defvar org-capture--prompt-history-table (make-hash-table :test #'equal)
+ "Hash table for all history lists per prompt.")
+
+(defvar org-capture--prompt-history nil
+ "History list for prompt placeholders.")
+
(defgroup org-capture nil
"Options concerning capturing new entries."
:tag "Org Capture"
@@ -1797,13 +1803,20 @@ The template may still contain \"%?\" for cursor positioning."
(member key '("u" "U"))
nil nil (list org-end-time-was-given))))
(`nil
+ ;; Load history list for current prompt.
+ (setq org-capture--prompt-history
+ (gethash prompt org-capture--prompt-history-table))
(push (org-completing-read
(concat (or prompt "Enter string")
(and default (format " [%s]" default))
": ")
- completions nil nil nil nil default)
+ completions
+ nil nil nil 'org-capture--prompt-history default)
strings)
- (insert (car strings)))
+ (insert (car strings))
+ ;; Save updated history list for current prompt.
+ (puthash prompt org-capture--prompt-history
+ org-capture--prompt-history-table))
(_
(error "Unknown template placeholder: \"%%^%s\""
key))))))))
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 83d0e12..0e7eb21 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1467,7 +1467,7 @@ The time is always returned as UTC."
(and (or (not cmt) (equal cmt "auto"))
lr))
(setq org--msg-extra "showing task time since last repeat.")
- (and lr (org-time-string-to-time lr t)))
+ (and lr (org-time-string-to-time lr)))
(t nil))))
(defun org-clock-find-position (find-unclosed)
@@ -1604,9 +1604,9 @@ to, overriding the existing value of `org-clock-out-switch-to-state'."
(insert "--")
(setq te (org-insert-time-stamp (or at-time now) 'with-hm 'inactive))
(setq s (- (float-time
- (apply #'encode-time (org-parse-time-string te nil t)))
+ (apply #'encode-time (org-parse-time-string te)))
(float-time
- (apply #'encode-time (org-parse-time-string ts nil t))))
+ (apply #'encode-time (org-parse-time-string ts))))
h (floor (/ s 3600))
s (- s (* 3600 h))
m (floor (/ s 60))
@@ -1711,8 +1711,8 @@ Optional argument N tells to change by that many units."
(begts (if updatets1 begts1 begts2)))
(setq tdiff
(time-subtract
- (org-time-string-to-time org-last-changed-timestamp t)
- (org-time-string-to-time ts t)))
+ (org-time-string-to-time org-last-changed-timestamp)
+ (org-time-string-to-time ts)))
(save-excursion
(goto-char begts)
(org-timestamp-change
@@ -1820,10 +1820,10 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
(lmax 30)
(ltimes (make-vector lmax 0))
(level 0)
- (tstart (cond ((stringp tstart) (org-time-string-to-seconds tstart t))
+ (tstart (cond ((stringp tstart) (org-time-string-to-seconds tstart))
((consp tstart) (float-time tstart))
(t tstart)))
- (tend (cond ((stringp tend) (org-time-string-to-seconds tend t))
+ (tend (cond ((stringp tend) (org-time-string-to-seconds tend))
((consp tend) (float-time tend))
(t tend)))
(t1 0)
@@ -1840,11 +1840,10 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
(let* ((ts (float-time
(apply #'encode-time
(save-match-data
- (org-parse-time-string
- (match-string 2) nil t)))))
+ (org-parse-time-string (match-string 2))))))
(te (float-time
(apply #'encode-time
- (org-parse-time-string (match-string 3) nil t))))
+ (org-parse-time-string (match-string 3)))))
(dt (- (if tend (min te tend) te)
(if tstart (max ts tstart) ts))))
(when (> dt 0) (cl-incf t1 (floor (/ dt 60))))))
@@ -2902,9 +2901,9 @@ Otherwise, return nil."
(setq ts (match-string 1)
te (match-string 3))
(setq s (- (float-time
- (apply #'encode-time (org-parse-time-string te nil t)))
+ (apply #'encode-time (org-parse-time-string te)))
(float-time
- (apply #'encode-time (org-parse-time-string ts nil t))))
+ (apply #'encode-time (org-parse-time-string ts))))
neg (< s 0)
s (abs s)
h (floor (/ s 3600))
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index eac29c5..649ca52 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -1070,7 +1070,7 @@ as a canonical duration, i.e., using units defined in
(cond
((string-match-p org-ts-regexp s)
(/ (- org-columns--time
- (float-time (apply #'encode-time (org-parse-time-string s nil t))))
+ (float-time (apply #'encode-time (org-parse-time-string s))))
60))
((org-duration-p s) (org-duration-to-minutes s t)) ;skip user units
(t (user-error "Invalid age: %S" s))))
diff --git a/lisp/org-feed.el b/lisp/org-feed.el
index 0119864..cd2e95f 100644
--- a/lisp/org-feed.el
+++ b/lisp/org-feed.el
@@ -624,7 +624,7 @@ containing the properties `:guid' and `:item-full-text'."
end (and (re-search-forward "</item>" nil t)
(match-beginning 0)))
(setq item (buffer-substring beg end)
- guid (if (string-match "<guid\\>.*?>\\(.*?\\)</guid>" item)
+ guid (if (string-match "<guid\\>.*?>\\([^\000]*?\\)</guid>" item)
(xml-substitute-special (match-string-no-properties 1 item))))
(setq entry (list :guid guid :item-full-text item))
(push entry entries)
diff --git a/lisp/org-gnus.el b/lisp/org-gnus.el
index 687bc08..26bb889 100644
--- a/lisp/org-gnus.el
+++ b/lisp/org-gnus.el
@@ -31,15 +31,31 @@
;;; Code:
-(require 'org)
+(require 'gnus-sum)
(require 'gnus-util)
+(require 'nnheader)
+(require 'nnir)
+(require 'org)
;;; Declare external functions and variables
+(declare-function gnus-activate-group "gnus-start" (group &optional scan dont-check method dont-sub-check))
+(declare-function gnus-find-method-for-group "gnus" (group &optional info))
+(declare-function gnus-group-group-name "gnus-group")
+(declare-function gnus-group-jump-to-group "gnus-group" (group &optional prompt))
+(declare-function gnus-group-read-group "gnus-group" (&optional all no-article group select-articles))
(declare-function message-fetch-field "message" (header &optional not-all))
+(declare-function message-generate-headers "message" (headers))
+(declare-function message-narrow-to-headers "message")
+(declare-function message-tokenize-header "message" (header &optional separator))
+(declare-function message-unquote-tokens "message" (elems))
(declare-function nnvirtual-map-article "nnvirtual" (article))
+(defvar gnus-newsgroup-name)
+(defvar gnus-summary-buffer)
+(defvar gnus-other-frame-object)
+
;;; Customization variables
@@ -120,9 +136,11 @@ If `org-store-link' was called with a prefix arg the meaning of
(let* ((group
(pcase (gnus-find-method-for-group gnus-newsgroup-name)
(`(nnvirtual . ,_)
- (car (nnvirtual-map-article (gnus-summary-article-number))))
+ (save-excursion
+ (car (nnvirtual-map-article (gnus-summary-article-number)))))
(`(nnir . ,_)
- (nnir-article-group (gnus-summary-article-number)))
+ (save-excursion
+ (nnir-article-group (gnus-summary-article-number))))
(_ gnus-newsgroup-name)))
(header (with-current-buffer gnus-summary-buffer
(gnus-summary-article-header)))
diff --git a/lisp/org-irc.el b/lisp/org-irc.el
index 5889f6d..3617ae9 100644
--- a/lisp/org-irc.el
+++ b/lisp/org-irc.el
@@ -50,18 +50,20 @@
(require 'org)
-;; Declare the function form ERC that we use.
+(declare-function erc-buffer-filter "erc" (predicate &optional proc))
+(declare-function erc-channel-p "erc" (channel))
+(declare-function erc-cmd-JOIN "erc" (channel &optional key))
(declare-function erc-current-logfile "erc-log" (&optional buffer))
-(declare-function erc-prompt "erc" ())
(declare-function erc-default-target "erc" ())
-(declare-function erc-channel-p "erc" (channel))
-(declare-function erc-buffer-filter "erc" (predicate &optional proc))
-(declare-function erc-server-buffer "erc" ())
(declare-function erc-get-server-nickname-list "erc" ())
-(declare-function erc-cmd-JOIN "erc" (channel &optional key))
+(declare-function erc-logging-enabled "erc-log" (&optional buffer))
+(declare-function erc-prompt "erc" ())
+(declare-function erc-save-buffer-in-logs "erc-log" (&optional buffer))
+(declare-function erc-server-buffer "erc" ())
(defvar org-irc-client 'erc
"The IRC client to act on.")
+
(defvar org-irc-link-to-logs nil
"Non-nil will store a link to the logs, nil will store an irc: style link.")
diff --git a/lisp/org-list.el b/lisp/org-list.el
index 8ea569f..5b292d0 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -149,7 +149,7 @@
(declare-function org-remove-indentation "org" (code &optional n))
(declare-function org-show-subtree "org" ())
(declare-function org-sort-remove-invisible "org" (S))
-(declare-function org-time-string-to-seconds "org" (s &optional zone))
+(declare-function org-time-string-to-seconds "org" (s))
(declare-function org-timer-hms-to-secs "org-timer" (hms))
(declare-function org-timer-item "org-timer" (&optional arg))
(declare-function org-trim "org" (s &optional keep-lead))
diff --git a/lisp/org-table.el b/lisp/org-table.el
index d51750f..6ebd6da 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -1087,22 +1087,18 @@ Before doing so, re-align the table if necessary."
(interactive)
(org-table-maybe-eval-formula)
(org-table-maybe-recalculate-line)
- (if (or (looking-at "[ \t]*$")
- (save-excursion (skip-chars-backward " \t") (bolp)))
- (newline)
- (if (and org-table-automatic-realign
- org-table-may-need-update)
- (org-table-align))
- (let ((col (org-table-current-column)))
- (beginning-of-line 2)
- (if (or (not (org-at-table-p))
+ (if (and org-table-automatic-realign
+ org-table-may-need-update)
+ (org-table-align))
+ (let ((col (org-table-current-column)))
+ (beginning-of-line 2)
+ (when (or (not (org-at-table-p))
(org-at-table-hline-p))
- (progn
- (beginning-of-line 0)
- (org-table-insert-row 'below)))
- (org-table-goto-column col)
- (skip-chars-backward "^|\n\r")
- (if (looking-at " ") (forward-char 1)))))
+ (beginning-of-line 0)
+ (org-table-insert-row 'below))
+ (org-table-goto-column col)
+ (skip-chars-backward "^|\n\r")
+ (when (looking-at " ") (forward-char))))
;;;###autoload
(defun org-table-copy-down (n)
diff --git a/lisp/org.el b/lisp/org.el
index 571a311..07727f6 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -182,7 +182,8 @@ Stars are put in group 1 and the trimmed body in group 2.")
(declare-function org-export-get-environment "ox" (&optional backend subtreep ext-plist))
(declare-function org-latex-make-preamble "ox-latex" (info &optional template snippet?))
-(defvar ffap-url-regexp) ;Silence byte-compiler
+(defvar ffap-url-regexp)
+(defvar org-element-paragraph-separate)
(defsubst org-uniquify (list)
"Non-destructively remove duplicate elements from LIST."
@@ -5753,6 +5754,10 @@ This should be called after the variable `org-link-parameters' has changed."
(when (save-excursion
(goto-char (match-beginning 0))
(and
+ ;; Do not match table hlines.
+ (not (and (equal marker "+")
+ (org-match-line
+ "[ \t]*\\(|[-+]+|?\\|\\+[-+]+\\+\\)[ \t]*$")))
;; Do not match headline stars. Do not consider
;; stars of a headline as closing marker for bold
;; markup either.
@@ -5761,12 +5766,12 @@ This should be called after the variable `org-link-parameters' has changed."
(forward-char)
(skip-chars-backward "*")
(looking-at-p org-outline-regexp-bol))))
- ;; Do not match table hlines.
- (not (and (equal marker "+")
- (org-match-line
- "^[ \t]*\\(|[-+]+|?\\|\\+[-+]+\\+\\)[ \t]*$")))
+ ;; Match full emphasis markup regexp.
(looking-at (if verbatim? org-verbatim-re org-emph-re))
- ;; At a table row, do not cross cell boundaries.
+ ;; Do not span over paragraph boundaries.
+ (not (string-match-p org-element-paragraph-separate
+ (match-string 2)))
+ ;; Do not span over cells in table rows.
(not (and (save-match-data (org-match-line "[ \t]*|"))
(string-match-p "|" (match-string 4))))))
(pcase-let ((`(,_ ,face ,_) (assoc marker org-emphasis-alist)))
@@ -9642,28 +9647,37 @@ active region."
(move-beginning-of-line 2)
(set-mark (point)))))
(setq org-store-link-plist nil)
- (let (link cpltxt desc description search
- txt custom-id agenda-link sfuns sfunsn)
+ (let (link cpltxt desc description search txt custom-id agenda-link)
(cond
-
- ;; Store a link using an external link type
+ ;; Store a link using an external link type, if any function is
+ ;; available. If more than one can generate a link from current
+ ;; location, ask which one to use.
((and (not (equal arg '(16)))
- (setq sfuns
- (delq
- nil (mapcar (lambda (f)
- (let (fs) (if (funcall f) (push f fs))))
- (org-store-link-functions)))
- sfunsn (mapcar (lambda (fu) (symbol-name (car fu))) sfuns))
- (or (and (cdr sfuns)
- (funcall (intern
- (completing-read
- "Which function for creating the link? "
- sfunsn nil t (car sfunsn)))))
- (funcall (caar sfuns)))
- (setq link (plist-get org-store-link-plist :link)
- desc (or (plist-get org-store-link-plist
- :description)
- link))))
+ (let ((results-alist nil))
+ (dolist (f (org-store-link-functions))
+ (when (funcall f)
+ ;; XXX: return value is not link's plist, so we
+ ;; store the new value before it is modified. It
+ ;; would be cleaner to ask store link functions to
+ ;; return the plist instead.
+ (push (cons f (copy-sequence org-store-link-plist))
+ results-alist)))
+ (pcase results-alist
+ (`nil nil)
+ (`((,_ . ,_)) t) ;single choice: nothing to do
+ (`((,name . ,_) . ,_)
+ ;; Reinstate link plist associated to the chosen
+ ;; function.
+ (apply #'org-store-link-props
+ (cdr (assoc-string
+ (completing-read
+ "Which function for creating the link? "
+ (mapcar #'car results-alist) nil t name)
+ results-alist)))
+ t))))
+ (setq link (plist-get org-store-link-plist :link))
+ (setq desc (or (plist-get org-store-link-plist :description)
+ link)))
;; Store a link from a source code buffer.
((org-src-edit-buffer-p)
@@ -14618,7 +14632,7 @@ it as a time string and apply `float-time' to it. If S is nil, just return 0."
((numberp s) s)
((stringp s)
(condition-case nil
- (float-time (apply #'encode-time (org-parse-time-string s nil t)))
+ (float-time (apply #'encode-time (org-parse-time-string s)))
(error 0.)))
(t 0.)))
@@ -17377,8 +17391,8 @@ both scheduled and deadline timestamps."
'timestamp)
(org-at-planning-p))
(time-less-p
- (org-time-string-to-time match t)
- (org-time-string-to-time d t)))))))
+ (org-time-string-to-time match)
+ (org-time-string-to-time d)))))))
(message "%d entries before %s"
(org-occur regexp nil callback)
d)))
@@ -17399,8 +17413,8 @@ both scheduled and deadline timestamps."
'timestamp)
(org-at-planning-p))
(not (time-less-p
- (org-time-string-to-time match t)
- (org-time-string-to-time d t))))))))
+ (org-time-string-to-time match)
+ (org-time-string-to-time d))))))))
(message "%d entries after %s"
(org-occur regexp nil callback)
d)))
@@ -17423,11 +17437,11 @@ both scheduled and deadline timestamps."
'timestamp)
(org-at-planning-p))
(not (time-less-p
- (org-time-string-to-time match t)
- (org-time-string-to-time start-date t)))
+ (org-time-string-to-time match)
+ (org-time-string-to-time start-date)))
(time-less-p
- (org-time-string-to-time match t)
- (org-time-string-to-time end-date t))))))))
+ (org-time-string-to-time match)
+ (org-time-string-to-time end-date))))))))
(message "%d entries between %s and %s"
(org-occur regexp nil callback) start-date end-date)))
@@ -17512,19 +17526,13 @@ days in order to avoid rounding problems."
(push m l))
(apply 'format fmt (nreverse l))))
-(defun org-time-string-to-time (s &optional zone)
- "Convert timestamp string S into internal 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."
- (apply #'encode-time (org-parse-time-string s nil zone)))
+(defun org-time-string-to-time (s)
+ "Convert timestamp string S into internal time."
+ (apply #'encode-time (org-parse-time-string s)))
-(defun org-time-string-to-seconds (s &optional zone)
- "Convert a timestamp string S into a number of seconds.
-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."
- (float-time (org-time-string-to-time s zone)))
+(defun org-time-string-to-seconds (s)
+ "Convert a timestamp string S into a number of seconds."
+ (float-time (org-time-string-to-time s)))
(org-define-error 'org-diary-sexp-no-match "Unable to match diary sexp")
@@ -17741,17 +17749,13 @@ day number."
(list (nth 4 d) (nth 3 d) (nth 5 d))))
((listp d) (list (nth 4 d) (nth 3 d) (nth 5 d)))))
-(defun org-parse-time-string (s &optional nodefault zone)
+(defun org-parse-time-string (s &optional nodefault)
"Parse the standard Org time string.
This should be a lot faster than the normal `parse-time-string'.
If time is not given, defaults to 0:00. However, with optional
-NODEFAULT, hour and minute fields will be nil if not given.
-
-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."
+NODEFAULT, hour and minute fields will be nil if not given."
(cond ((string-match org-ts-regexp0 s)
(list 0
(when (or (match-beginning 8) (not nodefault))
@@ -17761,7 +17765,7 @@ in the TZ environment variable."
(string-to-number (match-string 4 s))
(string-to-number (match-string 3 s))
(string-to-number (match-string 2 s))
- nil nil zone))
+ nil nil nil))
((string-match "^<[^>]+>$" s)
;; FIXME: `decode-time' needs to be called with ZONE as its
;; second argument. However, this requires at least Emacs
@@ -21036,13 +21040,17 @@ object (e.g., within a comment). In these case, you need to use
(let ((context (if org-return-follows-link (org-element-context)
(org-element-at-point))))
(cond
- ;; In a table, call `org-table-next-row'.
+ ;; In a table, call `org-table-next-row'. However, before first
+ ;; column or after last one, split the table.
((or (and (eq (org-element-type context) 'table)
(>= (point) (org-element-property :contents-begin context))
(< (point) (org-element-property :contents-end context)))
(org-element-lineage context '(table-row table-cell) t))
- (org-table-justify-field-maybe)
- (call-interactively #'org-table-next-row))
+ (if (or (looking-at-p "[ \t]*$")
+ (save-excursion (skip-chars-backward " \t") (bolp)))
+ (insert "\n")
+ (org-table-justify-field-maybe)
+ (call-interactively #'org-table-next-row)))
;; On a link or a timestamp, call `org-open-at-point' if
;; `org-return-follows-link' allows it. Tolerate fuzzy
;; locations, e.g., in a comment, as `org-open-at-point'.
@@ -21383,7 +21391,7 @@ an argument, unconditionally call `org-insert-heading'."
["Next keyword set" org-shiftcontrolright (and (> (length org-todo-sets) 1) (org-at-heading-p))]
["Previous keyword set" org-shiftcontrolright (and (> (length org-todo-sets) 1) (org-at-heading-p))])
["Show TODO Tree" org-show-todo-tree :active t :keys "C-c / t"]
- ["Global TODO list" org-todo-list :active t :keys "C-c a t"]
+ ["Global TODO list" org-todo-list :active t :keys "\\[org-agenda] t"]
"--"
["Enforce dependencies" (customize-variable 'org-enforce-todo-dependencies)
:selected org-enforce-todo-dependencies :style toggle :active t]
@@ -21462,8 +21470,8 @@ an argument, unconditionally call `org-insert-heading'."
"--"
["Export/Publish..." org-export-dispatch t]
("LaTeX"
- ["Org CDLaTeX mode" org-cdlatex-mode :style toggle
- :selected org-cdlatex-mode]
+ ["Org CDLaTeX mode" org-cdlatex-mode :active (require 'cdlatex nil t)
+ :style toggle :selected org-cdlatex-mode]
["Insert Environment" cdlatex-environment (fboundp 'cdlatex-environment)]
["Insert math symbol" cdlatex-math-symbol (fboundp 'cdlatex-math-symbol)]
["Modify math symbol" org-cdlatex-math-modify
@@ -21473,7 +21481,7 @@ an argument, unconditionally call `org-insert-heading'."
("MobileOrg"
["Push Files and Views" org-mobile-push t]
["Get Captured and Flagged" org-mobile-pull t]
- ["Find FLAGGED Tasks" (org-agenda nil "?") :active t :keys "C-c a ?"]
+ ["Find FLAGGED Tasks" (org-agenda nil "?") :active t :keys "\\[org-agenda] ?"]
"--"
["Setup" (progn (require 'org-mobile) (customize-group 'org-mobile)) t])
"--"
@@ -22775,7 +22783,6 @@ assumed to be significant there."
;; `org-setup-filling' installs filling and auto-filling related
;; variables during `org-mode' initialization.
-(defvar org-element-paragraph-separate) ; org-element.el
(defun org-setup-filling ()
(require 'org-element)
;; Prevent auto-fill from inserting unwanted new items.
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 3073727..bf08de1 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2202,7 +2202,7 @@ https://github.com/hniksic/emacs-htmlize"))
(org-html-htmlize-region-for-paste
(point-min) (point-max))))))
;; Strip any enclosing <pre></pre> tags.
- (let* ((beg (and (string-match "\\`<pre[^>]*>\n*" code) (match-end 0)))
+ (let* ((beg (and (string-match "\\`<pre[^>]*>\n?" code) (match-end 0)))
(end (and beg (string-match "</pre>\\'" code))))
(if (and beg end) (substring code beg end) code)))))))))
@@ -2215,7 +2215,7 @@ alist between line numbers and references (as returned by
`org-export-unravel-code'), a boolean specifying if labels should
appear in the source code, and the number associated to the first
line of code."
- (let* ((code-lines (org-split-string code "\n"))
+ (let* ((code-lines (split-string code "\n"))
(code-length (length code-lines))
(num-fmt
(and num-start
@@ -2953,10 +2953,7 @@ images, set it to:
DESC is the description part of the link, or the empty string.
INFO is a plist holding contextual information. See
`org-export-data'."
- (let* ((home (when (plist-get info :html-link-home)
- (org-trim (plist-get info :html-link-home))))
- (use-abs-url (plist-get info :html-link-use-abs-url))
- (link-org-files-as-html-maybe
+ (let* ((link-org-files-as-html-maybe
(lambda (raw-path info)
;; Treat links to `file.org' as links to `file.html', if
;; needed. See `org-html-link-org-files-as-html'.
@@ -2976,16 +2973,22 @@ INFO is a plist holding contextual information. See
((member type '("http" "https" "ftp" "mailto" "news"))
(url-encode-url (org-link-unescape (concat type ":" raw-path))))
((string= type "file")
- ;; Treat links to ".org" files as ".html", if needed.
+ ;; During publishing, turn absolute file names belonging
+ ;; to base directory into relative file names. Otherwise,
+ ;; append "file" protocol to absolute file name.
(setq raw-path
- (funcall link-org-files-as-html-maybe raw-path info))
- ;; If file path is absolute, prepend it with protocol
- ;; component - "file://".
- (cond
- ((file-name-absolute-p raw-path)
- (setq raw-path (org-export-file-uri raw-path)))
- ((and home use-abs-url)
- (setq raw-path (concat (file-name-as-directory home) raw-path))))
+ (org-export-file-uri
+ (org-publish-file-relative-name raw-path info)))
+ ;; Possibly append `:html-link-home' to relative file
+ ;; name.
+ (let ((home (and (plist-get info :html-link-home)
+ (org-trim (plist-get info :html-link-home)))))
+ (when (and home
+ (plist-get info :html-link-use-abs-url)
+ (file-name-absolute-p raw-path))
+ (setq raw-path (concat (file-name-as-directory home) raw-path))))
+ ;; Maybe turn ".org" into ".html".
+ (setq raw-path (funcall link-org-files-as-html-maybe raw-path info))
;; Add search option, if any. A search option can be
;; relative to a custom-id, a headline title, a name or
;; a target.
diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index d585636..a19bab2 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -3886,7 +3886,7 @@ contextual information."
;; themselves and the list can be arbitrarily deep.
;;
;; Inspired by following thread:
-;; https://lists.gnu.org/archive/html/emacs-orgmode/2011-03/msg01101.html
+;; https://lists.gnu.org/r/emacs-orgmode/2011-03/msg01101.html
;; Translate lists to tables
diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el
index 957b0da..c2416db 100644
--- a/lisp/ox-publish.el
+++ b/lisp/ox-publish.el
@@ -349,7 +349,6 @@ You can overwrite this default per project in your
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Timestamp-related functions
(defun org-publish-timestamp-filename (filename &optional pub-dir pub-func)
@@ -392,7 +391,6 @@ If there is no timestamp, create one."
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Getting project information out of `org-publish-project-alist'
(defun org-publish-property (property project &optional default)
@@ -525,7 +523,6 @@ publishing FILENAME."
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Tools for publishing functions in back-ends
(defun org-publish-org-to (backend filename extension plist &optional pub-dir)
@@ -899,7 +896,6 @@ representation for the files to include, as returned by
(org-list-to-org list)))
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Interactive publishing functions
;;;###autoload
@@ -1154,7 +1150,8 @@ references with `org-export-get-reference'."
(let* ((filename (file-truename file))
(crossrefs
(org-publish-cache-get-file-property filename :crossrefs nil t))
- (cells (org-export-string-to-search-cell search)))
+ (cells
+ (org-export-string-to-search-cell (org-link-unescape search))))
(or
;; Look for reference associated to search cells triggered by
;; LINK. It can match when targeted file has been published
@@ -1169,6 +1166,17 @@ references with `org-export-get-reference'."
(org-publish-cache-set-file-property filename :crossrefs crossrefs)
(org-export-format-reference new))))))
+(defun org-publish-file-relative-name (filename info)
+ "Convert FILENAME to be relative to current project's base directory.
+INFO is the plist containing the current export state. The
+function does not change relative file names."
+ (let ((base (plist-get info :base-directory)))
+ (if (and base
+ (file-name-absolute-p filename)
+ (file-in-directory-p filename base))
+ (file-relative-name filename base)
+ filename)))
+
;;; Caching functions
diff --git a/lisp/ox.el b/lisp/ox.el
index af16868..8ea47d8 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -3954,9 +3954,7 @@ INFO is a plist holding contextual information."
(defun org-export-numbered-headline-p (headline info)
"Return a non-nil value if HEADLINE element should be numbered.
INFO is a plist used as a communication channel."
- (unless (cl-some
- (lambda (head) (org-not-nil (org-element-property :UNNUMBERED head)))
- (org-element-lineage headline nil t))
+ (unless (org-not-nil (org-export-get-node-property :UNNUMBERED headline t))
(let ((sec-num (plist-get info :section-numbers))
(level (org-export-get-relative-level headline info)))
(if (wholenump sec-num) (<= level sec-num) sec-num))))
@@ -4055,11 +4053,15 @@ used as a communication channel."
(memq (org-element-type (org-export-get-previous-element blob info))
'(nil section)))
-(defun org-export-last-sibling-p (blob info)
- "Non-nil when BLOB is the last sibling in its parent.
-BLOB is an element or an object. INFO is a plist used as
+(defun org-export-last-sibling-p (datum info)
+ "Non-nil when DATUM is the last sibling in its parent.
+DATUM is an element or an object. INFO is a plist used as
a communication channel."
- (not (org-export-get-next-element blob info)))
+ (let ((next (org-export-get-next-element datum info)))
+ (or (not next)
+ (and (eq 'headline (org-element-type datum))
+ (> (org-element-property :level datum)
+ (org-element-property :level next))))))
;;;; For Keywords
diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index cc73946..9d9453a 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -889,27 +889,6 @@ x
(buffer-substring-no-properties
(point-at-bol) (point-at-eol)))))))
-(defun test-ob-verify-result-and-removed-result (result buffer-text)
- "Test helper function to test `org-babel-remove-result'.
-A temp buffer is populated with BUFFER-TEXT, the first block is executed,
-and the result of execution is verified against RESULT.
-
-The block is actually executed /twice/ to ensure result
-replacement happens correctly."
- (org-test-with-temp-text
- buffer-text
- (org-babel-next-src-block) (org-babel-execute-maybe) (org-babel-execute-maybe)
- (should (re-search-forward "\\#\\+results:" nil t))
- (forward-line)
- (should (string= result
- (buffer-substring-no-properties
- (point-at-bol)
- (- (point-max) 16))))
- (org-babel-previous-src-block) (org-babel-remove-result)
- (should (string= buffer-text
- (buffer-substring-no-properties
- (point-min) (point-max))))))
-
(ert-deftest test-ob/org-babel-remove-result--results-default ()
"Test `org-babel-remove-result' with default :results."
(mapcar (lambda (language)
@@ -1114,6 +1093,27 @@ Line 3\"
* next heading"))
+(ert-deftest test-ob/org-babel-remove-result--no-blank-line ()
+ "Test `org-babel-remove-result' without blank line between code and results."
+ (should
+ (equal "
+#+begin_src emacs-lisp
+ (+ 1 1)
+#+end_src
+#+results:
+: 2
+* next heading"
+ (org-test-with-temp-text
+ "
+<point>#+begin_src emacs-lisp
+ (+ 1 1)
+#+end_src
+#+results:
+: 2
+* next heading"
+ (org-babel-execute-maybe)
+ (buffer-string)))))
+
(ert-deftest test-ob/results-do-not-replace-code-blocks ()
(org-test-with-temp-text "Block two has a space after the name.
@@ -1251,9 +1251,10 @@ Line 3\"
#+RESULTS: test
: 4
-
+<point>
Paragraph"
- (narrow-to-region (point) (save-excursion (forward-line 7) (point)))
+ (narrow-to-region (point-min) (point))
+ (goto-char (point-min))
(let ((org-babel-results-keyword "RESULTS"))
(org-babel-execute-src-block))
(org-trim (buffer-string)))))
diff --git a/testing/lisp/test-org-clock.el b/testing/lisp/test-org-clock.el
index 98dab5b..b7b09ed 100644
--- a/testing/lisp/test-org-clock.el
+++ b/testing/lisp/test-org-clock.el
@@ -49,8 +49,8 @@ Return the clock line as a string."
(let* ((beg (org-test-clock-create-timestamp input1 t t))
(end (and input2 (org-test-clock-create-timestamp input2 t t)))
(sec-diff (and input2
- (floor (- (org-time-string-to-seconds end t)
- (org-time-string-to-seconds beg t))))))
+ (floor (- (org-time-string-to-seconds end)
+ (org-time-string-to-seconds beg))))))
(concat org-clock-string " " beg
(when end
(concat "--" end " => "
@@ -344,15 +344,15 @@ the buffer."
;; line, and ignore "file" column.
(should
(equal
- "| Headline | Time | |
-|--------------+------------+-----|
-| *Total time* | *16904:01* | foo |
-|--------------+------------+-----|
-| Test | 16904:01 | foo |
+ "| Headline | Time | |
+|--------------+--------+-----|
+| *Total time* | *8:40* | foo |
+|--------------+--------+-----|
+| Test | 8:40 | foo |
#+TBLFM: $3=string(\"foo\")"
(org-test-with-temp-text-in-file
"* Test
-CLOCK: [2012-03-29 Thu 16:40]--[2014-03-04 Thu 00:41] => 16904:01"
+CLOCK: [2012-03-29 Thu 8:00]--[2012-03-29 Thu 16:40] => 8:40"
(test-org-clock-clocktable-contents ":scope file-with-archives"
"#+TBLFM: $3=string(\"foo\")"))))
;; Test "function" scope.
diff --git a/testing/lisp/test-org-colview.el b/testing/lisp/test-org-colview.el
index 85c1bcf..5e1fe56 100644
--- a/testing/lisp/test-org-colview.el
+++ b/testing/lisp/test-org-colview.el
@@ -513,7 +513,7 @@
(cl-letf (((symbol-function 'current-time)
(lambda ()
(apply #'encode-time
- (org-parse-time-string "<2014-03-04 Tue>" nil t)))))
+ (org-parse-time-string "<2014-03-04 Tue>")))))
(org-test-with-temp-text
"* H
** S1
@@ -528,39 +528,39 @@
(get-char-property (point) 'org-columns-value-modified)))))
(should
(equal
- "705d"
+ "2d"
(cl-letf (((symbol-function 'current-time)
(lambda ()
(apply #'encode-time
- (org-parse-time-string "<2014-03-04 Tue>" nil t)))))
+ (org-parse-time-string "<2014-03-04 Tue>")))))
(org-test-with-temp-text
"* H
** S1
:PROPERTIES:
-:A: <2012-03-29 Thu>
+:A: <2014-03-03 Mon>
:END:
** S1
:PROPERTIES:
-:A: <2014-03-04 Tue>
+:A: <2014-03-02 Sun>
:END:"
(let ((org-columns-default-format "%A{@max}")) (org-columns))
(get-char-property (point) 'org-columns-value-modified)))))
(should
(equal
- "352d 12h"
+ "1d 12h"
(cl-letf (((symbol-function 'current-time)
(lambda ()
(apply #'encode-time
- (org-parse-time-string "<2014-03-04 Tue>" nil t)))))
+ (org-parse-time-string "<2014-03-04 Tue>")))))
(org-test-with-temp-text
"* H
** S1
:PROPERTIES:
-:A: <2012-03-29 Thu>
+:A: <2014-03-03 Mon>
:END:
** S1
:PROPERTIES:
-:A: <2014-03-04 Tue>
+:A: <2014-03-02 Sun>
:END:"
(let ((org-columns-default-format "%A{@mean}")) (org-columns))
(get-char-property (point) 'org-columns-value-modified)))))
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index d067c04..e1ef482 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -90,86 +90,81 @@
(should
(equal "# \nComment"
(org-test-with-temp-text "Comment"
- (progn (call-interactively 'comment-dwim)
- (buffer-string)))))
+ (call-interactively #'org-comment-dwim)
+ (buffer-string))))
;; No region selected, no comment on current line and line empty:
;; insert comment on this line.
(should
(equal "# \nParagraph"
(org-test-with-temp-text "\nParagraph"
- (progn (call-interactively 'comment-dwim)
- (buffer-string)))))
+ (call-interactively #'org-comment-dwim)
+ (buffer-string))))
;; No region selected, and a comment on this line: indent it.
(should
(equal "* Headline\n # Comment"
- (org-test-with-temp-text "* Headline\n# Comment"
- (progn (forward-line)
- (let ((org-adapt-indentation t))
- (call-interactively 'comment-dwim))
- (buffer-string)))))
+ (org-test-with-temp-text "* Headline\n# <point>Comment"
+ (let ((org-adapt-indentation t))
+ (call-interactively #'org-comment-dwim))
+ (buffer-string))))
;; Also recognize single # at column 0 as comments.
(should
(equal "# Comment"
(org-test-with-temp-text "# Comment"
- (progn (forward-line)
- (call-interactively 'comment-dwim)
- (buffer-string)))))
+ (call-interactively #'org-comment-dwim)
+ (buffer-string))))
;; Region selected and only comments and blank lines within it:
;; un-comment all commented lines.
(should
(equal "Comment 1\n\nComment 2"
(org-test-with-temp-text "# Comment 1\n\n# Comment 2"
- (progn
- (transient-mark-mode 1)
- (push-mark (point) t t)
- (goto-char (point-max))
- (call-interactively 'comment-dwim)
- (buffer-string)))))
+ (transient-mark-mode 1)
+ (push-mark (point) t t)
+ (goto-char (point-max))
+ (call-interactively #'org-comment-dwim)
+ (buffer-string))))
;; Region selected without comments: comment all lines if
;; `comment-empty-lines' is non-nil, only non-blank lines otherwise.
(should
(equal "# Comment 1\n\n# Comment 2"
(org-test-with-temp-text "Comment 1\n\nComment 2"
- (progn
- (transient-mark-mode 1)
- (push-mark (point) t t)
- (goto-char (point-max))
- (let ((comment-empty-lines nil))
- (call-interactively 'comment-dwim))
- (buffer-string)))))
+ (transient-mark-mode 1)
+ (push-mark (point) t t)
+ (goto-char (point-max))
+ (let ((comment-empty-lines nil))
+ (call-interactively #'org-comment-dwim))
+ (buffer-string))))
(should
(equal "# Comment 1\n# \n# Comment 2"
(org-test-with-temp-text "Comment 1\n\nComment 2"
- (progn
- (transient-mark-mode 1)
- (push-mark (point) t t)
- (goto-char (point-max))
- (let ((comment-empty-lines t))
- (call-interactively 'comment-dwim))
- (buffer-string)))))
+ (transient-mark-mode 1)
+ (push-mark (point) t t)
+ (goto-char (point-max))
+ (let ((comment-empty-lines t))
+ (call-interactively #'org-comment-dwim))
+ (buffer-string))))
;; In front of a keyword without region, insert a new comment.
(should
(equal "# \n#+KEYWORD: value"
(org-test-with-temp-text "#+KEYWORD: value"
- (progn (call-interactively 'comment-dwim)
- (buffer-string)))))
+ (call-interactively #'org-comment-dwim)
+ (buffer-string))))
;; In a source block, use appropriate syntax.
(should
(equal " ;; "
- (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\n\n#+END_SRC"
- (forward-line)
+ (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\n<point>\n#+END_SRC"
(let ((org-edit-src-content-indentation 2))
- (call-interactively 'comment-dwim))
- (buffer-substring-no-properties (line-beginning-position) (point)))))
+ (call-interactively #'org-comment-dwim))
+ (buffer-substring-no-properties (line-beginning-position)
+ (point)))))
(should
(equal "#+BEGIN_SRC emacs-lisp\n ;; a\n ;; b\n#+END_SRC"
- (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\na\nb\n#+END_SRC"
- (forward-line)
+ (org-test-with-temp-text
+ "#+BEGIN_SRC emacs-lisp\n<point>a\nb\n#+END_SRC"
(transient-mark-mode 1)
(push-mark (point) t t)
(forward-line 2)
(let ((org-edit-src-content-indentation 2))
- (call-interactively 'comment-dwim))
+ (call-interactively #'org-comment-dwim))
(buffer-string)))))
@@ -1184,6 +1179,18 @@
(equal "* h\n"
(org-test-with-temp-text "*<point> h"
(org-return)
+ (buffer-string))))
+ ;; Before first column or after last one in a table, split the
+ ;; table.
+ (should
+ (equal "| a |\n\n| b |"
+ (org-test-with-temp-text "| a |\n<point>| b |"
+ (org-return)
+ (buffer-string))))
+ (should
+ (equal "| a |\n\n| b |"
+ (org-test-with-temp-text "| a |<point>\n| b |"
+ (org-return)
(buffer-string)))))
(ert-deftest test-org/meta-return ()
diff --git a/testing/lisp/test-ox-publish.el b/testing/lisp/test-ox-publish.el
index 921e69e..55fa431 100644
--- a/testing/lisp/test-ox-publish.el
+++ b/testing/lisp/test-ox-publish.el
@@ -450,6 +450,33 @@ Unless set otherwise in PROPERTIES, `:base-directory' is set to
("p" :base-directory ,base))))
(car (org-publish-get-project-from-filename file t))))))
+(ert-deftest test-org-publish/file-relative-name ()
+ "Test `org-publish-file-relative-name' specifications."
+ ;; Turn absolute file names into relative ones if file belongs to
+ ;; base directory.
+ (should
+ (equal "a.org"
+ (let* ((base (expand-file-name "examples/pub/" org-test-dir))
+ (file (expand-file-name "a.org" base)))
+ (org-publish-file-relative-name file `(:base-directory ,base)))))
+ (should
+ (equal "pub/a.org"
+ (let* ((base (expand-file-name "examples/" org-test-dir))
+ (file (expand-file-name "pub/a.org" base)))
+ (org-publish-file-relative-name file `(:base-directory ,base)))))
+ ;; Absolute file names that do not belong to base directory are
+ ;; unchanged.
+ (should
+ (equal "/name.org"
+ (let ((base (expand-file-name "examples/pub/" org-test-dir)))
+ (org-publish-file-relative-name "/name.org"
+ `(:base-directory ,base)))))
+ ;; Relative file names are unchanged.
+ (should
+ (equal "a.org"
+ (let ((base (expand-file-name "examples/pub/" org-test-dir)))
+ (org-publish-file-relative-name "a.org" `(:base-directory ,base))))))
+
(provide 'test-ox-publish)
;;; test-ox-publish.el ends here
diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el
index 6b5e3a3..8b2ef81 100644
--- a/testing/lisp/test-ox.el
+++ b/testing/lisp/test-ox.el
@@ -2474,11 +2474,11 @@ Para2"
(org-export-numbered-headline-p
(org-element-map tree 'headline #'identity info t)
info)))
- ;; UNNUMBERED ignores inheritance. Any non-nil value among
- ;; ancestors disables numbering.
+ ;; UNNUMBERED is inherited.
(should
- (org-test-with-parsed-data
- "* H
+ (equal '(unnumbered numbered unnumbered)
+ (org-test-with-parsed-data
+ "* H
:PROPERTIES:
:UNNUMBERED: t
:END:
@@ -2486,10 +2486,12 @@ Para2"
:PROPERTIES:
:UNNUMBERED: nil
:END:
-*** H3"
- (cl-every
- (lambda (h) (not (org-export-numbered-headline-p h info)))
- (org-element-map tree 'headline #'identity info)))))
+** H3"
+ (org-element-map tree 'headline
+ (lambda (h)
+ (if (org-export-numbered-headline-p h info) 'numbered
+ 'unnumbered))
+ info)))))
(ert-deftest test-org-export/number-to-roman ()
"Test `org-export-number-to-roman' specifications."
@@ -2675,7 +2677,13 @@ Para2"
(org-test-with-parsed-data "* Headline\n* Headline 2 :ignore:"
(org-element-map tree 'headline
(lambda (h) (if (org-export-last-sibling-p h info) 'yes 'no))
- info))))))
+ info)))))
+ ;; Handle gracefully discontinuous headings.
+ (should
+ (equal '(yes yes)
+ (org-test-with-parsed-data "** S\n* H"
+ (org-element-map tree 'headline
+ (lambda (h) (if (org-export-last-sibling-p h info) 'yes 'no)))))))
(ert-deftest test-org-export/handle-inlinetasks ()
"Test inlinetask export."