summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Levitt <antoine.levitt@gmail.com>2011-09-23 17:22:31 -0400
committerChong Yidong <cyd@stupidchicken.com>2011-09-23 17:22:31 -0400
commit953ea722f439a38914cdf723341ac7b41deeec5f (patch)
tree743259d63f2fb6c20eb2561ad8a8d3f12a258af5
parent0a39f27eb9b78ceacdf351eba4549efd3323c88d (diff)
downloademacs-953ea722f439a38914cdf723341ac7b41deeec5f.tar.gz
* erc-button.el (erc-button-next-function): Scoping fix (Bug#9487).
-rw-r--r--lisp/erc/ChangeLog5
-rw-r--r--lisp/erc/erc-button.el26
2 files changed, 18 insertions, 13 deletions
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index 1560f2a9049..7c7f10de2c8 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -1,3 +1,8 @@
+2011-09-23 Antoine Levitt <antoine.levitt@gmail.com>
+
+ * erc-button.el (erc-button-next-function): Scoping fix
+ (Bug#9487).
+
2011-07-04 Vivek Dasmohapatra <vivek@etla.org>
* erc.el (erc-generate-new-buffer-name): Reuse old buffer names
diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el
index 3a897347dea..7fbbbc317d0 100644
--- a/lisp/erc/erc-button.el
+++ b/lisp/erc/erc-button.el
@@ -430,19 +430,19 @@ call it with the value of the `erc-data' text property."
(defun erc-button-next-function ()
"Pseudo completion function that actually jumps to the next button.
For use on `completion-at-point-functions'."
- (let ((here (point)))
- (when (< here (erc-beg-of-input-line))
- (lambda ()
- (while (and (get-text-property here 'erc-callback)
- (not (= here (point-max))))
- (setq here (1+ here)))
- (while (and (not (get-text-property here 'erc-callback))
- (not (= here (point-max))))
- (setq here (1+ here)))
- (if (< here (point-max))
- (goto-char here)
- (error "No next button"))
- t))))
+ (when (< (point) (erc-beg-of-input-line))
+ `(lambda ()
+ (let ((here ,(point)))
+ (while (and (get-text-property here 'erc-callback)
+ (not (= here (point-max))))
+ (setq here (1+ here)))
+ (while (and (not (get-text-property here 'erc-callback))
+ (not (= here (point-max))))
+ (setq here (1+ here)))
+ (if (< here (point-max))
+ (goto-char here)
+ (error "No next button"))
+ t))))
(defun erc-button-next ()
"Go to the next button in this buffer."