all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* OK to push Org bugfixes for next Emacs?
@ 2018-05-05 18:24 Rasmus
  2018-05-05 18:39 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Rasmus @ 2018-05-05 18:24 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 4781 bytes --]

Hi,

I would like to merge the attached patch that would update Org to 9.1.12.
They are all minor fixes (from the perspective of the Org devs).

Thanks,
Rasmus

Here is list of changes according to the git log:

    * lisp/org.el (org-open-link-from-string): Fix bug when links contain special characters.
    * lisp/org-attach.el: (org-attach-annex-get-maybe) Ensure shell
      command that checks whether a git-annex file exists is called from
      within the git-annex repository. Otherwise, it will result in an
      error.
    * lisp/org-agenda.el (org-tags-view): Don't leave an empty
      *Org agenda* buffer when keyboard-quitting the match prompt.
    * lisp/org-agenda.el (org-search-view): Remove agenda-archives even
      with buffer restriction.
    * lisp/org.el (org-fast-tag-selection): Fix
      "(wrong-number-of-arguments max 0)" error when setting tag and no
      tag is defined.
    * lisp/org-eww.el (org-eww-copy-for-org-mode): Fix typo in docstring.
    * doc/org.texi (Time-of-day specifications): Document
      `org-agenda-search-headline-for-time'.
    * lisp/org.el (org--tag-add-to-alist): Preserve order when merging tag
      alists.  Remove duplicates only when they are outside a group.
      Rename from `org-tag-add-to-alist'.
    (org-set-regexps-and-options):
    (org-global-tags-completion-table):
    (org-make-tags-matcher):
    (org-set-tags):
    (org-change-tag-in-region):
    (org-agenda-prepare-buffers): Apply renaming.
    * doc/org.texi (Editing source code, Export settings)
    (Closing items, Drawers, Structure editing): Fix use of
    @key.  For the details, see
    http://lists.gnu.org/archive/html/emacs-devel/2018-04/msg00390.html.
    (backport)
    * lisp/org-capture.el (org-capture-finalize): Fix error on capture abort.
      Do not set `abort-note' to `dirty' too easily.
    * lisp/org-capture.el (org-capture-fill-template): Fix "%x"
      placeholder when clipboard is empty.
    * lisp/ox-md.el (org-md--build-toc): Tiny refactoring.
    (org-md--build-toc): When exporting markdown with ToC, if heading
    numbering is not enabled, ToC will be shown as an unordered list.
    * doc/org.texi (Markdown export): Clarify `md' and `html' back-ends relationship.
    * org.el (org-timestamp-up): Document undocumented behavior.
    (org-timestamp-up): The function changes the timestamp type when
    the point is on the enclosing bracket.  The documentation now
    reflects that behavior.    
    * org.el (org-timestamp-down): Document undocumented behavior.
    (org-timestamp-down): The function changes the timestamp type when
    the point is on the enclosing bracket.  The documentation now
    reflects that behavior.
    * lisp/org.el (org-kill-line): Fix error message.
    * lisp/org-inlinetask.el (org-inlinetask-end-p): New function.
    (org-inlinetask-at-task-p):
    (org-inlinetask-in-task-p):
    (org-inlinetask-goto-beginning):
    (org-inlinetask-goto-end):
    * lisp/org.el (org-scan-tags): Use new function.
      The above changes remove inlinetask END part from Agenda view    
    * lisp/org-w3m.el (org-w3m-copy-for-org-mode):
    * lisp/org-eww.el (org-eww-copy-for-org-mode): Do not error when
      called on blank links.
    * lisp/org.el (org-file-apps): Fix regexp in docstring.
    * lisp/org-capture.el (org-capture-set-target-location): Handle
      non-default `org-extend-today-until'.
    * lisp/org-table.el (org-table-align): Fix alignment with long links.
    * lisp/org.el (org-return): Follow multi-line links.
    lisp/ob-sed.el (org-babel-execute:sed): Change file flag to "-f"
    instead of "--file" to support BSD sed as well.
    * lisp/org-agenda.el (org-agenda-list): Condition the call to
      `recenter` only when the buffer has a window associated.
    
    This permit to call `org-agenda-list` in a `with-temp-buffer` like
    below:
    
    (with-temp-buffer
      (let ((org-agenda-sticky nil)
            (org-agenda-buffer-tmp-name (buffer-name)))
        (org-agenda-list 1)
        (buffer-string))
    * lisp/ob-python.el (org-babel-python-evaluate-session): Small
      refactoring.
    * lisp/ob-python.el (org-bable-python-evaluate-session):
      Insert blank line when sending code to interpreter
      Syntax error occurs when evaluating the following code block:

      \#+begin_src python :session
      if True:
	  1
      2
      \#+end_src

      A blank line is required for top level module code to end an indented block, such as a for loop, try/except, or if statement.

      https://www.python.org/dev/peps/pep-0008/#blank-line
    * doc/org.texi (Installation): Fix clone commands. (backport)
    * doc/org.texi (@code{capture} protocol): Add missing protocol.


-- 
You people at the NSA are becoming my new best friends!

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Update-Org-to-v9.1.12.patch --]
[-- Type: text/x-patch, Size: 28212 bytes --]

From c1a36c4f87bf3506c77ea2d19f74cb9e84040390 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Sat, 5 May 2018 20:12:31 +0200
Subject: [PATCH] Update Org to v9.1.12

Please note this is a bugfix release. See etc/ORG-NEWS for details.
---
 doc/misc/org.texi          | 24 ++++++-----
 etc/refcards/orgcard.tex   |  2 +-
 lisp/org/ob-python.el      | 16 ++++++-
 lisp/org/ob-sed.el         |  4 +-
 lisp/org/org-agenda.el     | 20 ++++-----
 lisp/org/org-attach.el     |  3 +-
 lisp/org/org-capture.el    | 24 ++++-------
 lisp/org/org-eww.el        | 17 ++++----
 lisp/org/org-inlinetask.el | 33 +++++++-------
 lisp/org/org-table.el      |  2 +-
 lisp/org/org-version.el    |  4 +-
 lisp/org/org-w3m.el        | 17 ++++----
 lisp/org/org.el            | 88 +++++++++++++++++++++++++++-----------
 lisp/org/ox-md.el          | 11 +++--
 14 files changed, 158 insertions(+), 107 deletions(-)

diff --git a/doc/misc/org.texi b/doc/misc/org.texi
index 08ba33605e..5fb3efe52a 100644
--- a/doc/misc/org.texi
+++ b/doc/misc/org.texi
@@ -4,8 +4,8 @@
 @settitle The Org Manual
 @include docstyle.texi
 
-@set VERSION 9.1.9
-@set DATE 2018-03-22
+@set VERSION 9.1.12
+@set DATE 2018-04-27
 
 @c Version and Contact Info
 @set MAINTAINERSITE @uref{https://orgmode.org,maintainers web page}
@@ -7595,7 +7595,7 @@ To use this feature, add a bookmark with an arbitrary name, e.g.  @samp{Org:
 capture} and enter this as @samp{Location}:
 
 @example
-javascript:location.href='org-protocol://template=x'+
+javascript:location.href='org-protocol://capture?template=x'+
       '&url='+encodeURIComponent(window.location.href)+
       '&title='+encodeURIComponent(document.title)+
       '&body='+encodeURIComponent(window.getSelection());
@@ -8664,9 +8664,13 @@ ranges can be specified with two timestamps, like
 @c
 @w{@samp{<2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>}}.
 
-In the headline of the entry itself, a time(range) may also appear as
-plain text (like @samp{12:45} or a @samp{8:30-1pm}).  If the agenda
-integrates the Emacs diary (@pxref{Weekly/daily agenda}), time
+@vindex org-agenda-search-headline-for-time
+In the headline of the entry itself, a time(range) may also appear as plain
+text (like @samp{12:45} or a @samp{8:30-1pm})@footnote{You can, however,
+disable this by setting @code{org-agenda-search-headline-for-time} variable
+to a @code{nil} value.}.
+
+If the agenda integrates the Emacs diary (@pxref{Weekly/daily agenda}), time
 specifications in diary entries are recognized as well.
 
 For agenda display, Org mode extracts the time and displays it in a
@@ -12671,12 +12675,12 @@ The @LaTeX{} export back-end converts horizontal rules by the specified
 @section Markdown export
 @cindex Markdown export
 
-The Markdown export back-end, @code{md}, converts an Org file to a Markdown
+The Markdown export back-end, @code{md}, converts an Org file to Markdown
 format, as defined at @url{http://daringfireball.net/projects/markdown/}.
 
-Since @code{md} is built on top of the HTML back-end, any Org constructs not
-supported by Markdown, such as tables, the underlying @code{html} back-end
-(@pxref{HTML export}) converts them.
+The @code{md} back-end is built on top of the HTML back-end (@pxref{HTML
+export}).  As a consequence, it converts every Org construct not supported by
+Markdown syntax, such as tables, to HTML.
 
 @subheading Markdown export commands
 
diff --git a/etc/refcards/orgcard.tex b/etc/refcards/orgcard.tex
index 91cc03f1f1..c0edf394a7 100644
--- a/etc/refcards/orgcard.tex
+++ b/etc/refcards/orgcard.tex
@@ -1,5 +1,5 @@
 % Reference Card for Org Mode
-\def\orgversionnumber{9.1.9}
+\def\orgversionnumber{9.1.12}
 \def\versionyear{2018}          % latest update
 \input emacsver.tex
 
diff --git a/lisp/org/ob-python.el b/lisp/org/ob-python.el
index 9f1234bac5..a44e5a5183 100644
--- a/lisp/org/ob-python.el
+++ b/lisp/org/ob-python.el
@@ -308,9 +308,21 @@ last statement in BODY, as elisp."
 	       (list (format "open('%s', 'w').write(str(_))"
 			     (org-babel-process-file-name tmp-file
                                                           'noquote)))))))
+	 (last-indent 0)
 	 (input-body (lambda (body)
-		       (mapc (lambda (line) (insert line) (funcall send-wait))
-			     (split-string body "[\r\n]"))
+		       (dolist (line (split-string body "[\r\n]"))
+			 ;; Insert a blank line to end an indent
+			 ;; block.
+			 (let ((curr-indent (string-match "\\S-" line)))
+			   (if curr-indent
+			       (progn
+				 (when (< curr-indent last-indent)
+				   (insert "")
+				   (funcall send-wait))
+				 (setq last-indent curr-indent))
+			     (setq last-indent 0)))
+			 (insert line)
+			 (funcall send-wait))
 		       (funcall send-wait)))
          (results
           (pcase result-type
diff --git a/lisp/org/ob-sed.el b/lisp/org/ob-sed.el
index b2c80f88c0..ca8b7545fe 100644
--- a/lisp/org/ob-sed.el
+++ b/lisp/org/ob-sed.el
@@ -4,7 +4,7 @@
 
 ;; Author: Bjarte Johansen
 ;; Keywords: literate programming, reproducible research
-;; Version: 0.1.0
+;; Version: 0.1.1
 
 ;; This file is part of GNU Emacs.
 
@@ -79,7 +79,7 @@ function is called by `org-babel-execute-src-block'."
          (cmd (mapconcat #'identity
 			 (remq nil
 			       (list org-babel-sed-command
-				     (format "--file=\"%s\"" code-file)
+				     (format "-f \"%s\"" code-file)
 				     cmd-line
 				     in-file))
 			 " ")))
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el
index 5bbf5e34ee..322480cf25 100644
--- a/lisp/org/org-agenda.el
+++ b/lisp/org/org-agenda.el
@@ -4261,8 +4261,9 @@ items if they have an hour specification like [h]h:mm."
 	  (insert tbl)))
       (goto-char (point-min))
       (or org-agenda-multi (org-agenda-fit-window-to-buffer))
