2

The icons in speedbar are old-fashioned, I'm trying to replace them, but cannot locate any png files in /home/user/.emacs.d, are they pictures? If they are, where to find them?

enter image description here

And how can I replace them by specifying new image in emacs init file not actually replace them on disk.

Update: It works after adopting the answer in the solution, and it is also easy to switch to a png format picture. To load a new picture other than the original ones, first put a png pic in .emacs.d, and then add the following lines to the init file:

 (require 'speedbar)
 (defezimage ezimage-directory-plus-new
    ((:type png :file "~/.emacs.d/dir-plus-new.png" :ascent center))
    "Image used for empty directories.")

  (setq speedbar-expand-image-button-alist
        '(("<+>" . ezimage-directory-plus-new))

Now my speedbar looks like:

enter image description here

1 Answer 1

3

The images are XPM located in a directory such as .../Emacs.app/Contents/Resources/etc/images/ezimage [Location example is for Emacs built --with-ns.] This answer contemplates changing the current XPM images with different XPM images. It is certainly possible to rewrite the speedbar.el library and related libraries to insert PNG images (a time-consuming undertaking), but that is beyond the scope of this XPM answer.

The XPM images can be customized by modifying the values in the variable speedbar-expand-image-button-alist and by adding additional XPM images to the default location. The default values are as follows:

'(("<+>" . ezimage-directory-plus)
  ("<->" . ezimage-directory-minus)
  ("< >" . ezimage-directory)
  ("[+]" . ezimage-page-plus)
  ("[-]" . ezimage-page-minus)
  ("[?]" . ezimage-page)
  ("[ ]" . ezimage-page)
  ("{+}" . ezimage-box-plus)
  ("{-}" . ezimage-box-minus)
  ("<M>" . ezimage-mail)
  ("<d>" . ezimage-document-tag)
  ("<i>" . ezimage-info-tag)
  (" =>" . ezimage-tag)
  (" +>" . ezimage-tag-gt)
  (" ->" . ezimage-tag-v)
  (">"   . ezimage-tag)
  ("@"   . ezimage-tag-type)
  ("  @" . ezimage-tag-type)
  ("*"   . ezimage-checkout)
  ("#"   . ezimage-object)
  ("!"   . ezimage-object-out-of-date)
  ("//"  . ezimage-label)
  ("%"   . ezimage-lock)
  )

For example, let us assume that we want to change the directory plus/minus images for the box plus/minus images, and visa versa:

(setq speedbar-expand-image-button-alist
  '(("<+>" . ezimage-box-plus) ;; previously ezimage-directory-plus
    ("<->" . ezimage-box-minus) ;; previously ezimage-directory-minus
    ("< >" . ezimage-directory)
    ("[+]" . ezimage-page-plus)
    ("[-]" . ezimage-page-minus)
    ("[?]" . ezimage-page)
    ("[ ]" . ezimage-page)
    ("{+}" . ezimage-directory-plus) ;; previously ezimage-box-plus
    ("{-}" . ezimage-directory-minus) ;; previously ezimage-box-minus
    ("<M>" . ezimage-mail)
    ("<d>" . ezimage-document-tag)
    ("<i>" . ezimage-info-tag)
    (" =>" . ezimage-tag)
    (" +>" . ezimage-tag-gt)
    (" ->" . ezimage-tag-v)
    (">"   . ezimage-tag)
    ("@"   . ezimage-tag-type)
    ("  @" . ezimage-tag-type)
    ("*"   . ezimage-checkout)
    ("#"   . ezimage-object)
    ("!"   . ezimage-object-out-of-date)
    ("//"  . ezimage-label)
    ("%"   . ezimage-lock)
    ))
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.