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

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

Re: hippie-expand show possible expansions for files


From: Fabian Braennstroem
Subject: Re: hippie-expand show possible expansions for files
Date: Wed, 07 Nov 2007 21:19:34 +0000
User-agent: KNode/0.8.1

Hi to all,

Peter Dyballa wrote:

> 
> Am 07.11.2007 um 16:27 schrieb Bourgneuf Francois:
> 
>> I work under Windows and neither hippie-expand nor comint-dynamic-
>> complete could expand anything after c:\program Files
> 
> I am not working under Losedows and I am not writing a path with ``\
> ´´ (except I want to "escape" SPC or such in the path name) – and the
> latter makes an important difference! When you start with ``c:/program
> ´´ comint-dynamic-complete will work and probably expand to ``C:/
> Program\ Files/´´ ...
> 
> The reason is that backslash is used as a metacharacter that cannot
> stand for itself but gives other characters a particular meaning. So,
> when you write ``\p´´ it's not a sequence of ``\´´ and ``p´´ but a
> ``backslashed p´´, some new entity.

It has nothing to do with the windows problem, I am on Linux too :-),
but I just found a different idea to combine the mentioned
'hippie-expand' and 'comint...' (sorry Thierry, I still did not get your
setup). I use these lines,which I found in the net, to complete the words
using the 'tab' key:

(defun indent-or-expand (arg)
  "Either indent according to mode, or expand the word preceding
point."
  (interactive "*P")
  (if (and
       (or (bobp) (= ?w (char-syntax (char-before))))
       (or (eobp) (not (= ?w (char-syntax (char-after))))))
;      (dabbrev-expand arg)
      (hippie-expand arg)
    (indent-according-to-mode)))

(defun my-tab-fix ()
  (local-set-key [tab] 'indent-or-expand))
 
(add-hook 'python-mode-hook          'my-tab-fix)

The completion just works, if the cursor is behind the word. Now, a good
combination  would be to insert a second if-statement, which looks, if
the word to complete starts with "/" or "../"; then use
'comint...' otherwise use 'hippie...'. My problem now is to check for
the starting "/" or "../". Does anyone have an idea, how to do it?
Fabian


reply via email to

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