lem icon indicating copy to clipboard operation
lem copied to clipboard

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

Open rpx99 opened this issue 2 years ago • 1 comments

          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

rpx99 avatar Jul 25 '23 14:07 rpx99

I can give a few hints.

Yes it is called modeline too.

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

  • the list of everything to display: *modeline-status-list* it can be any element that is print-able, or a function
  • some attributes to style the elements
  • a function to add a custom element to it: modeline-add-status-list.

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

vindarel avatar Jul 25 '23 21:07 vindarel