8000 Cannot control face (and presence) of major mode name · Issue #41 · tarsius/minions · GitHub
[go: up one dir, main page]

Skip to content

Cannot control face (and presence) of major mode name #41

Closed

Description

@JesusTorrado

Hi @tarsius,

Thanks for the great package!

I am failing to change the face of the major mode name (mode-name) inserted inside the minions-mode-line-modes object. A propertize affecting minions-mode-line-modes does not do the job, since mode-line is already under a propertize, and they cannot be nested. So I end up with something similar to what was found in #32, but without using any mode-line modification package.

Would if be possible to add and expose a custom face for the major mode name, or, alternatively, an option to remove it from the minions-mode-line-modes so that its face can be changed separately? I may be able to write a PR for the 2nd case, though my elisp is not very good at all and it would need some review.

Activity

  1. tarsius commented on Mar 5, 2024

    @tarsius
    Owner

    Please post the code you have come up with so far.

    Would if be possible to add and expose a custom face for the major mode name

    That might be an option, but it might be best that would be done in Emacs. minions-mode-line-modes is a copy of mode-line-modes, which adds the delimiters and menu; but the major-mode part is the same in both formats (except we had some newlines to the help-text).

  2. JesusTorrado commented on Mar 6, 2024

    @JesusTorrado
    Author

    Thanks for the quick answer!

    Please post the code you have come up with so far.

    main...JesusTorrado:minions:major_mode_switch

    The 2nd blob takes care of the optional space between major mode name and the minor modes lighter,

    Would if be possible to add and expose a custom face for the major mode name

    That might be an option, but it might be best that would be done in Emacs. minions-mode-line-modes is a copy of mode-line-modes, which adds the delimiters and menu; but the major-mode part is the same in both formats (except we had some newlines to the help-text).

    It could, sure. But unless I am missing something (again, not an elisp expert) one would need to redefine all the properties, including the help-text in the new definition, just to change the face?

  3. tarsius commented on Mar 6, 2024

    @tarsius
    Owner

    Try this instead:

    (push 'warning (cddr (caddr minions-mode-line-modes)))
    (push 'face (cddr (caddr minions-mode-line-modes)))
  4. JesusTorrado commented on Mar 6, 2024

    @JesusTorrado
    Author

    Sorry, you got me there. Where should I try this?

  5. tarsius commented on Mar 6, 2024

    @tarsius
    Owner

    Add it to your init file, right after (require 'minions).

  6. JesusTorrado commented on Mar 6, 2024

    @JesusTorrado
    Author

    I see, sorry. Thanks!

    It does the job for the major mode name, but it does not apply to the extra text added by some modes, as shown below for the /l for lisp lexical binding:

    (defface mm
      '((default nil)
        (((class color)) :foreground "Blue" :background "DarkOrange2")
        )
      "desc")
    
    (require 'minions)
    (push 'mm (cddr (caddr minions-mode-line-modes)))
    (push 'face (cddr (caddr minions-mode-line-modes)))

    image

  7. tarsius commented on Mar 6, 2024

    @tarsius
    Owner

    it does not apply to the extra text added by some modes

    IMO that's acceptable. In the case of Elisp, the /d is supposed to stand out, to draw attention to the fact that it's not /l.

    But if you really must, you can do that without modifying minions.el:

    (setcar (cddr minions-mode-line-modes) your-modified-element)

    You probably have to use '(:eval (propertize ...)) instead of '(:propertize ...) to override existing faces.

  8. JesusTorrado commented on Mar 6, 2024

    @JesusTorrado
    Author

    Thanks!

    At the end of the day, passing nil as your-modified-element in your suggestion basically does the same as the change I was proposing (minus conditionally removing the space between major and minor, which can also be achieved without modification).

    I guess this is a non-issue, if you prefer to leave minions as-is. I have learned quite a bit from this conversation. Thanks a lot for your time!

  9. tarsius commented on Mar 6, 2024

    @tarsius
    Owner

    You're welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0