Mercurial > emacs
annotate lisp/erc/erc-menu.el @ 77857:da20d5887272
Remove dead URL for Fortune, and update URLs for Hideshow, Org, EDB,
and Remember.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 02 Jun 2007 11:02:32 +0000 |
parents | 2fae574a2382 |
children | 85d67fae9a94 |
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, |
4 ;; 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
|
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 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
11 ;; 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
|
12 ;; 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
|
13 ;; 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
|
14 ;; any later version. |
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 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
22 ;; 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
|
23 ;; 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
|
24 ;; Boston, MA 02110-1301, USA. |
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 ;;; Commentary: |
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 ;; 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
|
29 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
30 ;;; Code: |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
31 |
75259 | 32 (require 'erc) |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
33 (require 'easymenu) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
34 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
35 (defvar erc-menu-definition |
74093 | 36 (list "ERC" |
37 ["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
|
38 ["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
|
39 "-" |
68814
fe9073ac802e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents:
68451
diff
changeset
|
40 ["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
|
41 (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
|
42 ["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
|
43 ["Start a query..." erc-cmd-QUERY erc-server-connected] |
75259 | 44 ["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
|
45 "-" |
75259 | 46 (list |
47 "Current channel" | |
48 ["List users in channel" erc-channel-names erc-channel-users] | |
49 ["List channel operators" erc-cmd-OPS erc-channel-users] | |
50 ["Set topic..." erc-set-topic | |
51 (and (and (erc-default-target) (not (erc-query-buffer-p))) | |
52 (or (not (member "t" erc-channel-modes)) | |
53 (erc-channel-user-op-p (erc-current-nick))))] | |
54 (list "Channel modes" | |
55 ["Change mode..." erc-insert-mode-command | |
56 (erc-channel-user-op-p (erc-current-nick))] | |
57 ["No external send" (erc-toggle-channel-mode "n") | |
58 :active (erc-channel-user-op-p (erc-current-nick)) | |
59 :style toggle :selected (member "n" erc-channel-modes)] | |
60 ["Topic set by channel operator" (erc-toggle-channel-mode "t") | |
61 :style toggle :selected (member "t" erc-channel-modes) | |
62 :active (erc-channel-user-op-p (erc-current-nick))] | |
63 ["Invite only" (erc-toggle-channel-mode "i") | |
64 :style toggle :selected (member "i" erc-channel-modes) | |
65 :active (erc-channel-user-op-p (erc-current-nick))] | |
66 ["Private" (erc-toggle-channel-mode "p") | |
67 :style toggle :selected (member "p" erc-channel-modes) | |
68 :active (erc-channel-user-op-p (erc-current-nick))] | |
69 ["Secret" (erc-toggle-channel-mode "s") | |
70 :style toggle :selected (member "s" erc-channel-modes) | |
71 :active (erc-channel-user-op-p (erc-current-nick))] | |
72 ["Moderated" (erc-toggle-channel-mode "m") | |
73 :style toggle :selected (member "m" erc-channel-modes) | |
74 :active (erc-channel-user-op-p (erc-current-nick))] | |
75 ["Set a limit..." erc-set-channel-limit | |
76 (erc-channel-user-op-p (erc-current-nick))] | |
77 ["Set a key..." erc-set-channel-key | |
78 (erc-channel-user-op-p (erc-current-nick))]) | |
76856 | 79 ["Leave this channel..." erc-part-from-channel erc-channel-users]) |
80 "-" | |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
81 (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
|
82 ["Add pal..." erc-add-pal] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
83 ["Delete pal..." erc-delete-pal] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
84 ["Add fool..." erc-add-fool] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
85 ["Delete fool..." erc-delete-fool] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
86 ["Add keyword..." erc-add-keyword] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
87 ["Delete keyword..." erc-delete-keyword] |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
88 ["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
|
89 ["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
|
90 "-" |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
91 (list "IRC services" |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
92 ["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
|
93 (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
|
94 "-" |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
95 ["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
|
96 (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
|
97 ["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
|
98 "-" |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
99 ["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
|
100 ["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
|
101 ["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
|
102 "ERC menu definition.") |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
103 |
75259 | 104 (defvar erc-menu-defined nil |
105 "Internal variable used to keep track of whether we've defined the | |
106 ERC menu yet.") | |
107 | |
108 ;;;###autoload (autoload 'erc-menu-mode "erc-menu" nil t) | |
109 (define-erc-module menu nil | |
110 "Enable a menu in ERC buffers." | |
111 ((unless erc-menu-defined | |
112 ;; make sure the menu only gets defined once, since Emacs 22 | |
113 ;; activates it immediately | |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
114 (easy-menu-define erc-menu erc-mode-map "ERC menu" erc-menu-definition) |
75259 | 115 (setq erc-menu-defined t)) |
116 (if (featurep 'xemacs) | |
117 (progn | |
118 ;; the menu isn't automatically added to the menu bar in | |
119 ;; XEmacs | |
120 (add-hook 'erc-mode-hook 'erc-menu-add) | |
121 (dolist (buffer (erc-buffer-list)) | |
122 (with-current-buffer buffer (erc-menu-add)))) | |
123 (erc-menu-add))) | |
124 ((if (featurep 'xemacs) | |
125 (progn | |
126 (remove-hook 'erc-mode-hook 'erc-menu-add) | |
127 (dolist (buffer (erc-buffer-list)) | |
128 (with-current-buffer buffer (erc-menu-remove)))) | |
129 (erc-menu-remove) | |
130 ;; `easy-menu-remove' is a no-op in Emacs 22 | |
131 (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
|
132 |
75259 | 133 ;; silence byte-compiler warning |
134 (eval-when-compile | |
135 (defvar erc-menu nil)) | |
136 | |
137 (defun erc-menu-add () | |
138 "Add the ERC menu to the current buffer." | |
139 (easy-menu-add erc-menu erc-mode-map)) | |
140 | |
141 (defun erc-menu-remove () | |
142 "Remove the ERC menu from the current buffer." | |
143 (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
|
144 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
145 (provide 'erc-menu) |
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 ;;; erc-menu.el ends here |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
148 ;; |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
149 ;; Local Variables: |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
150 ;; indent-tabs-mode: t |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
151 ;; tab-width: 8 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
152 ;; End: |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
153 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
154 ;; arch-tag: 671219f2-b082-4753-a185-1d0c7e0c05bd |