]> code.delx.au - gnu-emacs/blob - lisp/erc/erc-menu.el
Merged from emacs@sv.gnu.org. Last-minute emacsclient rewrites be damned!
[gnu-emacs] / lisp / erc / erc-menu.el
1 ;; erc-menu.el -- Menu-bar definitions for ERC
2
3 ;; Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
4
5 ;; Author: Mario Lang <mlang@delysid.org>
6 ;; Keywords: comm, processes, menu
7
8 ;; This file is part of GNU Emacs.
9
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
14
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 ;; Boston, MA 02110-1301, USA.
24
25 ;;; Commentary:
26
27 ;; Loading this file defines a menu for ERC.
28
29 ;;; Code:
30
31 ;(require 'erc)
32 (require 'easymenu)
33
34 (defvar erc-menu-definition
35 (list "ERC"
36 ["Connect to server..." erc t]
37 ["Disconnect from server..." erc-quit-server erc-server-connected]
38 "-"
39 ["List channels..." erc-list-channels
40 (and erc-server-connected (fboundp 'erc-list-channels))]
41 ["Join channel..." erc-join-channel erc-server-connected]
42 ["Start a query..." erc-cmd-QUERY erc-server-connected]
43 "-"
44 ["List users in channel" erc-channel-names erc-channel-users]
45 ["List channel operators" erc-cmd-OPS erc-channel-users]
46 ["Input action..." erc-input-action (erc-default-target)]
47 ["Set topic..." erc-set-topic
48 (and (and (erc-default-target) (not (erc-query-buffer-p)))
49 (or (not (member "t" erc-channel-modes))
50 (erc-channel-user-op-p (erc-current-nick))))]
51 (list "Channel modes"
52 ["Change mode..." erc-insert-mode-command
53 (erc-channel-user-op-p (erc-current-nick))]
54 ["No external send" (erc-toggle-channel-mode "n")
55 :active (erc-channel-user-op-p (erc-current-nick))
56 :style toggle :selected (member "n" erc-channel-modes)]
57 ["Topic set by channel operator" (erc-toggle-channel-mode "t")
58 :style toggle :selected (member "t" erc-channel-modes)
59 :active (erc-channel-user-op-p (erc-current-nick))]
60 ["Invite only" (erc-toggle-channel-mode "i")
61 :style toggle :selected (member "i" erc-channel-modes)
62 :active (erc-channel-user-op-p (erc-current-nick))]
63 ["Private" (erc-toggle-channel-mode "p")
64 :style toggle :selected (member "p" erc-channel-modes)
65 :active (erc-channel-user-op-p (erc-current-nick))]
66 ["Secret" (erc-toggle-channel-mode "s")
67 :style toggle :selected (member "s" erc-channel-modes)
68 :active (erc-channel-user-op-p (erc-current-nick))]
69 ["Moderated" (erc-toggle-channel-mode "m")
70 :style toggle :selected (member "m" erc-channel-modes)
71 :active (erc-channel-user-op-p (erc-current-nick))]
72 ["Set a limit..." erc-set-channel-limit
73 (erc-channel-user-op-p (erc-current-nick))]
74 ["Set a key..." erc-set-channel-key
75 (erc-channel-user-op-p (erc-current-nick))])
76 ["Leave this channel..." erc-part-from-channel erc-channel-users]
77 "-"
78 (list "Pals, fools and other keywords"
79 ["Add pal..." erc-add-pal]
80 ["Delete pal..." erc-delete-pal]
81 ["Add fool..." erc-add-fool]
82 ["Delete fool..." erc-delete-fool]
83 ["Add keyword..." erc-add-keyword]
84 ["Delete keyword..." erc-delete-keyword]
85 ["Add dangerous host..." erc-add-dangerous-host]
86 ["Delete dangerous host..." erc-delete-dangerous-host])
87 "-"
88 (list "IRC services"
89 ["Identify to NickServ..." erc-nickserv-identify
90 (and erc-server-connected (functionp 'erc-nickserv-identify))])
91 "-"
92 ["Save buffer in log" erc-save-buffer-in-logs
93 (fboundp 'erc-save-buffer-in-logs)]
94 ["Truncate buffer" erc-truncate-buffer (fboundp 'erc-truncate-buffer)]
95 "-"
96 ["Customize ERC" (customize-group 'erc) t]
97 ["Enable/Disable ERC Modules" (customize-variable 'erc-modules) t]
98 ["Show ERC version" erc-version t])
99 "ERC menu definition.")
100
101 ;; `erc-mode-map' must be defined before doing this
102 (eval-after-load "erc"
103 '(progn
104 (easy-menu-define erc-menu erc-mode-map "ERC menu" erc-menu-definition)
105 (easy-menu-add erc-menu erc-mode-map)
106
107 ;; for some reason the menu isn't automatically added to the menu bar
108 (when (featurep 'xemacs)
109 (add-hook 'erc-mode-hook
110 (lambda () (easy-menu-add erc-menu erc-mode-map))))))
111
112 (provide 'erc-menu)
113
114 ;;; erc-menu.el ends here
115 ;;
116 ;; Local Variables:
117 ;; indent-tabs-mode: t
118 ;; tab-width: 8
119 ;; End:
120
121 ;; arch-tag: 671219f2-b082-4753-a185-1d0c7e0c05bd