summaryrefslogtreecommitdiff
path: root/lisp/org-macs.el
diff options
context:
space:
mode:
authorNicholas D Steeves <nsteeves@gmail.com>2017-07-03 20:44:19 -0400
committerNicholas D Steeves <nsteeves@gmail.com>2017-07-03 20:57:31 -0400
commit3458b4fdfffc1b4f542405325ffa8b6eed0eb1df (patch)
tree0c9ed6fcddc796bdb92d3fc5fd266fac3b583eda /lisp/org-macs.el
parent969f455bc143bb93c745b82db358392b123661e0 (diff)
New upstream version 9.0.9+dfsg
Diffstat (limited to 'lisp/org-macs.el')
-rw-r--r--lisp/org-macs.el12
1 files changed, 11 insertions, 1 deletions
diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index b7da6c6..ca47e5a 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -1,6 +1,6 @@
;;; org-macs.el --- Top-level Definitions for Org -*- lexical-binding: t; -*-
-;; Copyright (C) 2004-2016 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2017 Free Software Foundation, Inc.
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
@@ -294,6 +294,16 @@ removed."
(substring string (length pre) (- (length post)))
string))
+(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)
;;; org-macs.el ends here