forked from mirrors/org-mode
Remove spurious argument to `org-link-search'
* lisp/org.el (org-link-search): Remove TYPE argument, used to force `org-occur' or `org-do-occur' on fuzzy search. Instead, enclose string within forward slashes. * lisp/org-macro.el (org-macro-initialize-templates): * lisp/ob-exp.el (org-link-search): Apply signature change.
This commit is contained in:
parent
271ecd090a
commit
b4d85b47a9
|
@ -41,7 +41,7 @@
|
||||||
(declare-function org-in-commented-heading-p "org" (&optional no-inheritance))
|
(declare-function org-in-commented-heading-p "org" (&optional no-inheritance))
|
||||||
(declare-function org-in-block-p "org" (names))
|
(declare-function org-in-block-p "org" (names))
|
||||||
(declare-function org-in-verbatim-emphasis "org" ())
|
(declare-function org-in-verbatim-emphasis "org" ())
|
||||||
(declare-function org-link-search "org" (s &optional type avoid-pos stealth))
|
(declare-function org-link-search "org" (s &optional avoid-pos stealth))
|
||||||
(declare-function org-fill-template "org" (template alist))
|
(declare-function org-fill-template "org" (template alist))
|
||||||
(declare-function org-split-string "org" (string &optional separators))
|
(declare-function org-split-string "org" (string &optional separators))
|
||||||
(declare-function org-element-at-point "org-element" ())
|
(declare-function org-element-at-point "org-element" ())
|
||||||
|
|
|
@ -135,7 +135,7 @@ function installs the following ones: \"property\",
|
||||||
(when (org-string-nw-p l)
|
(when (org-string-nw-p l)
|
||||||
(condition-case _
|
(condition-case _
|
||||||
(let ((org-link-search-must-match-exact-headline t))
|
(let ((org-link-search-must-match-exact-headline t))
|
||||||
(org-link-search l nil nil t))
|
(org-link-search l nil t))
|
||||||
(error
|
(error
|
||||||
(error \"Macro property failed: cannot find location %s\"
|
(error \"Macro property failed: cannot find location %s\"
|
||||||
l)))))
|
l)))))
|
||||||
|
|
24
lisp/org.el
24
lisp/org.el
|
@ -10835,8 +10835,6 @@ link in a property drawer line."
|
||||||
,(if (member type '("custom-id" "coderef"))
|
,(if (member type '("custom-id" "coderef"))
|
||||||
(org-element-property :raw-link link)
|
(org-element-property :raw-link link)
|
||||||
path)
|
path)
|
||||||
,(cond ((equal arg '(4)) 'occur)
|
|
||||||
((equal arg '(16)) 'org-occur))
|
|
||||||
;; Prevent fuzzy links from matching
|
;; Prevent fuzzy links from matching
|
||||||
;; themselves.
|
;; themselves.
|
||||||
,(and (equal type "fuzzy")
|
,(and (equal type "fuzzy")
|
||||||
|
@ -10998,7 +10996,7 @@ White spaces are not significant."
|
||||||
(goto-char origin)
|
(goto-char origin)
|
||||||
(user-error "No match for radio target: %s" target))))
|
(user-error "No match for radio target: %s" target))))
|
||||||
|
|
||||||
(defun org-link-search (s &optional type avoid-pos stealth)
|
(defun org-link-search (s &optional avoid-pos stealth)
|
||||||
"Search for a search string S.
|
"Search for a search string S.
|
||||||
|
|
||||||
If S starts with \"#\", it triggers a custom ID search.
|
If S starts with \"#\", it triggers a custom ID search.
|
||||||
|
@ -11012,24 +11010,22 @@ a regular expression. In Org mode files, this will create an
|
||||||
to list matches. If the current buffer is in `dired-mode', grep
|
to list matches. If the current buffer is in `dired-mode', grep
|
||||||
will be used to search in all files.
|
will be used to search in all files.
|
||||||
|
|
||||||
When optional argument TYPE is `org-occur', call this function on
|
|
||||||
a regexp matching S. If it is `occur', call Emacs' `occur'
|
|
||||||
function instead.
|
|
||||||
|
|
||||||
When AVOID-POS is given, ignore matches near that position.
|
When AVOID-POS is given, ignore matches near that position.
|
||||||
|
|
||||||
When optional argument STEALTH is non-nil, do not modify
|
When optional argument STEALTH is non-nil, do not modify
|
||||||
visibility around point, thus ignoring `org-show-context-detail'
|
visibility around point, thus ignoring `org-show-context-detail'
|
||||||
variable.
|
variable.
|
||||||
|
|
||||||
Search is case-insensitive and ignores white spaces."
|
Search is case-insensitive and ignores white spaces. Return type
|
||||||
|
of matched result, with is either `dedicated' or `fuzzy'."
|
||||||
(unless (org-string-nw-p s) (error "Invalid search string \"%s\"" s))
|
(unless (org-string-nw-p s) (error "Invalid search string \"%s\"" s))
|
||||||
(let* ((case-fold-search t)
|
(let* ((case-fold-search t)
|
||||||
(origin (point))
|
(origin (point))
|
||||||
(normalized (replace-regexp-in-string "\n[ \t]*" " " s))
|
(normalized (replace-regexp-in-string "\n[ \t]*" " " s))
|
||||||
(words (org-split-string s "[ \t\n]+"))
|
(words (org-split-string s "[ \t\n]+"))
|
||||||
(s-multi-re (mapconcat #'regexp-quote words "[ \t]+\\(?:\n[ \t]*\\)?"))
|
(s-multi-re (mapconcat #'regexp-quote words "[ \t]+\\(?:\n[ \t]*\\)?"))
|
||||||
(s-single-re (mapconcat #'regexp-quote words "[ \t]+")))
|
(s-single-re (mapconcat #'regexp-quote words "[ \t]+"))
|
||||||
|
type)
|
||||||
(cond
|
(cond
|
||||||
;; Check if there are any special search functions.
|
;; Check if there are any special search functions.
|
||||||
((run-hook-with-args-until-success 'org-execute-file-search-functions s))
|
((run-hook-with-args-until-success 'org-execute-file-search-functions s))
|
||||||
|
@ -11066,10 +11062,8 @@ Search is case-insensitive and ignores white spaces."
|
||||||
(error "No match for coderef: %s" coderef))))
|
(error "No match for coderef: %s" coderef))))
|
||||||
((string-match "\\`/\\(.*\\)/\\'" normalized)
|
((string-match "\\`/\\(.*\\)/\\'" normalized)
|
||||||
;; Look for a regular expression.
|
;; Look for a regular expression.
|
||||||
(cond
|
(funcall (if (derived-mode-p 'org-mode) #'org-occur #'org-do-occur)
|
||||||
((derived-mode-p 'org-mode)
|
(match-string 1 s)))
|
||||||
(org-occur (match-string 1 s)))
|
|
||||||
(t (org-do-occur (match-string 1 s)))))
|
|
||||||
;; Fuzzy links.
|
;; Fuzzy links.
|
||||||
(t
|
(t
|
||||||
(let* ((starred (eq (string-to-char normalized) ?*))
|
(let* ((starred (eq (string-to-char normalized) ?*))
|
||||||
|
@ -11150,9 +11144,7 @@ Search is case-insensitive and ignores white spaces."
|
||||||
(headline-search
|
(headline-search
|
||||||
(goto-char origin)
|
(goto-char origin)
|
||||||
(error "No match for fuzzy expression: %s" normalized))
|
(error "No match for fuzzy expression: %s" normalized))
|
||||||
;; Regular text search or occur, depending on TYPE.
|
;; Regular text search.
|
||||||
((eq type 'org-occur) (org-occur s-multi-re))
|
|
||||||
((eq type 'occur) (org-do-occur s-multi-re 'cleanup))
|
|
||||||
((catch :fuzzy-match
|
((catch :fuzzy-match
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(while (re-search-forward s-multi-re nil t)
|
(while (re-search-forward s-multi-re nil t)
|
||||||
|
|
Loading…
Reference in New Issue