view lisp/mh-e/mh-tool-bar.el @ 94414:d86cb59eea9f

2008-04-27 Carsten Dominik <dominik@science.uva.nl> * org/org.el (org-html-level-start): Always have id's in HTML (org-export-as-html): Use `org-link-protocols' to retrieve the export form of the link. (org-add-link-type): Final parameter renamed from PUBLISH. Better documentation of how it is to be used. Avoid double entries for the same link type. (org-add-link-props): New function. (org-modules-loaded): New variable. (org-load-modules-maybe, org-set-modules): New function. (org-modules): New option. (org-mode, org-cycle, orgstruct-mode, org-run-like-in-org-mode) (orgtbl-mode, org-store-link, org-insert-link-global) (org-open-at-point): Call `org-load-modules-maybe'. (org-search-view): Add more text properties. (org-agenda-schedule, org-agenda-deadline): Allow also in search-type agendas. (org-search-view): Order of arguments has been changed. Interpret prefix-arg as TODO-ONLY. (org-agenda, org-run-agenda-series, org-agenda-manipulate-query): Take new argument order of `org-search-view' into account. (org-todo-only): New variable. (org-search-syntax-table): New variable and function. (org-search-view): Do the search with the special syntax table. (define-obsolete-function-alias): Make work with XEmacs. (org-add-planning-info): Use old date as default when modifying an existing deadline or scheduled item. (org-agenda-compute-time-span): Make argument N optional. (org-agenda-format-date-aligned): Require `cal-iso'. (org-agenda-list): Include week into into agenda heading, don't list it at each date (only on Mondays). (org-read-date-analyze): Define local variable `iso-date'. (org-agenda-format-date-aligned): Remove dependency on `calendar-time-from-absolute'. (org-remember-apply-template, org-go-to-remember-target): Interpret filenames relative to `org-directory'. (org-complete): Silently fail when trying to complete keywords that don't have a default value. (org-get-current-options): Added a #+DATE: option. (org-additional-option-like-keywords): Removed "DATE:" from the list of additional keywords. (org-export-as-html): Removed (current-time) as unnecessary second argument of `format-time-string'. (org-clock-find-position): Handle special case at end of buffer. (org-agenda-day-view): New argument DAY-OF-YEAR, pass it on to `org-agenda-change-time-span'. (org-agenda-week-view): New argument ISO-WEEK, pass it on to `org-agenda-change-time-span'. (org-agenda-month-view): New argument MONTH, pass it on to `org-agenda-change-time-span'. (org-agenda-year-view): New argument YEAR, pass it on to `org-agenda-change-time-span'. (org-agenda-change-time-span): New optional argument N, pass it on to `org-agenda-compute-time-span'. (org-agenda-compute-time-span): New argument N, interpret it by changing the starting day. (org-small-year-to-year): New function. (org-scheduled-past-days): Respect `org-scheduled-past-days'. (org-auto-repeat-maybe): Make sure that repeating dates are pushed into the future, and that the shift is at least one interval, never 0. (org-update-checkbox-count): Fix bug with checkbox counting. (org-add-note): New command. (org-add-log-setup): Renamed from `org-add-log-maybe'. (org-log-note-headings): New entry for plain notes (i.e. notes not related to state changes or clocking). (org-get-org-file): Check for availability of `remember-data-file'. (org-cached-entry-get): Allow a regexp value for `org-use-property-inheritance'. (org-use-property-inheritance): Allow regexp value. Fix bug in customization type. (org-use-tag-inheritance): Allow a list and a regexp value for this variable. (org-scan-tags, org-get-tags-at): Implement selective tag inheritance. (org-entry-get): Respect value `selective' for the INHERIT argument. (org-tag-inherit-p, org-property-inherit-p): New functions. (org-agenda-format-date-aligned): Allow 10 characters for weekday, to acomodate German locale. (org-add-archive-files): New function. (org-agenda-files): New argument `ext', to get archive files as well. (org-tbl-menu): Protect the use of variables that are only available when org-table.el gets loaded. (org-read-agenda-file-list): Error if `org-agenda-files' is a single directory. (org-open-file): Allow a batch process to trigger waiting after executing a system command. (org-store-link): Link to headline when there is not target and no region in an org-mode buffer when creating a link. (org-link-types-re): New variable. (org-make-link-regexps): Compute `org-link-types-re'. (org-make-link-description-function): New option. (org-agenda-date, org-agenda-date-weekend): New faces. (org-archive-sibling-heading): New option. (org-archive-to-archive-sibling): New function. (org-iswitchb): New command. (org-buffer-list): New function. (org-agenda-columns): Also try the #+COLUMNS line in the buffer associated with the entry at point (or with the first entry in the agenda view). (org-modules): Add entry for org-bibtex.el. (org-completion-fallback-command): Moved into `org-completion' group. (org-clock-heading-function): Moved to `org-progress' group. (org-auto-repeat-maybe): Make sure that a note can be enforces if `org-log-repeat' is `note'. (org-modules): Allow additional symbols for external packages. (org-ctrl-c-ctrl-c): Allow for `org-clock-overlays' to be undefined. (org-clock-goto): Hide drawers after showing an entry with `org-clock-goto.' (org-shiftup, org-shiftdown, org-shiftright, org-shiftleft): Try also a clocktable block shift. (org-clocktable-try-shift): New function. (org-columns-hscoll-title): New function. (org-columns-previous-hscroll): New variable. (org-columns-full-header-line-format): New variable. (org-columns-display-here-title, org-columns-remove-overlays): Install `org-columns-hscoll-title' in post-command-hook. * org/org.el: Split into many small files. * org/org-agenda.el: New file, split off from org.el. * org/org-archive.el: New file, split off from org.el. * org/org-bbdb.el: New file. * org/org-bibtex.el: New file, split off from org.el. * org/org-clock.el: New file, split off from org.el. * org/org-colview.el: New file, split off from org.el. * org/org-compat.el: New file, split off from org.el. * org/org-exp.el: New file, split off from org.el. * org/org-faces.el: New file, split off from org.el. * org/org-gnus.el: New file, split off from org.el. * org/org-info.el: New file, split off from org.el. * org/org-infojs.el: New file. * org/org-irc.el: New file. * org/org-macs.el: New file, split off from org.el. * org/org-mew.el: New file. * org/org-mhe.el: New file, split off from org.el. * org/org-publish.el: New file, split off from org.el. * org/org-remember.el: New file, split off from org.el. * org/org-rmail.el: New file, split off from org.el. * org/org-table.el: New file, split off from org.el. * org/org-vm.el: New file, split off from org.el. * org/org-wl.el: New file, split off from org.el. 2008-04-27 Jason Riedy <jason@acm.org> * lisp/org-table.el (orgtbl-to-generic): Add a :remove-nil-lines parameter that supresses lines that evaluate to NIL. (orgtbl-get-fmt): New inline function for picking apart formats that may be lists. (orgtbl-apply-fmt): New inline function for applying formats that may be functions. (orgtbl-eval-str): New inline function for strings that may be functions. (orgtbl-format-line, orgtbl-to-generic): Use and document. (orgtbl-to-latex, orgtbl-to-texinfo): Document. (*orgtbl-llfmt*, *orgtbl-llstart*) (*orgtbl-llend*): Dynamic variables for last-line formatting. (orgtbl-format-section): Shift formatting to support detecting the last line and formatting it specially. (orgtbl-to-generic): Document :ll* formats. Set to the non-ll formats unless overridden. (orgtbl-to-latex): Suggest using :llend to suppress the final \\. (*orgtbl-table*, *orgtbl-rtn*): Dynamically bound variables to hold the input collection of lines and output formatted text. (*orgtbl-hline*, *orgtbl-sep*, *orgtbl-fmt*, *orgtbl-efmt*, (*orgtbl-lfmt*, *orgtbl-lstart*, *orgtbl-lend*): Dynamically bound format parameters. (orgtbl-format-line): New function encapsulating formatting for a single line. (orgtbl-format-section): Similar for each section. Rebinding the dynamic vars customizes the formatting for each section. (orgtbl-to-generic): Use orgtbl-format-line and orgtbl-format-section. (org-get-param): Now unused, so delete. (orgtbl-gather-send-defs): New function to gather all the SEND definitions before a table. (orgtbl-send-replace-tbl): New function to find the RECEIVE corresponding to the current name. (orgtbl-send-table): Use the previous two functions and implement multiple destinations for each table. * doc/org.texi (A LaTeX example): Note that fmt may be a one-argument function, and efmt may be a two-argument function. (Radio tables): Document multiple destinations. 2008-04-27 Carsten Dominik <dominik@science.uva.nl> * org/org-agenda.el (org-add-to-diary-list): New function. (org-prefix-has-effort): New variable. (org-sort-agenda-noeffort-is-high): New option. (org-agenda-columns-show-summaries) (org-agenda-columns-compute-summary-properties): New options. (org-format-agenda-item): Compute the duration of the item. (org-agenda-weekend-days): New variable. (org-agenda-list, org-timeline): Use the proper faces for dates in the agenda and timeline buffers. (org-agenda-archive-to-archive-sibling): New command. (org-agenda-start-with-clockreport-mode): New option. (org-agenda-clockreport-parameter-plist): New option. (org-agenda-clocktable-mode): New variable. (org-agenda-deadline-leaders): Allow a function value for the deadline leader. (org-agenda-get-deadlines): Deal with new function value. * lisp/org-clock.el (org-clock): New customization group. (org-clock-into-drawer, org-clock-out-when-done) (org-clock-in-switch-to-state, org-clock-heading-function): Moved into the new group. (org-clock-out-remove-zero-time-clocks): New option. (org-clock-out): Use `org-clock-out-remove-zero-time-clocks'. (org-dblock-write:clocktable): Allow a Lisp form for the scope parameter. (org-dblock-write:clocktable): Fixed bug with total time calculation. (org-dblock-write:clocktable): Request the unrestricted list of files. (org-get-clocktable): New function. (org-dblock-write:clocktable): Make sure :tstart and :tend can not only be strings but also integers (an absolute day number) and lists (m d y). * org/org-colview.el (org-columns-next-allowed-value) (org-columns-edit-value): Limit the effort for updatig in the agenda to recomputing a single file. (org-columns-compute): Only write property value if it has changed. This avoids raising the buffer-change-flag unnecessarily. (org-agenda-colview-summarize) (org-agenda-colview-compute): New functions. (org-agenda-columns): Call `org-agenda-colview-summarize'. * org/org-exp.el (org-export-run-in-background): New option. (org-export-icalendar): Allow a batch process to trigger waiting after executing a system command. (org-export-preprocess-string): Renamed-from `org-cleaned-string-for-export'. (org-export-html-style): Made target class look like normal text. (org-export-as-html): Make use of the better proprocessing in `org-cleaned-string-for-export'. (org-cleaned-string-for-export): Better treatment of heuristic targets, many more internal links will now work in HTML export. (org-get-current-options): Incorporate LINK_UP, LINK_HOME, and INFOJS. (org-export-inbuffer-options-extra): New variable. (org-export-options-filters): New hook. (org-infile-export-plist): Find also the settings keywords in `org-export-inbuffer-options-extra'. (org-infile-export-plist): Allow multiple #+OPTIONS lines and multiple #+INFOJS_OPT lines. (org-export-html-handle-js-options): New function. (org-export-html-infojs-setup): New option. (org-export-as-html): Call `org-export-html-handle-js-options'. Add autoload to all entry points. (org-skip-comments): Function removed. * org/org-table.el (org-table-make-reference): Extra parenthesis around single fields, to make sure that algebraic formulas get correctly interpreted by calc. (org-table-current-column): No longer interactive. * org/org-export-latex.el (org-export-latex-preprocess): Renamed from `org-export-latex-cleaned-string'. 2008-04-27 Bastien Guerry <bzg@altern.org> * org/org-publish.el (org-publish-get-base-files-1): New function. (org-publish-get-base-files): Use it. (org-publish-temp-files): New variable. Don't require 'dired-aux anymore. (org-publish-initial-buffer): New variable. (org-publish-org-to, org-publish): Use it. (org-publish-get-base-files-1): Bug fix: get the proper list of files when recursing thru a directory. (org-publish-get-base-files): Use the :exclude property to skip both files and directories.
author Carsten Dominik <dominik@science.uva.nl>
date Sun, 27 Apr 2008 18:33:39 +0000
parents 3c2488d0ebd9
children 90c9ebd43589
line wrap: on
line source