-      (unless (and (pos-visible-in-window-p (point-min))
-		   (pos-visible-in-window-p (point-max)))
+      (unless (or (not (get-buffer-window))
+		  (and (pos-visible-in-window-p (point-min))
+		       (pos-visible-in-window-p (point-max))))
 	(goto-char (1- (point-max)))
 	(recenter -1)
 	(if (not (pos-visible-in-window-p (or start-pos 1)))
@@ -4486,9 +4487,9 @@ is active."
       (setq files (org-agenda-files nil 'ifmode))
       ;; Add `org-agenda-text-search-extra-files' unless there is some
       ;; restriction.
-      (unless (get 'org-agenda-files 'org-restrict)
-	(when (eq (car org-agenda-text-search-extra-files) 'agenda-archives)
-	  (pop org-agenda-text-search-extra-files)
+      (when (eq (car org-agenda-text-search-extra-files) 'agenda-archives)
+	(pop org-agenda-text-search-extra-files)
+	(unless (get 'org-agenda-files 'org-restrict)
 	  (setq files (org-add-archive-files files))))
       ;; Uniquify files.  However, let `org-check-agenda-file' handle
       ;; non-existent ones.
@@ -4750,11 +4751,11 @@ The prefix arg TODO-ONLY limits the search to TODO entries."
 		    (format "*Org Agenda(%s:%s)*"
 			    (or org-keys (or (and todo-only "M") "m")) match)
 		  (format "*Org Agenda(%s)*" (or (and todo-only "M") "m")))))
+      (setq matcher (org-make-tags-matcher match))
       ;; Prepare agendas (and `org-tag-alist-for-agenda') before
       ;; expanding tags within `org-make-tags-matcher'
       (org-agenda-prepare (concat "TAGS " match))
-      (setq matcher (org-make-tags-matcher match)
-	    match (car matcher)
+      (setq match (car matcher)
 	    matcher (cdr matcher))
       (org-compile-prefix-format 'tags)
       (org-set-sorting-strategy 'tags)
@@ -6003,10 +6004,7 @@ specification like [h]h:mm."
 			 org-deadline-warning-days))
 		   ;; Set pre-warning to deadline.
 		   (t 0))))
-	       (wdays (if suppress-prewarning
-			  (let ((org-deadline-warning-days suppress-prewarning))
-			    (org-get-wdays s))
-			(org-get-wdays s))))
+	       (wdays (or suppress-prewarning (org-get-wdays s))))
 	  (cond
 	   ;; Only display deadlines at their base date, at future
 	   ;; repeat occurrences or in today agenda.
diff --git a/lisp/org/org-attach.el b/lisp/org/org-attach.el
index 9774e3a797..86516e2702 100644
--- a/lisp/org/org-attach.el
+++ b/lisp/org/org-attach.el
@@ -319,7 +319,8 @@ the ATTACH_DIR property) their own attachment directory."
 (defun org-attach-annex-get-maybe (path)
   "Call git annex get PATH (via shell) if using git annex.
 Signals an error if the file content is not available and it was not retrieved."
-  (let ((path-relative (file-relative-name path)))
+  (let* ((default-directory (expand-file-name org-attach-directory))
+	 (path-relative (file-relative-name path)))
     (when (and (org-attach-use-annex)
 	       (not
 		(string-equal
diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el
index 3de386c69d..cd54491fc9 100644
--- a/lisp/org/org-capture.el
+++ b/lisp/org/org-capture.el
@@ -743,9 +743,7 @@ captured item after finalizing."
 	  (org-with-point-at clock-in-task (org-clock-in)))
 	(message "Interrupted clock has been resumed"))))
 
-  (let ((beg (point-min))
-	(end (point-max))
-	(abort-note nil))
+  (let ((abort-note nil))
     ;; Store the size of the capture buffer
     (org-capture-put :captured-entry-size (- (point-max) (point-min)))
     (widen)
@@ -753,16 +751,11 @@ captured item after finalizing."
     (org-capture-put :insertion-point (point))
 
     (if org-note-abort
-	(let ((m1 (org-capture-get :begin-marker 'local))
-	      (m2 (org-capture-get :end-marker 'local)))
-	  (if (and m1 m2 (= m1 beg) (= m2 end))
-	      (progn
-		(setq m2 (if (cdr (assq 'heading org-blank-before-new-entry))
-			     m2 (1+ m2))
-		      m2 (if (< (point-max) m2) (point-max) m2))
-		(setq abort-note 'clean)
-		(kill-region m1 m2))
-	    (setq abort-note 'dirty)))
+	(let ((beg (org-capture-get :begin-marker 'local))
+	      (end (org-capture-get :end-marker 'local)))
+	  (if (not (and beg end)) (setq abort-note 'dirty)
+	    (setq abort-note t)
+	    (org-with-wide-buffer (kill-region beg end))))
 
       ;; Postprocessing:  Update Statistics cookies, do the sorting
       (when (derived-mode-p 'org-mode)
@@ -1010,7 +1003,7 @@ Store them in the capture property list."
 			 ;; Use 00:00 when no time is given for another
 			 ;; date than today?
 			 (apply #'encode-time
-				(append '(0 0 0)
+				(append `(0 0 ,org-extend-today-until)
 					(cl-cdddr (decode-time prompt-time)))))
 			((string-match "\\([^ ]+\\)--?[^ ]+[ ]+\\(.*\\)"
 				       org-read-date-final-answer)
@@ -1607,7 +1600,8 @@ The template may still contain \"%?\" for cursor positioning."
 	 (v-c (and kill-ring (current-kill 0)))
 	 (v-x (or (org-get-x-clipboard 'PRIMARY)
 		  (org-get-x-clipboard 'CLIPBOARD)
-		  (org-get-x-clipboard 'SECONDARY)))
+		  (org-get-x-clipboard 'SECONDARY)
+		  ""))			;ensure it is a string
 	 ;; `initial' and `annotation' might have been passed.  But if
 	 ;; the property list has them, we prefer those values.
 	 (v-i (or (plist-get org-store-link-plist :initial)
diff --git a/lisp/org/org-eww.el b/lisp/org/org-eww.el
index 1b6112adbb..34c4fca690 100644
--- a/lisp/org/org-eww.el
+++ b/lisp/org/org-eww.el
@@ -93,11 +93,12 @@ Otherwise point is not moved.  Return point."
 (defun org-eww-copy-for-org-mode ()
   "Copy current buffer content or active region with `org-mode' style links.
 This will encode `link-title' and `link-location' with
-`org-make-link-string', and insert the transformed test into the kill ring,
-so that it can be yanked into an Org mode buffer with links working correctly.
+`org-make-link-string' and insert the transformed text into the
+kill ring, so that it can be yanked into an Org mode buffer with
+links working correctly.
 
-Further lines starting with a star get quoted with a comma to keep
-the structure of the Org file."
+Further lines starting with a star get quoted with a comma to
+keep the structure of the Org file."
   (interactive)
   (let* ((regionp (org-region-active-p))
          (transform-start (point-min))
@@ -140,13 +141,13 @@ the structure of the Org file."
               ;; concat `org-mode' style url to `return-content'.
 	      (setq return-content
 		    (concat return-content
-			    (if (stringp link-location)
-				;; hint: link-location is different for form-elements.
+			    (if (org-string-nw-p link-location)
+				;; Hint: link-location is different
+				;; for form-elements.
 				(org-make-link-string link-location link-title)
 			      link-title))))
 	  (goto-char temp-position) ; reset point before jump next anchor
-	  (setq out-bound t)	    ; for break out `while' loop
-	  ))
+	  (setq out-bound t)))	    ; for break out `while' loop
       ;; Add the rest until end of the region to be copied.
       (when (< (point) transform-end)
 	(setq return-content
diff --git a/lisp/org/org-inlinetask.el b/lisp/org/org-inlinetask.el
index 08fc268d0d..d95db321ac 100644
--- a/lisp/org/org-inlinetask.el
+++ b/lisp/org/org-inlinetask.el
@@ -152,24 +152,24 @@ The number of levels is controlled by `org-inlinetask-min-level'."
 		  org-inlinetask-min-level)))
     (format "^\\(\\*\\{%d,\\}\\)[ \t]+" nstars)))
 
+(defun org-inlinetask-end-p ()
+  "Return a non-nil value if point is on inline task's END part."
+  (let ((case-fold-search t))
+    (org-match-line (concat (org-inlinetask-outline-regexp) "END[ \t]*$"))))
+
 (defun org-inlinetask-at-task-p ()
-  "Return true if point is at beginning of an inline task."
-  (save-excursion
-    (beginning-of-line)
-    (and (looking-at (concat (org-inlinetask-outline-regexp)  "\\(.*\\)"))
-	 (not (string-match "^end[ \t]*$" (downcase (match-string 2)))))))
+  "Return non-nil if point is at beginning of an inline task."
+  (and (org-match-line (concat (org-inlinetask-outline-regexp)  "\\(.*\\)"))
+       (not (org-inlinetask-end-p))))
 
 (defun org-inlinetask-in-task-p ()
   "Return true if point is inside an inline task."
   (save-excursion
     (beginning-of-line)
-    (let* ((case-fold-search t)
-	   (stars-re (org-inlinetask-outline-regexp))
-	   (task-beg-re (concat stars-re "\\(?:.*\\)"))
-	   (task-end-re (concat stars-re "END[ \t]*$")))
-      (or (looking-at-p task-beg-re)
+    (let ((case-fold-search t))
+      (or (looking-at-p (concat (org-inlinetask-outline-regexp) "\\(?:.*\\)"))
 	  (and (re-search-forward "^\\*+[ \t]+" nil t)
-	       (progn (beginning-of-line) (looking-at-p task-end-re)))))))
+	       (org-inlinetask-end-p))))))
 
 (defun org-inlinetask-goto-beginning ()
   "Go to the beginning of the inline task at point."
@@ -177,7 +177,7 @@ The number of levels is controlled by `org-inlinetask-min-level'."
   (let ((case-fold-search t)
 	(inlinetask-re (org-inlinetask-outline-regexp)))
     (re-search-backward inlinetask-re nil t)
-    (when (looking-at-p (concat inlinetask-re "END[ \t]*$"))
+    (when (org-inlinetask-end-p)
       (re-search-backward inlinetask-re nil t))))
 
 (defun org-inlinetask-goto-end ()
@@ -185,16 +185,15 @@ The number of levels is controlled by `org-inlinetask-min-level'."
     Return point."
   (save-match-data
     (beginning-of-line)
-    (let* ((case-fold-search t)
-           (inlinetask-re (org-inlinetask-outline-regexp))
-           (task-end-re (concat inlinetask-re "END[ \t]*$")))
+    (let ((case-fold-search t)
+	  (inlinetask-re (org-inlinetask-outline-regexp)))
       (cond
-       ((looking-at-p task-end-re)
+       ((org-inlinetask-end-p)
         (forward-line))
        ((looking-at-p inlinetask-re)
         (forward-line)
         (cond
-         ((looking-at-p task-end-re) (forward-line))
+         ((org-inlinetask-end-p) (forward-line))
          ((looking-at-p inlinetask-re))
          ((org-inlinetask-in-task-p)
           (re-search-forward inlinetask-re nil t)
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index dcf7430363..e451350224 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -824,7 +824,7 @@ When nil, simply write \"#ERROR\" in corrupted fields.")
              ;; Find fields that are wider than FMAX, and shorten them.
              (when fmax
                (dolist (x column)
-                 (when (> (string-width x) fmax)
+                 (when (> (org-string-width x) fmax)
                    (org-add-props x nil
                      'help-echo
                      (concat
diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el
index 132ad2b303..90fc425849 100644
--- a/lisp/org/org-version.el
+++ b/lisp/org/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.1.9"))
+   (let ((org-release "9.1.12"))
      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 "release_9.1.9-65-g5e4542"))
+   (let ((org-git-version "release_9.1.12-72-gc9d49a"))
      org-git-version))
 \f
 (provide 'org-version)
diff --git a/lisp/org/org-w3m.el b/lisp/org/org-w3m.el
index 9690c8e90c..b2dfc7787c 100644
--- a/lisp/org/org-w3m.el
+++ b/lisp/org/org-w3m.el
@@ -76,13 +76,13 @@ so that it can be yanked into an Org  buffer with links working correctly."
     (message "Transforming links...")
     (save-excursion
       (goto-char transform-start)
-      (while (and (not out-bound)                 ; still inside region to copy
+      (while (and (not out-bound)	; still inside region to copy
                   (not (org-w3m-no-next-link-p))) ; no next link current buffer
         ;; store current point before jump next anchor
         (setq temp-position (point))
         ;; move to next anchor when current point is not at anchor
         (or (get-text-property (point) 'w3m-href-anchor) (org-w3m-get-next-link-start))
-        (if (<= (point) transform-end)  ; if point is inside transform bound
+        (if (<= (point) transform-end) ; if point is inside transform bound
             (progn
               ;; get content between two links.
               (if (> (point) temp-position)
@@ -95,12 +95,13 @@ so that it can be yanked into an Org  buffer with links working correctly."
               (setq link-title (buffer-substring (point)
                                                  (org-w3m-get-anchor-end)))
               ;; concat Org style url to `return-content'.
-              (setq return-content (concat return-content
-                                           (org-make-link-string
-                                            link-location link-title))))
-          (goto-char temp-position)     ; reset point before jump next anchor
-          (setq out-bound t)            ; for break out `while' loop
-          ))
+              (setq return-content
+		    (concat return-content
+			    (if (org-string-nw-p link-location)
+				(org-make-link-string link-location link-title)
+			      link-title))))
+          (goto-char temp-position) ; reset point before jump next anchor
+          (setq out-bound t)))	    ; for break out `while' loop
       ;; add the rest until end of the region to be copied
       (if (< (point) transform-end)
           (setq return-content
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 1373861ad1..626198155f 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -7,7 +7,7 @@
 ;; Maintainer: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: https://orgmode.org
-;; Version: 9.1.9
+;; Version: 9.1.12
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -2294,7 +2294,7 @@ Possible values for the file identifier are:
                  In a custom function, you can access the group matches with
                  (match-string n link).
 
-                 Example: (\"\\\\.pdf::\\\\(\\\\d+\\\\)\\\\\\='\" . \
+                 Example: (\"\\\\.pdf::\\\\([0-9]+\\\\)\\\\\\='\" . \
 \"evince -p %1 %s\")
                      to open [[file:document.pdf::5]] with evince at page 5.
 
@@ -4903,17 +4903,39 @@ Support for group tags is controlled by the option
   (message "Groups tags support has been turned %s"
 	   (if org-group-tags "on" "off")))
 
-(defun org-tag-add-to-alist (alist1 alist2)
-  "Append ALIST1 elements to ALIST2 if they are not there yet."
+(defun org--tag-add-to-alist (alist1 alist2)
+  "Merge tags from ALIST1 into ALIST2.
+
+Duplicates tags outside a group are removed.  Keywords and order
+are preserved.
+
+The function assumes ALIST1 and ALIST2 are proper tag alists.
+See `org-tag-alist' for their structure."
   (cond
    ((null alist2) alist1)
    ((null alist1) alist2)
-   (t (let ((alist2-cars (mapcar (lambda (x) (car-safe x)) alist2))
-	    to-add)
-	(dolist (i alist1)
-	  (unless (member (car-safe i) alist2-cars)
-	    (push i to-add)))
-	(append to-add alist2)))))
+   (t
+    (let ((to-add nil)
+	  (group-flag nil))
+      (dolist (tag-pair alist1)
+	(pcase tag-pair
+	  (`(,(or :startgrouptag :startgroup))
+	   (setq group-flag t)
+	   (push tag-pair to-add))
+	  (`(,(or :endgrouptag :endgroup))
+	   (setq group-flag nil)
+	   (push tag-pair to-add))
+	  (`(,(or :grouptags :newline))
+	   (push tag-pair to-add))
+	  (`(,tag . ,_)
+	   ;; Remove duplicates from ALIST1, unless they are in
+	   ;; a group.  Indeed, it makes sense to have a tag appear in
+	   ;; multiple groups.
+	   (when (or group-flag (not (assoc tag alist2)))
+	     (push tag-pair to-add)))
+	  (_ (error "Invalid association in tag alist: %S" tag-pair))))
+      ;; Preserve order of ALIST1.
+      (append (nreverse to-add) alist2)))))
 
 (defun org-set-regexps-and-options (&optional tags-only)
   "Precompute regular expressions used in the current buffer.
@@ -4943,7 +4965,7 @@ related expressions."
 		  (mapcar #'org-add-prop-inherited
 			  (cdr (assq 'filetags alist))))
       (setq org-current-tag-alist
-	    (org-tag-add-to-alist
+	    (org--tag-add-to-alist
 	     org-tag-persistent-alist
 	     (let ((tags (cdr (assq 'tags alist))))
 	       (if tags (org-tag-string-to-alist tags)
@@ -10517,7 +10539,7 @@ Raise an error when there is nothing to follow.  "
     (with-temp-buffer
       (let ((org-inhibit-startup (not reference-buffer)))
 	(org-mode)
-	(insert s)
+	(insert (org-link-escape s))
 	(goto-char (point-min))
 	(when reference-buffer
 	  (setq org-link-abbrev-alist-local
@@ -14162,6 +14184,9 @@ headlines matching this string."
 	       (re-search-forward re nil t))
 	(setq org-map-continue-from nil)
 	(catch :skip
+	  ;; Ignore closing parts of inline tasks.
+	  (when (and (fboundp 'org-inlinetask-end-p) (org-inlinetask-end-p))
+	    (throw :skip t))
 	  (setq todo
 		;; TODO: is the 1-2 difference a bug?
 		(when (match-end 1) (match-string-no-properties 2))
@@ -14337,7 +14362,7 @@ instead of the agenda files."
 		  (mapcar
 		   (lambda (file)
 		     (set-buffer (find-file-noselect file))
-		     (org-tag-add-to-alist
+		     (org--tag-add-to-alist
 		      (org-get-buffer-tags)
 		      (mapcar (lambda (x)
 				(and (stringp (car-safe x))
@@ -14369,7 +14394,7 @@ See also `org-scan-tags'."
     ;; Get a new match request, with completion against the global
     ;; tags table and the local tags in current buffer.
     (let ((org-last-tags-completion-table
-	   (org-tag-add-to-alist
+	   (org--tag-add-to-alist
 	    (org-get-buffer-tags)
 	    (org-global-tags-completion-table))))
       (setq match
@@ -14888,7 +14913,7 @@ When JUST-ALIGN is non-nil, only align tags."
 		    (let* ((table
 			    (setq
 			     org-last-tags-completion-table
-			     (org-tag-add-to-alist
+			     (org--tag-add-to-alist
 			      (and
 			       org-complete-tags-always-offer-all-agenda-tags
 			       (org-global-tags-completion-table
@@ -14973,7 +14998,7 @@ This works in the agenda, and also in an Org buffer."
    (list (region-beginning) (region-end)
 	 (let ((org-last-tags-completion-table
 		(if (derived-mode-p 'org-mode)
-		    (org-tag-add-to-alist
+		    (org--tag-add-to-alist
 		     (org-get-buffer-tags)
 		     (org-global-tags-completion-table))
 		  (org-global-tags-completion-table))))
@@ -15065,10 +15090,12 @@ TODO keywords, should these have keys assigned to them.
 If the keys are nil, a-z are automatically assigned.
 Returns the new tags string, or nil to not change the current settings."
   (let* ((fulltable (append table todo-table))
-	 (maxlen (apply 'max (mapcar
-			      (lambda (x)
-				(if (stringp (car x)) (string-width (car x)) 0))
-			      fulltable)))
+	 (maxlen (if (null fulltable) 0
+		   (apply #'max
+			  (mapcar (lambda (x)
+				    (if (stringp (car x)) (string-width (car x))
+				      0))
+				  fulltable))))
 	 (buf (current-buffer))
 	 (expert (eq org-fast-tag-selection-single-key 'expert))
 	 (buffer-tags nil)
@@ -17799,7 +17826,8 @@ NODEFAULT, hour and minute fields will be nil if not given."
 (defun org-timestamp-up (&optional arg)
   "Increase the date item at the cursor by one.
 If the cursor is on the year, change the year.  If it is on the month,
-the day or the time, change that.
+the day or the time, change that.  If the cursor is on the enclosing
+bracket, change the timestamp type.
 With prefix ARG, change by that many units."
   (interactive "p")
   (org-timestamp-change (prefix-numeric-value arg) nil 'updown))
@@ -17807,7 +17835,8 @@ With prefix ARG, change by that many units."
 (defun org-timestamp-down (&optional arg)
   "Decrease the date item at the cursor by one.
 If the cursor is on the year, change the year.  If it is on the month,
-the day or the time, change that.
+the day or the time, change that.  If the cursor is on the enclosing
+bracket, change the timestamp type.
 With prefix ARG, change by that many units."
   (interactive "p")
   (org-timestamp-change (- (prefix-numeric-value arg)) nil 'updown))
@@ -18560,7 +18589,7 @@ When a buffer is unmodified, it is just killed.  When modified, it is saved
 	    (setq org-todo-keyword-alist-for-agenda
 		  (append org-todo-keyword-alist-for-agenda org-todo-key-alist))
 	    (setq org-tag-alist-for-agenda
-		  (org-tag-add-to-alist
+		  (org--tag-add-to-alist
 		   org-tag-alist-for-agenda
 		   org-current-tag-alist))
 	    ;; Merge current file's tag groups into global
@@ -21080,7 +21109,14 @@ object (e.g., within a comment).  In these case, you need to use
      ;; `org-return-follows-link' allows it.  Tolerate fuzzy
      ;; locations, e.g., in a comment, as `org-open-at-point'.
      ((and org-return-follows-link
-	   (or (org-in-regexp org-ts-regexp-both nil t)
+	   (or (and (eq 'link (org-element-type context))
+		    ;; Ensure point is not on the white spaces after
+		    ;; the link.
+		    (let ((origin (point)))
+		      (org-with-point-at (org-element-property :end context)
+			(skip-chars-backward " \t")
+			(> (point) origin))))
+	       (org-in-regexp org-ts-regexp-both nil t)
 	       (org-in-regexp org-tsr-regexp-both nil  t)
 	       (org-in-regexp org-any-link-re nil t)))
       (call-interactively #'org-open-at-point))
@@ -23684,7 +23720,9 @@ depending on context."
 	       org-ctrl-k-protect-subtree
 	       (or (eq org-ctrl-k-protect-subtree 'error)
 		   (not (y-or-n-p "Kill hidden subtree along with headline? "))))
-      (user-error "C-k aborted as it would kill a hidden subtree"))
+      (user-error
+       (substitute-command-keys
+	"`\\[org-kill-line]' aborted as it would kill a hidden subtree")))
     (call-interactively
      (if (bound-and-true-p visual-line-mode) 'kill-visual-line 'kill-line)))
    ((looking-at ".*?\\S-\\([ \t]+\\(:[[:alnum:]_@#%:]+:\\)\\)[ \t]*$")
diff --git a/lisp/org/ox-md.el b/lisp/org/ox-md.el
index c4da8fcb14..9d7458e705 100644
--- a/lisp/org/ox-md.el
+++ b/lisp/org/ox-md.el
@@ -575,10 +575,13 @@ contents according to the current headline."
 	      (make-string
 	       (* 4 (1- (org-export-get-relative-level headline info)))
 	       ?\s))
-	     (number (format "%d."
-			     (org-last
-			      (org-export-get-headline-number headline info))))
-	     (bullet (concat number (make-string (- 4 (length number)) ?\s)))
+	     (bullet
+	      (if (not (org-export-numbered-headline-p headline info)) "-   "
+		(let ((prefix
+		       (format "%d." (org-last (org-export-get-headline-number
+						headline info)))))
+		  (concat prefix (make-string (max 1 (- 4 (length prefix)))
+					      ?\s)))))
 	     (title
 	      (format "[%s](#%s)"
 		      (org-export-data-with-backend
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: OK to push Org bugfixes for next Emacs?
  2018-05-05 18:24 OK to push Org bugfixes for next Emacs? Rasmus
@ 2018-05-05 18:39 ` Eli Zaretskii
  2018-05-07 21:56   ` Rasmus
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2018-05-05 18:39 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-devel

> From: Rasmus <rasmus@gmx.us>
> Date: Sat, 05 May 2018 20:24:52 +0200
> 
> I would like to merge the attached patch that would update Org to 9.1.12.
> They are all minor fixes (from the perspective of the Org devs).

Thanks, this is fine for the master branch.  (The org.texi changes
could go to the emacs-26 branch, where they document code and
behaviors existing on the branch.)



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: OK to push Org bugfixes for next Emacs?
  2018-05-05 18:39 ` Eli Zaretskii
@ 2018-05-07 21:56   ` Rasmus
  2018-05-08  2:26     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Rasmus @ 2018-05-07 21:56 UTC (permalink / raw)
  To: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Rasmus <rasmus@gmx.us>
>> Date: Sat, 05 May 2018 20:24:52 +0200
>> 
>> I would like to merge the attached patch that would update Org to 9.1.12.
>> They are all minor fixes (from the perspective of the Org devs).
>
> Thanks, this is fine for the master branch.  (The org.texi changes
> could go to the emacs-26 branch, where they document code and
> behaviors existing on the branch.)

The master branch would become Emacs v27, right?  Likely Org v10 will be
what we’d ship with that.

Can the Org bugfixes for v9.1 be part of a subsequent minor release?

Thanks,
Rasmus

-- 
A page of history is worth a volume of logic




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: OK to push Org bugfixes for next Emacs?
  2018-05-07 21:56   ` Rasmus
@ 2018-05-08  2:26     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2018-05-08  2:26 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-devel

> From: Rasmus <rasmus@gmx.us>
> Date: Mon, 07 May 2018 23:56:47 +0200
> 
> Can the Org bugfixes for v9.1 be part of a subsequent minor release?

Yes, of course.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-05-08  2:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-05 18:24 OK to push Org bugfixes for next Emacs? Rasmus
2018-05-05 18:39 ` Eli Zaretskii
2018-05-07 21:56   ` Rasmus
2018-05-08  2:26     ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.