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