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?

Of course.

(defun find-impl-file (&optional mdl-file)
  "When visiting a \".mdl\", visit the corresponding \"_Impl.c\" file."
  (interactive)
  (when (null mdl-file)
    (setq mdl-file buffer-file-name))
  (unless (and mdl-file (equal (file-name-extension mdl-file) "mdl"))
    (error "%s is not a \".mdl\" file" mdl-file))
  (find-file (concat (file-name-sans-extension mdl-file) "_Impl.c")))

--
Kevin Rodgers



_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

Reply via email to