##// END OF EJS Templates
Emacs: improved GNU Emacs support.
bos@serpentine.internal.keyresearch.com -
r1004:ad6fccea default
parent child Browse files
Show More
@@ -4,8 +4,6 b''
4 4
5 5 ;; Author: Bryan O'Sullivan <bos@serpentine.com>
6 6
7 ;; $Id$
8
9 7 ;; mercurial.el is free software; you can redistribute it and/or
10 8 ;; modify it under the terms of version 2 of the GNU General Public
11 9 ;; License as published by the Free Software Foundation.
@@ -22,7 +20,7 b''
22 20
23 21 ;;; Commentary:
24 22
25 ;; This mode builds upon Emacs's VC mode to provide flexible
23 ;; mercurial.el builds upon Emacs's VC mode to provide flexible
26 24 ;; integration with the Mercurial distributed SCM tool.
27 25
28 26 ;; To get going as quickly as possible, load mercurial.el into Emacs and
@@ -34,9 +32,9 b''
34 32 ;; job for the commercial Perforce SCM product. In fact, substantial
35 33 ;; chunks of code are adapted from p4.el.
36 34
37 ;; This code has been developed under XEmacs 21.5, and may will not
38 ;; work as well under GNU Emacs (albeit tested under 21.2). Patches
39 ;; to enhance the portability of this code, fix bugs, and add features
35 ;; This code has been developed under XEmacs 21.5, and may not work as
36 ;; well under GNU Emacs (albeit tested under 21.4). Patches to
37 ;; enhance the portability of this code, fix bugs, and add features
40 38 ;; are most welcome. You can clone a Mercurial repository for this
41 39 ;; package from http://www.serpentine.com/hg/hg-emacs
42 40
@@ -314,18 +312,26 b' If the command does not exit with a zero'
314 312 (hg-diff hg-view-file-name rev rev prev-buf))
315 313 ((message "I don't know how to do that yet")))))
316 314
315 (defsubst hg-event-point (event)
316 "Return the character position of the mouse event EVENT."
317 (if hg-running-xemacs
318 (event-point event)
319 (posn-point (event-start event))))
320
321 (defsubst hg-event-window (event)
322 "Return the window over which mouse event EVENT occurred."
323 (if hg-running-xemacs
324 (event-window event)
325 (posn-window (event-start event))))
326
317 327 (defun hg-buffer-mouse-clicked (event)
318 328 "Translate the mouse clicks in a HG log buffer to character events.
319 329 These are then handed off to `hg-buffer-commands'.
320 330
321 331 Handle frickin' frackin' gratuitous event-related incompatibilities."
322 332 (interactive "e")
323 (if hg-running-xemacs
324 (progn
325 (select-window (event-window event))
326 (hg-buffer-commands (event-point event)))
327 (select-window (posn-window (event-end event)))
328 (hg-buffer-commands (posn-point (event-start event)))))
333 (select-window (hg-event-window event))
334 (hg-buffer-commands (hg-event-point event)))
329 335
330 336 (unless (fboundp 'view-minor-mode)
331 337 (defun view-minor-mode (prev-buffer exit-func)
@@ -619,6 +625,7 b' With a prefix argument, prompt for the p'
619 625 (save-excursion
620 626 (goto-char pos)
621 627 (let ((face (get-text-property pos 'face))
628 (inhibit-read-only t)
622 629 bol)
623 630 (beginning-of-line)
624 631 (setq bol (+ (point) 4))
@@ -635,7 +642,7 b' With a prefix argument, prompt for the p'
635 642 (defun hg-commit-mouse-clicked (event)
636 643 "Toggle whether or not the file at POS will be committed."
637 644 (interactive "@e")
638 (hg-commit-toggle-file (event-point event)))
645 (hg-commit-toggle-file (hg-event-point event)))
639 646
640 647 (defun hg-commit-kill ()
641 648 "Kill the commit currently being prepared."
@@ -740,7 +747,7 b' Key bindings'
740 747 (insert "\n")
741 748 (let ((bol (point)))
742 749 (insert hg-commit-message-end)
743 (add-text-properties bol (point) '(read-only t face bold-italic)))
750 (add-text-properties bol (point) '(face bold-italic)))
744 751 (let ((file-area (point)))
745 752 (insert modified-files)
746 753 (goto-char file-area)
@@ -754,13 +761,21 b' Key bindings'
754 761 (forward-line 1))
755 762 (goto-char file-area)
756 763 (add-text-properties (point) (point-max)
757 `(read-only t keymap ,hg-commit-mode-file-map))
764 `(keymap ,hg-commit-mode-file-map))
758 765 (goto-char (point-min))
759 766 (insert hg-commit-message-start)
760 (add-text-properties (point-min) (point)
761 '(read-only t face bold-italic))
767 (add-text-properties (point-min) (point) '(face bold-italic))
762 768 (insert "\n\n")
763 769 (forward-line -1)
770 (save-excursion
771 (goto-char (point-max))
772 (search-backward hg-commit-message-end)
773 (add-text-properties (match-beginning 0) (point-max)
774 '(read-only t))
775 (goto-char (point-min))
776 (search-forward hg-commit-message-start)
777 (add-text-properties (match-beginning 0) (match-end 0)
778 '(read-only t)))
764 779 (hg-commit-mode))))))
765 780
766 781 (defun hg-diff (path &optional rev1 rev2)
General Comments 0
You need to be logged in to leave comments. Login now