Roy Smith wrote: > I'm working in a software development system which has classes defined > in foo.mdl files, with the corresponding implementation code in > foo_Impl.c files I want to write a macro or function which lets you > flip back and forth between the two. If I'm looking at a .mdl file, I > want it to construct the corresponding _Impl.c filename and visit that > file. Is that possible? > > I'm using GNU Emacs 21.3.1.
(defun my-open-complementary-file () "If buffer-file-name ends in .h open .mdl and vise versa." (interactive) (if buffer-file-name (if (string-match "\\(\\`.*\\.\\)mdl\\'" (buffer-file-name)) (find-file (concat (match-string 1 (buffer-file-name))"h")) (if (string-match ".*\\.h\\'" (buffer-file-name)) (find-file (concat (match-string 1 (buffer-file-name))"mdl")) (message "Buffer's filename doesn't end in .mdl or .h"))) (message "Buffer is not visiting a file"))) Don't expect to get this kind of service all the time! _______________________________________________ Help-gnu-emacs mailing list Help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs