Skip to content

Truncate multi-line messages less aggressively #990

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 13, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions haskell-interactive-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,15 @@ SESSION, otherwise operate on the current buffer.

(defun haskell-mode-message-line (str)
"Message only one line, multiple lines just disturbs the programmer."
(let ((lines (split-string str "\n" t)))
(when (and (car lines) (stringp (car lines)))
(message "%s"
(concat (car lines)
(if (and (cdr lines) (stringp (cadr lines)))
(format " [ %s .. ]" (haskell-string-take (haskell-string-trim (cadr lines)) 10))
""))))))
(message (haskell-mode-one-line str (frame-width))))

(defun haskell-mode-one-line (str width)
"Try to fit as much as possible on one line."
(let*
((long-line (replace-regexp-in-string "\n" " " str))
(condensed (replace-regexp-in-string " +" " "
(haskell-string-trim long-line))))
(truncate-string-to-width condensed width nil nil "…")))

(defun haskell-interactive-mode-tab ()
"Do completion if at prompt or else try collapse/expand."
Expand Down