aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/erc/erc-button.el
diff options
context:
space:
mode:
authorMiles Bader2008-01-30 07:57:28 +0000
committerMiles Bader2008-01-30 07:57:28 +0000
commitd235ca2ff8fab139ce797757fcb159d1e28fa7e0 (patch)
tree96c5cd1a06a0d9dc26e8470c6eabfc032c0046f3 /lisp/erc/erc-button.el
parent3709a060f679dba14df71ae64a0035fa2b5b3106 (diff)
parent02cbe062bee38a6705bafb1699d77e3c44cfafcf (diff)
downloademacs-d235ca2ff8fab139ce797757fcb159d1e28fa7e0.tar.gz
emacs-d235ca2ff8fab139ce797757fcb159d1e28fa7e0.zip
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-324
Diffstat (limited to 'lisp/erc/erc-button.el')
-rw-r--r--lisp/erc/erc-button.el26
1 files changed, 15 insertions, 11 deletions
diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el
index a74d56b90bd..7e45c6cd4ea 100644
--- a/lisp/erc/erc-button.el
+++ b/lisp/erc/erc-button.el
@@ -57,16 +57,15 @@
57 ((add-hook 'erc-insert-modify-hook 'erc-button-add-buttons 'append) 57 ((add-hook 'erc-insert-modify-hook 'erc-button-add-buttons 'append)
58 (add-hook 'erc-send-modify-hook 'erc-button-add-buttons 'append) 58 (add-hook 'erc-send-modify-hook 'erc-button-add-buttons 'append)
59 (add-hook 'erc-complete-functions 'erc-button-next) 59 (add-hook 'erc-complete-functions 'erc-button-next)
60 (add-hook 'erc-mode-hook 'erc-button-add-keys)) 60 (add-hook 'erc-mode-hook 'erc-button-setup))
61 ((remove-hook 'erc-insert-modify-hook 'erc-button-add-buttons) 61 ((remove-hook 'erc-insert-modify-hook 'erc-button-add-buttons)
62 (remove-hook 'erc-send-modify-hook 'erc-button-add-buttons) 62 (remove-hook 'erc-send-modify-hook 'erc-button-add-buttons)
63 (remove-hook 'erc-complete-functions 'erc-button-next) 63 (remove-hook 'erc-complete-functions 'erc-button-next)
64 (remove-hook 'erc-mode-hook 'erc-button-add-keys))) 64 (remove-hook 'erc-mode-hook 'erc-button-setup)
65 65 (when (featurep 'xemacs)
66;; Make XEmacs use `erc-button-face'. 66 (dolist (buffer (erc-buffer-list))
67(when (featurep 'xemacs) 67 (with-current-buffer buffer
68 (add-hook 'erc-mode-hook 68 (kill-local-variable 'widget-button-face))))))
69 (lambda () (set (make-local-variable 'widget-button-face) nil))))
70 69
71;;; Variables 70;;; Variables
72 71
@@ -247,8 +246,12 @@ constituents.")
247 "Internal variable used to keep track of whether we've added the 246 "Internal variable used to keep track of whether we've added the
248global-level ERC button keys yet.") 247global-level ERC button keys yet.")
249 248
250(defun erc-button-add-keys () 249(defun erc-button-setup ()
251 "Add ERC mode-level button movement keys. This is only done once." 250 "Add ERC mode-level button movement keys. This is only done once."
251 ;; Make XEmacs use `erc-button-face'.
252 (when (featurep 'xemacs)
253 (set (make-local-variable 'widget-button-face) nil))
254 ;; Add keys.
252 (unless erc-button-keys-added 255 (unless erc-button-keys-added
253 (define-key erc-mode-map (kbd "<backtab>") 'erc-button-previous) 256 (define-key erc-mode-map (kbd "<backtab>") 'erc-button-previous)
254 (setq erc-button-keys-added t))) 257 (setq erc-button-keys-added t)))
@@ -299,9 +302,10 @@ specified by `erc-button-alist'."
299 (setq bounds (bounds-of-thing-at-point 'word)) 302 (setq bounds (bounds-of-thing-at-point 'word))
300 (setq word (buffer-substring-no-properties 303 (setq word (buffer-substring-no-properties
301 (car bounds) (cdr bounds))) 304 (car bounds) (cdr bounds)))
302 (if (erc-get-server-user word) 305 (when (or (and (erc-server-buffer-p) (erc-get-server-user word))
303 (erc-button-add-button (car bounds) (cdr bounds) 306 (and erc-channel-users (erc-get-channel-user word)))
304 fun t (list word))))))) 307 (erc-button-add-button (car bounds) (cdr bounds)
308 fun t (list word)))))))
305 309
306(defun erc-button-add-buttons-1 (regexp entry) 310(defun erc-button-add-buttons-1 (regexp entry)
307 "Search through the buffer for matches to ENTRY and add buttons." 311 "Search through the buffer for matches to ENTRY and add buttons."