emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp ChangeLog vc-git.el


From: Dan Nicolaescu
Subject: [Emacs-diffs] emacs/lisp ChangeLog vc-git.el
Date: Sun, 20 Sep 2009 19:51:39 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Dan Nicolaescu <dann>   09/09/20 19:51:38

Modified files:
        lisp           : ChangeLog vc-git.el 

Log message:
        (vc-git-dir-extra-headers): Add keymap and mouse-face
        properties to the stash strings.
        (vc-git-stash-list): Return a list of strings.
        (vc-git-stash-get-at-point, vc-git-stash-delete-at-point)
        (vc-git-stash-show-at-point): New functions.
        (vc-git-stash-map): New keymap.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16221&r2=1.16222
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/vc-git.el?cvsroot=emacs&r1=1.93&r2=1.94

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16221
retrieving revision 1.16222
diff -u -b -r1.16221 -r1.16222
--- ChangeLog   20 Sep 2009 18:22:37 -0000      1.16221
+++ ChangeLog   20 Sep 2009 19:51:35 -0000      1.16222
@@ -1,5 +1,12 @@
 2009-09-20  Dan Nicolaescu  <address@hidden>
 
+       * vc-git.el (vc-git-dir-extra-headers): Add keymap and mouse-face
+       properties to the stash strings.
+       (vc-git-stash-list): Return a list of strings.
+       (vc-git-stash-get-at-point, vc-git-stash-delete-at-point)
+       (vc-git-stash-show-at-point): New functions.
+       (vc-git-stash-map): New keymap.
+
        * register.el (ctl-x-r-map): Define the keys here instead of using 
autoload. 
 
 2009-09-20  Thierry Volpiatto  <address@hidden>

Index: vc-git.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc-git.el,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -b -r1.93 -r1.94
--- vc-git.el   15 Sep 2009 17:52:46 -0000      1.93
+++ vc-git.el   20 Sep 2009 19:51:38 -0000      1.94
@@ -408,7 +408,6 @@
     (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str)
        (progn
          (setq branch (match-string 2 str))
-         (message "branch (%s)" branch)
          (setq remote
                (with-output-to-string
                  (with-current-buffer standard-output
@@ -424,7 +423,6 @@
            (setq remote-url (match-string 1 remote-url))))
       "not (detached HEAD)")
     ;; FIXME: maybe use a different face when nothing is stashed.
-    (when (string= stash "") (setq stash "Nothing stashed"))
     (concat
      (propertize "Branch     : " 'face 'font-lock-type-face)
      (propertize branch
@@ -436,10 +434,20 @@
        (propertize remote-url
                    'face 'font-lock-variable-name-face)))
      "\n"
+     (if stash
+       (concat
+       (propertize "Stash      :\n" 'face 'font-lock-type-face)
+       (mapconcat
+        (lambda (x)
+          (propertize x
+                      'face 'font-lock-variable-name-face
+                      'mouse-face 'highlight
+                      'keymap vc-git-stash-map))
+        stash "\n"))
+       (concat
      (propertize "Stash      : " 'face 'font-lock-type-face)
-     (propertize
-      stash
-       'face 'font-lock-variable-name-face))))
+       (propertize "Nothing stashed"
+                   'face 'font-lock-variable-name-face))))))
 
 ;;; STATE-CHANGING FUNCTIONS
 
@@ -797,10 +805,38 @@
   (pop-to-buffer (current-buffer)))
 
 (defun vc-git-stash-list ()
+  (delete
+   ""
+   (split-string
   (replace-regexp-in-string
-   "\n" "\n             "
-   (replace-regexp-in-string
-    "^stash@" "" (vc-git--run-command-string nil "stash" "list"))))
+     "^stash@" "             " (vc-git--run-command-string nil "stash" "list"))
+    "\n")))
+
+(defun vc-git-stash-get-at-point (point)
+  (save-excursion
+    (goto-char point)
+    (beginning-of-line)
+    (if (looking-at "^ +\\({[0-9]+}\\):")
+       (match-string 1)
+      (error "Cannot find stash at point"))))
+
+(defun vc-git-stash-delete-at-point ()
+  (interactive)
+  (let ((stash (vc-git-stash-get-at-point (point))))
+    (when (y-or-n-p (format "Remove stash %s ?" stash))
+      (vc-git--run-command-string nil "stash" "drop" (format "address@hidden" 
stash))
+      (vc-dir-refresh))))
+
+(defun vc-git-stash-show-at-point ()
+  (interactive)
+  (vc-git-stash-show (format "address@hidden" (vc-git-stash-get-at-point 
(point)))))
+
+(defvar vc-git-stash-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "\C-k" 'vc-git-stash-delete-at-point)
+    (define-key map "=" 'vc-git-stash-show-at-point)
+    (define-key map "\C-m" 'vc-git-stash-show-at-point)
+    map))
 
 
 ;;; Internal commands




reply via email to

[Prev in Thread] Current Thread [Next in Thread]