* mh-customize.el (mh-toolbar): Rename to mh-tool-bar.

(mh-tool-bar-search-function): Sync docstrings with manual.
(mh-tool-bar-customize): Replace toolbar with tool bar in docstring.
(mh-tool-bar-letter-help): Fix manual reference.
(mh-xemacs-use-toolbar-flag): Rename to mh-xemacs-use-tool-bar-flag.
Initialize to mh-xemacs-has-tool-bar-flag. Sync docstrings with
manual.
(mh-xemacs-toolbar-position): Rename to mh-xemacs-tool-bar-position.
Initialize to nil. Drop "no tool bar" option (redundant) and change
"Same As Default Tool Bar" setting to nil. Sync docstrings with
manual.
(mh-tool-bar-define): Replace toolbar with tool-bar or tool bar
depending on context.
(mh-toolbar-init): Rename to mh-tool-bar-init. Simplified condition
for calling set-specifier. Only look at the value of
mh-xemacs-use-tool-bar-flag.
(mh-tool-bar-folder-buttons, mh-tool-bar-letter-buttons): Sync
docstrings with manual.

* mh-comp.el (mh-letter-mode): Use mh-tool-bar-init instead of
mh-toolbar-init.

* mh-e.el (mh-folder-mode): Ditto.

* mh-utils.el (mh-show-mode): Ditto.
This commit is contained in:
Bill Wohler 2005-12-19 05:37:02 +00:00
parent d78e9711ab
commit fa4075e33c
5 changed files with 108 additions and 88 deletions

View file

@ -1,3 +1,32 @@
2005-12-18 Bill Wohler <wohler@newt.com>
* mh-customize.el (mh-toolbar): Rename to mh-tool-bar.
(mh-tool-bar-search-function): Sync docstrings with manual.
(mh-tool-bar-customize): Replace toolbar with tool bar in
docstring.
(mh-tool-bar-letter-help): Fix manual reference.
(mh-xemacs-use-toolbar-flag): Rename to
mh-xemacs-use-tool-bar-flag. Initialize to
mh-xemacs-has-tool-bar-flag. Sync docstrings with manual.
(mh-xemacs-toolbar-position): Rename to
mh-xemacs-tool-bar-position. Initialize to nil. Drop "no tool bar"
option (redundant) and change "Same As Default Tool Bar" setting
to nil. Sync docstrings with manual.
(mh-tool-bar-define): Replace toolbar with tool-bar or tool bar
depending on context.
(mh-toolbar-init): Rename to mh-tool-bar-init. Simplified
condition for calling set-specifier. Only look at the value of
mh-xemacs-use-tool-bar-flag.
(mh-tool-bar-folder-buttons, mh-tool-bar-letter-buttons): Sync
docstrings with manual.
* mh-comp.el (mh-letter-mode): Use mh-tool-bar-init instead of
mh-toolbar-init.
* mh-e.el (mh-folder-mode): Ditto.
* mh-utils.el (mh-show-mode): Ditto.
2005-12-15 Bill Wohler <wohler@newt.com>
* mh-e.el (mh-delete-msg): Sync docstrings with manual.

View file

