milkypostman / powerline

emacs powerline

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Glyphs not working in GUI

JesusMtnez opened this issue · comments

Emacs display glyphs if I use it in a terminal. But if a use it with GUI, no glyphs are display.
I use Emacs 24.5.1 in OSX (emacs-mac version)

Terminal:
screen shot 2015-09-09 at 23 48 38

GUI:
screen shot 2015-09-09 at 23 48 44

Comparison:
screen shot 2015-09-09 at 23 48 28

Any help?
Thank you!!

Powerline doesn't do anything with glyphs. I don't know where that's coming from in your terminal.

I was able to locate the version-control glyph in the code. It is render here:

(defpowerline powerline-vc
  (when (and (buffer-file-name (current-buffer)) vc-mode)
    (if window-system
    (format-mode-line '(vc-mode vc-mode))
      (let ((backend (vc-backend (buffer-file-name (current-buffer)))))
    (when backend
      (format " %s %s"
          (char-to-string #xe0a0)
          (vc-working-revision (buffer-file-name (current-buffer)) backend)))))))

In the line: (char-to-string #xe0a0)

Is there a way to enable glyphs?

Oh, sorry. Uh, man, I don't know who committed this. But I do happen to remember it now. You could modify this code somehow to support the glyphs in GUI mode. If you wanted to submit it into the main repo you'd need to figure out a way to make this configurable.

OK. I'll try to work on it and improve my little elisp knowledge. 👍

Thanks!
On Thu, Sep 10, 2015 at 03:18 Jesús Martínez notifications@github.com
wrote:

OK. I'll try to work on it and improve my little elisp knowledge. [image:
👍]


Reply to this email directly or view it on GitHub
#100 (comment)
.

Does the mode-line face font used by the GUI have the expected glyph at #xe0a0 ?

use M-x describe-face to check mode-line

jason, I think that I accepted a PR in the past that did VC different on
the command line

On Thu, Sep 10, 2015 at 8:54 PM JasonM23 notifications@github.com wrote:

use M-x describe-face to check mode-line


Reply to this email directly or view it on GitHub
#100 (comment)
.

Makes sense. The glyphs should be made into pix maps so there's no reliance on fonts.

They could just be done as PNG renders

@jasonm23 I have a Powerline patched font set as my GUI font. (You can check my init file).

As @milkypostman, VC displays different in terminal. The glyph is only displayed in Terminal.

I've been looking for the position glyph in the code. It is hardcoded just in the default theme, as you can see in the code:

...
(rhs (list ...
        (unless window-system
          (powerline-raw (char-to-string #xe0a1) face1 'l))

Source: https://github.com/milkypostman/powerline/blob/master/powerline-themes.el#L72-L73

As we can see, in both cases they are display only if window-system (which is deprecated) is nil.

So, I was thinking of using these fonts to solve the problem. Another solution can be a specific theme that uses glyphs. But I was think about a property in the package that enable or disable the glyphs.

Although this solutions, I will try to take a look at the PNG renders solution.

It would be detrimental if the user is forced to install a specific font. PNG is available so it should be used.

Is there any way to achieve this by now?

@VdeVatman absolutely, someone will need to code it though.

@jasonm23 Using your tips (from #103), I'm working on a new solution using XPM images for diplay mode. I'm converting some PNG to XPM, editing then myself and making XPM colors customizable.

All suggestions are welcome 😉

Let me know if you need any help

I'm very new to emacs (still haven't used it for a week), and I'm doing the change from vim where I had powerline, and it was quite useful to see the glyph to know which branch was I editting. Could someone point me in the right direction to achieve this? I would appreciate it, since I'm kind of lost.

@VdeVatman in #103 @jasonm23 shared some links to learn how to render XPM in Emacs. I'm working on a solution using them, but I don't have much time.

Even thought glyphs are not working, powerline show the current branch (without the icon) with this format: Git: master.

Until the solution is implemented, the glyphs are only avaliable if emacs running in a terminal.

@JesusMtnez I know it appears without the icon but for some reason it is much easier for me to understand where am I with a single sight with the glyphs. I didn't know that it worked just fine within the terminal (actually didn't expect it to work without any tweak), that would be the solution for me, thanks.

Although this issue seems to be pretty dead I want to add a little follow up.

I've been messing with powerline code but I don't know lisp more than for making custom configs on emacs so I ended with a shitty patch that makes the glyphs to show in GUI mode but breaks the VC if you use emacs in terminal. This is the result of following the hint about window-system that @JesusMtnez gave in his comment.

Maybe someone can actually fix it.

This is the result:
Shitty patched powerline

And here my shitty patch:

diff --git a/powerline-themes.el b/powerline-themes.el
index f519808..6694527 100644
--- a/powerline-themes.el
+++ b/powerline-themes.el
@@ -72,8 +72,8 @@
                                        (powerline-raw (list (nyan-create)) face2 'l))))
                           (rhs (list (powerline-raw global-mode-string face2 'r)
                                      (funcall separator-right face2 face1)
-                                    (unless window-system
-                                      (powerline-raw (char-to-string #xe0a1) face1 'l))
+                                    ;(unless window-system
+                                      (powerline-raw (char-to-string #xe0a1) face1 'l) ;)
                                     (powerline-raw "%4l" face1 'l)
                                     (powerline-raw ":" face1 'l)
                                     (powerline-raw "%3c" face1 'r)
diff --git a/powerline.el b/powerline.el
index 3b86fc8..cf41b0f 100644
--- a/powerline.el
+++ b/powerline.el
@@ -441,7 +441,7 @@ static char * %s[] = {
 (defpowerline powerline-vc
   (when (and (buffer-file-name (current-buffer)) vc-mode)
     (if window-system
-       (format-mode-line '(vc-mode vc-mode))
+       ;(format-mode-line '(vc-mode vc-mode))
       (let ((backend (vc-backend (buffer-file-name (current-buffer)))))
        (when backend
          (format " %s %s"