lem-project / lem

Common Lisp editor/IDE with high expansibility
http://lem-project.github.io/
MIT License
2.36k stars 172 forks source link

Do or can we have some info in the modeline (is it called modeline in lem ?) like so to show the encoding: #880

Open rpx99 opened 1 year ago

rpx99 commented 1 year ago
          Do or can we have some info in the modeline (is it called modeline in lem ?) like so to show the encoding:

Emacs: modeline_encoding With details: modeline_encoding_details

Notepad++: nppp_encoding

The line break format should be a useful information to display, too?

modeline_linebreak

Next step could be to be able to actually change the encoding, line break format?

nppp_encoding2

Originally posted by @rpx99 in https://github.com/lem-project/lem/issues/850#issuecomment-1647275515

vindarel commented 1 year ago

I can give a few hints.

Yes it is called modeline too.

There is the file src/modeline.lisp, defining:

This worked:

LEM> (modeline-add-status-list "-lol-")

Then I wondered how to find the encoding.

LEM> (apropos "encoding")

gave a lot of results, searching the ones with "lem" I got: buffer-encoding, and it seems to work:

LEM> (lem-base::buffer-encoding (find-file-buffer "lem.asd")) ;; if lem.asd is open
;; => <#LEM-ENCODINGS/UTF-8::UTF-8 {xyz}>

I press Enter on it and I see in the inspector that it has two slots: BOM and END-OF-LINE (value: :LF).

See src/base/unicode.lisp with the encoding base class, and lib/encodings/utf-8.lisp with (defclass utf-8 (encoding) …).

Ready for a PR? :D