@ -994,7 +994,7 @@ When a message is composed, the hooks `text-mode-hook' and
;; Enable undo since a show-mode buffer might have been reused.
(buffer-enable-undo)
(set (make-local-variable 'tool-bar-map) mh-letter-tool-bar-map)
(mh-funcall-if-exists mh-toolbar-init :letter)
(mh-funcall-if-exists mh-tool-bar-init :letter)
(make-local-variable 'font-lock-defaults)
(cond
((or (equal mh-highlight-citation-style 'font-lock)

View file

@ -198,9 +198,9 @@ mailutils."
:link '(custom-manual "(mh-e)Threading")
:group 'mh-e)
(defgroup mh-toolbar nil
"The toolbar"
:link '(custom-manual "(mh-e)Toolbar")
(defgroup mh-tool-bar nil
"The tool bar"
:link '(custom-manual "(mh-e)Tool Bar")
:prefix "mh-"
:group 'mh-e)
@ -1801,15 +1801,18 @@ only if the number of messages being threaded is less than `mh-large-folder'."
;;; The Toolbar (:group 'mh-toolbar)
;;; The Tool Bar (:group 'mh-tool-bar)
(defcustom mh-tool-bar-search-function 'mh-search-folder
"*Function called by the tool-bar search button.
See `mh-search-folder' and `mh-index-search' for details."
"*Function called by the tool bar search button.
Available functions include `mh-search-folder', the default, and
`mh-index-search'. You can also choose \"Other Function\" from the \"Value
Menu\" and enter a function of your own choosing."
:type '(choice (const mh-search-folder)
(const mh-index-search)
(function :tag "Other function"))
:group 'mh-toolbar)
(function :tag "Other Function"))
:group 'mh-tool-bar)
;; Functions called from the tool bar
(defun mh-tool-bar-search (&optional arg)
@ -1819,7 +1822,7 @@ Optional argument ARG is not used."
(call-interactively mh-tool-bar-search-function))
(defun mh-tool-bar-customize ()
"Call `mh-customize' from the toolbar."
"Call `mh-customize' from the tool bar."
(interactive)
(mh-customize t))
@ -1830,9 +1833,9 @@ Optional argument ARG is not used."
(delete-other-windows))
(defun mh-tool-bar-letter-help ()
"Visit \"(mh-e)Draft Editing\"."
"Visit \"(mh-e)Editing Drafts\"."
(interactive)
(info "(mh-e)Draft Editing")
(info "(mh-e)Editing Drafts")
(delete-other-windows))
(defmacro mh-tool-bar-reply-generator (function recipient folder-buffer-flag)
@ -1855,45 +1858,35 @@ When INCLUDE-FLAG is non-nil, include message body being replied to."
;; XEmacs has a couple of extra customizations...
(mh-do-in-xemacs
(defcustom mh-xemacs-use-toolbar-flag (if (and (featurep 'toolbar)
(featurep 'xpm)
(device-on-window-system-p))
t
nil)
"*If non-nil, use toolbar.
(defcustom mh-xemacs-use-tool-bar-flag mh-xemacs-has-tool-bar-flag
"*If non-nil, use tool bar.
This will default to t if you are in an environment that supports
toolbars and xpm."
This option controls whether to show the MH-E icons at all. By default, this
option is turned on if the window system supports tool bars. If your system
doesn't support tool bars, then you won't be able to turn on this option."
:type 'boolean
:group 'mh-toolbar)
:group 'mh-tool-bar
:set (lambda (symbol value)
(if (and (eq value t)
(not mh-xemacs-has-tool-bar-flag))
(error "Tool bar not supported"))
(set-default symbol value)))
(defcustom mh-xemacs-toolbar-position (if mh-xemacs-use-toolbar-flag
'default
nil)
"*Where to put the toolbar.
(defcustom mh-xemacs-tool-bar-position nil
"*Tool bar location.
Valid non-nil values are \"default\", \"top\", \"bottom\", \"left\",
\"right\". These match the four edges of the frame, with \"default\"
meaning \"use the same position as the default-toolbar\".
A nil value means do not use a toolbar.
If this variable is set to anything other than \"default\" and the
default-toolbar has a different positional setting from the value of
this variable, then two toolbars will be displayed. The MH-E toolbar
and the default-toolbar."
:type '(radio (const :tag "Same position as the \"default-toolbar\""
:value default)
(const :tag "Along the top edge of the frame"
:value top)
(const :tag "Along the bottom edge of the frame"
:value bottom)
(const :tag "Along the left edge of the frame"
:value left)
(const :tag "Along the right edge of the frame"
:value right)
(const :tag "Don't use a toolbar" nil))
:group 'mh-toolbar))
This option controls the placement of the tool bar along the four edges of the
frame. You can choose from one of \"Same As Default Tool Bar\", \"Top\",
\"Bottom\", \"Left\", or \"Right\". If this variable is set to anything other
than \"Same As Default Tool Bar\" and the default tool bar is in a different
location, then two tool bars will be displayed: the MH-E tool bar and the
default tool bar."
:type '(radio (const :tag "Same As Default Tool Bar" :value nil)
(const :tag "Top" :value top)
(const :tag "Bottom" :value bottom)
(const :tag "Left" :value left)
(const :tag "Right" :value right))
:group 'mh-tool-bar))
(defun mh-buffer-exists-p (mode)
"Test whether a buffer with major mode MODE is present."
@ -1996,7 +1989,7 @@ where,
(t 'folder-vectors)))
(list (cond ((eq type :letter) 'mh-tool-bar-letter-buttons)
(t 'mh-tool-bar-folder-buttons)))
(key (intern (concat "mh-" type1 "toolbar-" name-str)))
(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)
@ -2063,89 +2056,87 @@ where,
tool-bar-map))))
;; Custom setter functions
(defun mh-tool-bar-folder-buttons-set (symbol value)
"Construct toolbar for `mh-folder-mode' and `mh-show-mode'."
"Construct tool bar for `mh-folder-mode' and `mh-show-mode'."
(set-default symbol value)
(mh-tool-bar-folder-buttons-init))
(defun mh-tool-bar-letter-buttons-set (symbol value)
"Construct toolbar for `mh-letter-mode'."
"Construct tool bar for `mh-letter-mode'."
(set-default symbol value)
(mh-tool-bar-letter-buttons-init)))
;; XEmacs specific code
(mh-do-in-xemacs
(defvar mh-toolbar-folder-vector-map
(defvar mh-tool-bar-folder-vector-map
',(loop for button in folder-buttons
for vector in folder-vectors
collect (cons button vector)))
(defvar mh-toolbar-show-vector-map
(defvar mh-tool-bar-show-vector-map
',(loop for button in show-buttons
for vector in show-vectors
collect (cons button vector)))
(defvar mh-toolbar-letter-vector-map
(defvar mh-tool-bar-letter-vector-map
',(loop for button in letter-buttons
for vector in letter-vectors
collect (cons button vector)))
(defvar mh-toolbar-folder-buttons nil)
(defvar mh-toolbar-show-buttons nil)
(defvar mh-toolbar-letter-buttons nil)
(defvar mh-tool-bar-folder-buttons nil)
(defvar mh-tool-bar-show-buttons nil)
(defvar mh-tool-bar-letter-buttons nil)
;; Custom setter functions
(defun mh-tool-bar-letter-buttons-set (symbol value)
(set-default symbol value)
(when mh-xemacs-has-toolbar-flag
(setq mh-toolbar-letter-buttons
(when mh-xemacs-has-tool-bar-flag
(setq mh-tool-bar-letter-buttons
(loop for b in value
collect (cdr (assoc b mh-toolbar-letter-vector-map))))))
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-toolbar-flag
(setq mh-toolbar-folder-buttons
(when mh-xemacs-has-tool-bar-flag
(setq mh-tool-bar-folder-buttons
(loop for b in value
collect (cdr (assoc b mh-toolbar-folder-vector-map))))
(setq mh-toolbar-show-buttons
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-toolbar-show-vector-map))))))
;; Initialize toolbar
(defun mh-toolbar-init (mode)
"Install toolbar in MODE."
(let ((toolbar (cond ((eq mode :folder) mh-toolbar-folder-buttons)
((eq mode :letter) mh-toolbar-letter-buttons)
((eq mode :show) mh-toolbar-show-buttons)))
collect (cdr (assoc b mh-tool-bar-show-vector-map))))))
(defun mh-tool-bar-init (mode)
"Install tool bar in MODE."
(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)))
(when (and mh-xemacs-toolbar-position mh-xemacs-use-toolbar-flag
mh-xemacs-has-toolbar-flag)
(when mh-xemacs-use-tool-bar-flag
(cond
((eq mh-xemacs-toolbar-position 'top)
(set-specifier top-toolbar toolbar buffer)
((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-toolbar-position 'bottom)
(set-specifier bottom-toolbar toolbar buffer)
((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-toolbar-position 'left)
(set-specifier left-toolbar toolbar buffer)
((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-toolbar-position 'right)
(set-specifier right-toolbar toolbar buffer)
((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 toolbar buffer)))))))
;; Declare customizable toolbars
(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))
"Choose buttons to include in MH-E folder/show toolbar."
:group 'mh-toolbar :set 'mh-tool-bar-folder-buttons-set
"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))))
(custom-declare-variable
'mh-tool-bar-letter-buttons
'(list ,@(mapcar (lambda (x) `(quote ,x)) letter-defaults))
"Choose buttons to include in MH-E letter toolbar."
:group 'mh-toolbar :set 'mh-tool-bar-letter-buttons-set
"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)))))))

View file

@ -1742,7 +1742,7 @@ messages in that region.
(easy-menu-add mh-folder-message-menu)
(easy-menu-add mh-folder-folder-menu)
(set (make-local-variable 'tool-bar-map) mh-folder-tool-bar-map)
(mh-funcall-if-exists mh-toolbar-init :folder)
(mh-funcall-if-exists mh-tool-bar-init :folder)
(if (and mh-xemacs-flag
font-lock-auto-fontify)
(turn-on-font-lock))) ; Force font-lock in XEmacs.

View file

@ -1120,7 +1120,7 @@ See also `mh-folder-mode'.
font-lock-auto-fontify)
(turn-on-font-lock))
(set (make-local-variable 'tool-bar-map) mh-show-tool-bar-map)
(mh-funcall-if-exists mh-toolbar-init :show)
(mh-funcall-if-exists mh-tool-bar-init :show)
(when mh-decode-mime-flag
(mh-make-local-hook 'kill-buffer-hook)
(add-hook 'kill-buffer-hook 'mh-mime-cleanup nil t))