Someone at work asked how to remove a toolbar button and I suggested
using toolbar-kill-item-pos only to find it didn't work. It
complained about setting a nil specifier and when it did work after
telling it to use default-toolbar, only the portion after the removed
button showed up.
Turns out "toolbar" is used twice in the function but only tested for
nil once. Also, someone assumed that setcdr returns the newly
assembled spec list, it doesn't. Just the new cdr.
Jeff
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:34:35
@@ -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