Browse Source

Small fix to headline search string

* lisp/ol.el (org-link-heading-search-string):
(org-link-search):
* lisp/ox.el (org-export-search-cells): Replace statistics cookies
with a space before squeezing spaces so as to handle properly, e.g.,
"wordCOOKIEword".
Nicolas Goaziou 5 years ago
parent
commit
ee0dba6402
2 changed files with 4 additions and 6 deletions
  1. 3 5
      lisp/ol.el
  2. 1 1
      lisp/ox.el

+ 3 - 5
lisp/ol.el

@@ -1192,7 +1192,7 @@ of matched result, which is either `dedicated' or `fuzzy'."
 		 (when (equal words
 			      (split-string
 			       (replace-regexp-in-string
-				cookie-re ""
+				cookie-re " "
 				(replace-regexp-in-string
 				 comment-re "" (org-get-heading t t t)))))
 		   (throw :found t)))
@@ -1258,10 +1258,8 @@ into a single one."
 	     (unless (string-prefix-p "*" s) (setq s (concat "*" s)))
 	     (replace-regexp-in-string comment-re "" s))))
 	(cookie-re "\\[[0-9]*\\(?:%\\|/[0-9]*\\)\\]"))
-    (org-trim
-     (replace-regexp-in-string
-      cookie-re ""
-      (org-link--squeeze-white-spaces context)))))
+    (org-link--squeeze-white-spaces
+     (replace-regexp-in-string cookie-re " " context))))
 
 (defun org-link-open-as-file (path arg)
   "Pretend PATH is a file name and open it.

+ 1 - 1
lisp/ox.el

@@ -4354,7 +4354,7 @@ ignores white spaces and statistics cookies, if applicable."
     (`headline
      (let ((title (split-string
 		   (replace-regexp-in-string
-		    "\\[[0-9]*\\(?:%\\|/[0-9]*\\)\\]" ""
+		    "\\[[0-9]*\\(?:%\\|/[0-9]*\\)\\]" " "
 		    (org-element-property :raw-value datum)))))
        (delq nil
 	     (list