* locate-file-completion-table: Fixed point from lexical-binding?
@ 2012-02-20 21:47 Aaron S. Hawley
2012-02-22 17:38 ` Aaron S. Hawley
0 siblings, 1 reply; 3+ messages in thread
From: Aaron S. Hawley @ 2012-02-20 21:47 UTC (permalink / raw)
To: emacs-devel
Using this function and passing a lambda results in a recursive loop
that runs into the safety limit. It worked in 23.
(locate-file-completion-table
load-path '("\\.elc\\'" "\\.el\\'") ""
(lambda (s) (string-match "\\.elc?\\'" s)) t)
Lisp error: (error "Lisp nesting exceeds `max-lisp-eval-depth'")
--
In general, we reserve the right to have a poor
memory--the computer, however, is supposed to
remember! Poor computer. -- Guy Lewis Steele Jr.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: locate-file-completion-table: Fixed point from lexical-binding?
2012-02-20 21:47 locate-file-completion-table: Fixed point from lexical-binding? Aaron S. Hawley
@ 2012-02-22 17:38 ` Aaron S. Hawley
2012-02-23 6:27 ` Stefan Monnier
0 siblings, 1 reply; 3+ messages in thread
From: Aaron S. Hawley @ 2012-02-22 17:38 UTC (permalink / raw)
To: emacs-devel
On 2/20/12, Aaron S. Hawley <aaron.s.hawley@gmail.com> wrote:
> Using this function and passing a lambda results in a recursive loop
> that runs into the safety limit. It worked in 23.
>
> (locate-file-completion-table
> load-path '("\\.elc\\'" "\\.el\\'") ""
> (lambda (s) (string-match "\\.elc?\\'" s)) t)
> Lisp error: (error "Lisp nesting exceeds `max-lisp-eval-depth'")
The problem started after revision 103798. This patch seems to fix
the issue for me.
--- minibuffer.el
+++ minibuffer.el
@@ -229,6 +229,7 @@
;; Notice that `pred' may not be a function in some abusive cases.
(when (functionp pred)
(setq pred
+ (let ((pred pred))
;; Predicates are called differently depending on the nature of
;; the completion table :-(
(cond
@@ -240,7 +241,7 @@
(lambda (s) (funcall pred (concat prefix s))))
(t ;Lists and alists.
(lambda (s)
- (funcall pred (concat prefix (if (consp s) (car s) s))))))))
+ (funcall pred (concat prefix (if (consp s) (car s) s)))))))))
(if (eq (car-safe action) 'boundaries)
(let* ((len (length prefix))
(bound (completion-boundaries string table pred (cdr action))))
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: locate-file-completion-table: Fixed point from lexical-binding?
2012-02-22 17:38 ` Aaron S. Hawley
@ 2012-02-23 6:27 ` Stefan Monnier
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2012-02-23 6:27 UTC (permalink / raw)
To: Aaron S. Hawley; +Cc: emacs-devel
> The problem started after revision 103798. This patch seems to fix
> the issue for me.
Good catch, thank you. Once again, `setq' bites.
I installed the fix below which should work as well but avoids the use
of setq instead.
Stefan
=== modified file 'lisp/minibuffer.el'
--- lisp/minibuffer.el 2012-02-15 13:45:02 +0000
+++ lisp/minibuffer.el 2012-02-23 04:31:34 +0000
@@ -226,9 +226,10 @@
(defun completion-table-with-context (prefix table string pred action)
;; TODO: add `suffix' maybe?
+ (let ((pred
+ (if (not (functionp pred))
;; Notice that `pred' may not be a function in some abusive cases.
- (when (functionp pred)
- (setq pred
+ pred
;; Predicates are called differently depending on the nature of
;; the completion table :-(
(cond
@@ -240,7 +241,7 @@
(lambda (s) (funcall pred (concat prefix s))))
(t ;Lists and alists.
(lambda (s)
- (funcall pred (concat prefix (if (consp s) (car s) s))))))))
+ (funcall pred (concat prefix (if (consp s) (car s) s)))))))))
(if (eq (car-safe action) 'boundaries)
(let* ((len (length prefix))
(bound (completion-boundaries string table pred (cdr action))))
@@ -249,7 +250,7 @@
(cond
;; In case of try-completion, add the prefix.
((stringp comp) (concat prefix comp))
- (t comp)))))
+ (t comp))))))
(defun completion-table-with-terminator (terminator table string pred action)
"Construct a completion table like TABLE but with an extra TERMINATOR.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-02-23 6:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-20 21:47 locate-file-completion-table: Fixed point from lexical-binding? Aaron S. Hawley
2012-02-22 17:38 ` Aaron S. Hawley
2012-02-23 6:27 ` Stefan Monnier
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).