help-gnu-emacs
[Top][All Lists]
Advanced

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

complete file at point in buffer - solution and questions


From: Dirk80
Subject: complete file at point in buffer - solution and questions
Date: Tue, 18 May 2010 12:37:45 -0700 (PDT)

Hello,

in minibuffer it is easy to complete a file at point. Just press tab if you
don't know how to continue. But when I was looking in internet if this
feature is also available for a normal buffer I did not find a solution. So
I decided to write one on my own.

Because I am an emacs lisp newbie I am happy that the implementation is
working.

You need these 2 files:
http://www.dirkundsari.de/emacs/my/my-cfap.el
http://www.dirkundsari.de/emacs/my/my-cfap.el 
http://www.dirkundsari.de/emacs/my/my-utils.el
http://www.dirkundsari.de/emacs/my/my-utils.el 

Bind the function my-cfap-complete to a key (e.g. f3) and then you can use
it in a normal buffer to complete files. 

But now I also have some questions:
1.) Please give me feedback to my code. So I can learn.

2.) File completion in minibuffer shows the completion-buffer with bold
letters at the first difference. How could I integrate that feature in my
code when calling display-completion-list? I've looked a bit into the code
of minibuffer.el. It seems that "defface completions-first-difference" is
what I need. But I do not understand how to use it. The function
display-completion-list has an optional parameter common-substring. But this
is described obsolete.

3.) In unix the file system is case sensitive. In windows OS the file system
is not case sensitive. But my function is always case sensitive. How can I
say that when emacs is running in windows that case does not matter. I think
that I have to say to the C-Source functions "file-name-completion" and
"file-name-all-completions" that they should be not case sensitive when
emacs is running in windows. But I do not know how to do it.

4.) I would like to change the behaviour of the self-insert-command if a
completion window is available. So I tried to use defadvice with
self-insert-command. But it was not working. And I have also read that
defadvice is more a debugging feature and should not be used in productive
code. So what would be an alternative? I'd like to have the following
behaviour for self-insert-command:
If completion-window available then insert character and update
completion-window.

Thank you very much for your help
Dirk
-- 
View this message in context: 
http://old.nabble.com/complete-file-at-point-in-buffer---solution-and-questions-tp28599706p28599706.html
Sent from the Emacs - Help mailing list archive at Nabble.com.




reply via email to

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