diff options
Diffstat (limited to 'lisp/org')
-rw-r--r-- | lisp/org/ob-core.el | 9 | ||||
-rw-r--r-- | lisp/org/ob-tangle.el | 5 | ||||
-rw-r--r-- | lisp/org/oc-basic.el | 1 | ||||
-rw-r--r-- | lisp/org/org-compat.el | 19 | ||||
-rw-r--r-- | lisp/org/org-lint.el | 6 | ||||
-rw-r--r-- | lisp/org/org-plot.el | 7 | ||||
-rw-r--r-- | lisp/org/org-src.el | 4 | ||||
-rw-r--r-- | lisp/org/org-version.el | 2 | ||||
-rw-r--r-- | lisp/org/org.el | 4 | ||||
-rw-r--r-- | lisp/org/ox-ascii.el | 18 | ||||
-rw-r--r-- | lisp/org/ox-md.el | 10 | ||||
-rw-r--r-- | lisp/org/ox.el | 18 |
12 files changed, 61 insertions, 42 deletions
diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el index 04af84d2e44..3d159ed38a9 100644 --- a/lisp/org/ob-core.el +++ b/lisp/org/ob-core.el @@ -136,8 +136,7 @@ used." :type 'string :safe (lambda (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 "<<" "String used to begin a noweb reference in a code block. @@ -2435,7 +2434,7 @@ INFO may provide the values of these header arguments (in the ;; Escape contents from "export" wrap. Wrap ;; inline results within an export snippet with ;; appropriate value. - ((eq t (compare-strings type nil nil "export" nil nil t)) + ((string-equal-ignore-case type "export") (let ((backend (pcase split (`(,_) "none") (`(,_ ,b . ,_) b)))) @@ -2446,14 +2445,14 @@ INFO may provide the values of these header arguments (in the backend) "@@)}}}"))) ;; Escape contents from "example" wrap. Mark ;; inline results as verbatim. - ((eq t (compare-strings type nil nil "example" nil nil t)) + ((string-equal-ignore-case type "example") (funcall wrap opening-line closing-line nil nil "{{{results(=" "=)}}}")) ;; Escape contents from "src" wrap. Mark ;; 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 (pcase split (`(,_) diff --git a/lisp/org/ob-tangle.el b/lisp/org/ob-tangle.el index 566258eba4a..525d27bc070 100644 --- a/lisp/org/ob-tangle.el +++ b/lisp/org/ob-tangle.el @@ -581,7 +581,10 @@ which enable the original code blocks to be found." (error "Not in tangled code")) (setq body (buffer-substring body-start end))) ;; Go to the beginning of the relative block in Org file. - (org-link-open-from-string link) + ;; Explicitly allow fuzzy search even if user customized + ;; otherwise. + (let (org-link-search-must-match-exact-headline) + (org-link-open-from-string link)) (setq target-buffer (current-buffer)) (if (string-match "[^ \t\n\r]:\\([[:digit:]]+\\)" block-name) (let ((n (string-to-number (match-string 1 block-name)))) diff --git a/lisp/org/oc-basic.el b/lisp/org/oc-basic.el index 9ed1b810fab..8c76e200e4f 100644 --- a/lisp/org/oc-basic.el +++ b/lisp/org/oc-basic.el @@ -73,6 +73,7 @@ (require 'seq) (declare-function org-open-at-point "org" (&optional arg)) +(declare-function org-open-file "org" (path &optional in-emacs line search)) (declare-function org-element-interpret-data "org-element" (data)) (declare-function org-element-property "org-element" (property element)) diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el index 3e394fbab1c..085e32d6774 100644 --- a/lisp/org/org-compat.el +++ b/lisp/org/org-compat.el @@ -113,6 +113,11 @@ the symbol of the calling function, for example." ;;; Emacs < 27.1 compatibility +(if (version< emacs-version "27.1") + (defsubst org-replace-buffer-contents (source &optional _max-secs _max-costs) + (replace-buffer-contents source)) + (defalias 'org-replace-buffer-contents #'replace-buffer-contents)) + (unless (fboundp 'proper-list-p) ;; `proper-list-p' was added in Emacs 27.1. The function below is ;; taken from Emacs subr.el 200195e824b^. @@ -929,6 +934,14 @@ Implements `define-error' for older emacsen." (put name 'error-conditions (copy-sequence (cons name (get 'error 'error-conditions)))))) +(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)))) + (unless (fboundp 'string-suffix-p) ;; From Emacs subr.el. (defun string-suffix-p (suffix string &optional ignore-case) @@ -1120,10 +1133,8 @@ ELEMENT is the element at point." (and log (let ((drawer (org-element-lineage element '(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) (t (cl-case (org-element-type element) diff --git a/lisp/org/org-lint.el b/lisp/org/org-lint.el index 83c2d08a907..6d8cf3f2374 100644 --- a/lisp/org/org-lint.el +++ b/lisp/org/org-lint.el @@ -334,10 +334,8 @@ called with one argument, the key used for comparison." ast 'node-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))) (lambda (property _) (org-element-property :begin property)) (lambda (key) (format "Duplicate CUSTOM_ID property \"%s\"" key)))) diff --git a/lisp/org/org-plot.el b/lisp/org/org-plot.el index 7cce678a81b..c2da24266ab 100644 --- a/lisp/org/org-plot.el +++ b/lisp/org/org-plot.el @@ -682,9 +682,10 @@ line directly before or after the table." (looking-at "[[:space:]]*#\\+")) (setf params (org-plot/collect-options params)))) ;; Dump table to datafile - (if-let ((dump-func (plist-get type :data-dump))) - (funcall dump-func table data-file num-cols params) - (org-plot/gnuplot-to-data table data-file params)) + (let ((dump-func (plist-get type :data-dump))) + (if dump-func + (funcall dump-func table data-file num-cols params) + (org-plot/gnuplot-to-data table data-file params))) ;; Check type of ind column (timestamp? text?) (when (plist-get params :check-ind-type) (let* ((ind (1- (plist-get params :ind))) diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el index 54f901252f2..89d0c28a432 100644 --- a/lisp/org/org-src.el +++ b/lisp/org/org-src.el @@ -1235,7 +1235,7 @@ Throw an error if there is no such buffer." (insert (with-current-buffer write-back-buf (buffer-string)))) (save-restriction (narrow-to-region beg end) - (replace-buffer-contents write-back-buf 0.1 nil) + (org-replace-buffer-contents write-back-buf 0.1 nil) (goto-char (point-max)))) (when (and expecting-bol (not (bolp))) (insert "\n"))) (kill-buffer write-back-buf) @@ -1283,7 +1283,7 @@ Throw an error if there is no such buffer." (buffer-string)))) (save-restriction (narrow-to-region beg end) - (replace-buffer-contents write-back-buf 0.1 nil) + (org-replace-buffer-contents write-back-buf 0.1 nil) (goto-char (point-max)))) (when (and expecting-bol (not (bolp))) (insert "\n"))))) (when write-back-buf (kill-buffer write-back-buf)) diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el index 2a500fe5106..915c3f63c7d 100644 --- a/lisp/org/org-version.el +++ b/lisp/org/org-version.el @@ -11,7 +11,7 @@ Inserted by installing Org mode or when a release is made." (defun org-git-version () "The Git version of Org mode. Inserted by installing Org or when a release is made." - (let ((org-git-version "release_9.5.4-3-g6dc785")) + (let ((org-git-version "release_9.5.4-17-g6e991f")) org-git-version)) (provide 'org-version) diff --git a/lisp/org/org.el b/lisp/org/org.el index 008230500d7..7ab1801cfaa 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -1357,7 +1357,7 @@ Possible values for the file identifier are: to open [[file:document.pdf::5]] with evince at page 5. `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 because external applications cannot handle such paths. `auto-mode' Matches files that are matched by any entry in `auto-mode-alist', @@ -1694,7 +1694,7 @@ OK to kill that hidden subtree. When nil, kill without remorse." (const :tag "Never kill a hidden subtree with C-k" error))) (defcustom org-special-ctrl-o t - "Non-nil means, make `C-o' insert a row in tables." + "Non-nil means, make `open-line' (\\[open-line]) insert a row in tables." :group 'org-edit-structure :type 'boolean) diff --git a/lisp/org/ox-ascii.el b/lisp/org/ox-ascii.el index 38b2a5772c1..76a1a71fabe 100644 --- a/lisp/org/ox-ascii.el +++ b/lisp/org/ox-ascii.el @@ -948,12 +948,18 @@ channel." (when description (let ((dest (if (equal type "fuzzy") (org-export-resolve-fuzzy-link link info) - (org-export-resolve-id-link link info)))) - (concat - (org-ascii--fill-string - (format "[%s] %s" anchor (org-ascii--describe-datum dest info)) - width info) - "\n\n")))) + ;; Ignore broken links. On broken link, + ;; `org-export-resolve-id-link' will throw an + ;; error and we will return nil. + (condition-case nil + (org-export-resolve-id-link link info) + (org-link-broken nil))))) + (when dest + (concat + (org-ascii--fill-string + (format "[%s] %s" anchor (org-ascii--describe-datum dest info)) + width info) + "\n\n"))))) ;; Do not add a link that cannot be resolved and doesn't have ;; any description: destination is already visible in the ;; paragraph. diff --git a/lisp/org/ox-md.el b/lisp/org/ox-md.el index ad684d80333..3551e4184e5 100644 --- a/lisp/org/ox-md.el +++ b/lisp/org/ox-md.el @@ -193,11 +193,11 @@ of contents can refer to headlines." ;; A link refers internally to HEADLINE. (org-element-map (plist-get info :parse-tree) 'link (lambda (link) - (eq headline - (pcase (org-element-property :type link) - ((or "custom-id" "id") (org-export-resolve-id-link link info)) - ("fuzzy" (org-export-resolve-fuzzy-link link info)) - (_ nil)))) + (equal headline + ;; Ignore broken links. + (condition-case nil + (org-export-resolve-id-link link info) + (org-link-broken nil)))) info t)))) (defun org-md--headline-title (style level title &optional anchor tags) diff --git a/lisp/org/ox.el b/lisp/org/ox.el index ae7e41e576b..1bdf4dead89 100644 --- a/lisp/org/ox.el +++ b/lisp/org/ox.el @@ -80,6 +80,7 @@ (require 'org-element) (require 'org-macro) (require 'tabulated-list) +(require 'subr-x) (declare-function org-src-coderef-format "org-src" (&optional element)) (declare-function org-src-coderef-regexp "org-src" (fmt &optional label)) @@ -1908,8 +1909,10 @@ Return a string." (org-element-property :archivedp data))) (let ((transcoder (org-export-transcoder data info))) (or (and (functionp transcoder) - (broken-link-handler - (funcall transcoder data nil info))) + (if (eq type 'link) + (broken-link-handler + (funcall transcoder data nil info)) + (funcall transcoder data nil info))) ;; Export snippets never return a nil value so ;; that white spaces following them are never ;; ignored. @@ -4434,15 +4437,12 @@ INFO is a plist used as a communication channel. Return value can be a radio-target object or nil. Assume LINK 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 (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)) info 'first-match))) |