[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Custom type for "&rest props" style arguments?

From: Reiner Steib
Subject: Custom type for "&rest props" style arguments?
Date: Thu, 12 Jan 2006 16:09:30 +0100
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)


I'd like to have a customizable list as follows:

(defcustom rs-test-list
  '((gnus-summary-save-newsrc "save" nil :visible nil)
    (gnus-summary-print-article "print")
     "search" nil :visible (not (gnus-group-read-only-p))))
  "List of tool bar function items.

The first element of each item must be a menu command.  The
second must be an icon file name.  The first two elements are
required, all other are optinal.  The third argument is a keymap
or nil (default keymap).  The forth and all following arguments
are passed as the PROPS argument to `tool-bar-local-item'."
  :type '(repeat (list (function :tag "Menu Command")
                       (string   :tag "Icon file")
                       (choice (const :tag "Default map" nil)
                               (sexp :tag "Other map"))
                       (choice :tag "Properties"
                               (const :tag "None" nil)
                               (sexp :tag "Other")))))

My problem is how to express "the forth and all following arguments"
as a custom type.  My code results in a "mismatch" when calling `M-x
customize-variable RET rs-test-list RET'.  The "Properties" are
supposed to be passed as the PROPS argument to `tool-bar-local-item':

,----[ <f1> f tool-bar-local-item RET ]
| tool-bar-local-item is a compiled Lisp function in `tool-bar.el'.
| (tool-bar-local-item ICON DEF KEY MAP &rest PROPS)
| Add an item to the tool bar in map MAP.
| ICON names the image, DEF is the key definition and KEY is a symbol
| for the fake function key in the menu keymap.  Remaining arguments
| PROPS are additional items to add to the menu item specification.  See
| Info node `(elisp)Tool Bar'.  [...]

Here is an attempt for a defcustom of a single element:

(defcustom rs-test-item
  '(gnus-summary-save-newsrc "save" nil :visible nil) ;; -> mismatch
  ;; '(gnus-summary-print-article "print") ;; -> works
  ;; '(gnus-summary-edit-article
  ;;   "search" nil :visible (not (gnus-group-read-only-p))) ;; -> mismatch
  "A single item for testing."
  :type '(list (function :tag "Menu Command")
               (string   :tag "Icon file name")
               (choice (const :tag "Default map" nil)
                       (const :tag "No menu" t)
                       (sexp :tag "Other map"))
               (choice :tag "Properties"
                       (const :tag "None" nil)
                       (sexp  :tag "Other"))))

(Instead of `:visible test-function' there could also arbitrary other
arguments accepted by `tool-bar-local-item' such as `:help "Do

Any hints?

Bye, Reiner.
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |

reply via email to

[Prev in Thread] Current Thread [Next in Thread]