emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C-r and C-s in minibuffer should search completion


From: Juri Linkov
Subject: Re: C-r and C-s in minibuffer should search completion
Date: Thu, 17 Apr 2008 02:16:45 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu)

>> + (defun internal-complete-buffer (string predicate flag)
>> +   (let ((table (mapcar 'buffer-name (buffer-list))))
>
> Why not just use (mapcar 'buffer-name (buffer-list)) rather than using
> a function as the completion table?
>
> If it's because of the hide-spaces argument to all-completions, then
> please write a comment about it,

The reason of adding the C version of internal-complete-buffer was the
dynamic nature of the buffer list.  This is described in detail in
http://thread.gmane.org/gmane.emacs.devel/58453

  Date: Wed, 16 Aug 2006 13:55:32 -0700 (PDT)
  From: "Stuart D. Herring" <address@hidden>
  To: address@hidden

  Fread_buffer directly uses Vbuffer_alist in its call to Fcompleting_read.
  This breaks if, while the minibuffer is active, the user switches buffers
  around.  The cons which was the head of the list when Fread_buffer was
  called will in general no longer be at the head, and so part of the list
  will vanish for completion purposes.  (Of course, it's slightly worse when
  REQUIRE-MATCH is set.)  Similar problems result from creating or killing
  buffers during the call.  I also have a vague suspicion that this
  procedure exposes the alist to modification by user code, but I can't
  think of how at the moment.

  Copying the alist for the call to Fcompleting_read (which is trivial to
  implement) would solve the reordering problems but not the ones involving
  creation/destruction; the real solution is to write a `complete-buffer'
  completion function that would re-consult the buffer list each time
  completion was needed.

-- 
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]