[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to automate file-opening (derived filename)?
From: |
Danny Dorfman |
Subject: |
Re: How to automate file-opening (derived filename)? |
Date: |
8 Jan 2003 22:44:47 -0800 |
Here is what I got from posting a question at http://www.experts-exchange.com
This actually does the trick! (from user "itonju01")
> This works for me. You can rename it to whatever you want
> instead of open-x-header.
>
> Hopefully the backslashes aren't munged by the expert-exchange posting system.
>
> Enjoy.
>
>
> (defun open-x-header ()
> (interactive)
> (if
> ;; replace /a/ with /ZZZ/
> (string-match "^\\(.*\\)/a/\\(.*\\)\\.c$" buffer-file-name)
>
> ;; replace find-file-other-window with find-file
> ;; or find-file-other-frame if you wish
> (find-file-other-window
> (concat (match-string 1 buffer-file-name)
> "/"
> "b" ;; replace with YYY
> "/"
> (match-string 2 buffer-file-name)
> ".h"))
> (message "No match.")))
>