1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2025-01-30 20:41:41 +00:00

Move `org-completing-read' into "org-macs.el"

* lisp/org-macs.el (org-completing-read): Moved here...
* lisp/org.el: ... from there.
This commit is contained in:
Nicolas Goaziou 2017-10-17 10:11:21 +02:00
parent 45a1918efe
commit 7ac8883394
2 changed files with 25 additions and 20 deletions

View File

@ -167,6 +167,31 @@ point nowhere."
`(load ,file 'noerror nil nil 'mustsuffix))
;;; Input
(defun org-read-function (prompt &optional allow-empty?)
"Prompt for a function.
If ALLOW-EMPTY? is non-nil, return nil rather than raising an
error when the user input is empty."
(let ((func (completing-read prompt obarray #'fboundp t)))
(cond ((not (string= func ""))
(intern func))
(allow-empty? nil)
(t (user-error "Empty input is not valid")))))
(defun org-completing-read (&rest args)
"Completing-read with SPACE being a normal character."
(let ((enable-recursive-minibuffers t)
(minibuffer-local-completion-map
(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 #'completing-read args)))
;;; Logic
@ -469,16 +494,6 @@ The number of levels is controlled by `org-inlinetask-min-level'"
limit-level)))
(format "\\*\\{1,%d\\} " nstars)))))
(defun org-read-function (prompt &optional allow-empty?)
"Prompt for a function.
If ALLOW-EMPTY? is non-nil, return nil rather than raising an
error when the user input is empty."
(let ((func (completing-read prompt obarray #'fboundp t)))
(cond ((not (string= func ""))
(intern func))
(allow-empty? nil)
(t (user-error "Empty input is not valid")))))
(provide 'org-macs)

View File

@ -10322,16 +10322,6 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
(match-string 1 (expand-file-name file))))
(t (concat "file:" file)))))
(defun org-completing-read (&rest args)
"Completing-read with SPACE being a normal character."
(let ((enable-recursive-minibuffers t)
(minibuffer-local-completion-map
(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 #'completing-read args)))
;;; Opening/following a link