From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: wildernesscat@hotmail.com (Danny Dorfman) Newsgroups: gmane.emacs.help Subject: Re: How to automate file-opening (derived filename)? Date: 8 Jan 2003 22:44:47 -0800 Organization: http://groups.google.com/ Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <30055c1f.0301082244.35405451@posting.google.com> References: <30055c1f.0301070652.62cf0153@posting.google.com> <87heckhlfg.fsf@fbigm.here> NNTP-Posting-Host: main.gmane.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1042094753 26166 80.91.224.249 (9 Jan 2003 06:45:53 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 9 Jan 2003 06:45:53 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18WWRq-0006nr-00 for ; Thu, 09 Jan 2003 07:45:50 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18WWRp-0001oX-06 for gnu-help-gnu-emacs@m.gmane.org; Thu, 09 Jan 2003 01:45:49 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews1.google.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 28 Original-NNTP-Posting-Host: 213.8.87.246 Original-X-Trace: posting.google.com 1042094687 24354 127.0.0.1 (9 Jan 2003 06:44:47 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: 9 Jan 2003 06:44:47 GMT Original-Xref: shelby.stanford.edu gnu.emacs.help:108761 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:5290 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:5290 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."))) >