emacs-pretest-bug
[Top][All Lists]
Advanced

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

pcomplete and partial-completion-mode


From: Juri Linkov
Subject: pcomplete and partial-completion-mode
Date: Tue, 13 Jun 2006 16:27:52 +0300
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

There is one problem in using pcomplete with partial-completion-mode
enabled.  partial-completion-mode forces pcomplete to move point to the
end of the original buffer (non-minibuffer).

Test case:

M-x partial-completion-mode RET

;;; Fill buffer with some text and set point to the beginning.
M-: (progn (insert "abc\ndef\n") (goto-char (point-min)))

M-x pcomplete RET

;;; Select a file name completion from the *Completions* buffer.
C-x o C-n C-n C-n C-n C-n ... RET

;;; Observe how a selected file name is inserted to the end of the
;;; original buffer, not to the beginning where point initially was.

A small patch below fixes this bug.  I could install it, if it is right
also for other cases where the affected code was intended for.  (IIUC from
the comment above this code in complete.el, it was intended for the
minibuffer usage).

Index: lisp/complete.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/complete.el,v
retrieving revision 1.53
diff -c -r1.53 complete.el
*** lisp/complete.el    22 May 2006 18:09:40 -0000      1.53
--- lisp/complete.el    13 Jun 2006 12:27:35 -0000
***************
*** 234,240 ****
    (funcall
     (if partial-completion-mode 'add-hook 'remove-hook)
     'choose-completion-string-functions
!    (lambda (&rest x) (goto-char (point-max)) nil))
    ;; Build the env-completion and mapping table.
    (when (and partial-completion-mode (null PC-env-vars-alist))
      (setq PC-env-vars-alist
--- 234,242 ----
    (funcall
     (if partial-completion-mode 'add-hook 'remove-hook)
     'choose-completion-string-functions
!    (lambda (choice buffer mini-p base-size)
!      (if mini-p (goto-char (point-max)))
!      nil))
    ;; Build the env-completion and mapping table.
    (when (and partial-completion-mode (null PC-env-vars-alist))
      (setq PC-env-vars-alist

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





reply via email to

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