SiteMap Search ElispArea HowTo Glossary RecentChanges News Problems Suggestions

ProgrammableCompletion

Last edit

Changed:

< This same issue appears even without a $ in the path if the directory to be completed starts with ~, using emacs 24 -- TuomasKuismin

to

> This same issue appears even without a $ in the path if the directory to be completed starts with ~ and eshell-cmpl-ignore-case is true, using emacs 24 -- TuomasKuismin


This page is about standard Emacs library `pcomplete.el’ and its related libraries. See PcompleteExamples for examples of using `pcomplete.el’.

Note: The “programmable completion” of library `pcomplete.el’ has nothing to do with the “programmed completion” described in the EmacsLisp manual (dynamic-completion-table). The latter is about using a function to perform completion rather than supplying an explicit list of completion candidates.

Bugs

Within EShell, pcomplete seems to not work for me on XP when sitting at a UNC path such as:

    //evon620c/c$/home/work/HPCMS/HPCMS 6.0/Agent/common/s $ cd ~/dow

pressing TAB here gives the error “Text is read-only”. Anyone verify this? – PatrickAnderson

This will be because the standard eshell-prompt-regexp expects there to be only a single $ before your command. I use "^[^#\n]* [#$] " instead. Note that you’ll need to escape any $ signs in the eshell command line, eg., cd //evon620c/c\$/home/ – RohanHart?

This same issue appears even without a $ in the path if the directory to be completed starts with ~ and eshell-cmpl-ignore-case is true, using emacs 24 – TuomasKuismin?

Adding programmable completion using pcomplete

Example:

(defun pcomplete-erc-setup () 
"Setup erc-mode to use pcomplete." 
(set (make-local-variable 'pcomplete-parse-arguments-function) 
   'pcomplete-parse-erc-arguments) 
(set (make-local-variable 'pcomplete-command-completion-function)  
   'pcomplete/erc-mode/complete-command)
(set (make-local-variable 'pcomplete-command-name-function) 
    'pcomplete-erc-command-name)
(set (make-local-variable 'pcomplete-default-completion-function)
    (lambda () (pcomplete-here (pcomplete-erc-nicks))))
(set (make-local-variable 'pcomplete-suffix-list) '(?  ?:)) 
)                 
(add-hook 'erc-mode-hook 'pcomplete-erc-setup)                                                                                                                                                         

pcomplete-parse-arguments-function has no parameters. It returns a list of arguments for the current command.

Returns the canonical name of the command. This is used to find the appropriate programmable completion function. For example, if the function returns “MSG” and the major mode is “erc-mode”, pcomplete will check pcomplete/erc-mode/MSG and pcomplete/MSG for completions.

pcomplete-default-completion-function gets called when you don’t have a function for the command currently being completed. Body should be of the form (pcomplete-here (… list of completions …))

Body should be of the form (pcomplete-here (… list of completions …))


Do newer versions of JavaCompletion use pcomplete? The copy from 2004 does not.


CategoryCode CategoryCompletion