0

I use this code snippet taken from some forum to complete the file path at point on pressing, C-M-/.

(defun my-expand-file-name-at-point ()
  "Use hippie-expand to expand the filename"
  (interactive)
  (let ((hippie-expand-try-functions-list '(try-complete-file-name-partially try-complete-file-name)))
    (call-interactively 'hippie-expand)))

It works good most of the time. On occassions, i use bash environment variables like $WS_HOME, $PROJ inside my shell scripts to keep the path concise.

Is there a way hippie-file-name-complete can understand the environment variables, that contain file paths and list out possible completions from there?

Madhavan
  • 1,957
  • 12
  • 28
  • Based on the environment that Emacs sees, or based on the environment that the shell script you're editing will see when it executes? (the latter being impossible to do in a general way). Or are you specifically wanting something that will parse the shell variable definitions made in the script itself, and make those substitutions when attempting file path completions? – phils Aug 06 '15 at 01:59
  • the shell variables are constants that are defined inside /home/user/.bashrc file... they are not dynamically constructed ones... – Madhavan Aug 06 '15 at 02:06
  • If you always run Emacs from a bash shell, and the shell vars are exported, then they ought to be present in Emacs' own environment. e.g. `(getenv "WS_HOME")`, which is probably going to simplify a solution. – phils Aug 06 '15 at 02:27
  • @phils, surprisingly, i got struck at my first step,to `getenv` bashrc variables inside emacs - @http://unix.stackexchange.com/questions/220517/emacs-window-mode-is-not-seeing-bashrc-shell-variables – Madhavan Aug 06 '15 at 12:56

0 Answers0