diff --git a/lisp/org.el b/lisp/org.el index 79f660598..589686677 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9136,23 +9136,15 @@ according to FMT (default from `org-email-link-description-format')." (setq fmt (replace-match "from %f" t t fmt)))) (org-replace-escapes fmt table))) -(defun org-make-org-heading-search-string (&optional string heading) - "Make search string for STRING or current headline." - (interactive) - (let ((s (or string (org-get-heading))) +(defun org-make-org-heading-search-string (&optional string) + "Make search string for the current headline or STRING." + (let ((s (or string + (and (derived-mode-p 'org-mode) + (save-excursion + (org-back-to-heading t) + (plist-get (cadr (org-element-at-point)) + :raw-value))))) (lines org-context-in-file-links)) - (unless (and string (not heading)) - ;; We are using a headline, clean up garbage in there. - (if (string-match org-todo-regexp s) - (setq s (replace-match "" t t s))) - (if (string-match (org-re ":[[:alnum:]_@#%:]+:[ \t]*$") s) - (setq s (replace-match "" t t s))) - (setq s (org-trim s)) - (if (string-match (concat "^\\(" org-quote-string "\\|" - org-comment-string "\\)") s) - (setq s (replace-match "" t t s))) - (while (string-match org-ts-regexp s) - (setq s (replace-match "" t t s)))) (or string (setq s (concat "*" s))) ; Add * for headlines (when (and string (integerp lines) (> lines 0)) (let ((slines (org-split-string s "\n")))