[Ecls-list] readline

Carlo Capocasa capocasa at gmx.net
Thu Sep 20 08:16:25 UTC 2007

> Is there a way to add GNU readline support to the Ecls interpreter?

rlwrap is a pretty nice alternative.

When you've got it built or a package installed, you can add the
following to your .bashrc:

  alias sbcl="rlwrap -b \$BREAK_CHARS sbcl"

and then create a file ~/.ecl_completions with the following content:

(with-open-file (!!!-stream "~/.ecl_completions"
                                :direction :output
                                :if-exists :supersede)
  (let ((!!!-seen (make-hash-table :size 6000 :test #'equal))
    (!!!-cl-package (find-package "CL"))
    (!!!-cl-user-package (find-package "CL-USER")))
    (loop for !!!-package in (list-all-packages)
      do (let ((!!!-prefixes
        (if (or (eq !!!-package !!!-cl-package)
          (eq !!!-package !!!-cl-user-package))
            (list "")
            (mapcar #'(lambda (!!!-prefix)
              (concatenate 'string
                (string-downcase !!!-prefix)
              (if (package-nicknames !!!-package)
                (package-nicknames !!!-package)
                (list (package-name !!!-package)))))))
  (loop for !!!-symbol being the symbols of !!!-package
    for !!!-symbol-name = (symbol-name !!!-symbol)
    when (or (eq (nth-value 1
    (find-symbol !!!-symbol-name
    (eq !!!-package !!!-cl-user-package))
      do (loop for !!!-prefix in !!!-prefixes
          do (let ((!!!-completion
            (format nil
                    (string-downcase !!!-symbol))))
  (unless (or (gethash !!!-completion !!!-seen)
    (string= "!!!-"
      :end2 (min
      (length !!!-symbol-name)
      (setf (gethash !!!-completion !!!-seen)
      (princ !!!-completion !!!-stream)))))))))


More information about the ecl-devel mailing list