574de93efbba22db0ec816ecec717d502dfa333e

Author
Tristan Carel <tcarel@exalead.com>
Committer
Tristan Carel <tcarel@exalead.com>
Date

Message

New function `efile`

Diff

 1diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh
 2index 3e45e54d0d653554aa1591d43e1d8a284718c1bb..737abe9d6f438c2f5996c4e16594e7d91f5754c5 100644
 3--- a/plugins/emacs/emacs.plugin.zsh
 4+++ b/plugins/emacs/emacs.plugin.zsh
 5@@ -24,14 +24,22 @@ if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then
 6     alias emasc=emacs
 7     alias emcas=emacs
 8 
 9-    # jump to the directory of the current buffer
10+    # Write to standard output the path to the file
11+    # opened in the current buffer.
12+    function efile {
13+        local cmd="(buffer-file-name (window-buffer))"
14+        $EDITOR --eval "$cmd" | tr -d \"
15+    }
16+
17+    # display the directory of the file
18+    # opened in the the current buffer
19     function ecd {
20         local cmd="(let ((buf-name (buffer-file-name (window-buffer))))
21                      (if buf-name (file-name-directory buf-name)))"
22 
23         local dir=`$EDITOR --eval "$cmd" | tr -d \"`
24         if [ -n "$dir" ] ;then
25-            cd "$dir"
26+            echo "$dir"
27         else
28             echo "can not deduce current buffer filename." >/dev/stderr
29             return 1
30@@ -39,7 +47,6 @@ if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then
31     }
32 fi
33 
34-
35 ## Local Variables:
36 ## mode: sh
37 ## End: