Browse Source

Obsolete `org-icompleting-read' and `org-completing-read-no-i'

* lisp/org.el (org-icompleting-read, org-completing-read-no-i): Obsolete
  aliases for `completing-read'
(org-iswitchb-completing-read): Remove function.
(org-sort-entries):
(org-refile-get-location):
(org-todo):
(org-deadline):
(org-occur-parameters):
(org-change-tag-in-region):
(org-fast-tag-selection):
(org-delete-property-globally):
(org-compute-property-at-point):
(org-buffer-list): Use genuine function.

* contrib/lisp/org-colview-xemacs.el (org-columns-edit-value):
(org-columns-new):
(org-insert-columns-dblock):
* contrib/lisp/org-index.el (org-index):
* contrib/lisp/ox-bibtex.el (org-bibtex-goto-citation):
* lisp/ob-core.el (org-babel-insert-header-arg):
(org-babel-goto-named-src-block):
(org-babel-goto-named-result):
(org-babel-demarcate-block):
* lisp/org-agenda.el (org-todo-list):
(org-agenda-filter-by-tag):
(org-agenda-bulk-action):
* lisp/org-attach.el (org-attach-delete-one):
(org-attach-open):
* lisp/org-bibtex.el (org-bibtex-fleshout):
(org-bibtex-create):
* lisp/org-capture.el (org-capture-fill-template):
* lisp/org-colview.el (org-columns-edit-value):
(org-columns-new):
(org-insert-columns-dblock):
* lisp/org-footnote.el (org-footnote-new):
* lisp/org-list.el (org-sort-list):
* lisp/ox-publish.el (org-publish):
* lisp/ox.el (org-export-dispatch): Use genuine function.
Nicolas Goaziou 9 years ago
parent
commit
fdbf441560

+ 6 - 6
contrib/lisp/org-colview-xemacs.el

@@ -602,7 +602,7 @@ Where possible, use the standard interface for changing this line."
      (t
       (setq allowed (org-property-get-allowed-values pom key 'table))
       (if allowed
-	  (setq nval (org-icompleting-read
+	  (setq nval (completing-read
 		      "Value: " allowed nil
 		      (not (get-text-property 0 'org-unrestricted
 					      (caar allowed)))))
@@ -910,7 +910,7 @@ interactive function `org-columns-new'.
 				       org-columns-current-fmt-compiled
 				       t)))
 	cell)
