From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephan Schmitt Subject: link to magit-status buffers Date: Sat, 15 Aug 2009 15:27:53 +0200 Message-ID: <4A86B7D9.6080805@cs.tu-berlin.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1McJJC-0007MY-Vx for emacs-orgmode@gnu.org; Sat, 15 Aug 2009 09:28:34 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1McJJ7-0007Cr-QK for emacs-orgmode@gnu.org; Sat, 15 Aug 2009 09:28:34 -0400 Received: from [199.232.76.173] (port=55506 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1McJJ7-0007Cg-MQ for emacs-orgmode@gnu.org; Sat, 15 Aug 2009 09:28:29 -0400 Received: from mail.cs.tu-berlin.de ([130.149.17.13]:46944) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1McJJ7-00007C-9h for emacs-orgmode@gnu.org; Sat, 15 Aug 2009 09:28:29 -0400 Received: from localhost (localhost [127.0.0.1]) by localhost-12225.cs.tu-berlin.de (Postfix) with ESMTP id A89F52A450 for ; Sat, 15 Aug 2009 15:28:17 +0200 (MEST) Received: from mailhost.cs.tu-berlin.de ([127.0.0.1]) by localhost (mail.cs.tu-berlin.de [127.0.0.1]) (amavisd-new, port 12224) with ESMTP id p7YtFsV+3YAn 04948-08 for ; Sat, 15 Aug 2009 15:28:15 +0200 (MEST) 16226 Received: from [130.149.24.75] (algieba.ni.cs.tu-berlin.de [130.149.24.75]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: drmabuse) by mailhost.cs.tu-berlin.de (Postfix) with ESMTPSA for ; Sat, 15 Aug 2009 15:28:15 +0200 (MEST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hello, if you use magit mode for your git repositories and want to create/follow links to magit status buffers (showing the current branch) like this: [[magit:/usr/local/emacs/org-mode/][/usr/local/emacs/org-mode/]] you may want to use this code snippet: --8<---------------cut here---------------start------------->8--- (defun org-magit-store-link () "Store a link to a directory to open with magit." (when (eq major-mode 'magit-mode) (let* ((dir default-directory) (link (org-make-link "magit:" dir)) (desc (abbreviate-file-name dir))) (org-store-link-props :type "magit" :link link :description desc) link))) (defun org-magit-open (dir) "Follow a magit link to DIR." (require 'magit) (magit-status dir)) (org-add-link-type "magit" 'org-magit-open nil) (add-hook 'org-store-link-functions 'org-magit-store-link) --8<---------------cut here---------------end--------------->8--- Greetings, Stephan