Mercurial > emacs
annotate lisp/erc/erc-menu.el @ 94990:eab7f768651d
*** empty log message ***
author | John Paul Wallington <jpw@pobox.com> |
---|---|
date | Thu, 15 May 2008 02:01:46 +0000 |
parents | 2a734255bcc7 |
children | b52fd6b0e051 |
rev | line source |
---|---|
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
1 ;; erc-menu.el -- Menu-bar definitions for ERC |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
2 |
76856 | 3 ;; Copyright (C) 2001, 2002, 2004, 2005, 2006, |
79706 | 4 ;; 2007, 2008 Free Software Foundation, Inc. |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
5 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
6 ;; Author: Mario Lang <mlang@delysid.org> |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
7 ;; Keywords: comm, processes, menu |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
8 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
10 |
94660
2a734255bcc7
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79706
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
94660
2a734255bcc7
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79706
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
2a734255bcc7
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79706
diff
changeset
|
14 ;; (at your option) any later version. |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
15 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
20 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
94660
2a734255bcc7
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79706
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
23 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
24 ;;; Commentary: |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
25 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
26 ;; Loading this file defines a menu for ERC. |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
27 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
28 ;;; Code: |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
29 |
75259 | 30 (require 'erc) |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
31 (require 'easymenu) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
32 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
33 (defvar erc-menu-definition |
74093 | 34 (list "ERC" |
35 ["Connect to server..." erc t] | |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
36 ["Disconnect from server..." erc-quit-server erc-server-connected] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
37 "-" |
68814
fe9073ac802e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents:
68451
diff
changeset
|
38 ["List channels..." erc-list-channels |
fe9073ac802e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents:
68451
diff
changeset
|
39 (and erc-server-connected (fboundp 'erc-list-channels))] |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
40 ["Join channel..." erc-join-channel erc-server-connected] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
41 ["Start a query..." erc-cmd-QUERY erc-server-connected] |
75259 | 42 ["Input action..." erc-input-action (erc-default-target)] |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
43 "-" |
75259 | 44 (list |
45 "Current channel" | |
46 ["List users in channel" erc-channel-names erc-channel-users] | |
47 ["List channel operators" erc-cmd-OPS erc-channel-users] | |
48 ["Set topic..." erc-set-topic | |
49 (and (and (erc-default-target) (not (erc-query-buffer-p))) | |
50 (or (not (member "t" erc-channel-modes)) | |
51 (erc-channel-user-op-p (erc-current-nick))))] | |
52 (list "Channel modes" | |
53 ["Change mode..." erc-insert-mode-command | |
54 (erc-channel-user-op-p (erc-current-nick))] | |
55 ["No external send" (erc-toggle-channel-mode "n") | |
56 :active (erc-channel-user-op-p (erc-current-nick)) | |
57 :style toggle :selected (member "n" erc-channel-modes)] | |
58 ["Topic set by channel operator" (erc-toggle-channel-mode "t") | |
59 :style toggle :selected (member "t" erc-channel-modes) | |
60 :active (erc-channel-user-op-p (erc-current-nick))] | |
61 ["Invite only" (erc-toggle-channel-mode "i") | |
62 :style toggle :selected (member "i" erc-channel-modes) | |
63 :active (erc-channel-user-op-p (erc-current-nick))] | |
64 ["Private" (erc-toggle-channel-mode "p") | |
65 :style toggle :selected (member "p" erc-channel-modes) | |
66 :active (erc-channel-user-op-p (erc-current-nick))] | |
67 ["Secret" (erc-toggle-channel-mode "s") | |
68 :style toggle :selected (member "s" erc-channel-modes) | |
69 :active (erc-channel-user-op-p (erc-current-nick))] | |
70 ["Moderated" (erc-toggle-channel-mode "m") | |
71 :style toggle :selected (member "m" erc-channel-modes) | |
72 :active (erc-channel-user-op-p (erc-current-nick))] | |
73 ["Set a limit..." erc-set-channel-limit | |
74 (erc-channel-user-op-p (erc-current-nick))] | |
75 ["Set a key..." erc-set-channel-key | |
76 (erc-channel-user-op-p (erc-current-nick))]) | |
76856 | 77 ["Leave this channel..." erc-part-from-channel erc-channel-users]) |
78 "-" | |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
79 (list "Pals, fools and other keywords" |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
80 ["Add pal..." erc-add-pal] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
81 ["Delete pal..." erc-delete-pal] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
82 ["Add fool..." erc-add-fool] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
83 ["Delete fool..." erc-delete-fool] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
84 ["Add keyword..." erc-add-keyword] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
85 ["Delete keyword..." erc-delete-keyword] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
86 ["Add dangerous host..." erc-add-dangerous-host] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
87 ["Delete dangerous host..." erc-delete-dangerous-host]) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
88 "-" |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
89 (list "IRC services" |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
90 ["Identify to NickServ..." erc-nickserv-identify |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
91 (and erc-server-connected (functionp 'erc-nickserv-identify))]) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
92 "-" |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
93 ["Save buffer in log" erc-save-buffer-in-logs |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
94 (fboundp 'erc-save-buffer-in-logs)] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
95 ["Truncate buffer" erc-truncate-buffer (fboundp 'erc-truncate-buffer)] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
96 "-" |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
97 ["Customize ERC" (customize-group 'erc) t] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
98 ["Enable/Disable ERC Modules" (customize-variable 'erc-modules) t] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
99 ["Show ERC version" erc-version t]) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
100 "ERC menu definition.") |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
101 |
75259 | 102 (defvar erc-menu-defined nil |
103 "Internal variable used to keep track of whether we've defined the | |
104 ERC menu yet.") | |
105 | |
106 ;;;###autoload (autoload 'erc-menu-mode "erc-menu" nil t) | |
107 (define-erc-module menu nil | |
108 "Enable a menu in ERC buffers." | |
109 ((unless erc-menu-defined | |
110 ;; make sure the menu only gets defined once, since Emacs 22 | |
111 ;; activates it immediately | |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
112 (easy-menu-define erc-menu erc-mode-map "ERC menu" erc-menu-definition) |
75259 | 113 (setq erc-menu-defined t)) |
114 (if (featurep 'xemacs) | |
115 (progn | |
116 ;; the menu isn't automatically added to the menu bar in | |
117 ;; XEmacs | |
118 (add-hook 'erc-mode-hook 'erc-menu-add) | |
119 (dolist (buffer (erc-buffer-list)) | |
120 (with-current-buffer buffer (erc-menu-add)))) | |
121 (erc-menu-add))) | |
122 ((if (featurep 'xemacs) | |
123 (progn | |
124 (remove-hook 'erc-mode-hook 'erc-menu-add) | |
125 (dolist (buffer (erc-buffer-list)) | |
126 (with-current-buffer buffer (erc-menu-remove)))) | |
127 (erc-menu-remove) | |
128 ;; `easy-menu-remove' is a no-op in Emacs 22 | |
129 (message "You might have to restart Emacs to remove the ERC menu")))) | |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
130 |
75259 | 131 ;; silence byte-compiler warning |
132 (eval-when-compile | |
133 (defvar erc-menu nil)) | |
134 | |
135 (defun erc-menu-add () | |
136 "Add the ERC menu to the current buffer." | |
137 (easy-menu-add erc-menu erc-mode-map)) | |
138 | |
139 (defun erc-menu-remove () | |
140 "Remove the ERC menu from the current buffer." | |
141 (easy-menu-remove erc-menu)) | |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
142 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
143 (provide 'erc-menu) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
144 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
145 ;;; erc-menu.el ends here |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
146 ;; |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
147 ;; Local Variables: |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
148 ;; indent-tabs-mode: t |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
149 ;; tab-width: 8 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
150 ;; End: |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
151 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
152 ;; arch-tag: 671219f2-b082-4753-a185-1d0c7e0c05bd |