-    (setq prop (org-icompleting-read
+    (setq prop (completing-read
 		"Property: " (mapcar 'list (org-buffer-property-keys t nil t))
 		nil nil prop))
     (setq title (read-string (concat "Column title [" prop "]: ") (or title prop)))
@@ -918,9 +918,9 @@ interactive function `org-columns-new'.
     (if (string-match "\\S-" width)
 	(setq width (string-to-number width))
       (setq width nil))
-    (setq fmt (org-icompleting-read "Summary [none]: "
-				    (mapcar (lambda (x) (list (symbol-name (cadr x)))) org-columns-compile-map)
-				    nil t))
+    (setq fmt (completing-read "Summary [none]: "
+			       (mapcar (lambda (x) (list (symbol-name (cadr x)))) org-columns-compile-map)
+			       nil t))
     (setq fmt (intern fmt)
 	  fun (cdr (assoc fmt (mapcar 'cdr org-columns-compile-map))))
     (if (eq fmt 'none) (setq fmt nil))
@@ -1486,7 +1486,7 @@ and tailing newline characters."
   (interactive)
   (when (featurep 'xemacs) (org-columns-quit))
   (let ((defaults '(:name "columnview" :hlines 1))
-	(id (org-icompleting-read
+	(id (completing-read
 	     "Capture columns (local, global, entry with :ID: property) [local]: "
 	     (append '(("global") ("local"))
 		     (mapcar 'list (org-property-values "ID"))))))

+ 1 - 3
contrib/lisp/ox-bibtex.el

@@ -159,9 +159,7 @@ to `org-bibtex-citation-p' predicate."
 (defun org-bibtex-goto-citation (&optional citation)
   "Visit a citation given its ID."
   (interactive)
-  (let ((citation (or citation
-		      (org-icompleting-read "Citation: "
-					    (obe-citations)))))
+  (let ((citation (or citation (completing-read "Citation: " (obe-citations)))))
     (find-file (or org-bibtex-file
 		   (error "`org-bibtex-file' has not been configured")))
     (goto-char (point-min))

+ 6 - 7
lisp/ob-core.el

@@ -47,7 +47,6 @@
 (declare-function tramp-file-name-user "tramp" (vec))
 (declare-function tramp-file-name-host "tramp" (vec))
 (declare-function with-parsed-tramp-file-name "tramp" (filename var &rest body))
-(declare-function org-icompleting-read "org" (&rest args))
 (declare-function org-edit-src-code "org-src" (&optional code edit-buffer-name))
 (declare-function org-edit-src-exit "org-src"  ())
 (declare-function org-open-at-point "org" (&optional in-emacs reference-buffer))
@@ -850,7 +849,7 @@ arguments and pop open the results in a preview buffer."
 		   org-babel-common-header-args-w-values
 		   (when (boundp lang-headers) (eval lang-headers))))
 	 (header-arg (or header-arg
-			 (org-icompleting-read
+			 (completing-read
 			  "Header Arg: "
 			  (mapcar
 			   (lambda (header-spec) (symbol-name (car header-spec)))
@@ -863,7 +862,7 @@ arguments and pop open the results in a preview buffer."
 		     ((listp vals)
 		      (mapconcat
 		       (lambda (group)
-			 (let ((arg (org-icompleting-read
+			 (let ((arg (completing-read
 				     "Value: "
 				     (cons "default"
 					   (mapcar #'symbol-name group)))))
@@ -1729,7 +1728,7 @@ If the point is not on a source block then return nil."
    (let ((completion-ignore-case t)
 	 (case-fold-search t)
 	 (under-point (thing-at-point 'line)))
-     (list (org-icompleting-read
+     (list (completing-read
 	    "source-block name: " (org-babel-src-block-names) nil t
 	    (cond
 	     ;; noweb
@@ -1784,8 +1783,8 @@ to `org-babel-named-src-block-regexp'."
   "Go to a named result."
   (interactive
    (let ((completion-ignore-case t))
-     (list (org-icompleting-read "source-block name: "
-				 (org-babel-result-names) nil t))))
+     (list (completing-read "Source-block name: "
+			    (org-babel-result-names) nil t))))
   (let ((point (org-babel-find-named-result name)))
     (if point
         ;; taken from `org-open-at-point'
@@ -1888,7 +1887,7 @@ region is not active then the point is demarcated."
 	   (move-end-of-line 2))
          (sort (if (org-region-active-p) (list (mark) (point)) (list (point))) #'>))
       (let ((start (point))
-	    (lang (org-icompleting-read
+	    (lang (completing-read
 		   "Lang: "
 		   (mapcar #'symbol-name
 			   (delete-dups

+ 8 - 8
lisp/org-agenda.el

@@ -4744,8 +4744,8 @@ for a keyword.  A numeric prefix directly selects the Nth keyword in
 	 rtn rtnall files file pos)
     (when (equal arg '(4))
       (setq org-select-this-todo-keyword
-	    (org-icompleting-read "Keyword (or KWD1|K2D2|...): "
-				  (mapcar 'list kwds) nil nil)))
+	    (completing-read "Keyword (or KWD1|K2D2|...): "
+			     (mapcar #'list kwds) nil nil)))
     (and (equal 0 arg) (setq org-select-this-todo-keyword nil))
     (catch 'exit
       (if org-agenda-sticky
@@ -7532,7 +7532,7 @@ to switch between filtering and excluding."
 	(setq-local org-global-tags-completion-table
 		    (org-global-tags-completion-table)))
       (let ((completion-ignore-case t))
-	(setq tag (org-icompleting-read
+	(setq tag (completing-read
 		   "Tag: " org-global-tags-completion-table))))
     (cond
      ((eq char ?\r)
@@ -9904,16 +9904,16 @@ The prefix arg is passed through to the command if possible."
 		redo-at-end t))
 
 	 ((equal action ?t)
-	  (setq state (org-icompleting-read
+	  (setq state (completing-read
 		       "Todo state: "
 		       (with-current-buffer (marker-buffer (car entries))
-			 (mapcar 'list org-todo-keywords-1))))
+			 (mapcar #'list org-todo-keywords-1))))
 	  (setq cmd `(let ((org-inhibit-blocking t)
 			   (org-inhibit-logging 'note))
 		       (org-agenda-todo ,state))))
 
 	 ((memq action '(?- ?+))
-	  (setq tag (org-icompleting-read
+	  (setq tag (completing-read
 		     (format "Tag to %s: " (if (eq action ?+) "add" "remove"))
 		     (with-current-buffer (marker-buffer (car entries))
 		       (delq nil
@@ -9968,8 +9968,8 @@ The prefix arg is passed through to the command if possible."
 
 	 ((equal action ?f)
 	  (setq cmd (list (intern
-			   (org-icompleting-read "Function: "
-						 obarray 'fboundp t nil nil)))))
+			   (completing-read "Function: "
+					    obarray 'fboundp t nil nil)))))
 
 	 (t (user-error "Invalid bulk action")))
 

+ 3 - 3
lisp/org-attach.el

@@ -388,7 +388,7 @@ The attachment is created as an Emacs buffer."
   (let* ((attach-dir (org-attach-dir t))
 	 (files (org-attach-file-list attach-dir))
 	 (file (or file
-		   (org-icompleting-read
+		   (completing-read
 		    "Delete attachment: "
 		    (mapcar (lambda (f)
 			      (list (file-name-nondirectory f)))
@@ -464,8 +464,8 @@ If IN-EMACS is non-nil, force opening in Emacs."
 	 (files (org-attach-file-list attach-dir))
 	 (file (if (= (length files) 1)
 		   (car files)
-		 (org-icompleting-read "Open attachment: "
-				       (mapcar 'list files) nil t))))
+		 (completing-read "Open attachment: "
+				  (mapcar #'list files) nil t))))
     (org-open-file (expand-file-name file attach-dir) in-emacs)))
 
 (defun org-attach-open-in-emacs ()

+ 2 - 2
lisp/org-bibtex.el

@@ -441,7 +441,7 @@ With optional argument OPTIONAL, also prompt for optional fields."
 				(lambda (f) (when (org-bibtex-get (funcall name f)) f))
 				field)))))
           (setf field (or present (funcall keyword
-					   (org-icompleting-read
+					   (completing-read
 					    "Field: " (mapcar name field)))))))
       (let ((name (funcall name field)))
         (unless (org-bibtex-get name)
@@ -592,7 +592,7 @@ With prefix argument OPTIONAL also prompt for optional fields."
 With a prefix arg, query for optional fields as well.
 If nonew is t, add data to the headline of the entry at point."
   (interactive "P")
-  (let* ((type (org-icompleting-read
+  (let* ((type (completing-read
 		"Type: " (mapcar (lambda (type)
 				   (substring (symbol-name (car type)) 1))
 				 org-bibtex-types)

+ 1 - 1
lisp/org-capture.el

@@ -1760,7 +1760,7 @@ The template may still contain \"%?\" for cursor positioning."
 			(member key '("u" "U"))
 			nil nil (list org-end-time-was-given))))
 		    (_
-		     (push (org-completing-read-no-i
+		     (push (completing-read
 			    (concat (or prompt "Enter string")
 				    (and default (format " [%s]" default))
 				    ": ")

+ 6 - 6
lisp/org-colview.el

@@ -459,7 +459,7 @@ Where possible, use the standard interface for changing this line."
      (t
       (setq allowed (org-property-get-allowed-values pom key 'table))
       (if allowed
-	  (setq nval (org-icompleting-read
+	  (setq nval (completing-read
 		      "Value: " allowed nil
 		      (not (get-text-property 0 'org-unrestricted
 					      (caar allowed)))))
@@ -777,15 +777,15 @@ calc        function called on every element before summarizing.  This is
   (let ((editp (and prop
 		    (assoc-string prop org-columns-current-fmt-compiled t)))
 	cell)
-    (setq prop (org-icompleting-read
-		"Property: " (mapcar 'list (org-buffer-property-keys t nil t))
+    (setq prop (completing-read
+		"Property: " (mapcar #'list (org-buffer-property-keys t nil t))
 		nil nil prop))
     (setq title (read-string (concat "Column title [" prop "]: ") (or title prop)))
     (setq width (read-string "Column width: " (if width (number-to-string width))))
     (if (string-match "\\S-" width)
 	(setq width (string-to-number width))
       (setq width nil))
-    (setq fmt (org-icompleting-read
+    (setq fmt (completing-read
 	       "Summary [none]: "
 	       (mapcar (lambda (x) (list (symbol-name (cadr x))))
 		       org-columns-compile-map)
@@ -1340,10 +1340,10 @@ and tailing newline characters."
   "Create a dynamic block capturing a column view table."
   (interactive)
   (let ((defaults '(:name "columnview" :hlines 1))
-	(id (org-icompleting-read
+	(id (completing-read
 	     "Capture columns (local, global, entry with :ID: property) [local]: "
 	     (append '(("global") ("local"))
-		     (mapcar 'list (org-property-values "ID"))))))
+		     (mapcar #'list (org-property-values "ID"))))))
     (if (equal id "") (setq id 'local))
     (if (equal id "global") (setq id 'global))
     (setq defaults (append defaults (list :id id)))

+ 2 - 3
lisp/org-list.el

@@ -131,7 +131,6 @@
 		  (backend data &optional contents info))
 (declare-function org-fix-tags-on-the-fly "org" ())
 (declare-function org-get-indentation "org" (&optional line))
-(declare-function org-icompleting-read "org" (&rest args))
 (declare-function org-in-block-p "org" (names))
 (declare-function org-in-regexp "org" (re &optional nlines visually))
 (declare-function org-inlinetask-goto-beginning "org-inlinetask" ())
@@ -2869,8 +2868,8 @@ ignores hidden links."
 	 (getkey-func
 	  (or getkey-func
 	      (and (= (downcase sorting-type) ?f)
-		   (intern (org-icompleting-read "Sort using function: "
-						 obarray 'fboundp t nil nil))))))
+		   (intern (completing-read "Sort using function: "
+					    obarray 'fboundp t nil nil))))))
     (message "Sorting items...")
     (save-restriction
       (narrow-to-region start end)

+ 33 - 63
lisp/org.el

@@ -8946,16 +8946,16 @@ When sorting is done, call `org-after-sorting-entries-or-items-hook'."
       (unless getkey-func
 	(and (= (downcase sorting-type) ?f)
 	     (setq getkey-func
-		   (org-icompleting-read "Sort using function: "
-					 obarray 'fboundp t nil nil))
+		   (completing-read "Sort using function: "
+				    obarray 'fboundp t nil nil))
 	     (setq getkey-func (intern getkey-func))))
 
       (and (= (downcase sorting-type) ?r)
 	   (not property)
            (setq property
-                 (org-icompleting-read "Property: "
-				       (mapcar 'list (org-buffer-property-keys t))
-				       nil t))))
+                 (completing-read "Property: "
+				  (mapcar #'list (org-buffer-property-keys t))
+				  nil t))))
 
     (when (member sorting-type '(?k ?K)) (org-clock-sum))
     (message "Sorting entries...")
@@ -10462,42 +10462,14 @@ See `read-file-name' for a description of parameters."
 	 (copy-keymap minibuffer-local-completion-map)))
     (org-defkey minibuffer-local-completion-map " " 'self-insert-command)
     (org-defkey minibuffer-local-completion-map "?" 'self-insert-command)
-    (org-defkey minibuffer-local-completion-map (kbd "C-c !") 'org-time-stamp-inactive)
-    (apply 'org-icompleting-read args)))
-
-(defun org-completing-read-no-i (&rest args)
-  (let (org-completion-use-ido org-completion-use-iswitchb)
-    (apply 'org-completing-read args)))
-
-(defun org-iswitchb-completing-read (prompt choices &rest args)
-  "Use iswitch as a completing-read replacement to choose from choices.
-PROMPT is a string to prompt with.  CHOICES is a list of strings to choose
-from."
-  (let* ((iswitchb-use-virtual-buffers nil)
-	 (iswitchb-make-buflist-hook
-	  (lambda ()
-	    (setq iswitchb-temp-buflist choices))))
-    (iswitchb-read-buffer prompt)))
-
-(defun org-icompleting-read (&rest args)
-  "Completing-read using `ido-mode' or `iswitchb' speedups if available.
-Should be called like `completing-read'."
-  (org-without-partial-completion
-   (if (not (listp (nth 1 args)))
-       ;; Ido only supports lists as the COLLECTION argument.  Use
-       ;; default completion function when second argument is not
-       ;; a list.
-       (apply #'completing-read args)
-     (let ((ido-enter-matching-directory nil))
-       (apply (cond ((and org-completion-use-ido
-			  (fboundp 'ido-completing-read)
-			  (org-bound-and-true-p ido-mode))
-		     #'ido-completing-read)
-		    ((and org-completion-use-iswitchb
-			  (org-bound-and-true-p iswitchb-mode))
-		     #'org-iswitchb-completing-read)
-		    (t #'completing-read))
-	      args)))))
+    (org-defkey minibuffer-local-completion-map (kbd "C-c !")
+		'org-time-stamp-inactive)
+    (apply #'completing-read args)))
+
+(define-obsolete-function-alias
+  'org-completing-read-no-i 'completing-read "Org 9.0")
+(define-obsolete-function-alias
+  'org-icompleting-read 'completing-read "Org 9.0")
 
 ;;; Opening/following a link
 
@@ -12008,12 +11980,11 @@ this is used for the GOTO interface."
   (unless org-refile-target-table
     (user-error "No refile targets"))
   (let* ((cbuf (current-buffer))
-	 (partial-completion-mode nil)
 	 (cfn (buffer-file-name (buffer-base-buffer cbuf)))
 	 (cfunc (if (and org-refile-use-outline-path
 			 org-outline-path-complete-in-steps)
-		    'org-olpath-completing-read
-		  'org-icompleting-read))
+		    #'org-olpath-completing-read
+		  #'completing-read))
 	 (extra (if org-refile-use-outline-path "/" ""))
 	 (cbnex (concat (buffer-name) extra))
 	 (filename (and cfn (expand-file-name cfn)))
@@ -12115,10 +12086,8 @@ this is used for the GOTO interface."
 
 (defun org-olpath-completing-read (prompt collection &rest args)
   "Read an outline path like a file name."
-  (let ((thetable collection)
-	(org-completion-use-ido nil)	   ; does not work with ido.
-	(org-completion-use-iswitchb nil)) ; or iswitchb
-    (apply #'org-icompleting-read
+  (let ((thetable collection))
+    (apply #'completing-read
 	   prompt
 	   (lambda (string predicate &optional flag)
 	     (cond
@@ -12541,8 +12510,8 @@ When called through ELisp, arg is also interpreted in the following way:
 				   (or (not org-use-fast-todo-selection)
 				       (not org-todo-key-trigger)))
 			      ;; Read a state with completion
-			      (org-icompleting-read
-			       "State: " (mapcar 'list org-todo-keywords-1)
+			      (completing-read
+			       "State: " (mapcar #'list org-todo-keywords-1)
 			       nil t))
 			     ((eq arg 'right)
 			      (if this
@@ -13262,8 +13231,9 @@ of `org-todo-keywords-1'."
 	(kwd-re
 	 (cond ((null arg) org-not-done-regexp)
 	       ((equal arg '(4))
-		(let ((kwd (org-icompleting-read "Keyword (or KWD1|KWD2|...): "
-						 (mapcar 'list org-todo-keywords-1))))
+		(let ((kwd
+		       (completing-read "Keyword (or KWD1|KWD2|...): "
+					(mapcar #'list org-todo-keywords-1))))
 		  (concat "\\("
 			  (mapconcat 'identity (org-split-string kwd "|") "\\|")
 			  "\\)\\>")))
@@ -13849,10 +13819,10 @@ D      Show deadlines and scheduled items between a date range."
       (?T (org-show-todo-tree '(4)))
       (?m (call-interactively 'org-match-sparse-tree))
       ((?p ?P)
-       (let* ((kwd (org-icompleting-read
-		    "Property: " (mapcar 'list (org-buffer-property-keys))))
-	      (value (org-icompleting-read
-		      "Value: " (mapcar 'list (org-property-values kwd)))))
+       (let* ((kwd (completing-read
+		    "Property: " (mapcar #'list (org-buffer-property-keys))))
+	      (value (completing-read
+		      "Value: " (mapcar #'list (org-property-values kwd)))))
 	 (unless (string-match "\\`{.*}\\'" value)
 	   (setq value (concat "\"" value "\"")))
 	 (org-match-sparse-tree arg (concat kwd "=" value))))
@@ -15054,7 +15024,7 @@ This works in the agenda, and also in an org-mode buffer."
 		     (delq nil (append (org-get-buffer-tags)
 				       (org-global-tags-completion-table))))
 		  (org-global-tags-completion-table))))
-	   (org-icompleting-read
+	   (completing-read
 	    "Tag: " 'org-tags-completion-function nil nil nil
 	    'org-tags-history))
 	 (progn
@@ -15286,7 +15256,7 @@ Returns the new tags string, or nil to not change the current settings."
 		  (when exit-after-next (setq exit-after-next 'now)))
 		 ((= c ?\t)
 		  (condition-case nil
-		      (setq tg (org-icompleting-read
+		      (setq tg (completing-read
 				"Tag: "
 				(or buffer-tags
 				    (with-current-buffer buf
@@ -16400,7 +16370,7 @@ part of the buffer."
 	  (props (if cat props0
 		   (delete `("CATEGORY" . ,(org-get-category)) props0)))
 	  (prop (if (< 1 (length props))
-		    (org-icompleting-read "Property: " props nil t)
+		    (completing-read "Property: " props nil t)
 		  (caar props))))
      (list prop)))
   (if (not property)
@@ -16413,7 +16383,7 @@ part of the buffer."
 This function ignores narrowing, if any."
   (interactive
    (let* ((completion-ignore-case t)
-	  (prop (org-icompleting-read
+	  (prop (completing-read
 		 "Globally remove property: "
 		 (mapcar #'list (org-buffer-property-keys)))))
      (list prop)))
@@ -18448,9 +18418,9 @@ Set `org-completion-use-ido' to make it use ido instead."
     (unless (or org-completion-use-ido org-completion-use-iswitchb)
       (setq org-completion-use-iswitchb t))
     (org-pop-to-buffer-same-window
-     (org-icompleting-read "Org buffer: "
-			   (mapcar 'list (mapcar 'buffer-name blist))
-			   nil t))))
+     (completing-read "Org buffer: "
+		      (mapcar #'list (mapcar #'buffer-name blist))
+		      nil t))))
 
 ;;; Define some older names previously used for this functionality
 ;;;###autoload

+ 2 - 2
lisp/ox-publish.el

@@ -864,8 +864,8 @@ When optional argument FORCE is non-nil, force publishing all
 files in PROJECT.  With a non-nil optional argument ASYNC,
 publishing will be done asynchronously, in another process."
   (interactive
-   (list (assoc (org-icompleting-read "Publish project: "
-				      org-publish-project-alist nil t)
+   (list (assoc (completing-read "Publish project: "
+				 org-publish-project-alist nil t)
 		org-publish-project-alist)
 	 current-prefix-arg))
   (let ((project (if (not (stringp project)) project

+ 1 - 1
lisp/ox.el

@@ -6198,7 +6198,7 @@ When ARG is \\[universal-argument] \\[universal-argument], display the asynchron
       (publish-current-project
        (org-publish-current-project (memq 'force optns) (memq 'async optns)))
       (publish-choose-project
-       (org-publish (assoc (org-icompleting-read
+       (org-publish (assoc (completing-read
 			    "Publish project: "
 			    org-publish-project-alist nil t)
 			   org-publish-project-alist)