dbordak / telephone-line

A new implementation of Powerline for Emacs
GNU General Public License v3.0
550 stars 51 forks source link

Don't work on *message* buffer #49

Closed Iorest closed 6 years ago

Iorest commented 6 years ago

Telephone-line don't work on message buffer.What should I do?

dbordak commented 6 years ago

It's because the message buffer is loaded before telephone-line is, so it's not enabled on it. I think you can close the message buffer, and on reopening it it'll be enabled, not sure...

Iorest commented 6 years ago

Thank you,I'll try it.

ogdenwebb commented 6 years ago

At first, thanks to @dbordak for the suggestion about reopening the message buffer. It works, at least on my machine.

Probably the most simplest workaround is the following:

(add-hook 'after-init-hook (lambda () (kill-buffer "*Messages*")))

But you will lose almost all the messages after startup, so you can't read Emacs log, errors, etc.

I'd a similar question in the near past and now I find the workaround after reading your issue:

  (defun recreate-message-buffer ()
    (cl-flet ((buffer-string* (buffer)
                (with-current-buffer buffer
                  (buffer-string))))
      (let ((msg (buffer-string* "*Messages*")))
        (kill-buffer "*Messages*")
        (message msg))))

  (add-hook 'after-init-hook #'recreate-message-buffer)

Note if you didn't load cl library in Emacs config, you need to past (require 'cl-lib) before this code.

Please let me now if it doesn't work for you.

dbordak commented 6 years ago

You're using the namespaced functions, so that'd be cl-lib rather than cl

ogdenwebb commented 6 years ago

@dbordak I've read commentary in both of the libraries, Yes, you're completely right. I'm just starting to learn Emacs libraries at this moment so didn't know about that.

I correct the post above.

Iorest commented 6 years ago

@ogdenwebb It solved my problem perfectly.

dbordak commented 6 years ago

I guess I should probably have this solved in the package, but I don't want to go adding this kind of hook to everyone's init. Hm