joaotavora / sly

Sylvester the Cat's Common Lisp IDE
1.24k stars 140 forks source link

Customizable prompt fixes #490

Open Ambrevar opened 2 years ago

Ambrevar commented 2 years ago

This rebases #365 onto master.

It includes the last 2 fixes:

Indeed, in https://github.com/joaotavora/sly/issues/360#issuecomment-773473236 I mentioned that coloring was broken. Here is the custom prompt I'm using which displays how coloring is broken on master and fixed with this patch:

(cl-defun ambrevar/sly-new-prompt (_package
                                package-nickname
                                error-level
                                entry-idx
                                _condition)
  (concat
   "("
   (propertize (abbreviate-file-name default-directory) 'font-lock-face 'diff-added)
   ")\n"
   (propertize "<" 'font-lock-face 'sly-mrepl-prompt-face)
   (propertize (number-to-string entry-idx) 'font-lock-face 'sly-mode-line)
   (propertize ":" 'font-lock-face 'sly-mrepl-prompt-face)
   (propertize package-nickname 'font-lock-face 'sly-mode-line)
   (when (cl-plusp error-level)
     (concat (sly-make-action-button
              (format "[%d]" error-level)
              #'sly-db-pop-to-debugger-maybe)
             " "))
   (propertize "> " 'font-lock-face 'sly-mrepl-prompt-face)))