(setq cl-complete nil)
(libreadline::clear-completions))
- (defun use-custom-complete ()
- "Use custom-competions."
- (libreadline::use-custom-complete)
- nil)
-
- (defun use-filename-complete ()
- "Use default completion system. (filename)"
- (libreadline::use-filename-complete)
- nil)
-
(defun use-cl-complete ()
"Load symbols in package CL-USER as custom-completions."
(unless cl-complete
(do-symbols (sym (find-package :cl-user))
(add-completion (string-downcase (string sym)))))
(use-custom-complete)
- nil)
+ nil))
+
+;;; Everything that affects the custom-completion collection goes
+;;; above.
+
+(defun use-custom-complete ()
+ "Use custom-competions."
+ (libreadline::use-custom-complete)
+ nil)
+
+(defun use-filename-complete ()
+ "Use default completion system. (filename)"
+ (libreadline::use-filename-complete)
+ nil)
- (defun add-history (string)
- "Add STRING to history."
- (with-cstring (c-string string)
- (libreadline::add-history c-string))
- string)
+(defun add-history (string)
+ "Add STRING to history."
+ (with-cstring (c-string string)
+ (libreadline::add-history c-string))
+ string)
- (defun readline (&key (prompt "") (history t))
- "Read a line from current TTY with line-editing."
- (with-cstring (c-prompt prompt)
- (let ((str (string-trim
- *whitespace*
- (convert-from-cstring (libreadline::readline c-prompt)))))
- (when (and history (not (string= "" str)))
- (add-history str))))))
+(defun readline (&key (prompt "") (history t))
+ "Read a line from current TTY with line-editing."
+ (with-cstring (c-prompt prompt)
+ (let* ((char* (libreadline::readline c-prompt))
+ (str (string-trim *whitespace*
+ (convert-from-foreign-string char*))))
+ (free-foreign-object char*)
+ (when (and history (not (string= "" str)))
+ (add-history str))
+ str)))