all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Masatake YAMATO <jet@gyve.org>
Cc: bug-cc-mode@gnu.org, rwa@alumni.princeton.edu, emacs-devel@gnu.org
Subject: Re: naming convention based file toggling facility
Date: Fri, 26 Sep 2003 15:03:36 +0900 (JST)	[thread overview]
Message-ID: <20030926.150336.173372132.jet@gyve.org> (raw)
In-Reply-To: <E1A2fQS-0000W6-8L@fencepost.gnu.org>

>     > I've had a hackish little elisp function for years that always struck me
>     > as a slightly surprising omission from emacs: the ability to toggle
>     > between files based on a naming convention like: <source>.c and
>     > <source>.h.
> 
>     M-x ff-find-other-file may be useful.
> 
> If this does the job, maybe CC mode should provide bindings and menu
> bar entrie for it--or for some other clean interface to it.

ff-find-other-file is useful particularly in c-mode and c++-mode.
However it may be useful in other modes.
e.g. moving between *gud* buffer and .gdbinit.

Next patch is prosaic but it works.

Masatake YAMATO

Index: lisp/bindings.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/bindings.el,v
retrieving revision 1.123
diff -u -r1.123 bindings.el
--- lisp/bindings.el	8 Sep 2003 08:02:45 -0000	1.123
+++ lisp/bindings.el	26 Sep 2003 05:56:23 -0000
@@ -371,6 +371,13 @@
   (interactive)
   (switch-to-buffer (other-buffer)))
 
+(defun mode-line-ff-other-file (event) "\
+Find the header or source file corresponding to the current buffer."
+  (interactive "e")
+  (save-selected-window
+    (select-window (posn-window (event-start event)))
+    (ff-find-the-other-file)))
+
 (defvar mode-line-mode-menu (make-sparse-keymap "Minor Modes") "\
 Menu of mode operations in the mode line.")
 
@@ -449,6 +456,7 @@
   (define-key map [mode-line mouse-3] 'mode-line-bury-buffer)
   (define-key map [header-line down-mouse-3] 'ignore)
   (define-key map [header-line mouse-3] 'mode-line-bury-buffer)
+  (define-key map [mode-line mouse-2] 'mode-line-ff-other-file)
   (setq mode-line-buffer-identification-keymap map))
 
 (defun propertized-buffer-identification (fmt)
@@ -458,7 +466,7 @@
   (list (propertize fmt
 		    'face '(:weight bold)
 		    'help-echo
-		    (purecopy "mouse-1: previous buffer, mouse-3: next buffer")
+		    (purecopy "mouse-1: previous buffer, mouse-2: find related file, mouse-3: next buffer")
 		    'local-map mode-line-buffer-identification-keymap)))
 
 (setq-default mode-line-buffer-identification

  reply	other threads:[~2003-09-26  6:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-25  7:07 naming convention based file toggling facility Robert Anderson
2003-09-25  7:20 ` Masatake YAMATO
2003-09-25  7:24   ` Robert Anderson
2003-09-25 23:21   ` Richard Stallman
2003-09-26  6:03     ` Masatake YAMATO [this message]
2003-09-27  2:31       ` Richard Stallman
2003-09-25 10:27 ` Kim F. Storm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030926.150336.173372132.jet@gyve.org \
    --to=jet@gyve.org \
    --cc=bug-cc-mode@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=rwa@alumni.princeton.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.