;;; mh-tool-bar.el --- MH-E tool bar support

;; Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.

;; Author: Satyaki Das <satyaki@theforce.stanford.edu>
;; Maintainer: Bill Wohler <wohler@newt.com>
;; Keywords: mail
;; See: mh-e.el

;; This file is part of GNU Emacs.

;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.

;;; Commentary:

;;; Change Log:

;;; Code:

(require 'mh-e)
(mh-do-in-gnu-emacs
  (require 'tool-bar))
(mh-do-in-xemacs
  (require 'toolbar))

;;; Tool Bar Commands

(defun mh-tool-bar-search (&optional arg)
  "Interactively call `mh-tool-bar-search-function'.
Optional argument ARG is not used."
  (interactive "P")
  (call-interactively mh-tool-bar-search-function))

(defun mh-tool-bar-customize ()
  "Call `mh-customize' from the tool bar."
  (interactive)
  (mh-customize t))

(defun mh-tool-bar-folder-help ()
  "Visit \"(mh-e)Top\"."
  (interactive)
  (info "(mh-e)Top")
  (delete-other-windows))

(defun mh-tool-bar-letter-help ()
  "Visit \"(mh-e)Editing Drafts\"."
  (interactive)
  (info "(mh-e)Editing Drafts")
  (delete-other-windows))

(defmacro mh-tool-bar-reply-generator (function recipient folder-buffer-flag)
  "Generate FUNCTION that replies to RECIPIENT.
If FOLDER-BUFFER-FLAG is nil then the function generated...
When INCLUDE-FLAG is non-nil, include message body being replied to."
  `(defun ,function (&optional arg)
     ,(format "Reply to \"%s\".\nWhen ARG is non-nil include message in reply."
              recipient)
     (interactive "P")
     ,(if folder-buffer-flag nil '(set-buffer mh-show-folder-buffer))
     (mh-reply (mh-get-msg-num nil) ,recipient arg)))

(mh-tool-bar-reply-generator mh-tool-bar-reply-from "from" t)
(mh-tool-bar-reply-generator mh-show-tool-bar-reply-from "from" nil)
(mh-tool-bar-reply-generator mh-tool-bar-reply-to "to" t)
(mh-tool-bar-reply-generator mh-show-tool-bar-reply-to "to" nil)
(mh-tool-bar-reply-generator mh-tool-bar-reply-all "all" t)
(mh-tool-bar-reply-generator mh-show-tool-bar-reply-all "all" nil)



;;; Tool Bar Creation

;; Shush compiler.
(defvar image-load-path)

(defmacro mh-tool-bar-define (defaults &rest buttons)
  "Define a tool bar for MH-E.
DEFAULTS is the list of buttons that are present by default. It
is a list of lists where the sublists are of the following form:

  (:KEYWORD FUNC1 FUNC2 FUNC3 ...)

Here :KEYWORD is one of :folder or :letter. If it is :folder then
the default buttons in the folder and show mode buffers are being
specified. If it is :letter then the default buttons in the
letter mode are listed. FUNC1, FUNC2, FUNC3, ... are the names of
the functions that the buttons would execute.

Each element of BUTTONS is a list consisting of four mandatory
items and one optional item as follows:

  (FUNCTION MODES ICON DOC &optional ENABLE-EXPR)

where,

  FUNCTION is the name of the function that will be executed when
  the button is clicked.

  MODES is a list of symbols. List elements must be from \"folder\",
  \"letter\" and \"sequence\". If \"folder\" is present then the button is
  available in the folder and show buffer. If the name of FUNCTION is
  of the form \"mh-foo\", where foo is some arbitrary string, then we
  check if the function `mh-show-foo' exists. If it exists then that
  function is used in the show buffer. Otherwise the original function
  `mh-foo' is used in the show buffer as well. Presence of \"sequence\"
  is handled similar to the above. The only difference is that the
  button is shown only when the folder is narrowed to a sequence. If
  \"letter\" is present in MODES, then the button is available during
  draft editing and runs FUNCTION when clicked.

  ICON is the icon that is drawn in the button.

  DOC is the documentation for the button. It is used in tool-tips and
  in providing other help to the user. GNU Emacs uses only the first
  line of the string. So the DOC should be formatted such that the
  first line is useful and complete without the rest of the string.

  Optional item ENABLE-EXPR is an arbitrary lisp expression. If it
  evaluates to nil, then the button is deactivated, otherwise it is
  active. If it isn't present then the button is always active."
  ;; The following variable names have been carefully chosen to make code
  ;; generation easier. Modifying the names should be done carefully.
  (let (folder-buttons folder-docs folder-button-setter sequence-button-setter
                       show-buttons show-button-setter show-seq-button-setter
                       letter-buttons letter-docs letter-button-setter
                       folder-defaults letter-defaults
                       folder-vectors show-vectors letter-vectors)
    (dolist (x defaults)
      (cond ((eq (car x) :folder) (setq folder-defaults (cdr x)))
            ((eq (car x) :letter) (setq letter-defaults (cdr x)))))
    (dolist (button buttons)
      (unless (and (listp button)
                   (or (equal (length button) 4) (equal (length button) 5)))
        (error "Incorrect MH-E tool-bar button specification: %s" button))
      (let* ((name (nth 0 button))
             (name-str (symbol-name name))
             (icon (nth 2 button))
             (xemacs-icon (mh-do-in-xemacs
                            `(cdr (assoc (quote ,(intern icon)) mh-xemacs-icon-map))))
             (full-doc (nth 3 button))
             (doc (if (string-match "\\(.*\\)\n" full-doc)
                      (match-string 1 full-doc)
                    full-doc))
             (enable-expr (if (eql (length button) 4) t (nth 4 button)))
             (modes (nth 1 button))
             functions show-sym)
        (when (memq 'letter modes) (setq functions `(:letter ,name)))
        (when (or (memq 'folder modes) (memq 'sequence modes))
          (setq functions
                (append `(,(if (memq 'folder modes) :folder :sequence) ,name)
                        functions))
          (setq show-sym
                (if (string-match "^mh-\\(.*\\)$" name-str)
                    (intern (concat "mh-show-" (match-string 1 name-str)))
                  name))
          (setq functions
                (append `(,(if (memq 'folder modes) :show :show-seq)
                          ,(if (fboundp show-sym) show-sym name))
                        functions)))
        (do ((functions functions (cddr functions)))
            ((null functions))
          (let* ((type (car functions))
                 (function (cadr functions))
                 (type1 (substring (symbol-name type) 1))
                 (vector-list (cond ((eq type :show) 'show-vectors)
                                    ((eq type :show-seq) 'show-vectors)
                                    ((eq type :letter) 'letter-vectors)
                                    (t 'folder-vectors)))
                 (list (cond ((eq type :letter) 'mh-tool-bar-letter-buttons)
                             (t 'mh-tool-bar-folder-buttons)))
                 (key (intern (concat "mh-" type1 "-tool-bar-" name-str)))
                 (setter (intern (concat type1 "-button-setter")))
                 (mbuttons (cond ((eq type :letter) 'letter-buttons)
                                 ((eq type :show) 'show-buttons)
                                 ((eq type :show-seq) 'show-buttons)
                                 (t 'folder-buttons)))
                 (docs (cond ((eq mbuttons 'letter-buttons) 'letter-docs)
                             ((eq mbuttons 'folder-buttons) 'folder-docs))))
            (add-to-list vector-list `(vector ,xemacs-icon ',function t ,full-doc))
            (add-to-list
             setter `(when (member ',name ,list)
                       (mh-funcall-if-exists
                        tool-bar-add-item ,icon ',function ',key
                        :help ,doc :enable ',enable-expr)))
            (add-to-list mbuttons name)
            (if docs (add-to-list docs doc))))))
    (setq folder-buttons (nreverse folder-buttons)
          letter-buttons (nreverse letter-buttons)
          show-buttons (nreverse show-buttons)
          letter-docs (nreverse letter-docs)
          folder-docs (nreverse folder-docs)
          folder-vectors (nreverse folder-vectors)
          show-vectors (nreverse show-vectors)
          letter-vectors (nreverse letter-vectors))
    (dolist (x folder-defaults)
      (unless (memq x folder-buttons)
        (error "Folder defaults contains unknown button %s" x)))
    (dolist (x letter-defaults)
      (unless (memq x letter-buttons)
        (error "Letter defaults contains unknown button %s" x)))
    `(eval-when (compile load eval)
       ;; GNU Emacs tool bar specific code
       (mh-do-in-gnu-emacs
         (defun mh-buffer-exists-p (mode)
           "Test whether a buffer with major mode MODE is present."
           (loop for buf in (buffer-list)
                 when (with-current-buffer buf
                        (eq major-mode mode))
                 return t))
         ;; Tool bar initialization functions
         (defun mh-tool-bar-folder-buttons-init ()
           (when (mh-buffer-exists-p 'mh-folder-mode)
             (let* ((load-path (mh-image-load-path-for-library "mh-e"
                                                               "mh-logo.xpm"))
                    (image-load-path (cons (car load-path)
                                           (when (boundp 'image-load-path)
                                             image-load-path))))
               (setq mh-folder-tool-bar-map
                     (let ((tool-bar-map (make-sparse-keymap)))
                       ,@(nreverse folder-button-setter)
                       tool-bar-map))
               (setq mh-folder-seq-tool-bar-map
                     (let ((tool-bar-map (copy-keymap mh-folder-tool-bar-map)))
                       ,@(nreverse sequence-button-setter)
                       tool-bar-map))
               (setq mh-show-tool-bar-map
                     (let ((tool-bar-map (make-sparse-keymap)))
                       ,@(nreverse show-button-setter)
                       tool-bar-map))
               (setq mh-show-seq-tool-bar-map
                     (let ((tool-bar-map (copy-keymap mh-show-tool-bar-map)))
                       ,@(nreverse show-seq-button-setter)
                       tool-bar-map)))))
         (defun mh-tool-bar-letter-buttons-init ()
           (when (mh-buffer-exists-p 'mh-letter-mode)
             (let* ((load-path (mh-image-load-path-for-library "mh-e"
                                                               "mh-logo.xpm"))
                    (image-load-path (cons (car load-path)
                                           (when (boundp 'image-load-path)
                                             image-load-path))))
               (setq mh-letter-tool-bar-map
                     (let ((tool-bar-map (make-sparse-keymap)))
                       ,@(nreverse letter-button-setter)
                       tool-bar-map)))))
         ;; Custom setter functions
         (defun mh-tool-bar-update (mode default-map sequence-map)
           "Update `tool-bar-map' in all buffers of MODE.
Use SEQUENCE-MAP if display is limited; DEFAULT-MAP otherwise."
           (loop for buf in (buffer-list)
                 do (with-current-buffer buf
                      (if (eq mode major-mode)
                          (let ((map (if mh-folder-view-stack
                                         sequence-map
                                       default-map)))
                            ;; Yes, make-local-variable is necessary since we
                            ;; get here during initialization when loading
                            ;; mh-e.el, after the +inbox buffer has been
                            ;; created, but before mh-folder-mode has run and
                            ;; created the local map.
                            (set (make-local-variable 'tool-bar-map) map))))))
         (defun mh-tool-bar-folder-buttons-set (symbol value)
           "Construct tool bar for `mh-folder-mode' and `mh-show-mode'."
           (set-default symbol value)
           (mh-tool-bar-folder-buttons-init)
           (mh-tool-bar-update 'mh-folder-mode mh-folder-tool-bar-map
                               mh-folder-seq-tool-bar-map)
           (mh-tool-bar-update 'mh-show-mode mh-show-tool-bar-map
                               mh-show-seq-tool-bar-map))
         (defun mh-tool-bar-letter-buttons-set (symbol value)
           "Construct tool bar for `mh-letter-mode'."
           (set-default symbol value)
           (mh-tool-bar-letter-buttons-init)
           (mh-tool-bar-update 'mh-letter-mode mh-letter-tool-bar-map
                               mh-letter-tool-bar-map)))
       ;; XEmacs specific code
       (mh-do-in-xemacs
         (defvar mh-tool-bar-folder-vector-map
           (list ,@(loop for button in folder-buttons
                     for vector in folder-vectors
                     collect `(cons ',button ,vector))))
         (defvar mh-tool-bar-show-vector-map
           (list ,@(loop for button in show-buttons
                     for vector in show-vectors
                     collect `(cons ',button ,vector))))
         (defvar mh-tool-bar-letter-vector-map
           (list ,@(loop for button in letter-buttons
                     for vector in letter-vectors
                     collect `(cons ',button ,vector))))
         (defvar mh-tool-bar-folder-buttons)
         (defvar mh-tool-bar-show-buttons)
         (defvar mh-tool-bar-letter-buttons)
         ;; Custom setter functions
         (defun mh-tool-bar-letter-buttons-set (symbol value)
           (set-default symbol value)
           (when mh-xemacs-has-tool-bar-flag
             (setq mh-tool-bar-letter-buttons
                   (loop for b in value
                         collect (cdr
                                  (assoc b mh-tool-bar-letter-vector-map))))))
         (defun mh-tool-bar-folder-buttons-set (symbol value)
           (set-default symbol value)
           (when mh-xemacs-has-tool-bar-flag
             (setq mh-tool-bar-folder-buttons
                   (loop for b in value
                         collect (cdr (assoc b mh-tool-bar-folder-vector-map))))
             (setq mh-tool-bar-show-buttons
                   (loop for b in value
                         collect (cdr (assoc b mh-tool-bar-show-vector-map))))))
         (defun mh-tool-bar-init (mode)
           "Install tool bar in MODE."
           (when mh-xemacs-use-tool-bar-flag
             (let ((tool-bar (cond ((eq mode :folder)
                                    mh-tool-bar-folder-buttons)
                                   ((eq mode :letter)
                                    mh-tool-bar-letter-buttons)
                                   ((eq mode :show)
                                    mh-tool-bar-show-buttons)))
                   (height 37)
                   (width 40)
                   (buffer (current-buffer)))
               (cond
                ((eq mh-xemacs-tool-bar-position 'top)
                 (set-specifier top-toolbar tool-bar buffer)
                 (set-specifier top-toolbar-visible-p t)
                 (set-specifier top-toolbar-height height))
                ((eq mh-xemacs-tool-bar-position 'bottom)
                 (set-specifier bottom-toolbar tool-bar buffer)
                 (set-specifier bottom-toolbar-visible-p t)
                 (set-specifier bottom-toolbar-height height))
                ((eq mh-xemacs-tool-bar-position 'left)
                 (set-specifier left-toolbar tool-bar buffer)
                 (set-specifier left-toolbar-visible-p t)
                 (set-specifier left-toolbar-width width))
                ((eq mh-xemacs-tool-bar-position 'right)
                 (set-specifier right-toolbar tool-bar buffer)
                 (set-specifier right-toolbar-visible-p t)
                 (set-specifier right-toolbar-width width))
                (t (set-specifier default-toolbar tool-bar buffer)))))))
       ;; Declare customizable tool bars
       (custom-declare-variable
        'mh-tool-bar-folder-buttons
        '(list ,@(mapcar (lambda (x) `(quote ,x)) folder-defaults))
        "List of buttons to include in MH-Folder tool bar."
        :group 'mh-tool-bar
        :set 'mh-tool-bar-folder-buttons-set
        :type '(set ,@(loop for x in folder-buttons
                            for y in folder-docs
                            collect `(const :tag ,y ,x)))
        ;;:package-version '(MH-E "7.1")
        )
       (custom-declare-variable
        'mh-tool-bar-letter-buttons
        '(list ,@(mapcar (lambda (x) `(quote ,x)) letter-defaults))
        "List of buttons to include in MH-Letter tool bar."
        :group 'mh-tool-bar
        :set 'mh-tool-bar-letter-buttons-set
        :type '(set ,@(loop for x in letter-buttons
                            for y in letter-docs
                            collect `(const :tag ,y ,x)))
        ;;:package-version '(MH-E "7.1")
        ))))

;; The icon names are duplicated in the Makefile and mh-xemacs.el.
(mh-tool-bar-define
 ((:folder mh-inc-folder mh-mime-save-parts
           mh-previous-undeleted-msg mh-page-msg
           mh-next-undeleted-msg mh-delete-msg mh-refile-msg
           mh-undo mh-execute-commands mh-toggle-tick mh-reply
           mh-alias-grab-from-field mh-send mh-rescan-folder
           mh-tool-bar-search mh-visit-folder
           mh-tool-bar-customize mh-tool-bar-folder-help
           mh-widen)
  (:letter mh-send-letter save-buffer mh-fully-kill-draft
           mh-compose-insertion ispell-message undo
           clipboard-kill-region clipboard-kill-ring-save
           clipboard-yank mh-tool-bar-customize
           mh-tool-bar-letter-help))
 ;; Folder/Show buffer buttons
 (mh-inc-folder (folder) "mail/inbox" "Incorporate new mail in Inbox
This button runs `mh-inc-folder' which drags any
new mail into your Inbox folder")
 (mh-mime-save-parts (folder) "attach" "Save MIME parts from this message
This button runs `mh-mime-save-parts' which saves a message's
different parts into separate files")
 (mh-previous-undeleted-msg (folder) "left-arrow"
                            "Go to the previous undeleted message
This button runs `mh-previous-undeleted-msg'")
 (mh-page-msg (folder) "next-page" "Page the current message forwards
This button runs `mh-page-msg'")
 (mh-next-undeleted-msg (folder) "right-arrow" "Go to the next undeleted message
The button runs `mh-next-undeleted-msg'")
 (mh-delete-msg (folder) "delete" "Mark this message for deletion
This button runs `mh-delete-msg'")
 (mh-refile-msg (folder) "mail/move" "Refile this message
This button runs `mh-refile-msg'")
 (mh-undo (folder) "undo" "Undo last operation
This button runs `undo'"
          (mh-outstanding-commands-p))
 (mh-execute-commands (folder) "data-save" "Perform moves and deletes
This button runs `mh-execute-commands'"
                      (mh-outstanding-commands-p))
 (mh-toggle-tick (folder) "mail/flag-for-followup" "Toggle tick mark
This button runs `mh-toggle-tick'")
 (mh-toggle-showing (folder) "show" "Toggle showing message
This button runs `mh-toggle-showing'")
 (mh-reply (folder) "mail/reply" "Reply to this message
This button runs `mh-reply'")
 (mh-tool-bar-reply-from (folder) "mail/reply-from" "Reply to \"from\"")
 (mh-tool-bar-reply-to (folder) "mail/reply-to" "Reply to \"to\"")
 (mh-tool-bar-reply-all (folder) "mail/reply-all" "Reply to \"all\"")
 (mh-alias-grab-from-field (folder) "contact" "Create alias for sender
This button runs `mh-alias-grab-from-field'"
                           (and (mh-extract-from-header-value)
                                (not (mh-alias-for-from-p))))
 (mh-send (folder) "mail/compose" "Compose new message
This button runs `mh-send'")
 (mh-rescan-folder (folder) "refresh" "Rescan this folder
This button runs `mh-rescan-folder'")
 (mh-pack-folder (folder) "mail/repack" "Repack this folder
This button runs `mh-pack-folder'")
 (mh-tool-bar-search (folder) "search" "Search
This button runs `mh-tool-bar-search-function'")
 (mh-visit-folder (folder) "open" "Visit other folder
This button runs `mh-visit-folder'")
 ;; Letter buffer buttons
 (mh-send-letter (letter) "mail/send" "Send this letter")
 (save-buffer (letter) "save" "Save current buffer to its file"
              (buffer-modified-p))
 (mh-fully-kill-draft (letter) "delete" "Kill this draft")
 (mh-compose-insertion (letter) "attach" "Insert attachment")
 (ispell-message (letter) "spell" "Check spelling")
 (undo (letter) "undo" "Undo last operation")
 (clipboard-kill-region (letter) "cut"
  "Cut (kill) text in region")
 (clipboard-kill-ring-save (letter) "copy"
  "Copy text in region")
 (clipboard-yank (letter) "paste"
  "Paste (yank) text cut or copied earlier")
 ;; Common buttons
 (mh-tool-bar-customize (folder letter) "preferences" "MH-E Preferences")
 (mh-tool-bar-folder-help (folder) "help" "Help! (general help)
This button runs `info'")
 (mh-tool-bar-letter-help (letter) "help" "Help! (general help)
This button runs `info'")
 ;; Folder narrowed to sequence buttons
 (mh-widen (sequence) "zoom-out" "Widen from the sequence
This button runs `mh-widen'"))

(provide 'mh-tool-bar)

;; Local Variables:
;; indent-tabs-mode: nil
;; sentence-end-double-space: nil
;; End:

;; arch-tag: 28c2436d-bb8d-486a-a8d7-5a4d9cae3513
;;; mh-tool-bar.el ends here