Skip to content
Snippets Groups Projects
toolbar-x.el 81 KiB
Newer Older
				       (get major-mode 'mode-class)))))

    ;; Emacs only
    (write-file :image "saveas"
		:command write-file
		:enable (not
			 (window-minibuffer-p
			  (frame-selected-window menu-updating-frame)))
		:insert [t nil]
		:help "Write current buffer to another file"
		:visible (or buffer-file-name
			     (not (eq 'special (get major-mode 'mode-class)))))

    (undo :image ["undo" toolbar-undo-icon]
	  :command [undo toolbar-undo]
	  :enable [(and (not buffer-read-only)
			(not (eq t buffer-undo-list))
			(if (eq last-command 'undo)
			    pending-undo-list
			  (consp buffer-undo-list)))
		   t]
	  :help ["Undo last operation" "Undo edit"]
	  :visible (not (eq 'special (get major-mode 'mode-class))))

    (cut :image ["cut" toolbar-cut-icon]
	 :help ["Delete text in region and copy it to the clipboard"
		"Kill region"]
	 :command [clipboard-kill-region toolbar-cut]
	 :visible (not (eq 'special (get major-mode 'mode-class))))

    (copy :image ["copy" toolbar-copy-icon]
	  :help ["Copy text in region to the clipboard" "Copy region"]
	  :command [clipboard-kill-ring-save toolbar-copy])

    (paste :image ["paste" toolbar-paste-icon]
	   :help ["Paste text from clipboard" "Paste from clipboard"]
	   :command [clipboard-yank toolbar-paste]
	   :visible (not (eq 'special (get major-mode 'mode-class))))

    ;; Emacs only
    (search-forward :command nonincremental-search-forward
		    :help "Search forward for a string"
		    :image "search"
		    :insert [t nil])

    (search-replace
     :image ["search-replace" toolbar-replace-icon]
     :command [query-replace toolbar-replace]
     :help ["Replace string interactively, ask about each occurrence"
	    "Search & Replace"])

    (print-buffer :image ["print" toolbar-printer-icon]
		  :command [print-buffer toolbar-print]
		  :help ["Print current buffer with page headings"
			 "Print buffer"])

    ;; Emacs only
    (customize :image "preferences"
	       :command customize
	       :help "Edit preferences (customize)"
	       :insert [t nil])

    ;; Emacs only
    (help :image "help"
	  :command (lambda () (interactive) (popup-menu menu-bar-help-menu))
	  :help "Pop up the Help menu"
	  :insert [t nil])

    ;; Emacs only
    (kill-buffer :command kill-this-buffer
		 :enable (kill-this-buffer-enabled-p)
		 :help "Discard current buffer"
		 :image "close"
		 :insert [t nil])

    ;; Emacs only
    (exit-emacs :image "exit"
		:command save-buffers-kill-emacs
		:help "Offer to save unsaved buffers, then exit Emacs"
		:insert [t nil])

    (spell-buffer :image ["spell" toolbar-spell-icon]
		  :command [ispell-buffer toolbar-ispell]
		  :help ["Check spelling of selected buffer" "Check spelling"])

    (info :image ["info" toolbar-info-icon]
	  :command [info toolbar-info]
	  :help ["Enter Info, the documentation browser" "Info documentation"])

    ;; XEmacs only
    (mail :image toolbar-mail-icon
	  :command toolbar-mail
	  :help "Read mail"
	  :insert [nil t])

    ;; XEmacs only
    (compile :image toolbar-compile-icon
	     :command toolbar-compile
	     :help "Start a compilation"
	     :insert [nil t])

    ;; XEmacs only
    (debug :image toolbar-debug-icon
	   :command toolbar-debug
	   :help "Start a debugger"
	   :insert [nil t])

    ;; XEmacs only
    (news :image toolbar-news-icon
	  :command toolbar-news
	  :help "Read news"
	  :insert [nil t]))
  "A meaning alist with definition of the default buttons.
The following buttons are available:

* Both Emacs and XEmacs: `open-file', `dired', `save-buffer',
`undo', `cut', `copy', `paste', `search-replace', `print-buffer',
`spell-buffer', `info'.

* Emacs only: `write-file', `search-forward', `customize', `help',
`kill-buffer', `exit-emacs'.

* XEmacs only: `mail', `compile', `debug', `news'.

To reproduce the default toolbar in both editors with use as BUTTON
in `toolbarx-install-toolbar':

\(toolbarx-install-toolbar
 '([(open-file dired kill-buffer save-buffer write-file undo cut
               copy paste search-forward print-buffer customize help)
    (open-file dired save-buffer print-buffer cut copy paste undo
               spell-buffer search-replace mail info compile debug news)])
 toolbarx-default-toolbar-meaning-alist)

Ps.: there are more buttons available than suggested in the
expression above.")

(provide 'toolbar-x)

;;; toolbar-x.el ends here