Mercurial > emacs
annotate lisp/erc/erc-menu.el @ 75786:732f9b589f8e
(change-major-mode-with-file-name): Fix typo in docstring.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Sun, 11 Feb 2007 02:28:57 +0000 |
parents | 7a3f13e2dd57 |
children | 2fae574a2382 |
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 |
75346 | 3 ;; Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
4 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
5 ;; 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
|
6 ;; Keywords: comm, processes, menu |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
7 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
8 ;; 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
|
9 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
10 ;; GNU Emacs is free software; you can redistribute it and/or modify |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
11 ;; it under the terms of the GNU General Public License as published by |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
13 ;; any later version. |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
14 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
15 ;; 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
|
16 ;; 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
|
17 ;; 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
|
18 ;; 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
|
19 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
20 ;; You should have received a copy of the GNU General Public License |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
23 ;; Boston, MA 02110-1301, USA. |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
24 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
25 ;;; Commentary: |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
26 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
27 ;; 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
|
28 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
29 ;;; Code: |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
30 |
75259 | 31 (require 'erc) |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
32 (require 'easymenu) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
33 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
34 (defvar erc-menu-definition |
74093 | 35 (list "ERC" |
36 ["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
|
37 ["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
|
38 "-" |
68814
fe9073ac802e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents:
68451
diff
changeset
|
39 ["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
|
40 (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
|
41 ["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
|
42 ["Start a query..." erc-cmd-QUERY erc-server-connected] |
75259 | 43 ["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
|
44 "-" |
75259 | 45 (list |
46 "Current channel" | |
47 ["List users in channel" erc-channel-names erc-channel-users] | |
48 ["List channel operators" erc-cmd-OPS erc-channel-users] | |
49 ["Set topic..." erc-set-topic | |
50 (and (and (erc-default-target) (not (erc-query-buffer-p))) | |
51 (or (not (member "t" erc-channel-modes)) | |
52 (erc-channel-user-op-p (erc-current-nick))))] | |
53 (list "Channel modes" | |
54 ["Change mode..." erc-insert-mode-command | |
55 (erc-channel-user-op-p (erc-current-nick))] | |
56 ["No external send" (erc-toggle-channel-mode "n") | |
57 :active (erc-channel-user-op-p (erc-current-nick)) | |
58 :style toggle :selected (member "n" erc-channel-modes)] | |
59 ["Topic set by channel operator" (erc-toggle-channel-mode "t") | |
60 :style toggle :selected (member "t" erc-channel-modes) | |
61 :active (erc-channel-user-op-p (erc-current-nick))] | |
62 ["Invite only" (erc-toggle-channel-mode "i") | |
63 :style toggle :selected (member "i" erc-channel-modes) | |
64 :active (erc-channel-user-op-p (erc-current-nick))] | |
65 ["Private" (erc-toggle-channel-mode "p") | |
66 :style toggle :selected (member "p" erc-channel-modes) | |
67 :active (erc-channel-user-op-p (erc-current-nick))] | |
68 ["Secret" (erc-toggle-channel-mode "s") | |
69 :style toggle :selected (member "s" erc-channel-modes) | |
70 :active (erc-channel-user-op-p (erc-current-nick))] | |
71 ["Moderated" (erc-toggle-channel-mode "m") | |
72 :style toggle :selected (member "m" erc-channel-modes) | |
73 :active (erc-channel-user-op-p (erc-current-nick))] | |
74 ["Set a limit..." erc-set-channel-limit | |
75 (erc-channel-user-op-p (erc-current-nick))] | |
76 ["Set a key..." erc-set-channel-key | |
77 (erc-channel-user-op-p (erc-current-nick))]) | |
78 ["Leave this channel..." erc-part-from-channel erc-channel-users] | |
79 "-") | |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
80 (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
|
81 ["Add pal..." erc-add-pal] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
82 ["Delete pal..." erc-delete-pal] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
83 ["Add fool..." erc-add-fool] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
84 ["Delete fool..." erc-delete-fool] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
85 ["Add keyword..." erc-add-keyword] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
86 ["Delete keyword..." erc-delete-keyword] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
87 ["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
|
88 ["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
|
89 "-" |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
90 (list "IRC services" |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
91 ["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
|
92 (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
|
93 "-" |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
94 ["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
|
95 (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
|
96 ["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
|
97 "-" |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
98 ["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
|
99 ["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
|
100 ["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
|
101 "ERC menu definition.") |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
102 |
75259 | 103 (defvar erc-menu-defined nil |
104 "Internal variable used to keep track of whether we've defined the | |
105 ERC menu yet.") | |
106 | |
107 ;;;###autoload (autoload 'erc-menu-mode "erc-menu" nil t) | |
108 (define-erc-module menu nil | |
109 "Enable a menu in ERC buffers." | |
110 ((unless erc-menu-defined | |
111 ;; make sure the menu only gets defined once, since Emacs 22 | |
112 ;; activates it immediately | |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
113 (easy-menu-define erc-menu erc-mode-map "ERC menu" erc-menu-definition) |
75259 | 114 (setq erc-menu-defined t)) |
115 (if (featurep 'xemacs) | |
116 (progn | |
117 ;; the menu isn't automatically added to the menu bar in | |
118 ;; XEmacs | |
119 (add-hook 'erc-mode-hook 'erc-menu-add) | |
120 (dolist (buffer (erc-buffer-list)) | |
121 (with-current-buffer buffer (erc-menu-add)))) | |
122 (erc-menu-add))) | |
123 ((if (featurep 'xemacs) | |
124 (progn | |
125 (remove-hook 'erc-mode-hook 'erc-menu-add) | |
126 (dolist (buffer (erc-buffer-list)) | |
127 (with-current-buffer buffer (erc-menu-remove)))) | |
128 (erc-menu-remove) | |
129 ;; `easy-menu-remove' is a no-op in Emacs 22 | |
130 (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
|
131 |
75259 | 132 ;; silence byte-compiler warning |
133 (eval-when-compile | |
134 (defvar erc-menu nil)) | |
135 | |
136 (defun erc-menu-add () | |
137 "Add the ERC menu to the current buffer." | |
138 (easy-menu-add erc-menu erc-mode-map)) | |
139 | |
140 (defun erc-menu-remove () | |
141 "Remove the ERC menu from the current buffer." | |
142 (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
|
143 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
144 (provide 'erc-menu) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
145 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
146 ;;; erc-menu.el ends here |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
147 ;; |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
148 ;; Local Variables: |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
149 ;; indent-tabs-mode: t |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
150 ;; tab-width: 8 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
151 ;; End: |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
152 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
153 ;; arch-tag: 671219f2-b082-4753-a185-1d0c7e0c05bd |