annotate contrib/mercurial.el @ 945:f15901d053e1

Merge with MPM.
author Bryan O'Sullivan <bos@serpentine.com>
date Thu, 18 Aug 2005 12:32:15 -0800
parents 41ca6bf19735
children 4cabedfab66e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
944
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
1 ;;; mercurial.el --- Emacs support for the Mercurial distributed SCM
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
2
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
3 ;; Copyright (C) 2005 Bryan O'Sullivan
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
4
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
5 ;; Author: Bryan O'Sullivan <bos@serpentine.com>
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
6
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
7 ;; $Id$
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
8
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
9 ;; mercurial.el ("this file") is free software; you can redistribute
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
10 ;; it and/or modify it under the terms of version 2 of the GNU General
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
11 ;; Public License as published by the Free Software Foundation.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
12
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
13 ;; This file is distributed in the hope that it will be useful, but
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
14 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
16 ;; General Public License for more details.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
17
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
18 ;; You should have received a copy of the GNU General Public License
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
19 ;; along with this file, GNU Emacs, or XEmacs; see the file COPYING
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
20 ;; (`C-h C-l'). If not, write to the Free Software Foundation, Inc.,
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
21 ;; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
22
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
23 ;;; Commentary:
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
24
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
25 ;; This mode builds upon Emacs's VC mode to provide flexible
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
26 ;; integration with the Mercurial distributed SCM tool.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
27
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
28 ;; To get going as quickly as possible, load this file into Emacs and
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
29 ;; type `C-c h h'; this runs hg-help-overview, which prints a helpful
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
30 ;; usage overview.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
31
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
32 ;; Much of the inspiration for mercurial.el comes from Rajesh
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
33 ;; Vaidheeswarran's excellent p4.el, which does an admirably thorough
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
34 ;; job for the commercial Perforce SCM product. In fact, substantial
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
35 ;; chunks of code are adapted from p4.el.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
36
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
37 ;; This code has been developed under XEmacs 21.5, and may will not
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
38 ;; work as well under GNU Emacs (albeit tested under 21.2). Patches
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
39 ;; to enhance the portability of this code, fix bugs, and add features
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
40 ;; are most welcome. You can clone a Mercurial repository for this
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
41 ;; package from http://www.serpentine.com/hg/hg-emacs
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
42
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
43 ;; Please send problem reports and suggestions to bos@serpentine.com.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
44
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
45
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
46 ;;; Code:
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
47
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
48 (require 'advice)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
49 (require 'cl)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
50 (require 'diff-mode)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
51 (require 'easymenu)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
52 (require 'vc)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
53
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
54
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
55 ;;; XEmacs has view-less, while GNU Emacs has view. Joy.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
56
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
57 (condition-case nil
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
58 (require 'view-less)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
59 (error nil))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
60 (condition-case nil
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
61 (require 'view)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
62 (error nil))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
63
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
64
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
65 ;;; Variables accessible through the custom system.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
66
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
67 (defgroup hg nil
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
68 "Mercurial distributed SCM."
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
69 :group 'tools)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
70
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
71 (defcustom hg-binary
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
72 (dolist (path '("~/bin/hg"
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
73 "/usr/bin/hg"
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
74 "/usr/local/bin/hg"))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
75 (when (file-executable-p path)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
76 (return path)))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
77 "The path to Mercurial's hg executable."
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
78 :type '(file :must-match t)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
79 :group 'hg)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
80
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
81 (defcustom hg-mode-hook nil
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
82 "Hook run when a buffer enters hg-mode."
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
83 :type 'sexp
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
84 :group 'hg)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
85
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
86 (defcustom hg-global-prefix "\C-ch"
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
87 "The global prefix for Mercurial keymap bindings."
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
88 :type 'sexp
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
89 :group 'hg)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
90
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
91
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
92 ;;; Other variables.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
93
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
94 (defconst hg-running-xemacs (string-match "XEmacs" emacs-version)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
95 "Is mercurial.el running under XEmacs?")
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
96
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
97 (defvar hg-mode nil
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
98 "Is this file managed by Mercurial?")
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
99
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
100 (defvar hg-output-buffer-name "*Hg*"
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
101 "The name to use for Mercurial output buffers.")
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
102
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
103 (defvar hg-file-name-history nil)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
104
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
105
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
106 ;;; hg-mode keymap.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
107
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
108 (defvar hg-prefix-map
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
109 (let ((map (copy-keymap vc-prefix-map)))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
110 (set-keymap-name map 'hg-prefix-map)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
111 map)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
112 "This keymap overrides some default vc-mode bindings.")
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
113 (fset 'hg-prefix-map hg-prefix-map)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
114 (define-key hg-prefix-map "=" 'hg-diff-file)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
115 (define-key hg-prefix-map "c" 'hg-undo)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
116 (define-key hg-prefix-map "g" 'hg-annotate)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
117 (define-key hg-prefix-map "l" 'hg-log-file)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
118 ;; (define-key hg-prefix-map "r" 'hg-update)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
119 (define-key hg-prefix-map "u" 'hg-revert-file)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
120 (define-key hg-prefix-map "~" 'hg-version-other-window)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
121
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
122 (defvar hg-mode-map (make-sparse-keymap))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
123 (define-key hg-mode-map "\C-xv" 'hg-prefix-map)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
124
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
125
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
126 ;;; Global keymap.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
127
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
128 (global-set-key "\C-xvi" 'hg-add-file)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
129
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
130 (defvar hg-global-map (make-sparse-keymap))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
131 (fset 'hg-global-map hg-global-map)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
132 (global-set-key hg-global-prefix 'hg-global-map)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
133 (define-key hg-global-map "," 'hg-incoming)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
134 (define-key hg-global-map "." 'hg-outgoing)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
135 (define-key hg-global-map "<" 'hg-pull)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
136 (define-key hg-global-map "=" 'hg-diff)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
137 (define-key hg-global-map ">" 'hg-push)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
138 (define-key hg-global-map "?" 'hg-help-overview)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
139 (define-key hg-global-map "A" 'hg-addremove)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
140 (define-key hg-global-map "U" 'hg-revert)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
141 (define-key hg-global-map "a" 'hg-add)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
142 (define-key hg-global-map "c" 'hg-commit)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
143 (define-key hg-global-map "h" 'hg-help-overview)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
144 (define-key hg-global-map "i" 'hg-init)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
145 (define-key hg-global-map "l" 'hg-log)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
146 (define-key hg-global-map "r" 'hg-root)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
147 (define-key hg-global-map "s" 'hg-status)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
148 (define-key hg-global-map "u" 'hg-update)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
149
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
150
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
151 ;;; View mode keymap.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
152
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
153 (defvar hg-view-mode-map
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
154 (let ((map (copy-keymap (if (boundp 'view-minor-mode-map)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
155 view-minor-mode-map
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
156 view-mode-map))))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
157 (set-keymap-name map 'hg-view-mode-map)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
158 map))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
159 (fset 'hg-view-mode-map hg-view-mode-map)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
160 (define-key hg-view-mode-map
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
161 (if hg-running-xemacs [button2] [mouse-2])
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
162 'hg-buffer-mouse-clicked)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
163
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
164
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
165 ;;; Convenience functions.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
166
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
167 (defun hg-binary ()
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
168 (if hg-binary
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
169 hg-binary
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
170 (error "No `hg' executable found!")))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
171
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
172 (defun hg-replace-in-string (str regexp newtext &optional literal)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
173 "Replace all matches in STR for REGEXP with NEWTEXT string.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
174 Return the new string. Optional LITERAL non-nil means do a literal
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
175 replacement.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
176
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
177 This function bridges yet another pointless impedance gap between
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
178 XEmacs and GNU Emacs."
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
179 (if (fboundp 'replace-in-string)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
180 (replace-in-string str regexp newtext literal)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
181 (replace-regexp-in-string regexp newtext str nil literal)))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
182
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
183 (defun hg-chomp (str)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
184 "Strip trailing newlines from a string."
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
185 (hg-replace-in-string str "[\r\n]+$" ""))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
186
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
187 (defun hg-run-command (command &rest args)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
188 "Run the shell command COMMAND, returning (EXIT-CODE . COMMAND-OUTPUT).
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
189 The list ARGS contains a list of arguments to pass to the command."
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
190 (let* (exit-code
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
191 (output
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
192 (with-output-to-string
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
193 (with-current-buffer
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
194 standard-output
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
195 (setq exit-code
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
196 (apply 'call-process command nil t nil args))))))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
197 (cons exit-code output)))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
198
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
199 (defun hg-run (command &rest args)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
200 "Run the Mercurial command COMMAND, returning (EXIT-CODE . COMMAND-OUTPUT)."
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
201 (apply 'hg-run-command (hg-binary) command args))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
202
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
203 (defun hg-run0 (command &rest args)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
204 "Run the Mercurial command COMMAND, returning its output.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
205 If the command does not exit with a zero status code, raise an error."
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
206 (let ((res (apply 'hg-run-command (hg-binary) command args)))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
207 (if (not (eq (car res) 0))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
208 (error "Mercurial command failed %s - exit code %s"
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
209 (cons command args)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
210 (car res))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
211 (cdr res))))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
212
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
213 (defun hg-buffer-commands (pnt)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
214 "Use the properties of a character to do something sensible."
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
215 (interactive "d")
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
216 (let ((rev (get-char-property pnt 'rev))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
217 (file (get-char-property pnt 'file))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
218 (date (get-char-property pnt 'date))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
219 (user (get-char-property pnt 'user))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
220 (host (get-char-property pnt 'host))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
221 (prev-buf (current-buffer)))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
222 (cond
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
223 (file
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
224 (find-file-other-window file))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
225 (rev
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
226 (hg-diff hg-view-file-name rev rev prev-buf))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
227 ((message "I don't know how to do that yet")))))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
228
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
229 (defun hg-buffer-mouse-clicked (event)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
230 "Translate the mouse clicks in a HG log buffer to character events.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
231 These are then handed off to `hg-buffer-commands'.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
232
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
233 Handle frickin' frackin' gratuitous event-related incompatibilities."
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
234 (interactive "e")
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
235 (if hg-running-xemacs
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
236 (progn
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
237 (select-window (event-window event))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
238 (hg-buffer-commands (event-point event)))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
239 (select-window (posn-window (event-end event)))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
240 (hg-buffer-commands (posn-point (event-start event)))))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
241
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
242 (unless (fboundp 'view-minor-mode)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
243 (defun view-minor-mode (prev-buffer exit-func)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
244 (view-mode)))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
245
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
246 (defun hg-abbrev-file-name (file)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
247 (if hg-running-xemacs
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
248 (abbreviate-file-name file t)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
249 (abbreviate-file-name file)))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
250
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
251
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
252 ;;; View mode bits.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
253
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
254 (defun hg-exit-view-mode (buf)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
255 "Exit from hg-view-mode.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
256 We delete the current window if entering hg-view-mode split the
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
257 current frame."
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
258 (when (and (eq buf (current-buffer))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
259 (> (length (window-list)) 1))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
260 (delete-window))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
261 (when (buffer-live-p buf)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
262 (kill-buffer buf)))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
263
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
264 (defun hg-view-mode (prev-buffer &optional file-name)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
265 (goto-char (point-min))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
266 (set-buffer-modified-p nil)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
267 (toggle-read-only t)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
268 (view-minor-mode prev-buffer 'hg-exit-view-mode)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
269 (use-local-map hg-view-mode-map)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
270 (setq truncate-lines t)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
271 (when file-name
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
272 (set (make-local-variable 'hg-view-file-name)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
273 (hg-abbrev-file-name file-name))))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
274
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
275 (defmacro hg-view-output (args &rest body)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
276 "Execute BODY in a clean buffer, then switch that buffer to view-mode.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
277 ARGS is of the form (BUFFER-NAME &optional FILE), where BUFFER-NAME is
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
278 the name of the buffer to create, and FILE is the name of the file
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
279 being viewed."
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
280 (let ((prev-buf (gensym "prev-buf-"))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
281 (v-b-name (car args))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
282 (v-m-rest (cdr args)))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
283 `(let ((view-buf-name ,v-b-name)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
284 (,prev-buf (current-buffer)))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
285 (get-buffer-create view-buf-name)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
286 (kill-buffer view-buf-name)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
287 (pop-to-buffer view-buf-name)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
288 (save-excursion
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
289 ,@body)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
290 (hg-view-mode ,prev-buf ,@v-m-rest))))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
291
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
292 (put 'hg-view-output 'lisp-indent-function 1)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
293
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
294
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
295 ;;; User interface functions.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
296
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
297 (defun hg-help-overview ()
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
298 "This is an overview of the Mercurial SCM mode for Emacs.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
299
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
300 You can find the source code, license (GPL v2), and credits for this
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
301 code by typing `M-x find-library mercurial RET'.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
302
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
303 The Mercurial mode user interface is based on that of the older VC
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
304 mode, so if you're already familiar with VC, the same keybindings and
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
305 functions will generally work.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
306
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
307 Below is a list of common SCM tasks, with the key bindings needed to
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
308 perform them, and the command names. This list is not exhaustive.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
309
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
310 In the list below, `G/L' indicates whether a key binding is global (G)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
311 or local (L). Global keybindings work on any file inside a Mercurial
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
312 repository. Local keybindings only apply to files under the control
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
313 of Mercurial. Many commands take a prefix argument.
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
314
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
315
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
316 SCM Task G/L Key Binding Command Name
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
317 -------- --- ----------- ------------
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
318 Help overview (what you are reading) G C-c h h hg-help-overview
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
319
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
320 Tell Mercurial to manage a file G C-x v i hg-add-file
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
321 Commit changes to current file only L C-x C-q vc-toggle-read-only
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
322 Undo changes to file since commit L C-x v u hg-revert-file
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
323
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
324 Diff file vs last checkin L C-x v = hg-diff-file
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
325
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
326 View file change history L C-x v l hg-log-file
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
327 View annotated file L C-x v a hg-annotate
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
328
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
329 Diff repo vs last checkin G C-c h = hg-diff
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
330 View status of files in repo G C-c h s hg-status
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
331 Commit all changes G C-c h c hg-commit
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
332
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
333 Undo all changes since last commit G C-c h U hg-revert
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
334 View repo change history G C-c h l hg-log
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
335
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
336 See changes that can be pulled G C-c h , hg-incoming
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
337 Pull changes G C-c h < hg-pull
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
338 Update working directory after pull G C-c h u hg-update
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
339 See changes that can be pushed G C-c h . hg-outgoing
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
340 Push changes G C-c h > hg-push"
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
341 (interactive)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
342 (hg-view-output ("Mercurial Help Overview")
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
343 (insert (documentation 'hg-help-overview))))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
344
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
345 (defun hg-add ()
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
346 (interactive)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
347 (error "not implemented"))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
348
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
349 (defun hg-add-file ()
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
350 (interactive)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
351 (error "not implemented"))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
352
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
353 (defun hg-addremove ()
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
354 (interactive)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
355 (error "not implemented"))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
356
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
357 (defun hg-annotate ()
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
358 (interactive)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
359 (error "not implemented"))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
360
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
361 (defun hg-commit ()
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
362 (interactive)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
363 (error "not implemented"))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
364
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
365 (defun hg-diff ()
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
366 (interactive)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
367 (error "not implemented"))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
368
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
369 (defun hg-diff-file ()
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
370 (interactive)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
371 (error "not implemented"))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
372
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
373 (defun hg-incoming ()
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
374 (interactive)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
375 (error "not implemented"))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
376
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
377 (defun hg-init ()
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
378 (interactive)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
379 (error "not implemented"))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
380
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
381 (defun hg-log-file ()
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
382 (interactive)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
383 (error "not implemented"))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
384
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
385 (defun hg-log ()
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
386 (interactive)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
387 (error "not implemented"))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
388
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
389 (defun hg-outgoing ()
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
390 (interactive)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
391 (error "not implemented"))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
392
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
393 (defun hg-pull ()
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
394 (interactive)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
395 (error "not implemented"))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
396
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
397 (defun hg-push ()
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
398 (interactive)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
399 (error "not implemented"))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
400
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
401 (defun hg-revert ()
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
402 (interactive)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
403 (error "not implemented"))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
404
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
405 (defun hg-revert-file ()
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
406 (interactive)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
407 (error "not implemented"))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
408
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
409 (defun hg-root (&optional path)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
410 (interactive)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
411 (unless path
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
412 (setq path (if (and (interactive-p) current-prefix-arg)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
413 (expand-file-name (read-file-name "Path name: "))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
414 (or (buffer-file-name) "(none)"))))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
415 (let ((root (do ((prev nil dir)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
416 (dir (file-name-directory path)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
417 (file-name-directory (directory-file-name dir))))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
418 ((equal prev dir))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
419 (when (file-directory-p (concat dir ".hg"))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
420 (return dir)))))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
421 (when (interactive-p)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
422 (if root
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
423 (message "The root of this repository is `%s'." root)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
424 (message "The path `%s' is not in a Mercurial repository."
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
425 (abbreviate-file-name path t))))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
426 root))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
427
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
428 (defun hg-status ()
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
429 (interactive)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
430 (error "not implemented"))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
431
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
432 (defun hg-undo ()
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
433 (interactive)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
434 (error "not implemented"))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
435
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
436 (defun hg-version-other-window ()
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
437 (interactive)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
438 (error "not implemented"))
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
439
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
440
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
441 (provide 'mercurial)
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
442
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
443
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
444 ;;; Local Variables:
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
445 ;;; mode: emacs-lisp
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
446 ;;; prompt-to-byte-compile: nil
41ca6bf19735 Initial skeleton for mercurial.el.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
447 ;;; end: