ryuslash/mode-icons

Invalid XPM file - ivy.xpm

Addlai opened this issue · 4 comments

I'm having the same issue as described in Issue #57, opened Jan 16, 2018 and closed Aug 5, 2018.

I'm running Emacs for OSX version 27.2

It's because the xpm file starts with

    /* XPM */
    static char * c:\EmacsPortable_App\Data\src\mode_icons\icons\ivy_xpm[] = {

when it should start with

    /* XPM */
    static char * ivy_xpm[] = {

Emacs on Windows probably handles the first version, but on unix/linux systems will not.

These icon files are affected:

autohotkey.xpm:2:static char * e:\EmacsPortable_App\Data\src\mode_icons\icons\autohotkey_xpm[] = {
bibtex.xpm:2:static char * e:\EmacsPortable_App\Data\src\mode_icons\icons\bibtex_xpm[] = {
cmd.xpm:2:static char * d:\EmacsPortable_App\Data\src\mode_icons\icons\cmd_xpm[] = {
cygwin.xpm:2:static char * d:\EmacsPortable_App\Data\src\mode_icons\icons\cygwin_xpm[] = {
golden.xpm:2:static char * e:\EmacsPortable_App\Data\src\mode_icons\icons\golden_xpm[] = {
helm.xpm:2:static char * C:\tmp\EmacsPortable_App\Data\src\mode_icons\icons\helm_xpm[] = {
icy.xpm:2:static char * e:\EmacsPortable_App\Data\src\mode_icons\icons\icy_xpm[] = {
msys.xpm:2:static char * d:\EmacsPortable_App\Data\src\mode_icons\icons\msys_xpm[] = {
octave.xpm:2:static char * e:\EmacsPortable_App\Data\src\mode_icons\icons\octave_xpm[] = {
powershell.xpm:2:static char * d:\EmacsPortable_App\Data\src\mode_icons\icons\powershell_xpm[] = {
rainbow.xpm:2:static char * E:\EmacsPortable_App\Data\src\mode_icons\icons\rainbow_xpm[] = {
R.xpm:2:static char * C:\tmp\R_xpm[] = {
sas.xpm:2:static char * E:\EmacsPortable_App\Data\src\mode_icons\icons\sas_xpm[] = {

The following bash command did the trick for me, you might need to use "sed -r" instead of "sed -E" to make sed use extended regex syntax:

grep -Eln 'static +char +\* *[a-zA-Z]:' *.xpm | 
    while read xpm; do 
        mv ${xpm} ${xpm}.orig; 
        sed -E 's@^ *static +char +\* *[a-zA-Z]:.*\\([^[\\]+)\[@static char * \1[@' <${xpm}.orig >${xpm}; 
    done

Indeed.

I haven't done too much recently, but I think that it used to work on the mac because I swapped between the mac and PC when I was working on this. It works on a very old version of emacs at my work too.

However, now it works on recent emacs too 😄