1

enter image description here

I was trying to change defconst value for a tabbar image, the following lines are defined in tabbar.el:

(defconst tabbar-scroll-left-button-enabled-image
  '((:type pbm :data "\
P2 13 13 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 128 16 48 255 255 255 255 255 255 255
255 144 28 86 128 0 255 255 255 255 255 255 160 44 92 159 135 113 0
255 255 255 255 160 44 97 165 144 129 120 117 0 255 255 176 44 98 175
174 146 127 126 127 128 0 255 255 0 160 184 156 143 136 134 135 137
138 0 255 255 176 32 67 144 146 144 145 146 148 149 0 255 255 255 255
160 42 75 140 154 158 159 160 0 255 255 255 255 255 255 160 40 74 154
170 171 0 255 255 255 255 255 255 255 255 160 41 82 163 0 255 255 255
255 255 255 255 255 255 255 160 32 48 255 255 255 255 255 255 255 255
255 255 255 255 255 255
"))
  "Default image for the enabled scroll left button.
A disabled button image will be automatically build from it.")

So first I put the following lines in my init file but it is not working, but they works if I do replace in the original file tabbar.el:

(defconst tabbar-scroll-left-button-enabled-image
  '((:type png :file "~/.emacs.d/new-scroll-left.png" :ascent center))
  "Default image for the enabled scroll right button.
A disabled button image will be automatically build from it.")

Since I still want to redefine the image in my init file not modify tabbar.el directly, then I tried to append the defcustom found in tabbar.el calling tabbar-scroll-left-button-enabled-image also in the init file:

(defcustom tabbar-scroll-left-button
  (cons (cons " <" tabbar-scroll-left-button-enabled-image)
        (cons " =" nil))
  "The scroll left button.
The variable `tabbar-button-widget' gives details on this widget."
  :group 'tabbar
  :type tabbar-button-widget
  :set '(lambda (variable value)
          (custom-set-default variable value)
          ;; Schedule refresh of button value.
          (setq tabbar-scroll-left-button-value nil)))

And I found no other functions are calling this defcustom in tabbar.el. However so far it is still not working. Anyone who is familar with tabbar loading its images can possibly help to explain a little bit?

  • 2
    How about just using plain old setq? E.g., (setq tabbar-scroll-left-button-enabled-image '((specs....))) and (setq tabbar-scroll-left-button (cons (cons ...))) The tabbar-separator image is not a nested list, but instead just a list of specs that would need to be created if so desired -- e.g., (defconst tabbar-separator-image '(:type pbm :data ...)) and (setq tabbar-separator (list .75 tabbar-separator-image)) – lawlist Nov 20 '16 at 20:00
1

By adding the following lines to init

  ;; Load a new tabbar arrow image
  (setq tabbar-scroll-left-button-enabled-image-one '((:type png :file "~/tabbar-scroll-left.png" :ascent center)))
  (setq tabbar-scroll-left-button
        (cons (cons " <" tabbar-scroll-left-button-enabled-image-one)
              (cons " =" nil)))
  (setq tabbar-scroll-right-button-enabled-image-one '((:type png :file "~/tabbar-scroll-right.png" :ascent center)))
  (setq tabbar-scroll-right-button
        (cons (cons " >" tabbar-scroll-right-button-enabled-image-one)
              (cons " =" nil)))

I was able to replace the image.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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