[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Reuse frame with emacsclient and/or use shell aliases when finding f
Re: Reuse frame with emacsclient and/or use shell aliases when finding files
Sat, 31 May 2014 13:21:34 +0200
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)
() Jacob Gerlach <email@example.com>
() Fri, 30 May 2014 18:57:19 -0700 (PDT)
I wonder if I could come up with some utility
function to read in bash aliases and create the
associated dired bookmarks when I start emacs.
Probably yes, if you learn a small bit of Emacs Lisp.
Personally, i define an env var for each directory:
and type (for example) ‘C-x C-f $go/gnugo.el’ to visit
Recent Emacs versions can do completion, and even on
the env vars! (I marvel at this, taken aback by the
mega-cycles burned for such banalities -- i guess i
prefer a more lizard-like less-electric lifestyle...
[insert more curmudgeonly harumphing] here.)
The "scads of short env vars" approach has, over the
years, tickled bugs in various tools that presume such
env vars are not set, which was annoying at the time,
but good for all (me and tools) over the long run,
once the tools' authors made them more mindful.
I also instrument ‘M-x compile’ like so:
(defun rewrite-shell-command-w/cd (string)
"If STRING begins w/ \"$foo\", return a new string.
In the new string, the \"$foo\" is replaced with \"cd $foo\", and
furthermore \"$foo\" is replaced with the value of `(getenv \"foo\")'.
For example, if (getenv \"hack\") => \"~/build/hack\", then
(rewrite-shell-command-w/cd \"$hack.b ; echo $hack\")
=> \"cd ~/build/hack.b ; echo $hack\"
For other values of STRING, simply return it."
(if (string-match "^[$]\\([a-zA-Z_]+\\)" string)
(replace-match (concat "cd " (getenv (match-string 1 string)))
t t string)
(defadvice compilation-start (before rewrite-compilation-command-w/cd activate)
"Replace COMMAND using `rewrite-shell-command-w/cd'."
(ad-set-arg 0 (rewrite-shell-command-w/cd (ad-get-arg 0))))
and bind ‘M-m’ to ‘compile’, such that (for example)
M-m $go ; git remote update RET
invokes the "git remote update" command in directory
/home/ttn/build/GNU/elpa/packages/gnugo, no matter
what the ‘default-directory’ (from current buffer) is
at ‘M-m’ time. This is a small step towards the yet-
unrealized ideal of having the env var expanded in the
command, itself, which involves phasing complications
for the expansion of "~", primarily. Maybe Some Day...
GPG key: 4C807502
(if you're human and you know it)
read my lisp: (responsep (questions 'technical)
(not (via 'mailing-list)))
Description: PGP signature
Re: Reuse frame with emacsclient and/or use shell aliases when finding files, Thorsten Jolitz, 2014/05/31