浏览代码

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.
Nicolas Goaziou 9 年之前
父节点
当前提交
b4d85b47a9
共有 3 个文件被更改,包括 10 次插入18 次删除
  1. 1 1
      lisp/ob-exp.el
  2. 1 1
      lisp/org-macro.el
  3. 8 16
      lisp/org.el

+ 1 - 1
lisp/ob-exp.el

@@ -41,7 +41,7 @@
 (declare-function org-in-commented-heading-p "org" (&optional no-inheritance))
 (declare-function org-in-block-p "org" (names))
 (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-split-string "org" (string &optional separators))
 (declare-function org-element-at-point "org-element" ())

+ 1 - 1
lisp/org-macro.el

@@ -135,7 +135,7 @@ function installs the following ones: \"property\",
           (when (org-string-nw-p l)
             (condition-case _
                 (let ((org-link-search-must-match-exact-headline t))
-                  (org-link-search l nil nil t))
+                  (org-link-search l nil t))
               (error
                (error \"Macro property failed: cannot find location %s\"
                       l)))))

+ 8 - 16
lisp/org.el

@@ -10835,8 +10835,6 @@ link in a property drawer line."
 			     ,(if (member type '("custom-id" "coderef"))
 				  (org-element-property :raw-link link)
 				path)
-			     ,(cond ((equal arg '(4)) 'occur)
-				    ((equal arg '(16)) 'org-occur))
 			     ;; Prevent fuzzy links from matching
 			     ;; themselves.
 			     ,(and (equal type "fuzzy")
@@ -10998,7 +10996,7 @@ White spaces are not significant."
       (goto-char origin)
       (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.
 
 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
 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 optional argument STEALTH is non-nil, do not modify
 visibility around point, thus ignoring `org-show-context-detail'
 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))
   (let* ((case-fold-search t)
 	 (origin (point))
 	 (normalized (replace-regexp-in-string "\n[ \t]*" " " s))
 	 (words (org-split-string s "[ \t\n]+"))
 	 (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
      ;; Check if there are any special search functions.
      ((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))))
      ((string-match "\\`/\\(.*\\)/\\'" normalized)
       ;; Look for a regular expression.
-      (cond
-       ((derived-mode-p 'org-mode)
-	(org-occur (match-string 1 s)))
-       (t (org-do-occur (match-string 1 s)))))
+      (funcall (if (derived-mode-p 'org-mode) #'org-occur #'org-do-occur)
+	       (match-string 1 s)))
      ;; Fuzzy links.
      (t
       (let* ((starred (eq (string-to-char normalized) ?*))
@@ -11150,9 +11144,7 @@ Search is case-insensitive and ignores white spaces."
 	 (headline-search
 	  (goto-char origin)
 	  (error "No match for fuzzy expression: %s" normalized))
-	 ;; Regular text search or occur, depending on TYPE.
-	 ((eq type 'org-occur) (org-occur s-multi-re))
-	 ((eq type 'occur) (org-do-occur s-multi-re 'cleanup))
+	 ;; Regular text search.
 	 ((catch :fuzzy-match
 	    (goto-char (point-min))
 	    (while (re-search-forward s-multi-re nil t)