Someone at work asked how to remove a toolbar button, I suggested
using toolbar-kill-item-pos and then found it didn't work. The
toolbar argument is used twice and only tested for nil once.
Also, in trying to clean up the code, someone assumed that setcdr
returned the entire new list. It doesn't, just the new cdr. And that's
what was showing up as the new toolbar.
ChangeLog addition:
2006-06-22 Jeff Miller <jmiller(a)cablespeed.com>
* toolbar-utils.el (toolbar-kill-item-pos): set toolbar to default-toolbar if not
passed as an argument.
Fix wrong usage of setcdr when setting specifier.
toolbar source patch:
Diff command: cvs -q diff -u
Files affected: toolbar-utils.el
Index: toolbar-utils.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/edit-utils/toolbar-utils.el,v
retrieving revision 1.2
diff -u -u -r1.2 toolbar-utils.el
--- toolbar-utils.el 2002/12/12 03:28:33 1.2
+++ toolbar-utils.el 2006/06/23 02:18:33
@@ -383,14 +383,14 @@
See also `toolbar-find-button-by-icon', `toolbar-find-button-by-command',
and `toolbar-find-button-by-help-string'."
(setq locale (or locale 'global))
- (let ((spec (cdadar (specifier-spec-list (or toolbar default-toolbar)
- locale))))
+ (setq toolbar (or toolbar default-toolbar))
+ (let ((spec (cdadar (specifier-spec-list toolbar locale))))
(setq button-palette (cons (nth pos spec) button-palette))
- (set-specifier toolbar (if (eq pos 0)
- (cdr spec)
- (setcdr (nthcdr (1- pos) spec)
- (nthcdr (1+ pos) spec)))
- locale)))
+ (if (eq pos 0)
+ (setq spec (cdr spec))
+ (setcdr (nthcdr (1- pos) spec)
+ (nthcdr (1+ pos) spec)))
+ (set-specifier toolbar spec locale)))
;; locating buttons by their content, returning a position