Browse Source

Merge branch 'km/from-emacs-master'

Kyle Meyer 2 years ago
parent
commit
42c418693f

+ 1 - 1
doc/org-manual.org

@@ -3405,7 +3405,7 @@ current buffer:
   ~org-link-email-description-format~.  By default, it refers to the
   ~org-link-email-description-format~.  By default, it refers to the
   addressee and the subject.
   addressee and the subject.
 
 
-- /Web browsers: W3, W3M and EWW/ ::
+- /Web browsers: W3M and EWW/ ::
 
 
   Here the link is the current URL, with the page title as the
   Here the link is the current URL, with the page title as the
   description.
   description.

+ 1 - 1
lisp/ob-comint.el

@@ -168,7 +168,7 @@ source block, and the name of the temp file.")
 (defvar-local org-babel-comint-async-chunk-callback nil
 (defvar-local org-babel-comint-async-chunk-callback nil
   "Callback function to clean Babel async output results before insertion.
   "Callback function to clean Babel async output results before insertion.
 Its single argument is a string consisting of output from the
 Its single argument is a string consisting of output from the
-comint process.  It should return a string that will be be passed
+comint process.  It should return a string that will be passed
 to `org-babel-insert-result'.")
 to `org-babel-insert-result'.")
 
 
 (defvar-local org-babel-comint-async-dangling nil
 (defvar-local org-babel-comint-async-dangling nil

+ 13 - 14
lisp/ob-core.el

@@ -144,8 +144,7 @@ used."
   :type 'string
   :type 'string
   :safe (lambda (v)
   :safe (lambda (v)
 	  (and (stringp v)
 	  (and (stringp v)
-	       (eq (compare-strings "RESULTS" nil nil v nil nil t)
-		   t))))
+	       (string-equal-ignore-case "RESULTS" v))))
 
 
 (defcustom org-babel-noweb-wrap-start "<<"
 (defcustom org-babel-noweb-wrap-start "<<"
   "String used to begin a noweb reference in a code block.
   "String used to begin a noweb reference in a code block.
@@ -500,13 +499,13 @@ arguments, imagine you'd like to set the file name output of a
 latex source block to a sha1 of its contents.  We could achieve
 latex source block to a sha1 of its contents.  We could achieve
 this with:
 this with:
 
 
-(defun org-src-sha ()
-  (let ((elem (org-element-at-point)))
-    (concat (sha1 (org-element-property :value elem)) \".svg\")))
+  (defun org-src-sha ()
+    (let ((elem (org-element-at-point)))
+      (concat (sha1 (org-element-property :value elem)) \".svg\")))
 
 
-(setq org-babel-default-header-args:latex
-      `((:results . \"file link replace\")
-        (:file . (lambda () (org-src-sha)))))
+  (setq org-babel-default-header-args:latex
+        `((:results . \"file link replace\")
+          (:file . (lambda () (org-src-sha)))))
 
 
 Because the closure is evaluated with point at the source block,
 Because the closure is evaluated with point at the source block,
 the call to `org-element-at-point' above will always retrieve
 the call to `org-element-at-point' above will always retrieve
@@ -1984,9 +1983,9 @@ region is not active then the point is demarcated."
              (let ((lang (nth 0 info))
              (let ((lang (nth 0 info))
                    (indent (make-string (org-current-text-indentation) ?\s)))
                    (indent (make-string (org-current-text-indentation) ?\s)))
 	       (when (string-match "^[[:space:]]*$"
 	       (when (string-match "^[[:space:]]*$"
-				   (buffer-substring (line-beginning-position)
-						     (line-end-position)))
-		 (delete-region (line-beginning-position) (line-end-position)))
+                                   (buffer-substring (line-beginning-position)
+                                                     (line-end-position)))
+                 (delete-region (line-beginning-position) (line-end-position)))
                (insert (concat
                (insert (concat
 			(if (looking-at "^") "" "\n")
 			(if (looking-at "^") "" "\n")
 			indent (if upper-case-p "#+END_SRC\n" "#+end_src\n")
 			indent (if upper-case-p "#+END_SRC\n" "#+end_src\n")
@@ -2492,7 +2491,7 @@ INFO may provide the values of these header arguments (in the
 		       ;; Escape contents from "export" wrap.  Wrap
 		       ;; Escape contents from "export" wrap.  Wrap
 		       ;; inline results within an export snippet with
 		       ;; inline results within an export snippet with
 		       ;; appropriate value.
 		       ;; appropriate value.
-		       ((eq t (compare-strings type nil nil "export" nil nil t))
+		       ((string-equal-ignore-case type "export")
 			(let ((backend (pcase split
 			(let ((backend (pcase split
 					 (`(,_) "none")
 					 (`(,_) "none")
 					 (`(,_ ,b . ,_) b))))
 					 (`(,_ ,b . ,_) b))))
@@ -2503,14 +2502,14 @@ INFO may provide the values of these header arguments (in the
 					   backend) "@@)}}}")))
 					   backend) "@@)}}}")))
 		       ;; Escape contents from "example" wrap.  Mark
 		       ;; Escape contents from "example" wrap.  Mark
 		       ;; inline results as verbatim.
 		       ;; inline results as verbatim.
-		       ((eq t (compare-strings type nil nil "example" nil nil t))
+		       ((string-equal-ignore-case type "example")
 			(funcall wrap
 			(funcall wrap
 				 opening-line closing-line
 				 opening-line closing-line
 				 nil nil
 				 nil nil
 				 "{{{results(=" "=)}}}"))
 				 "{{{results(=" "=)}}}"))
 		       ;; Escape contents from "src" wrap.  Mark
 		       ;; Escape contents from "src" wrap.  Mark
 		       ;; inline results as inline source code.
 		       ;; inline results as inline source code.
-		       ((eq t (compare-strings type nil nil "src" nil nil t))
+		       ((string-equal-ignore-case type "src")
 			(let ((inline-open
 			(let ((inline-open
 			       (pcase split
 			       (pcase split
 				 (`(,_)
 				 (`(,_)

+ 2 - 1
lisp/ob-lilypond.el

@@ -40,6 +40,7 @@
 
 
 (declare-function org-fold-show-all "org-fold" (&optional types))
 (declare-function org-fold-show-all "org-fold" (&optional types))
 
 
+;; FIXME: Doesn't this rather belong in lilypond-mode.el?
 (defalias 'lilypond-mode 'LilyPond-mode)
 (defalias 'lilypond-mode 'LilyPond-mode)
 
 
 (add-to-list 'org-babel-tangle-lang-exts '("LilyPond" . "ly"))
 (add-to-list 'org-babel-tangle-lang-exts '("LilyPond" . "ly"))
@@ -315,7 +316,7 @@ LINENO is the number of the erroneous line."
 	(progn
 	(progn
 	  (goto-char (point-min))
 	  (goto-char (point-min))
 	  (forward-line (- lineNo 1))
 	  (forward-line (- lineNo 1))
-	  (buffer-substring (point) (line-end-position)))
+          (buffer-substring (point) (line-end-position)))
       nil)))
       nil)))
 
 
 (defun org-babel-lilypond-attempt-to-open-pdf (file-name &optional test)
 (defun org-babel-lilypond-attempt-to-open-pdf (file-name &optional test)

+ 1 - 1
lisp/ob-octave.el

@@ -259,7 +259,7 @@ This removes initial blank and comment lines and then calls
       (insert-file-contents file-name)
       (insert-file-contents file-name)
       (re-search-forward "^[ \t]*[^# \t]" nil t)
       (re-search-forward "^[ \t]*[^# \t]" nil t)
       (when (< (setq beg (point-min))
       (when (< (setq beg (point-min))
-	       (setq end (line-beginning-position)))
+               (setq end (line-beginning-position)))
 	(delete-region beg end)))
 	(delete-region beg end)))
     (org-babel-import-elisp-from-file temp-file '(16))))
     (org-babel-import-elisp-from-file temp-file '(16))))
 
 

+ 1 - 1
lisp/ol-doi.el

@@ -47,7 +47,7 @@ PATH is a the path to search for, as a string."
   "Export a \"doi\" type link.
   "Export a \"doi\" type link.
 PATH is the DOI name.  DESC is the description of the link, or
 PATH is the DOI name.  DESC is the description of the link, or
 nil.  BACKEND is a symbol representing the backend used for
 nil.  BACKEND is a symbol representing the backend used for
-export.  INFO is a a plist containing the export parameters."
+export.  INFO is a plist containing the export parameters."
   (let ((uri (concat org-link-doi-server-url path)))
   (let ((uri (concat org-link-doi-server-url path)))
     (pcase backend
     (pcase backend
       (`html
       (`html

+ 1 - 1
lisp/ol-eshell.el

@@ -49,7 +49,7 @@ followed by a colon."
          (eshell-buffer-name (car buffer-and-command))
          (eshell-buffer-name (car buffer-and-command))
          (command (cadr buffer-and-command)))
          (command (cadr buffer-and-command)))
     (if (get-buffer eshell-buffer-name)
     (if (get-buffer eshell-buffer-name)
-	(pop-to-buffer-same-window eshell-buffer-name)
+	(pop-to-buffer eshell-buffer-name display-comint-buffer-action)
       (eshell))
       (eshell))
     (goto-char (point-max))
     (goto-char (point-max))
     (eshell-kill-input)
     (eshell-kill-input)

+ 6 - 6
lisp/ol-irc.el

@@ -138,13 +138,13 @@ result is a cons of the filename and search string."
      ;; can we get a '::' part?
      ;; can we get a '::' part?
      (if (string= erc-line (erc-prompt))
      (if (string= erc-line (erc-prompt))
 	 (progn
 	 (progn
-	   (goto-char (line-beginning-position))
+           (goto-char (line-beginning-position))
 	   (when (search-backward-regexp "^[^	]" nil t)
 	   (when (search-backward-regexp "^[^	]" nil t)
-	     (buffer-substring-no-properties (line-beginning-position)
-					     (line-end-position))))
+             (buffer-substring-no-properties (line-beginning-position)
+                                             (line-end-position))))
        (when (search-backward erc-line nil t)
        (when (search-backward erc-line nil t)
-	 (buffer-substring-no-properties (line-beginning-position)
-					 (line-end-position)))))))
+         (buffer-substring-no-properties (line-beginning-position)
+                                         (line-end-position)))))))
 
 
 (defun org-irc-erc-store-link ()
 (defun org-irc-erc-store-link ()
   "Store a link to the IRC log file or the session itself.
   "Store a link to the IRC log file or the session itself.
@@ -154,7 +154,7 @@ the session itself."
   (require 'erc-log)
   (require 'erc-log)
   (if org-irc-link-to-logs
   (if org-irc-link-to-logs
       (let* ((erc-line (buffer-substring-no-properties
       (let* ((erc-line (buffer-substring-no-properties
-			(line-beginning-position) (line-end-position)))
+                        (line-beginning-position) (line-end-position)))
 	     (parsed-line (org-irc-erc-get-line-from-log erc-line)))
 	     (parsed-line (org-irc-erc-get-line-from-log erc-line)))
 	(if (erc-logging-enabled nil)
 	(if (erc-logging-enabled nil)
 	    (progn
 	    (progn

+ 4 - 4
lisp/ol-man.el

@@ -8,12 +8,12 @@
 ;;
 ;;
 ;; This file is part of GNU Emacs.
 ;; This file is part of GNU Emacs.
 ;;
 ;;
-;; This program is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 
-;; This program is distributed in the hope that it will be useful,
+;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ;; GNU General Public License for more details.
 ;; GNU General Public License for more details.

+ 1 - 9
lisp/ol.el

@@ -1529,7 +1529,7 @@ non-nil."
 	(let ((end (region-end)))
 	(let ((end (region-end)))
 	  (goto-char (region-beginning))
 	  (goto-char (region-beginning))
 	  (set-mark (point))
 	  (set-mark (point))
-	  (while (< (line-end-position) end)
+          (while (< (line-end-position) end)
 	    (move-end-of-line 1) (activate-mark)
 	    (move-end-of-line 1) (activate-mark)
 	    (let (current-prefix-arg)
 	    (let (current-prefix-arg)
 	      (call-interactively 'org-store-link))
 	      (call-interactively 'org-store-link))
@@ -1624,14 +1624,6 @@ non-nil."
 		 (org-encode-time 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd))))
 		 (org-encode-time 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd))))
 	  (org-link-store-props :type "calendar" :date cd)))
 	  (org-link-store-props :type "calendar" :date cd)))
 
 
-       ((eq major-mode 'w3-mode)
-	(setq cpltxt (if (and (buffer-name)
-			      (not (string-match "Untitled" (buffer-name))))
-			 (buffer-name)
-		       (url-view-url t))
-	      link (url-view-url t))
-	(org-link-store-props :type "w3" :url (url-view-url t)))
-
        ((eq major-mode 'image-mode)
        ((eq major-mode 'image-mode)
 	(setq cpltxt (concat "file:"
 	(setq cpltxt (concat "file:"
 			     (abbreviate-file-name buffer-file-name))
 			     (abbreviate-file-name buffer-file-name))

+ 43 - 32
lisp/org-agenda.el

@@ -3118,10 +3118,10 @@ s   Search for keywords                 M   Like m, but only TODO entries
 	  (when (eq rmheader t)
 	  (when (eq rmheader t)
 	    (org-goto-line 1)
 	    (org-goto-line 1)
 	    (re-search-forward ":" nil t)
 	    (re-search-forward ":" nil t)
-	    (delete-region (match-end 0) (line-end-position))
+            (delete-region (match-end 0) (line-end-position))
 	    (forward-char 1)
 	    (forward-char 1)
 	    (looking-at "-+")
 	    (looking-at "-+")
-	    (delete-region (match-end 0) (line-end-position))
+            (delete-region (match-end 0) (line-end-position))
 	    (move-marker header-end (match-end 0)))
 	    (move-marker header-end (match-end 0)))
 	  (goto-char header-end)
 	  (goto-char header-end)
 	  (delete-region (point) (point-max))
 	  (delete-region (point) (point-max))
@@ -3757,7 +3757,7 @@ removed from the entry content.  Currently only `planning' is allowed here."
 	     (while (not (eobp))
 	     (while (not (eobp))
 	       (unless (looking-at "[ \t]*$")
 	       (unless (looking-at "[ \t]*$")
 		 (move-to-column ind)
 		 (move-to-column ind)
-		 (delete-region (line-beginning-position) (point)))
+                 (delete-region (line-beginning-position) (point)))
 	       (beginning-of-line 2))
 	       (beginning-of-line 2))
 
 
 	     (run-hooks 'org-agenda-entry-text-cleanup-hook)
 	     (run-hooks 'org-agenda-entry-text-cleanup-hook)
@@ -4029,7 +4029,7 @@ agenda display, configure `org-agenda-finalize-hook'."
 	      (goto-char (point-min))
 	      (goto-char (point-min))
 	      (while (equal (forward-line) 0)
 	      (while (equal (forward-line) 0)
 		(when (setq mrk (get-text-property (point) 'org-hd-marker))
 		(when (setq mrk (get-text-property (point) 'org-hd-marker))
-		  (put-text-property (line-beginning-position) (line-end-position)
+                  (put-text-property (line-beginning-position) (line-end-position)
 				     'tags
 				     'tags
 				     (org-with-point-at mrk
 				     (org-with-point-at mrk
 				       (org-get-tags))))))))
 				       (org-get-tags))))))))
@@ -4077,7 +4077,8 @@ agenda display, configure `org-agenda-finalize-hook'."
 	      (goto-char s)
 	      (goto-char s)
 	      (when (equal (org-get-at-bol 'org-hd-marker)
 	      (when (equal (org-get-at-bol 'org-hd-marker)
 			   org-clock-hd-marker)
 			   org-clock-hd-marker)
-		(setq ov (make-overlay (line-beginning-position) (1+ (line-end-position))))
+                (setq ov (make-overlay (line-beginning-position)
+                                       (1+ (line-end-position))))
 		(overlay-put ov 'type 'org-agenda-clocking)
 		(overlay-put ov 'type 'org-agenda-clocking)
 		(overlay-put ov 'face 'org-agenda-clocking)
 		(overlay-put ov 'face 'org-agenda-clocking)
 		(overlay-put ov 'help-echo
 		(overlay-put ov 'help-echo
@@ -4108,7 +4109,7 @@ agenda display, configure `org-agenda-finalize-hook'."
 	      b (match-beginning 1)
 	      b (match-beginning 1)
 	      e (if (eq org-agenda-fontify-priorities 'cookies)
 	      e (if (eq org-agenda-fontify-priorities 'cookies)
 		    (1+ (match-end 2))
 		    (1+ (match-end 2))
-		  (line-end-position))
+                  (line-end-position))
 	      ov (make-overlay b e))
 	      ov (make-overlay b e))
 	(overlay-put
 	(overlay-put
 	 ov 'face
 	 ov 'face
@@ -4800,7 +4801,7 @@ is active."
 				  (forward-line -1)
 				  (forward-line -1)
 				  (org-back-to-heading t)))
 				  (org-back-to-heading t)))
 		      (skip-chars-forward "* ")
 		      (skip-chars-forward "* ")
-		      (setq beg (line-beginning-position)
+                      (setq beg (line-beginning-position)
 			    beg1 (point)
 			    beg1 (point)
 			    end (progn
 			    end (progn
 				  (outline-next-heading)
 				  (outline-next-heading)
@@ -4815,8 +4816,8 @@ is active."
 			(goto-char beg)
 			(goto-char beg)
 			(org-agenda-skip)
 			(org-agenda-skip)
 			(setq str (buffer-substring-no-properties
 			(setq str (buffer-substring-no-properties
-				   (line-beginning-position)
-				   (if hdl-only (line-end-position) end)))
+                                   (line-beginning-position)
+                                   (if hdl-only (line-end-position) end)))
 			(mapc (lambda (wr) (when (string-match wr str)
 			(mapc (lambda (wr) (when (string-match wr str)
 					     (goto-char (1- end))
 					     (goto-char (1- end))
 					     (throw :skip t)))
 					     (throw :skip t)))
@@ -4844,7 +4845,7 @@ is active."
 			      txt (org-agenda-format-item
 			      txt (org-agenda-format-item
 				   ""
 				   ""
 				   (buffer-substring-no-properties
 				   (buffer-substring-no-properties
-				    beg1 (line-end-position))
+                                    beg1 (line-end-position))
 				   level category tags t))
 				   level category tags t))
 			(org-add-props txt props
 			(org-add-props txt props
 			  'org-marker marker 'org-hd-marker marker
 			  'org-marker marker 'org-hd-marker marker
@@ -6138,7 +6139,7 @@ then those holidays will be skipped."
 	    'type type 'date date
 	    'type type 'date date
 	    'undone-face 'org-warning 'done-face 'org-agenda-done)
 	    'undone-face 'org-warning 'done-face 'org-agenda-done)
 	  (push txt ee))
 	  (push txt ee))
-	(goto-char (line-end-position))))
+        (goto-char (line-end-position))))
     (nreverse ee)))
     (nreverse ee)))
 
 
 (defun org-agenda-show-clocking-issues ()
 (defun org-agenda-show-clocking-issues ()
@@ -6175,7 +6176,7 @@ See also the user option `org-agenda-clock-consistency-checks'."
 	  (setq issue "No valid clock line") (throw 'next t))
 	  (setq issue "No valid clock line") (throw 'next t))
 	(org-with-point-at m
 	(org-with-point-at m
 	  (save-excursion
 	  (save-excursion
-	    (goto-char (line-beginning-position))
+            (goto-char (line-beginning-position))
 	    (unless (looking-at re)
 	    (unless (looking-at re)
 	      (error "No valid Clock line")
 	      (error "No valid Clock line")
 	      (throw 'next t))
 	      (throw 'next t))
@@ -6221,7 +6222,7 @@ See also the user option `org-agenda-clock-consistency-checks'."
       (setq tlend (or te tlend) tlstart (or ts tlstart))
       (setq tlend (or te tlend) tlstart (or ts tlstart))
       (when issue
       (when issue
 	;; OK, there was some issue, add an overlay to show the issue
 	;; OK, there was some issue, add an overlay to show the issue
-	(setq ov (make-overlay (line-beginning-position) (line-end-position)))
+        (setq ov (make-overlay (line-beginning-position) (line-end-position)))
 	(overlay-put ov 'before-string
 	(overlay-put ov 'before-string
 		     (concat
 		     (concat
 		      (org-add-props
 		      (org-add-props
@@ -7649,7 +7650,10 @@ The optional argument TYPE tells the agenda type."
 	(save-excursion
 	(save-excursion
 	  (beginning-of-line 1)
 	  (beginning-of-line 1)
 	  (setq re (org-get-at-bol 'org-todo-regexp))
 	  (setq re (org-get-at-bol 'org-todo-regexp))
-	  (goto-char (or (text-property-any (line-beginning-position) (line-end-position) 'org-heading t) (point)))
+          (goto-char (or (text-property-any (line-beginning-position)
+                                            (line-end-position)
+                                            'org-heading t)
+                         (point)))
 	  (when (looking-at (concat "[ \t]*\\.*\\(" re "\\) +"))
 	  (when (looking-at (concat "[ \t]*\\.*\\(" re "\\) +"))
 	    (add-text-properties (match-beginning 0) (match-end 1)
 	    (add-text-properties (match-beginning 0) (match-end 1)
 				 (list 'face (org-get-todo-face 1)))
 				 (list 'face (org-get-todo-face 1)))
@@ -7930,7 +7934,7 @@ subtree."
 			(point)
 			(point)
 			(if org-agenda-restriction-lock-highlight-subtree
 			(if org-agenda-restriction-lock-highlight-subtree
 			    (save-excursion (org-end-of-subtree t t) (point))
 			    (save-excursion (org-end-of-subtree t t) (point))
-			  (line-end-position)))
+                          (line-end-position)))
 	  (move-marker org-agenda-restrict-begin (point))
 	  (move-marker org-agenda-restrict-begin (point))
 	  (move-marker org-agenda-restrict-end
 	  (move-marker org-agenda-restrict-end
 		       (save-excursion (org-end-of-subtree t t)))
 		       (save-excursion (org-end-of-subtree t t)))
@@ -8759,8 +8763,8 @@ grouptags."
 (defun org-agenda-filter-hide-line (type)
 (defun org-agenda-filter-hide-line (type)
   "If current line is TYPE, hide it in the agenda buffer."
   "If current line is TYPE, hide it in the agenda buffer."
   (let* (buffer-invisibility-spec
   (let* (buffer-invisibility-spec
-	 (beg (max (point-min) (1- (line-beginning-position))))
-	 (end (line-end-position)))
+         (beg (max (point-min) (1- (line-beginning-position))))
+         (end (line-end-position)))
     (let ((inhibit-read-only t))
     (let ((inhibit-read-only t))
       (add-text-properties
       (add-text-properties
        beg end `(invisible org-filtered org-filter-type ,type)))))
        beg end `(invisible org-filtered org-filter-type ,type)))))
@@ -9474,7 +9478,8 @@ When called with a prefix argument, include all archive files as well."
 	(when (re-search-forward org-complex-heading-regexp nil t)
 	(when (re-search-forward org-complex-heading-regexp nil t)
 	  (goto-char (match-beginning 4)))))
 	  (goto-char (match-beginning 4)))))
     (run-hooks 'org-agenda-after-show-hook)
     (run-hooks 'org-agenda-after-show-hook)
-    (and highlight (org-highlight (line-beginning-position) (line-end-position)))))
+    (and highlight (org-highlight (line-beginning-position)
+                                  (line-end-position)))))
 
 
 (defvar org-agenda-after-show-hook nil
 (defvar org-agenda-after-show-hook nil
   "Normal hook run after an item has been shown from the agenda.
   "Normal hook run after an item has been shown from the agenda.
@@ -9497,7 +9502,7 @@ deletes the agenda entry and don't move to the next entry."
 	  (level (and (eq org-agenda-loop-over-headlines-in-active-region 'start-level)
 	  (level (and (eq org-agenda-loop-over-headlines-in-active-region 'start-level)
 		      (org-get-at-bol 'level))))
 		      (org-get-at-bol 'level))))
       (while (< (point) mend)
       (while (< (point) mend)
-	(let ((ov (make-overlay (point) (line-end-position))))
+        (let ((ov (make-overlay (point) (line-end-position))))
 	  (if (not (or all
 	  (if (not (or all
 		     (and match (looking-at-p match))
 		     (and match (looking-at-p match))
 		     (eq level (org-get-at-bol 'level))))
 		     (eq level (org-get-at-bol 'level))))
@@ -9542,8 +9547,8 @@ Pass ARG, FORCE-ARG, DELETE and BODY to `org-agenda-do-in-region'."
 	   (if (and (derived-mode-p 'org-mode) (not (member type '("sexp"))))
 	   (if (and (derived-mode-p 'org-mode) (not (member type '("sexp"))))
 	       (setq dbeg (progn (org-back-to-heading t) (point))
 	       (setq dbeg (progn (org-back-to-heading t) (point))
 		     dend (org-end-of-subtree t t))
 		     dend (org-end-of-subtree t t))
-	     (setq dbeg (line-beginning-position)
-		   dend (min (point-max) (1+ (line-end-position)))))
+             (setq dbeg (line-beginning-position)
+                   dend (min (point-max) (1+ (line-end-position)))))
 	   (goto-char dbeg)
 	   (goto-char dbeg)
 	   (while (re-search-forward "^[ \t]*\\S-" dend t) (setq n (1+ n)))))
 	   (while (re-search-forward "^[ \t]*\\S-" dend t) (setq n (1+ n)))))
        (when (or (eq t org-agenda-confirm-kill)
        (when (or (eq t org-agenda-confirm-kill)
@@ -9642,7 +9647,8 @@ If this information is not given, the function uses the tree at point."
 		     (>= p beg)
 		     (>= p beg)
 		     (< p end))
 		     (< p end))
 	    (let ((inhibit-read-only t))
 	    (let ((inhibit-read-only t))
-	      (delete-region (line-beginning-position) (1+ (line-end-position)))))
+              (delete-region (line-beginning-position)
+                             (1+ (line-end-position)))))
 	  (beginning-of-line 0))))))
 	  (beginning-of-line 0))))))
 
 
 (defun org-agenda-refile (&optional goto rfloc no-update)
 (defun org-agenda-refile (&optional goto rfloc no-update)
@@ -9691,7 +9697,8 @@ It also looks at the text of the entry itself."
   (let* ((marker (or (org-get-at-bol 'org-hd-marker)
   (let* ((marker (or (org-get-at-bol 'org-hd-marker)
 		     (org-get-at-bol 'org-marker)))
 		     (org-get-at-bol 'org-marker)))
 	 (buffer (and marker (marker-buffer marker)))
 	 (buffer (and marker (marker-buffer marker)))
-	 (prefix (buffer-substring (line-beginning-position) (line-end-position)))
+         (prefix (buffer-substring (line-beginning-position)
+                                   (line-end-position)))
 	 (lkall (and buffer (org-offer-links-in-entry
 	 (lkall (and buffer (org-offer-links-in-entry
 			     buffer marker arg prefix)))
 			     buffer marker arg prefix)))
 	 (lk0 (car lkall))
 	 (lk0 (car lkall))
@@ -10068,7 +10075,8 @@ If FORCE-TAGS is non-nil, the car of it returns the new tags."
                                      'effort effort
                                      'effort effort
                                      'effort-minutes effort-minutes)
                                      'effort-minutes effort-minutes)
                                    level cat tags dotime))))
                                    level cat tags dotime))))
-		;; pl (text-property-any (line-beginning-position) (line-end-position) 'org-heading t)
+                ;; pl (text-property-any (line-beginning-position)
+                ;;                       (line-end-position) 'org-heading t)
 		undone-face (org-get-at-bol 'undone-face)
 		undone-face (org-get-at-bol 'undone-face)
 		done-face (org-get-at-bol 'done-face))
 		done-face (org-get-at-bol 'done-face))
 	  (beginning-of-line 1)
 	  (beginning-of-line 1)
@@ -10085,10 +10093,11 @@ If FORCE-TAGS is non-nil, the car of it returns the new tags."
 	      (replace-match new t t)
 	      (replace-match new t t)
 	      (beginning-of-line)
 	      (beginning-of-line)
 	      (when mark (move-overlay mark (point) (+ 2 (point)))))
 	      (when mark (move-overlay mark (point) (+ 2 (point)))))
-	    (add-text-properties (line-beginning-position) (line-end-position) props)
+            (add-text-properties (line-beginning-position)
+                                 (line-end-position) props)
 	    (when fixface
 	    (when fixface
 	      (add-text-properties
 	      (add-text-properties
-	       (line-beginning-position) (line-end-position)
+               (line-beginning-position) (line-end-position)
 	       (list 'face
 	       (list 'face
 		     (if org-last-todo-state-is-todo
 		     (if org-last-todo-state-is-todo
 			 undone-face done-face))))
 			 undone-face done-face))))
@@ -10096,7 +10105,7 @@ If FORCE-TAGS is non-nil, the car of it returns the new tags."
 	    (beginning-of-line 1))
 	    (beginning-of-line 1))
 	   (t (error "Line update did not work")))
 	   (t (error "Line update did not work")))
 	  (save-restriction
 	  (save-restriction
-	    (narrow-to-region (line-beginning-position) (line-end-position))
+            (narrow-to-region (line-beginning-position) (line-end-position))
 	    (org-agenda-finalize)))
 	    (org-agenda-finalize)))
 	(beginning-of-line 0)))))
 	(beginning-of-line 0)))))
 
 
@@ -10328,7 +10337,8 @@ When called programmatically, FORCE-DIRECTION can be `set', `up',
 	    (setq arg (- today cdate))))
 	    (setq arg (- today cdate))))
 	(org-timestamp-change arg (or what 'day))
 	(org-timestamp-change arg (or what 'day))
 	(when (and (org-at-date-range-p)
 	(when (and (org-at-date-range-p)
-		   (re-search-backward org-tr-regexp-both (line-beginning-position)))
+                   (re-search-backward org-tr-regexp-both
+                                       (line-beginning-position)))
 	  (let ((end org-last-changed-timestamp))
 	  (let ((end org-last-changed-timestamp))
 	    (org-timestamp-change arg (or what 'day))
 	    (org-timestamp-change arg (or what 'day))
 	    (setq org-last-changed-timestamp
 	    (setq org-last-changed-timestamp
@@ -10380,7 +10390,7 @@ When called programmatically, FORCE-DIRECTION can be `set', `up',
               (length stamp))
               (length stamp))
            t)
            t)
           (add-text-properties
           (add-text-properties
-	   (1- (point)) (line-end-position)
+           (1- (point)) (line-end-position)
 	   (list 'display (org-add-props stamp nil
 	   (list 'display (org-add-props stamp nil
 			    'face '(secondary-selection default))))
 			    'face '(secondary-selection default))))
 	  (beginning-of-line 1))
 	  (beginning-of-line 1))
@@ -10530,7 +10540,7 @@ buffer, display it in another window."
 	    d2 (and (ignore-errors (mark))
 	    d2 (and (ignore-errors (mark))
 		    (save-excursion
 		    (save-excursion
 		      (goto-char (mark))
 		      (goto-char (mark))
-		      (setq dp2 (get-text-property (line-beginning-position) 'day)))
+                      (setq dp2 (get-text-property (line-beginning-position) 'day)))
 		    (calendar-gregorian-from-absolute dp2))))
 		    (calendar-gregorian-from-absolute dp2))))
     (message "Diary entry: [d]ay [a]nniversary [b]lock [j]ump to date tree")
     (message "Diary entry: [d]ay [a]nniversary [b]lock [j]ump to date tree")
     (setq char (read-char-exclusive))
     (setq char (read-char-exclusive))
@@ -10878,7 +10888,8 @@ When ARG is greater than one mark ARG lines."
 	(unless (org-agenda-bulk-marked-p)
 	(unless (org-agenda-bulk-marked-p)
 	  (unless m (user-error "Nothing to mark at point"))
 	  (unless m (user-error "Nothing to mark at point"))
 	  (push m org-agenda-bulk-marked-entries)
 	  (push m org-agenda-bulk-marked-entries)
-	  (setq ov (make-overlay (line-beginning-position) (+ 2 (line-beginning-position))))
+          (setq ov (make-overlay (line-beginning-position)
+                                 (+ 2 (line-beginning-position))))
 	  (org-overlay-display ov (concat org-agenda-bulk-mark-char " ")
 	  (org-overlay-display ov (concat org-agenda-bulk-mark-char " ")
 			       (org-get-todo-face "TODO")
 			       (org-get-todo-face "TODO")
 			       'evaporate)
 			       'evaporate)
@@ -10922,7 +10933,7 @@ When ARG is greater than one mark ARG lines."
       (org-agenda-bulk-unmark-all)
       (org-agenda-bulk-unmark-all)
     (cond ((org-agenda-bulk-marked-p)
     (cond ((org-agenda-bulk-marked-p)
 	   (org-agenda-bulk-remove-overlays
 	   (org-agenda-bulk-remove-overlays
-	    (line-beginning-position) (+ 2 (line-beginning-position)))
+            (line-beginning-position) (+ 2 (line-beginning-position)))
 	   (setq org-agenda-bulk-marked-entries
 	   (setq org-agenda-bulk-marked-entries
 		 (delete (org-get-at-bol 'org-hd-marker)
 		 (delete (org-get-at-bol 'org-hd-marker)
 			 org-agenda-bulk-marked-entries))
 			 org-agenda-bulk-marked-entries))

+ 8 - 5
lisp/org-capture.el

@@ -1458,7 +1458,7 @@ Of course, if exact position has been required, just put it there."
 		(if (org-at-table-p)
 		(if (org-at-table-p)
 		    (save-excursion
 		    (save-excursion
 		      (org-table-goto-line (nth 1 where))
 		      (org-table-goto-line (nth 1 where))
-		      (line-beginning-position))
+                      (line-beginning-position))
 		  (point))))))
 		  (point))))))
     (with-current-buffer (buffer-base-buffer (current-buffer))
     (with-current-buffer (buffer-base-buffer (current-buffer))
       (org-with-point-at pos
       (org-with-point-at pos
@@ -1830,10 +1830,13 @@ Expansion occurs in a temporary Org mode buffer."
 		     ;; Load history list for current prompt.
 		     ;; Load history list for current prompt.
 		     (setq org-capture--prompt-history
 		     (setq org-capture--prompt-history
 			   (gethash prompt org-capture--prompt-history-table))
 			   (gethash prompt org-capture--prompt-history-table))
-		     (push (org-completing-read
-			    (concat (or prompt "Enter string")
-				    (and default (format " [%s]" default))
-				    ": ")
+                     (push (org-completing-read
+                            ;; `format-prompt' is new in Emacs 28.1.
+                            (if (fboundp 'format-prompt)
+                                (format-prompt (or prompt "Enter string") default)
+                              (concat (or prompt "Enter string")
+                                      (and default (format " [%s]" default))
+                                      ": "))
 			    completions
 			    completions
 			    nil nil nil 'org-capture--prompt-history default)
 			    nil nil nil 'org-capture--prompt-history default)
 			   strings)
 			   strings)

+ 5 - 6
lisp/org-clock.el

@@ -224,8 +224,7 @@ Emacs initialization file."
 	  (const :tag "Clock and history" t)
 	  (const :tag "Clock and history" t)
 	  (const :tag "No persistence" nil)))
 	  (const :tag "No persistence" nil)))
 
 
-(defcustom org-clock-persist-file (convert-standard-filename
-				   (concat user-emacs-directory "org-clock-save.el"))
+(defcustom org-clock-persist-file (locate-user-emacs-file "org-clock-save.el")
   "File to save clock data to."
   "File to save clock data to."
   :group 'org-clock
   :group 'org-clock
   :type 'string)
   :type 'string)
@@ -1820,7 +1819,7 @@ Optional argument N tells to change by that many units."
     (goto-char org-clock-marker)
     (goto-char org-clock-marker)
     (if (looking-back (concat "^[ \t]*" org-clock-string ".*")
     (if (looking-back (concat "^[ \t]*" org-clock-string ".*")
 		      (line-beginning-position))
 		      (line-beginning-position))
-	(progn (delete-region (1- (line-beginning-position)) (line-end-position))
+        (progn (delete-region (1- (line-beginning-position)) (line-end-position))
 	       (org-remove-empty-drawer-at (point)))
 	       (org-remove-empty-drawer-at (point)))
       (message "Clock gone, cancel the timer anyway")
       (message "Clock gone, cancel the timer anyway")
       (sit-for 2)))
       (sit-for 2)))
@@ -1959,7 +1958,7 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
 			       (aset ltimes l (+ (aref ltimes l) t1))))
 			       (aset ltimes l (+ (aref ltimes l) t1))))
 		  (setq time (aref ltimes level))
 		  (setq time (aref ltimes level))
 		  (goto-char (match-beginning 0))
 		  (goto-char (match-beginning 0))
-		  (put-text-property (point) (line-end-position)
+                  (put-text-property (point) (line-end-position)
 				     (or propname :org-clock-minutes) time)
 				     (or propname :org-clock-minutes) time)
 		  (when headline-filter
 		  (when headline-filter
 		    (save-excursion
 		    (save-excursion
@@ -2127,7 +2126,7 @@ fontified, and then returned."
     (forward-line 2)
     (forward-line 2)
     (buffer-substring (point) (progn
     (buffer-substring (point) (progn
 				(re-search-forward "^[ \t]*#\\+END" nil t)
 				(re-search-forward "^[ \t]*#\\+END" nil t)
-				(line-beginning-position)))))
+                                (line-beginning-position)))))
 
 
 ;;;###autoload
 ;;;###autoload
 (defun org-clock-report (&optional arg)
 (defun org-clock-report (&optional arg)
@@ -3059,7 +3058,7 @@ Otherwise, return nil."
 	 ((not (match-end 2))
 	 ((not (match-end 2))
 	  (when (and (equal (marker-buffer org-clock-marker) (current-buffer))
 	  (when (and (equal (marker-buffer org-clock-marker) (current-buffer))
 		     (> org-clock-marker (point))
 		     (> org-clock-marker (point))
-		     (<= org-clock-marker (line-end-position)))
+                     (<= org-clock-marker (line-end-position)))
 	    ;; The clock is running here
 	    ;; The clock is running here
 	    (setq org-clock-start-time
 	    (setq org-clock-start-time
 		  (org-time-string-to-time (match-string 1)))
 		  (org-time-string-to-time (match-string 1)))

+ 13 - 8
lisp/org-compat.el

@@ -45,7 +45,7 @@
 (declare-function org-calendar-goto-agenda "org-agenda" ())
 (declare-function org-calendar-goto-agenda "org-agenda" ())
 (declare-function org-align-tags "org" (&optional all))
 (declare-function org-align-tags "org" (&optional all))
 (declare-function org-at-heading-p "org" (&optional ignored))
 (declare-function org-at-heading-p "org" (&optional ignored))
-(declare-function org-at-table.el-p "org" ())
+(declare-function org-at-table.el-p "org-table" ())
 (declare-function org-back-to-heading "org" (&optional invisible-ok))
 (declare-function org-back-to-heading "org" (&optional invisible-ok))
 (declare-function org-element-at-point "org-element" (&optional pom cached-only))
 (declare-function org-element-at-point "org-element" (&optional pom cached-only))
 (declare-function org-element-at-point-no-context "org-element" (&optional pom))
 (declare-function org-element-at-point-no-context "org-element" (&optional pom))
@@ -258,8 +258,7 @@ Execute BODY, and unwind connection-local variables."
   (defsubst file-attribute-modification-time (attributes)
   (defsubst file-attribute-modification-time (attributes)
     "The modification time in ATTRIBUTES returned by `file-attributes'.
     "The modification time in ATTRIBUTES returned by `file-attributes'.
 This is the time of the last change to the file's contents, and
 This is the time of the last change to the file's contents, and
-is a list of integers (HIGH LOW USEC PSEC) in the same style
-as (current-time)."
+is a Lisp timestamp in the same style as `current-time'."
     (nth 5 attributes)))
     (nth 5 attributes)))
 
 
 (unless (fboundp 'file-attribute-size)
 (unless (fboundp 'file-attribute-size)
@@ -1161,6 +1160,14 @@ Pass COLUMN and FORCE to `move-to-column'."
 (define-obsolete-function-alias 'org-define-error #'define-error "9.6")
 (define-obsolete-function-alias 'org-define-error #'define-error "9.6")
 (define-obsolete-function-alias 'org-without-partial-completion 'progn "9.6")
 (define-obsolete-function-alias 'org-without-partial-completion 'progn "9.6")
 
 
+(unless (fboundp 'string-equal-ignore-case)
+  ;; From Emacs subr.el.
+  (defun string-equal-ignore-case (string1 string2)
+    "Like `string-equal', but case-insensitive.
+Upper-case and lower-case letters are treated as equal.
+Unibyte strings are converted to multibyte for comparison."
+    (eq t (compare-strings string1 0 nil string2 0 nil t))))
+
 
 
 ;;; Integration with and fixes for other packages
 ;;; Integration with and fixes for other packages
 
 
@@ -1262,7 +1269,7 @@ To get rid of the restriction, use `\\[org-agenda-remove-restriction-lock]'."
 	(org-agenda-set-restriction-lock 'file)))
 	(org-agenda-set-restriction-lock 'file)))
      (t (user-error "Don't know how to restrict Org mode agenda")))
      (t (user-error "Don't know how to restrict Org mode agenda")))
     (move-overlay org-speedbar-restriction-lock-overlay
     (move-overlay org-speedbar-restriction-lock-overlay
-		  (line-beginning-position) (line-end-position))
+                  (line-beginning-position) (line-end-position))
     (setq current-prefix-arg nil)
     (setq current-prefix-arg nil)
     (org-agenda-maybe-redo)))
     (org-agenda-maybe-redo)))
 
 
@@ -1340,10 +1347,8 @@ ELEMENT is the element at point."
 	  (and log
 	  (and log
 	       (let ((drawer (org-element-lineage element '(drawer))))
 	       (let ((drawer (org-element-lineage element '(drawer))))
 		 (and drawer
 		 (and drawer
-		      (eq (compare-strings
-			   log nil nil
-			   (org-element-property :drawer-name drawer) nil nil t)
-			  t)))))
+		      (string-equal-ignore-case
+		       log (org-element-property :drawer-name drawer))))))
 	nil)
 	nil)
        (t
        (t
 	(cl-case (org-element-type element)
 	(cl-case (org-element-type element)

+ 1 - 1
lisp/org-element.el

@@ -2414,7 +2414,7 @@ CDR is a plist containing `:key', `:value', `:begin', `:end',
 	  (key (progn (looking-at "[ \t]*#\\+\\(\\S-*\\):")
 	  (key (progn (looking-at "[ \t]*#\\+\\(\\S-*\\):")
 		      (upcase (match-string-no-properties 1))))
 		      (upcase (match-string-no-properties 1))))
 	  (value (org-trim (buffer-substring-no-properties
 	  (value (org-trim (buffer-substring-no-properties
-			    (match-end 0) (line-end-position))))
+                            (match-end 0) (line-end-position))))
 	  (pos-before-blank (progn (forward-line) (point)))
 	  (pos-before-blank (progn (forward-line) (point)))
 	  (end (progn (skip-chars-forward " \r\t\n" limit)
 	  (end (progn (skip-chars-forward " \r\t\n" limit)
 		      (if (eobp) (point) (line-beginning-position)))))
 		      (if (eobp) (point) (line-beginning-position)))))

+ 1 - 1
lisp/org-feed.el

@@ -409,7 +409,7 @@ it can be a list structured like an entry in `org-feed-alist'."
 
 
 	  ;; Write the new status
 	  ;; Write the new status
 	  ;; We do this only now, in case something goes wrong above, so
 	  ;; We do this only now, in case something goes wrong above, so
-	  ;; that would would end up with a status that does not reflect
+          ;; that would end up with a status that does not reflect
 	  ;; which items truly have been handled
 	  ;; which items truly have been handled
 	  (org-feed-write-status inbox-pos drawer status)
 	  (org-feed-write-status inbox-pos drawer status)
 
 

+ 1 - 2
lisp/org-id.el

@@ -201,8 +201,7 @@ the link."
   :group 'org-id
   :group 'org-id
   :type 'boolean)
   :type 'boolean)
 
 
-(defcustom org-id-locations-file (convert-standard-filename
-				  (concat user-emacs-directory ".org-id-locations"))
+(defcustom org-id-locations-file (locate-user-emacs-file ".org-id-locations")
   "The file for remembering in which file an ID was defined.
   "The file for remembering in which file an ID was defined.
 This variable is only relevant when `org-id-track-globally' is set."
 This variable is only relevant when `org-id-track-globally' is set."
   :group 'org-id
   :group 'org-id

+ 2 - 2
lisp/org-inlinetask.el

@@ -241,7 +241,7 @@ going below `org-inlinetask-min-level'."
 	  (setq beg (point))
 	  (setq beg (point))
 	  (replace-match down-task nil t nil 1)
 	  (replace-match down-task nil t nil 1)
 	  (org-inlinetask-goto-end)
 	  (org-inlinetask-goto-end)
-	  (if (and (eobp) (looking-back "END\\s-*" (line-beginning-position)))
+          (if (and (eobp) (looking-back "END\\s-*" (line-beginning-position)))
               (beginning-of-line)
               (beginning-of-line)
             (forward-line -1))
             (forward-line -1))
 	  (unless (= (point) beg)
 	  (unless (= (point) beg)
@@ -317,7 +317,7 @@ When STATE is `unfold', unfold unconditionally."
 	       (if (bolp) (1- (point)) (point))))
 	       (if (bolp) (1- (point)) (point))))
 	(start (save-excursion
 	(start (save-excursion
 		 (org-inlinetask-goto-beginning)
 		 (org-inlinetask-goto-beginning)
-		 (line-end-position))))
+                 (line-end-position))))
     (cond
     (cond
      ;; Nothing to show/hide.
      ;; Nothing to show/hide.
      ((= end start))
      ((= end start))

+ 2 - 4
lisp/org-lint.el

@@ -383,10 +383,8 @@ called with one argument, the key used for comparison."
    ast
    ast
    'node-property
    'node-property
    (lambda (property)
    (lambda (property)
-     (and (eq (compare-strings "CUSTOM_ID" nil nil
-			       (org-element-property :key property) nil nil
-			       t)
-	      t)
+     (and (string-equal-ignore-case
+           "CUSTOM_ID" (org-element-property :key property))
 	  (org-element-property :value property)))
 	  (org-element-property :value property)))
    (lambda (property _) (org-element-property :begin property))
    (lambda (property _) (org-element-property :begin property))
    (lambda (key) (format "Duplicate CUSTOM_ID property \"%s\"" key))))
    (lambda (key) (format "Duplicate CUSTOM_ID property \"%s\"" key))))

+ 33 - 33
lisp/org-list.el

@@ -522,7 +522,7 @@ Contexts `block' and `invalid' refer to `org-list-forbidden-blocks'."
 		   (and (not (looking-at beg-re))
 		   (and (not (looking-at beg-re))
 			(not (looking-at end-re))
 			(not (looking-at end-re))
 			(setq beg (and (re-search-backward beg-re lim-up t)
 			(setq beg (and (re-search-backward beg-re lim-up t)
-				       (1+ (line-end-position))))
+                                       (1+ (line-end-position))))
 			(setq end (or (and (re-search-forward end-re lim-down t)
 			(setq end (or (and (re-search-forward end-re lim-down t)
 					   (1- (match-beginning 0)))
 					   (1- (match-beginning 0)))
 				      lim-down))
 				      lim-down))
@@ -533,12 +533,12 @@ Contexts `block' and `invalid' refer to `org-list-forbidden-blocks'."
 	   (when (save-excursion
 	   (when (save-excursion
 		   (and (not (looking-at block-re))
 		   (and (not (looking-at block-re))
 			(setq beg (and (re-search-backward block-re lim-up t)
 			(setq beg (and (re-search-backward block-re lim-up t)
-				       (1+ (line-end-position))))
+                                       (1+ (line-end-position))))
 			(looking-at "^[ \t]*#\\+begin_\\(\\S-+\\)")
 			(looking-at "^[ \t]*#\\+begin_\\(\\S-+\\)")
 			(setq type (downcase (match-string 1)))
 			(setq type (downcase (match-string 1)))
 			(goto-char beg)
 			(goto-char beg)
 			(setq end (or (and (re-search-forward block-re lim-down t)
 			(setq end (or (and (re-search-forward block-re lim-down t)
-					   (1- (line-beginning-position)))
+                                           (1- (line-beginning-position)))
 				      lim-down))
 				      lim-down))
 			(>= end pos)
 			(>= end pos)
 			(equal (downcase (match-string 1)) "end")))
 			(equal (downcase (match-string 1)) "end")))
@@ -552,7 +552,7 @@ Contexts `block' and `invalid' refer to `org-list-forbidden-blocks'."
 			     (end-re (concat beg-re "END[ \t]*$")))
 			     (end-re (concat beg-re "END[ \t]*$")))
 			(and (not (looking-at "^\\*+"))
 			(and (not (looking-at "^\\*+"))
 			     (setq beg (and (re-search-backward beg-re lim-up t)
 			     (setq beg (and (re-search-backward beg-re lim-up t)
-					    (1+ (line-end-position))))
+                                            (1+ (line-end-position))))
 			     (not (looking-at end-re))
 			     (not (looking-at end-re))
 			     (setq end (and (re-search-forward end-re lim-down t)
 			     (setq end (and (re-search-forward end-re lim-down t)
 					    (1- (match-beginning 0))))
 					    (1- (match-beginning 0))))
@@ -622,7 +622,7 @@ Assume point is at an item."
 	    ;; Ensure list ends at the first blank line.
 	    ;; Ensure list ends at the first blank line.
 	    (lambda ()
 	    (lambda ()
 	      (skip-chars-backward " \r\t\n")
 	      (skip-chars-backward " \r\t\n")
-	      (min (1+ (line-end-position)) lim-down))))
+              (min (1+ (line-end-position)) lim-down))))
       ;; 1. Read list from starting item to its beginning, and save
       ;; 1. Read list from starting item to its beginning, and save
       ;;    top item position and indentation in BEG-CELL.  Also store
       ;;    top item position and indentation in BEG-CELL.  Also store
       ;;    ending position of items in END-LST.
       ;;    ending position of items in END-LST.
@@ -1172,7 +1172,7 @@ some heuristics to guess the result."
 	   (lambda ()
 	   (lambda ()
 	     ;; Count blank lines above beginning of line.
 	     ;; Count blank lines above beginning of line.
 	     (save-excursion
 	     (save-excursion
-	       (count-lines (goto-char (line-beginning-position))
+               (count-lines (goto-char (line-beginning-position))
 			    (progn (skip-chars-backward " \r\t\n")
 			    (progn (skip-chars-backward " \r\t\n")
 				   (forward-line)
 				   (forward-line)
 				   (point)))))))
 				   (point)))))))
@@ -1277,7 +1277,7 @@ This function modifies STRUCT."
 		 ;; must be removed, or they will be left, stacking up
 		 ;; must be removed, or they will be left, stacking up
 		 ;; after the list.
 		 ;; after the list.
 		 (when (< item-end pos)
 		 (when (< item-end pos)
-		   (delete-region (1- item-end) (line-end-position)))
+                   (delete-region (1- item-end) (line-end-position)))
 		 (skip-chars-backward " \r\t\n")
 		 (skip-chars-backward " \r\t\n")
 		 ;; Cut position is after any blank on the line.
 		 ;; Cut position is after any blank on the line.
 		 (save-excursion
 		 (save-excursion
@@ -1354,7 +1354,7 @@ STRUCT is the list structure."
 		  (save-excursion
 		  (save-excursion
 		    (goto-char item)
 		    (goto-char item)
 		    (skip-chars-backward " \r\t\n")
 		    (skip-chars-backward " \r\t\n")
-		    (min (1+ (line-end-position)) (point-max)))
+                    (min (1+ (line-end-position)) (point-max)))
 		item)))
 		item)))
     ;; Remove item from buffer.
     ;; Remove item from buffer.
     (delete-region beg end)
     (delete-region beg end)
@@ -1431,7 +1431,7 @@ This function returns, destructively, the new list structure."
 		      (setq dest (org-list-get-list-end item struct prevs))
 		      (setq dest (org-list-get-list-end item struct prevs))
 		      (save-excursion
 		      (save-excursion
 			(goto-char (org-list-get-last-item item struct prevs))
 			(goto-char (org-list-get-last-item item struct prevs))
-			(line-end-position)))
+                        (line-end-position)))
 		     ((and (stringp dest) (string-match-p "\\`[0-9]+\\'" dest))
 		     ((and (stringp dest) (string-match-p "\\`[0-9]+\\'" dest))
 		      (let* ((all (org-list-get-all-items item struct prevs))
 		      (let* ((all (org-list-get-all-items item struct prevs))
 			     (len (length all))
 			     (len (length all))
@@ -1443,7 +1443,7 @@ This function returns, destructively, the new list structure."
 			  (save-excursion
 			  (save-excursion
 			    (goto-char
 			    (goto-char
 			     (org-list-get-last-item item struct prevs))
 			     (org-list-get-last-item item struct prevs))
-			    (line-end-position)))))
+                            (line-end-position)))))
 		     (t dest)))
 		     (t dest)))
 	 (org-M-RET-may-split-line nil)
 	 (org-M-RET-may-split-line nil)
 	 ;; Store inner overlays (to preserve visibility).
 	 ;; Store inner overlays (to preserve visibility).
@@ -1885,7 +1885,7 @@ Initial position of cursor is restored after the changes."
 		    (insert (concat new-box (unless counterp " "))))))
 		    (insert (concat new-box (unless counterp " "))))))
 	      ;; c.  Indent item to appropriate column.
 	      ;; c.  Indent item to appropriate column.
 	      (unless (= new-ind old-ind)
 	      (unless (= new-ind old-ind)
-		(delete-region (goto-char (line-beginning-position))
+                (delete-region (goto-char (line-beginning-position))
 			       (progn (skip-chars-forward " \t") (point)))
 			       (progn (skip-chars-forward " \t") (point)))
 		(indent-to new-ind))))))
 		(indent-to new-ind))))))
     ;; 1. First get list of items and position endings.  We maintain
     ;; 1. First get list of items and position endings.  We maintain
@@ -2015,7 +2015,7 @@ Sublists of the list are skipped.  Cursor is always at the
 beginning of the item."
 beginning of the item."
   (let* ((struct (org-list-struct))
   (let* ((struct (org-list-struct))
 	 (prevs (org-list-prevs-alist struct))
 	 (prevs (org-list-prevs-alist struct))
-	 (item (copy-marker (line-beginning-position)))
+         (item (copy-marker (line-beginning-position)))
 	 (all (org-list-get-all-items (marker-position item) struct prevs))
 	 (all (org-list-get-all-items (marker-position item) struct prevs))
 	 (value init-value))
 	 (value init-value))
     (dolist (e (nreverse all))
     (dolist (e (nreverse all))
@@ -2152,10 +2152,10 @@ the item, so this really moves item trees."
   (interactive)
   (interactive)
   (unless (org-at-item-p) (error "Not at an item"))
   (unless (org-at-item-p) (error "Not at an item"))
   (let* ((col (current-column))
   (let* ((col (current-column))
-	 (item (line-beginning-position))
+         (item (line-beginning-position))
 	 (struct (org-list-struct))
 	 (struct (org-list-struct))
 	 (prevs (org-list-prevs-alist struct))
 	 (prevs (org-list-prevs-alist struct))
-	 (next-item (org-list-get-next-item (line-beginning-position) struct prevs)))
+         (next-item (org-list-get-next-item (line-beginning-position) struct prevs)))
     (unless (or next-item org-list-use-circular-motion)
     (unless (or next-item org-list-use-circular-motion)
       (user-error "Cannot move this item further down"))
       (user-error "Cannot move this item further down"))
     (if (not next-item)
     (if (not next-item)
@@ -2173,10 +2173,10 @@ the item, so this really moves item trees."
   (interactive)
   (interactive)
   (unless (org-at-item-p) (error "Not at an item"))
   (unless (org-at-item-p) (error "Not at an item"))
   (let* ((col (current-column))
   (let* ((col (current-column))
-	 (item (line-beginning-position))
+         (item (line-beginning-position))
 	 (struct (org-list-struct))
 	 (struct (org-list-struct))
 	 (prevs (org-list-prevs-alist struct))
 	 (prevs (org-list-prevs-alist struct))
-	 (prev-item (org-list-get-prev-item (line-beginning-position) struct prevs)))
+         (prev-item (org-list-get-prev-item (line-beginning-position) struct prevs)))
     (unless (or prev-item org-list-use-circular-motion)
     (unless (or prev-item org-list-use-circular-motion)
       (user-error "Cannot move this item further up"))
       (user-error "Cannot move this item further up"))
     (if (not prev-item)
     (if (not prev-item)
@@ -2342,7 +2342,7 @@ is an integer, 0 means `-', 1 means `+' etc.  If WHICH is
 	   (old-struct (copy-tree struct))
 	   (old-struct (copy-tree struct))
 	   (cbox (org-list-get-checkbox cpos struct))
 	   (cbox (org-list-get-checkbox cpos struct))
            (prevs (org-list-prevs-alist struct))
            (prevs (org-list-prevs-alist struct))
-	   (start (org-list-get-list-begin (line-beginning-position) struct prevs))
+           (start (org-list-get-list-begin (line-beginning-position) struct prevs))
 	   (new (unless (and cbox (equal arg '(4)) (equal start cpos))
 	   (new (unless (and cbox (equal arg '(4)) (equal start cpos))
 		  "[ ]")))
 		  "[ ]")))
       (dolist (pos (org-list-get-all-items
       (dolist (pos (org-list-get-all-items
@@ -2402,7 +2402,7 @@ subtree, ignoring planning line and any drawer following it."
 		(let ((limit (region-end)))
 		(let ((limit (region-end)))
 		  (goto-char (region-beginning))
 		  (goto-char (region-beginning))
 		  (if (org-list-search-forward (org-item-beginning-re) limit t)
 		  (if (org-list-search-forward (org-item-beginning-re) limit t)
-		      (setq lim-up (line-beginning-position))
+                      (setq lim-up (line-beginning-position))
 		    (error "No item in region"))
 		    (error "No item in region"))
 		  (setq lim-down (copy-marker limit))))
 		  (setq lim-down (copy-marker limit))))
 	       ((org-at-heading-p)
 	       ((org-at-heading-p)
@@ -2411,14 +2411,14 @@ subtree, ignoring planning line and any drawer following it."
 		(let ((limit (save-excursion (outline-next-heading) (point))))
 		(let ((limit (save-excursion (outline-next-heading) (point))))
 		  (org-end-of-meta-data t)
 		  (org-end-of-meta-data t)
 		  (if (org-list-search-forward (org-item-beginning-re) limit t)
 		  (if (org-list-search-forward (org-item-beginning-re) limit t)
-		      (setq lim-up (line-beginning-position))
+                      (setq lim-up (line-beginning-position))
 		    (error "No item in subtree"))
 		    (error "No item in subtree"))
 		  (setq lim-down (copy-marker limit))))
 		  (setq lim-down (copy-marker limit))))
 	       ;; Just one item: set SINGLEP flag.
 	       ;; Just one item: set SINGLEP flag.
 	       ((org-at-item-p)
 	       ((org-at-item-p)
 		(setq singlep t)
 		(setq singlep t)
-		(setq lim-up (line-beginning-position)
-		      lim-down (copy-marker (line-end-position))))
+                (setq lim-up (line-beginning-position)
+                      lim-down (copy-marker (line-end-position))))
 	       (t (error "Not at an item or heading, and no active region"))))
 	       (t (error "Not at an item or heading, and no active region"))))
 	     ;; Determine the checkbox going to be applied to all items
 	     ;; Determine the checkbox going to be applied to all items
 	     ;; within bounds.
 	     ;; within bounds.
@@ -2666,7 +2666,7 @@ Return t if successful."
 	   ;; Are we going to move the whole list?
 	   ;; Are we going to move the whole list?
 	   (specialp
 	   (specialp
 	    (and (not regionp)
 	    (and (not regionp)
-		 (= top (line-beginning-position))
+                 (= top (line-beginning-position))
 		 (cdr (assq 'indent org-list-automatic-rules))
 		 (cdr (assq 'indent org-list-automatic-rules))
 		 (if no-subtree
 		 (if no-subtree
 		     (user-error
 		     (user-error
@@ -2680,12 +2680,12 @@ Return t if successful."
 	    (progn
 	    (progn
 	      (set-marker org-last-indent-begin-marker rbeg)
 	      (set-marker org-last-indent-begin-marker rbeg)
 	      (set-marker org-last-indent-end-marker rend))
 	      (set-marker org-last-indent-end-marker rend))
-	  (set-marker org-last-indent-begin-marker (line-beginning-position))
+          (set-marker org-last-indent-begin-marker (line-beginning-position))
 	  (set-marker org-last-indent-end-marker
 	  (set-marker org-last-indent-end-marker
 		      (cond
 		      (cond
 		       (specialp (org-list-get-bottom-point struct))
 		       (specialp (org-list-get-bottom-point struct))
-		       (no-subtree (1+ (line-beginning-position)))
-		       (t (org-list-get-item-end (line-beginning-position) struct))))))
+                       (no-subtree (1+ (line-beginning-position)))
+                       (t (org-list-get-item-end (line-beginning-position) struct))))))
       (let* ((beg (marker-position org-last-indent-begin-marker))
       (let* ((beg (marker-position org-last-indent-begin-marker))
 	     (end (marker-position org-last-indent-end-marker)))
 	     (end (marker-position org-last-indent-end-marker)))
 	(cond
 	(cond
@@ -2923,8 +2923,8 @@ function is being called interactively."
   (let* ((case-func (if with-case 'identity 'downcase))
   (let* ((case-func (if with-case 'identity 'downcase))
          (struct (org-list-struct))
          (struct (org-list-struct))
          (prevs (org-list-prevs-alist struct))
          (prevs (org-list-prevs-alist struct))
-	 (start (org-list-get-list-begin (line-beginning-position) struct prevs))
-	 (end (org-list-get-list-end (line-beginning-position) struct prevs))
+         (start (org-list-get-list-begin (line-beginning-position) struct prevs))
+         (end (org-list-get-list-end (line-beginning-position) struct prevs))
 	 (sorting-type
 	 (sorting-type
 	  (or sorting-type
 	  (or sorting-type
 	      (progn
 	      (progn
@@ -2969,21 +2969,21 @@ function is being called interactively."
 		   ((= dcst ?n)
 		   ((= dcst ?n)
 		    (string-to-number
 		    (string-to-number
 		     (org-sort-remove-invisible
 		     (org-sort-remove-invisible
-		      (buffer-substring (match-end 0) (line-end-position)))))
+                      (buffer-substring (match-end 0) (line-end-position)))))
 		   ((= dcst ?a)
 		   ((= dcst ?a)
 		    (funcall case-func
 		    (funcall case-func
 			     (org-sort-remove-invisible
 			     (org-sort-remove-invisible
 			      (buffer-substring
 			      (buffer-substring
-			       (match-end 0) (line-end-position)))))
+                               (match-end 0) (line-end-position)))))
 		   ((= dcst ?t)
 		   ((= dcst ?t)
 		    (cond
 		    (cond
 		     ;; If it is a timer list, convert timer to seconds
 		     ;; If it is a timer list, convert timer to seconds
 		     ((org-at-item-timer-p)
 		     ((org-at-item-timer-p)
 		      (org-timer-hms-to-secs (match-string 1)))
 		      (org-timer-hms-to-secs (match-string 1)))
 		     ((or (save-excursion
 		     ((or (save-excursion
-			    (re-search-forward org-ts-regexp (line-end-position) t))
+                            (re-search-forward org-ts-regexp (line-end-position) t))
 			  (save-excursion (re-search-forward org-ts-regexp-both
 			  (save-excursion (re-search-forward org-ts-regexp-both
-							     (line-end-position) t)))
+                                                             (line-end-position) t)))
 		      (org-time-string-to-seconds (match-string 0)))
 		      (org-time-string-to-seconds (match-string 0)))
 		     (t (float-time now))))
 		     (t (float-time now))))
 		   ((= dcst ?x) (or (and (stringp (match-string 1))
 		   ((= dcst ?x) (or (and (stringp (match-string 1))
@@ -3056,14 +3056,14 @@ With a prefix argument ARG, change the region in a single item."
 	   (save-excursion
 	   (save-excursion
 	     (goto-char pos)
 	     (goto-char pos)
 	     (skip-chars-forward " \r\t\n")
 	     (skip-chars-forward " \r\t\n")
-	     (line-beginning-position))))
+             (line-beginning-position))))
 	beg end)
 	beg end)
     ;; Determine boundaries of changes.
     ;; Determine boundaries of changes.
     (if (org-region-active-p)
     (if (org-region-active-p)
 	(setq beg (funcall skip-blanks (region-beginning))
 	(setq beg (funcall skip-blanks (region-beginning))
 	      end (copy-marker (region-end)))
 	      end (copy-marker (region-end)))
       (setq beg (line-beginning-position)
       (setq beg (line-beginning-position)
-	    end (copy-marker (line-end-position))))
+            end (copy-marker (line-end-position))))
     ;; Depending on the starting line, choose an action on the text
     ;; Depending on the starting line, choose an action on the text
     ;; between BEG and END.
     ;; between BEG and END.
     (org-with-limited-levels
     (org-with-limited-levels

+ 1 - 1
lisp/org-macro.el

@@ -72,7 +72,7 @@
 (declare-function org-mode "org" ())
 (declare-function org-mode "org" ())
 (declare-function vc-backend "vc-hooks" (f))
 (declare-function vc-backend "vc-hooks" (f))
 (declare-function vc-call "vc-hooks" (fun file &rest args) t)
 (declare-function vc-call "vc-hooks" (fun file &rest args) t)
-(declare-function vc-exec-after "vc-dispatcher" (code))
+(declare-function vc-exec-after "vc-dispatcher" (code &optional success))
 
 
 (defvar org-link-search-must-match-exact-headline)
 (defvar org-link-search-must-match-exact-headline)
 
 

+ 5 - 3
lisp/org-macs.el

@@ -94,6 +94,7 @@ Version mismatch is commonly encountered in the following situations:
 (declare-function org-fold-core-with-forced-fontification "org-fold" (&rest body))
 (declare-function org-fold-core-with-forced-fontification "org-fold" (&rest body))
 (declare-function org-fold-folded-p "org-fold" (&optional pos limit ignore-hidden-p previous-p))
 (declare-function org-fold-folded-p "org-fold" (&optional pos limit ignore-hidden-p previous-p))
 (declare-function string-collate-lessp "org-compat" (s1 s2 &optional locale ignore-case))
 (declare-function string-collate-lessp "org-compat" (s1 s2 &optional locale ignore-case))
+(declare-function org-time-convert-to-integer "org-compat" (time))
 
 
 (defvar org-ts-regexp0)
 (defvar org-ts-regexp0)
 (defvar ffap-url-regexp)
 (defvar ffap-url-regexp)
@@ -312,15 +313,16 @@ If EXCLUDE-TMP is non-nil, ignore temporary buffers."
 
 
 (defun org-file-newer-than-p (file time)
 (defun org-file-newer-than-p (file time)
   "Non-nil if FILE is newer than TIME.
   "Non-nil if FILE is newer than TIME.
-FILE is a filename, as a string, TIME is a list of integers, as
+FILE is a filename, as a string, TIME is a Lisp time value, as
 returned by, e.g., `current-time'."
 returned by, e.g., `current-time'."
   (and (file-exists-p file)
   (and (file-exists-p file)
        ;; Only compare times up to whole seconds as some file-systems
        ;; Only compare times up to whole seconds as some file-systems
        ;; (e.g. HFS+) do not retain any finer granularity.  As
        ;; (e.g. HFS+) do not retain any finer granularity.  As
        ;; a consequence, make sure we return non-nil when the two
        ;; a consequence, make sure we return non-nil when the two
        ;; times are equal.
        ;; times are equal.
-       (not (time-less-p (cl-subseq (nth 5 (file-attributes file)) 0 2)
-			 (cl-subseq time 0 2)))))
+       (not (time-less-p (org-time-convert-to-integer
+			  (nth 5 (file-attributes file)))
+			 (org-time-convert-to-integer time)))))
 
 
 (defun org-compile-file (source process ext &optional err-msg log-buf spec)
 (defun org-compile-file (source process ext &optional err-msg log-buf spec)
   "Compile a SOURCE file using PROCESS.
   "Compile a SOURCE file using PROCESS.

+ 5 - 5
lisp/org-mobile.el

@@ -620,7 +620,7 @@ The table of checksums is written to the file mobile-checksums."
 	 ((looking-at "[ \t]*$")) ; keep empty lines
 	 ((looking-at "[ \t]*$")) ; keep empty lines
 	 ((looking-at "=+$")
 	 ((looking-at "=+$")
 	  ;; remove underlining
 	  ;; remove underlining
-	  (delete-region (point) (line-end-position)))
+          (delete-region (point) (line-end-position)))
 	 ((get-text-property (point) 'org-agenda-structural-header)
 	 ((get-text-property (point) 'org-agenda-structural-header)
 	  (setq in-date nil)
 	  (setq in-date nil)
 	  (setq app (get-text-property (point) 'org-agenda-title-append))
 	  (setq app (get-text-property (point) 'org-agenda-title-append))
@@ -640,14 +640,14 @@ The table of checksums is written to the file mobile-checksums."
 		      (get-text-property (point) 'org-marker)))
 		      (get-text-property (point) 'org-marker)))
 	  (setq sexp (member (get-text-property (point) 'type)
 	  (setq sexp (member (get-text-property (point) 'type)
 			     '("diary" "sexp")))
 			     '("diary" "sexp")))
-	  (if (setq pl (text-property-any (point) (line-end-position) 'org-heading t))
+          (if (setq pl (text-property-any (point) (line-end-position) 'org-heading t))
 	      (progn
 	      (progn
 		(setq prefix (org-trim (buffer-substring
 		(setq prefix (org-trim (buffer-substring
 					(point) pl))
 					(point) pl))
 		      line (org-trim (buffer-substring
 		      line (org-trim (buffer-substring
 				      pl
 				      pl
-				      (line-end-position))))
-		(delete-region (line-beginning-position) (line-end-position))
+                                      (line-end-position))))
+                (delete-region (line-beginning-position) (line-end-position))
 		(insert line "<before>" prefix "</before>")
 		(insert line "<before>" prefix "</before>")
 		(beginning-of-line 1))
 		(beginning-of-line 1))
 	    (and (looking-at "[ \t]+") (replace-match "")))
 	    (and (looking-at "[ \t]+") (replace-match "")))
@@ -860,7 +860,7 @@ If BEG and END are given, only do this in that region."
 	    (org-mobile-timestamp-buffer (marker-buffer id-pos))
 	    (org-mobile-timestamp-buffer (marker-buffer id-pos))
 	    (push (marker-buffer id-pos) buf-list))
 	    (push (marker-buffer id-pos) buf-list))
 	  (unless (markerp id-pos)
 	  (unless (markerp id-pos)
-	    (goto-char (+ 2 (line-beginning-position)))
+            (goto-char (+ 2 (line-beginning-position)))
 	    (if (stringp id-pos)
 	    (if (stringp id-pos)
 		(insert id-pos " ")
 		(insert id-pos " ")
 	      (insert "BAD REFERENCE "))
 	      (insert "BAD REFERENCE "))

+ 2 - 2
lisp/org-mouse.el

@@ -211,7 +211,7 @@ this function is called.  Otherwise, the current major mode menu is used."
   (interactive "@e \nP")
   (interactive "@e \nP")
   (if (and (= (event-click-count event) 1)
   (if (and (= (event-click-count event) 1)
 	   (or (not mark-active)
 	   (or (not mark-active)
-	       (sit-for (/ double-click-time 1000.0))))
+               (sit-for (/ (mouse-double-click-time) 1000.0))))
       (progn
       (progn
 	(select-window (posn-window (event-start event)))
 	(select-window (posn-window (event-start event)))
 	(when (not (org-mouse-mark-active))
 	(when (not (org-mouse-mark-active))
@@ -1013,7 +1013,7 @@ This means, between the beginning of line and the point."
 		     (org-fold-heading nil)))   ; show the next heading
 		     (org-fold-heading nil)))   ; show the next heading
 	      (org-back-to-heading)
 	      (org-back-to-heading)
 	      (setq marker (point-marker))
 	      (setq marker (point-marker))
-	      (goto-char (max (line-beginning-position) (- (line-end-position) anticol)))
+              (goto-char (max (line-beginning-position) (- (line-end-position) anticol)))
 	      (funcall command)
 	      (funcall command)
 	      (message "_cmd: %S" org-mouse-cmd)
 	      (message "_cmd: %S" org-mouse-cmd)
 	      (message "this-command: %S" this-command)
 	      (message "this-command: %S" this-command)

+ 5 - 4
lisp/org-plot.el

@@ -275,10 +275,10 @@ argument for the FUNCTION."
 	     for k in keys collect
 	     for k in keys collect
 	     (cons k (funcall function (lookup k alist1) (lookup k alist2))))))
 	     (cons k (funcall function (lookup k alist1) (lookup k alist2))))))
 
 
-(defun org--plot/item-frequencies (values &optional normalise)
+(defun org--plot/item-frequencies (values &optional normalize)
   "Return an alist indicating the frequency of values in VALUES list.
   "Return an alist indicating the frequency of values in VALUES list.
-When NORMALISE is non-nil, the count is divided by the number of values."
-  (let ((normaliser (if normalise (float (length values)) 1)))
+When NORMALIZE is non-nil, the count is divided by the number of values."
+  (let ((normaliser (if normalize (float (length values)) 1)))
     (cl-loop for (n . m) in (seq-group-by #'identity values)
     (cl-loop for (n . m) in (seq-group-by #'identity values)
 	     collect (cons n (/ (length m) normaliser)))))
 	     collect (cons n (/ (length m) normaliser)))))
 
 
@@ -624,7 +624,8 @@ manner suitable for prepending to a user-specified script."
   "Find any overlays for IMG-FILE in the current Org buffer, and refresh them."
   "Find any overlays for IMG-FILE in the current Org buffer, and refresh them."
   (dolist (img-overlay org-inline-image-overlays)
   (dolist (img-overlay org-inline-image-overlays)
     (when (string= img-file (plist-get (cdr (overlay-get img-overlay 'display)) :file))
     (when (string= img-file (plist-get (cdr (overlay-get img-overlay 'display)) :file))
-      (when (file-exists-p img-file)
+      (when (and (file-exists-p img-file)
+                 (fboundp 'image-flush))
         (image-flush (overlay-get img-overlay 'display))))))
         (image-flush (overlay-get img-overlay 'display))))))
 
 
 ;;-----------------------------------------------------------------------------
 ;;-----------------------------------------------------------------------------

+ 9 - 7
lisp/org-refile.el

@@ -467,9 +467,9 @@ prefix argument (`C-u C-u C-u C-c C-w')."
 	(unless (or (org-kill-is-subtree-p
 	(unless (or (org-kill-is-subtree-p
 		     (buffer-substring region-start region-end))
 		     (buffer-substring region-start region-end))
 		    (prog1 org-refile-active-region-within-subtree
 		    (prog1 org-refile-active-region-within-subtree
-		      (let ((s (line-end-position)))
+                      (let ((s (line-end-position)))
 			(org-toggle-heading)
 			(org-toggle-heading)
-			(setq region-end (+ (- (line-end-position) s) region-end)))))
+                        (setq region-end (+ (- (line-end-position) s) region-end)))))
 	  (user-error "The region is not a (sequence of) subtree(s)")))
 	  (user-error "The region is not a (sequence of) subtree(s)")))
       (if (equal arg '(16))
       (if (equal arg '(16))
 	  (org-refile-goto-last-stored)
 	  (org-refile-goto-last-stored)
@@ -642,11 +642,13 @@ this function appends the default value from
 	       org-refile-target-table))
 	       org-refile-target-table))
 	 (completion-ignore-case t)
 	 (completion-ignore-case t)
 	 cdef
 	 cdef
-	 (prompt (concat prompt
-			 (or (and (car org-refile-history)
-				  (concat " (default " (car org-refile-history) ")"))
-			     (and (assoc cbnex tbl) (setq cdef cbnex)
-				  (concat " (default " cbnex ")"))) ": "))
+         (prompt (let ((default (or (car org-refile-history)
+                                    (and (assoc cbnex tbl) (setq cdef cbnex)
+                                         cbnex))))
+                   ;; `format-prompt' is new in Emacs 28.1.
+                   (if (fboundp 'format-prompt)
+                       (format-prompt prompt default)
+                     (concat prompt " (default " default ": "))))
 	 pa answ parent-target child parent old-hist)
 	 pa answ parent-target child parent old-hist)
     (setq old-hist org-refile-history)
     (setq old-hist org-refile-history)
     (setq answ (funcall cfunc prompt tbl nil (not new-nodes)
     (setq answ (funcall cfunc prompt tbl nil (not new-nodes)

+ 11 - 9
lisp/org-table.el

@@ -841,7 +841,7 @@ SIZE is a string Columns x Rows like for example \"3x2\"."
 	 (line (concat (apply 'concat indent "|" (make-list columns "  |"))
 	 (line (concat (apply 'concat indent "|" (make-list columns "  |"))
 		       "\n")))
 		       "\n")))
     (if (string-match "^[ \t]*$" (buffer-substring-no-properties
     (if (string-match "^[ \t]*$" (buffer-substring-no-properties
-				  (line-beginning-position) (point)))
+                                  (line-beginning-position) (point)))
 	(beginning-of-line 1)
 	(beginning-of-line 1)
       (newline))
       (newline))
     ;; (mapcar (lambda (x) (insert line)) (make-list rows t))
     ;; (mapcar (lambda (x) (insert line)) (make-list rows t))
@@ -1175,7 +1175,7 @@ When ALIGN is set, also realign the table."
       (goto-char (org-table-begin))
       (goto-char (org-table-begin))
       (while (and (re-search-forward org-table-dataline-regexp end t)
       (while (and (re-search-forward org-table-dataline-regexp end t)
 		  (setq cnt (1+ cnt))
 		  (setq cnt (1+ cnt))
-		  (< (line-end-position) pos))))
+                  (< (line-end-position) pos))))
     cnt))
     cnt))
 
 
 (defun org-table-current-column ()
 (defun org-table-current-column ()
@@ -1338,7 +1338,7 @@ However, when FORCE is non-nil, create new columns if necessary."
   (beginning-of-line 1)
   (beginning-of-line 1)
   (when (> n 0)
   (when (> n 0)
     (while (and (> (setq n (1- n)) -1)
     (while (and (> (setq n (1- n)) -1)
-		(or (search-forward "|" (line-end-position) t)
+                (or (search-forward "|" (line-end-position) t)
 		    (and force
 		    (and force
 			 (progn (end-of-line 1)
 			 (progn (end-of-line 1)
 				(skip-chars-backward "^|")
 				(skip-chars-backward "^|")
@@ -1679,7 +1679,7 @@ With prefix ABOVE, insert above the current line."
     (org-table-align))
     (org-table-align))
   (org-table-with-shrunk-columns
   (org-table-with-shrunk-columns
    (let ((line (org-table-clean-line
    (let ((line (org-table-clean-line
-		(buffer-substring (line-beginning-position) (line-end-position))))
+                (buffer-substring (line-beginning-position) (line-end-position))))
 	 (col (current-column)))
 	 (col (current-column)))
      (while (string-match "|\\( +\\)|" line)
      (while (string-match "|\\( +\\)|" line)
        (setq line (replace-match
        (setq line (replace-match
@@ -1728,7 +1728,8 @@ In particular, this does handle wide and invisible characters."
 	(dline (and (not (org-match-line org-table-hline-regexp))
 	(dline (and (not (org-match-line org-table-hline-regexp))
 		    (org-table-current-dline))))
 		    (org-table-current-dline))))
     (org-table-with-shrunk-columns
     (org-table-with-shrunk-columns
-     (kill-region (line-beginning-position) (min (1+ (line-end-position)) (point-max)))
+     (kill-region (line-beginning-position)
+                  (min (1+ (line-end-position)) (point-max)))
      (if (not (org-at-table-p)) (beginning-of-line 0))
      (if (not (org-at-table-p)) (beginning-of-line 0))
      (org-move-to-column col)
      (org-move-to-column col)
      (when (and dline
      (when (and dline
@@ -2269,14 +2270,14 @@ For all numbers larger than LIMIT, shift them by DELTA."
 		 (format "@%d\\$[0-9]+=.*?\\(::\\|$\\)" remove))))
 		 (format "@%d\\$[0-9]+=.*?\\(::\\|$\\)" remove))))
 	    s n a)
 	    s n a)
 	(when remove
 	(when remove
-	  (while (re-search-forward re2 (line-end-position) t)
+          (while (re-search-forward re2 (line-end-position) t)
 	    (unless (save-match-data (org-in-regexp "remote([^)]+?)"))
 	    (unless (save-match-data (org-in-regexp "remote([^)]+?)"))
 	      (if (equal (char-before (match-beginning 0)) ?.)
 	      (if (equal (char-before (match-beginning 0)) ?.)
 		  (user-error
 		  (user-error
 		   "Change makes TBLFM term %s invalid, use undo to recover"
 		   "Change makes TBLFM term %s invalid, use undo to recover"
 		   (match-string 0))
 		   (match-string 0))
 		(replace-match "")))))
 		(replace-match "")))))
-	(while (re-search-forward re (line-end-position) t)
+        (while (re-search-forward re (line-end-position) t)
 	  (unless (save-match-data (org-in-regexp "remote([^)]+?)"))
 	  (unless (save-match-data (org-in-regexp "remote([^)]+?)"))
 	    (setq s (match-string 1) n (string-to-number s))
 	    (setq s (match-string 1) n (string-to-number s))
 	    (cond
 	    (cond
@@ -3802,8 +3803,9 @@ FACE, when non-nil, for the highlight."
     (let ((id 0) (ih 0) hline eol str ov)
     (let ((id 0) (ih 0) hline eol str ov)
       (goto-char (org-table-begin))
       (goto-char (org-table-begin))
       (while (org-at-table-p)
       (while (org-at-table-p)
-	(setq eol (line-end-position))
-	(setq ov (make-overlay (line-beginning-position) (1+ (line-beginning-position))))
+        (setq eol (line-end-position))
+        (setq ov (make-overlay (line-beginning-position)
+                               (1+ (line-beginning-position))))
 	(push ov org-table-coordinate-overlays)
 	(push ov org-table-coordinate-overlays)
 	(setq hline (looking-at org-table-hline-regexp))
 	(setq hline (looking-at org-table-hline-regexp))
 	(setq str (if hline (format "I*%-2d" (setq ih (1+ ih)))
 	(setq str (if hline (format "I*%-2d" (setq ih (1+ ih)))

+ 34 - 32
lisp/org.el

@@ -84,8 +84,8 @@
 
 
 (condition-case nil
 (condition-case nil
     (load (concat (file-name-directory load-file-name)
     (load (concat (file-name-directory load-file-name)
-		  "org-loaddefs.el")
-	  nil t t t)
+		  "org-loaddefs")
+	  nil t nil t)
   (error
   (error
    (message "WARNING: No org-loaddefs.el file could be found from where org.el is loaded.")
    (message "WARNING: No org-loaddefs.el file could be found from where org.el is loaded.")
    (sit-for 3)
    (sit-for 3)
@@ -1310,7 +1310,7 @@ Possible values for the file identifier are:
                  name as a subcommand.
                  name as a subcommand.
 
 
  `directory'   Matches a directory
  `directory'   Matches a directory
- `remote'      Matches a remote file, accessible through tramp or efs.
+ `remote'      Matches a remote file, accessible through tramp.
                Remote files most likely should be visited through Emacs
                Remote files most likely should be visited through Emacs
                because external applications cannot handle such paths.
                because external applications cannot handle such paths.
 `auto-mode'    Matches files that are matched by any entry in `auto-mode-alist',
 `auto-mode'    Matches files that are matched by any entry in `auto-mode-alist',
@@ -3672,10 +3672,6 @@ This is needed for font-lock setup.")
 (declare-function dired-get-filename
 (declare-function dired-get-filename
 		  "dired"
 		  "dired"
 		  (&optional localp no-error-if-not-filep))
 		  (&optional localp no-error-if-not-filep))
-(declare-function iswitchb-read-buffer
-		  "iswitchb"
-		  (prompt &optional
-			  default require-match _predicate start matches-set))
 (declare-function org-agenda-change-all-lines
 (declare-function org-agenda-change-all-lines
 		  "org-agenda"
 		  "org-agenda"
 		  (newhead hdmarker &optional fixface just-this))
 		  (newhead hdmarker &optional fixface just-this))
@@ -3709,7 +3705,6 @@ This is needed for font-lock setup.")
 (defvar calc-embedded-open-formula)
 (defvar calc-embedded-open-formula)
 (defvar calc-embedded-open-mode)
 (defvar calc-embedded-open-mode)
 (defvar font-lock-unfontify-region-function)
 (defvar font-lock-unfontify-region-function)
-(defvar iswitchb-temp-buflist)
 (defvar org-agenda-tags-todo-honor-ignore-options)
 (defvar org-agenda-tags-todo-honor-ignore-options)
 (defvar remember-data-file)
 (defvar remember-data-file)
 (defvar texmathp-why)
 (defvar texmathp-why)
@@ -7706,7 +7701,7 @@ function is being called interactively."
 		    (org-time-string-to-seconds (match-string 1))
 		    (org-time-string-to-seconds (match-string 1))
 		  (float-time now))))
 		  (float-time now))))
 	     ((= dcst ?p)
 	     ((= dcst ?p)
-	      (if (re-search-forward org-priority-regexp (line-end-position) t)
+              (if (re-search-forward org-priority-regexp (line-end-position) t)
 		  (string-to-char (match-string 2))
 		  (string-to-char (match-string 2))
 		org-priority-default))
 		org-priority-default))
 	     ((= dcst ?r)
 	     ((= dcst ?r)
@@ -8615,7 +8610,8 @@ If not found, stay at current position and return nil."
 (defun org-create-dblock (plist)
 (defun org-create-dblock (plist)
   "Create a dynamic block section, with parameters taken from PLIST.
   "Create a dynamic block section, with parameters taken from PLIST.
 PLIST must contain a :name entry which is used as the name of the block."
 PLIST must contain a :name entry which is used as the name of the block."
-  (when (string-match "\\S-" (buffer-substring (line-beginning-position) (line-end-position)))
+  (when (string-match "\\S-" (buffer-substring (line-beginning-position)
+                                               (line-end-position)))
     (end-of-line 1)
     (end-of-line 1)
     (newline))
     (newline))
   (let ((col (current-column))
   (let ((col (current-column))
@@ -8685,6 +8681,7 @@ TYPE is the dynamic block type, as a string."
   "List all defined dynamic block types."
   "List all defined dynamic block types."
   (mapcar #'car org-dynamic-block-alist))
   (mapcar #'car org-dynamic-block-alist))
 
 
+;;;###org-autoload
 (defun org-dynamic-block-define (type func)
 (defun org-dynamic-block-define (type func)
   "Define dynamic block TYPE with FUNC.
   "Define dynamic block TYPE with FUNC.
 TYPE is a string.  FUNC is the function creating the dynamic
 TYPE is a string.  FUNC is the function creating the dynamic
@@ -9301,7 +9298,8 @@ When called through ELisp, arg is also interpreted in the following way:
 	    (run-hooks 'org-after-todo-state-change-hook)
 	    (run-hooks 'org-after-todo-state-change-hook)
 	    (when (and arg (not (member org-state org-done-keywords)))
 	    (when (and arg (not (member org-state org-done-keywords)))
 	      (setq head (org-get-todo-sequence-head org-state)))
 	      (setq head (org-get-todo-sequence-head org-state)))
-	    (put-text-property (line-beginning-position) (line-end-position) 'org-todo-head head)
+            (put-text-property (line-beginning-position)
+                               (line-end-position) 'org-todo-head head)
 	    ;; Do we need to trigger a repeat?
 	    ;; Do we need to trigger a repeat?
 	    (when now-done-p
 	    (when now-done-p
 	      (when (boundp 'org-agenda-headline-snapshot-before-repeat)
 	      (when (boundp 'org-agenda-headline-snapshot-before-repeat)
@@ -9514,7 +9512,7 @@ all statistics cookies in the buffer."
 	      (beginning-of-line 1)
 	      (beginning-of-line 1)
 	      (while (re-search-forward
 	      (while (re-search-forward
 		      "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)"
 		      "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)"
-		      (line-end-position) t)
+                      (line-end-position) t)
 		(replace-match (if (match-end 2) "[100%]" "[0/0]") t t)))))
 		(replace-match (if (match-end 2) "[100%]" "[0/0]") t t)))))
 	(goto-char pos)
 	(goto-char pos)
 	(move-marker pos nil)))))
 	(move-marker pos nil)))))
@@ -9561,7 +9559,7 @@ statistics everywhere."
 			   (downcase (or (org-entry-get nil "COOKIE_DATA")
 			   (downcase (or (org-entry-get nil "COOKIE_DATA")
 					 "")))))
 					 "")))))
 	    (throw 'exit nil))
 	    (throw 'exit nil))
-	  (while (re-search-forward box-re (line-end-position) t)
+          (while (re-search-forward box-re (line-end-position) t)
 	    (setq cnt-all 0 cnt-done 0 cookie-present t)
 	    (setq cnt-all 0 cnt-done 0 cookie-present t)
 	    (setq is-percent (match-end 2) checkbox-beg (match-beginning 0))
 	    (setq is-percent (match-end 2) checkbox-beg (match-beginning 0))
 	    (save-match-data
 	    (save-match-data
@@ -9672,8 +9670,9 @@ right sequence."
      ((not kwd)
      ((not kwd)
       (or (get-text-property (line-beginning-position) 'org-todo-head)
       (or (get-text-property (line-beginning-position) 'org-todo-head)
 	  (progn
 	  (progn
-	    (setq p (next-single-property-change (line-beginning-position) 'org-todo-head
-						 nil (line-end-position)))
+            (setq p (next-single-property-change (line-beginning-position)
+                                                 'org-todo-head
+                                                 nil (line-end-position)))
 	    (get-text-property p 'org-todo-head))))
 	    (get-text-property p 'org-todo-head))))
      ((not (member kwd org-todo-keywords-1))
      ((not (member kwd org-todo-keywords-1))
       (car org-todo-keywords-1))
       (car org-todo-keywords-1))
@@ -10135,13 +10134,13 @@ nil."
       (outline-next-heading)
       (outline-next-heading)
       (while (re-search-backward re beg t)
       (while (re-search-backward re beg t)
 	(replace-match "")
 	(replace-match "")
-	(if (and (string-match "\\S-" (buffer-substring (line-beginning-position) (point)))
+        (if (and (string-match "\\S-" (buffer-substring (line-beginning-position) (point)))
 		 (equal (char-before) ?\ ))
 		 (equal (char-before) ?\ ))
 	    (backward-delete-char 1)
 	    (backward-delete-char 1)
 	  (when (string-match "^[ \t]*$" (buffer-substring
 	  (when (string-match "^[ \t]*$" (buffer-substring
-					  (line-beginning-position) (line-end-position)))
-	    (delete-region (line-beginning-position)
-			   (min (point-max) (1+ (line-end-position))))))))))
+                                          (line-beginning-position) (line-end-position)))
+            (delete-region (line-beginning-position)
+                           (min (point-max) (1+ (line-end-position))))))))))
 
 
 (defvar org-time-was-given) ; dynamically scoped parameter
 (defvar org-time-was-given) ; dynamically scoped parameter
 (defvar org-end-time-was-given) ; dynamically scoped parameter
 (defvar org-end-time-was-given) ; dynamically scoped parameter
@@ -11802,7 +11801,7 @@ Returns the new tags string, or nil to not change the current settings."
 	  (setq ov-start (match-beginning 1)
 	  (setq ov-start (match-beginning 1)
 		ov-end (match-end 1)
 		ov-end (match-end 1)
 		ov-prefix "")
 		ov-prefix "")
-	(setq ov-start (1- (line-end-position))
+        (setq ov-start (1- (line-end-position))
 	      ov-end (1+ ov-start))
 	      ov-end (1+ ov-start))
 	(skip-chars-forward "^\n\r")
 	(skip-chars-forward "^\n\r")
 	(setq ov-prefix
 	(setq ov-prefix
@@ -11969,7 +11968,7 @@ Returns the new tags string, or nil to not change the current settings."
 		  (when (eq exit-after-next 'now) (throw 'exit t))
 		  (when (eq exit-after-next 'now) (throw 'exit t))
 		  (goto-char (point-min))
 		  (goto-char (point-min))
 		  (beginning-of-line 2)
 		  (beginning-of-line 2)
-		  (delete-region (point) (line-end-position))
+                  (delete-region (point) (line-end-position))
 		  (org-fast-tag-insert "Current" current c-face)
 		  (org-fast-tag-insert "Current" current c-face)
 		  (org-set-current-tags-overlay current ov-prefix)
 		  (org-set-current-tags-overlay current ov-prefix)
 		  (let ((tag-re (concat "\\[.\\] \\(" org-tag-re "\\)")))
 		  (let ((tag-re (concat "\\[.\\] \\(" org-tag-re "\\)")))
@@ -13720,7 +13719,8 @@ user."
 			    (max (point-min) (- (point) 4)) (point))
 			    (max (point-min) (- (point) 4)) (point))
 			   "    "))
 			   "    "))
 	  (insert " ")))
 	  (insert " ")))
-      (let* ((ans (concat (buffer-substring (line-beginning-position) (point-max))
+      (let* ((ans (concat (buffer-substring (line-beginning-position)
+                                            (point-max))
 			  " " (or org-ans1 org-ans2)))
 			  " " (or org-ans1 org-ans2)))
 	     (org-end-time-was-given nil)
 	     (org-end-time-was-given nil)
 	     (f (org-read-date-analyze ans org-def org-defdecode))
 	     (f (org-read-date-analyze ans org-def org-defdecode))
@@ -13742,7 +13742,7 @@ user."
 	(when org-read-date-analyze-futurep
 	(when org-read-date-analyze-futurep
 	  (setq txt (concat txt " (=>F)")))
 	  (setq txt (concat txt " (=>F)")))
 	(setq org-read-date-overlay
 	(setq org-read-date-overlay
-	      (make-overlay (1- (line-end-position)) (line-end-position)))
+              (make-overlay (1- (line-end-position)) (line-end-position)))
 	(org-overlay-display org-read-date-overlay txt 'secondary-selection)))))
 	(org-overlay-display org-read-date-overlay txt 'secondary-selection)))))
 
 
 (defun org-read-date-analyze (ans def defdecode)
 (defun org-read-date-analyze (ans def defdecode)
@@ -16240,7 +16240,7 @@ buffer boundaries with possible narrowing."
 				(org-element-property :begin link)
 				(org-element-property :begin link)
 				'org-image-overlay)))
 				'org-image-overlay)))
 		      (if (and (car-safe old) refresh)
 		      (if (and (car-safe old) refresh)
-			  (image-flush (overlay-get (cdr old) 'display))
+                          (image-flush (overlay-get (cdr old) 'display))
 			(let ((image (org--create-inline-image file width)))
 			(let ((image (org--create-inline-image file width)))
 			  (when image
 			  (when image
 			    (let ((ov (make-overlay
 			    (let ((ov (make-overlay
@@ -16787,14 +16787,14 @@ this function returns t, nil otherwise."
     (save-excursion
     (save-excursion
       (catch 'exit
       (catch 'exit
 	(unless (org-region-active-p)
 	(unless (org-region-active-p)
-	  (setq beg (line-beginning-position))
+          (setq beg (line-beginning-position))
 	  (beginning-of-line 2)
 	  (beginning-of-line 2)
 	  (while (and (not (eobp)) ;; this is like `next-line'
 	  (while (and (not (eobp)) ;; this is like `next-line'
 		      (org-invisible-p (1- (point))))
 		      (org-invisible-p (1- (point))))
 	    (beginning-of-line 2))
 	    (beginning-of-line 2))
 	  (setq end (point))
 	  (setq end (point))
 	  (goto-char beg)
 	  (goto-char beg)
-	  (goto-char (line-end-position))
+          (goto-char (line-end-position))
 	  (setq end (max end (point)))
 	  (setq end (max end (point)))
 	  (while (re-search-forward re end t)
 	  (while (re-search-forward re end t)
 	    (when (org-invisible-p (match-beginning 0))
 	    (when (org-invisible-p (match-beginning 0))
@@ -17709,7 +17709,7 @@ number of stars to add."
 	     (goto-char pos)
 	     (goto-char pos)
 	     (while (org-at-comment-p) (forward-line))
 	     (while (org-at-comment-p) (forward-line))
 	     (skip-chars-forward " \r\t\n")
 	     (skip-chars-forward " \r\t\n")
-	     (line-beginning-position))))
+             (line-beginning-position))))
 	beg end toggled)
 	beg end toggled)
     ;; Determine boundaries of changes.  If a universal prefix has
     ;; Determine boundaries of changes.  If a universal prefix has
     ;; been given, put the list in a region.  If region ends at a bol,
     ;; been given, put the list in a region.  If region ends at a bol,
@@ -17723,9 +17723,9 @@ number of stars to add."
 	(setq beg (funcall skip-blanks (region-beginning))
 	(setq beg (funcall skip-blanks (region-beginning))
 	      end (copy-marker (save-excursion
 	      end (copy-marker (save-excursion
 				 (goto-char (region-end))
 				 (goto-char (region-end))
-				 (if (bolp) (point) (line-end-position)))))
+                                 (if (bolp) (point) (line-end-position)))))
       (setq beg (funcall skip-blanks (line-beginning-position))
       (setq beg (funcall skip-blanks (line-beginning-position))
-	    end (copy-marker (line-end-position))))
+            end (copy-marker (line-end-position))))
     ;; Ensure inline tasks don't count as headings.
     ;; Ensure inline tasks don't count as headings.
     (org-with-limited-levels
     (org-with-limited-levels
      (save-excursion
      (save-excursion
@@ -18335,7 +18335,9 @@ and :keyword."
     ;; First the large context
     ;; First the large context
     (cond
     (cond
      ((org-at-heading-p)
      ((org-at-heading-p)
-      (push (list :headline (line-beginning-position) (line-end-position)) clist)
+      (push (list :headline (line-beginning-position)
+                  (line-end-position))
+            clist)
       (when (progn
       (when (progn
 	      (beginning-of-line 1)
 	      (beginning-of-line 1)
 	      (looking-at org-todo-line-tags-regexp))
 	      (looking-at org-todo-line-tags-regexp))
@@ -20036,7 +20038,7 @@ interactive command with similar behavior."
 		    (and (looking-at "[ \t]*$")
 		    (and (looking-at "[ \t]*$")
 			 (string-match
 			 (string-match
 			  "\\`\\*+\\'"
 			  "\\`\\*+\\'"
-			  (buffer-substring (line-beginning-position) (point)))))))
+                          (buffer-substring (line-beginning-position) (point)))))))
 	  swallowp)
 	  swallowp)
       (cond
       (cond
        ((and subtreep org-yank-folded-subtrees)
        ((and subtreep org-yank-folded-subtrees)
@@ -20069,7 +20071,7 @@ interactive command with similar behavior."
 	  (beginning-of-line 1)
 	  (beginning-of-line 1)
 	  (push-mark beg 'nomsg)))
 	  (push-mark beg 'nomsg)))
        ((and subtreep org-yank-adjusted-subtrees)
        ((and subtreep org-yank-adjusted-subtrees)
-	(let ((beg (line-beginning-position)))
+        (let ((beg (line-beginning-position)))
 	  (org-paste-subtree nil nil 'for-yank)
 	  (org-paste-subtree nil nil 'for-yank)
 	  (push-mark beg 'nomsg)))
 	  (push-mark beg 'nomsg)))
        (t
        (t

+ 3 - 4
lisp/ox-icalendar.el

@@ -863,8 +863,7 @@ as a communication channel."
    (if (not (plist-get info :with-author)) ""
    (if (not (plist-get info :with-author)) ""
      (org-export-data (plist-get info :author) info))
      (org-export-data (plist-get info :author) info))
    ;; Timezone.
    ;; Timezone.
-   (if (org-string-nw-p org-icalendar-timezone) org-icalendar-timezone
-     (cadr (current-time-zone)))
+   (or (org-string-nw-p org-icalendar-timezone) (format-time-string "%Z"))
    ;; Description.
    ;; Description.
    (org-export-data (plist-get info :title) info)
    (org-export-data (plist-get info :title) info)
    contents))
    contents))
@@ -1011,7 +1010,7 @@ This function assumes major mode for current buffer is
        (org-icalendar--vcalendar
        (org-icalendar--vcalendar
 	org-icalendar-combined-name
 	org-icalendar-combined-name
 	user-full-name
 	user-full-name
-	(or (org-string-nw-p org-icalendar-timezone) (cadr (current-time-zone)))
+	(or (org-string-nw-p org-icalendar-timezone) (format-time-string "%Z"))
 	org-icalendar-combined-description
 	org-icalendar-combined-description
 	contents)))
 	contents)))
     (run-hook-with-args 'org-icalendar-after-save-hook file)))
     (run-hook-with-args 'org-icalendar-after-save-hook file)))
@@ -1034,7 +1033,7 @@ FILES is a list of files to build the calendar from."
 	      user-full-name
 	      user-full-name
 	      ;; Timezone.
 	      ;; Timezone.
 	      (or (org-string-nw-p org-icalendar-timezone)
 	      (or (org-string-nw-p org-icalendar-timezone)
-		  (cadr (current-time-zone)))
+		  (format-time-string "Z"))
 	      ;; Description.
 	      ;; Description.
 	      org-icalendar-combined-description
 	      org-icalendar-combined-description
 	      ;; Contents.
 	      ;; Contents.

+ 5 - 7
lisp/ox.el

@@ -82,6 +82,7 @@
 (require 'org-element)
 (require 'org-element)
 (require 'org-macro)
 (require 'org-macro)
 (require 'tabulated-list)
 (require 'tabulated-list)
+(require 'subr-x)
 
 
 (declare-function org-src-coderef-format "org-src" (&optional element))
 (declare-function org-src-coderef-format "org-src" (&optional element))
 (declare-function org-src-coderef-regexp "org-src" (fmt &optional label))
 (declare-function org-src-coderef-regexp "org-src" (fmt &optional label))
@@ -4453,15 +4454,12 @@ INFO is a plist used as a communication channel.
 
 
 Return value can be a radio-target object or nil.  Assume LINK
 Return value can be a radio-target object or nil.  Assume LINK
 has type \"radio\"."
 has type \"radio\"."
-  (let ((path (replace-regexp-in-string
-	       "[ \r\t\n]+" " " (org-element-property :path link))))
+  (let ((path (string-clean-whitespace (org-element-property :path link))))
     (org-element-map (plist-get info :parse-tree) 'radio-target
     (org-element-map (plist-get info :parse-tree) 'radio-target
       (lambda (radio)
       (lambda (radio)
-	(and (eq (compare-strings
-		  (replace-regexp-in-string
-		   "[ \r\t\n]+" " " (org-element-property :value radio))
-		  nil nil path nil nil t)
-		 t)
+	(and (string-equal-ignore-case
+	      (string-clean-whitespace (org-element-property :value radio))
+              path)
 	     radio))
 	     radio))
       info 'first-match)))
       info 'first-match)))