Re: [StGit PATCH 2/2] Emacs mode: delete patches

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

 



Karl Hasselström <kha@xxxxxxxxxxx> writes:

> Teach the emacs mode to delete patches.
>
> Signed-off-by: Karl Hasselström <kha@xxxxxxxxxxx>
>
> ---
>
> David, could you have a look at this as well? In addition to me being
> elisp challenged, there are the following issues:
>
>   * Is "d" a reasonable binding? Any better suggestion?

We could reserve "d" for moving a patch "down", maybe.  The more
destructive commands could be on less accessible keys. Maybe "D" or
"C-d".

>   * Currently, this command requires you to mark one or more patches
>     before deleting. This is convenient when deleting more than one
>     patch, but one could argue that it should be possible to delete
>     the patch at point without having to select it.

You need something like this:

--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -187,6 +187,15 @@ Commands:
         (match-string-no-properties 1)
       nil)))
 
+(defun stgit-selected-patches ()
+  "Return the names of the marked patches, or the patch on the current line."
+  (if stgit-marked-patches
+      (stgit-marked-patches)
+    (let ((patch (stgit-patch-at-point)))
+      (if patch
+          (list patch)
+        '()))))
+
 (defun stgit-goto-patch (patch)
   "Move point to the line containing PATCH"
   (let ((p (point)))

>   * We should probably ask for confirmation before deleting.

Absolutely. Something like this (untested):

(defun stgit-delete (patch-names)
  "Delete the named patches"
  (interactive (list (stgit-selected-patches)))
  (if (zerop (length patch-names))
      (error "No patches to delete")
    (when (yes-or-no-p (format "Really delete %d patches? "
                               (length patch-names)))
      (stgit-capture-output nil
        (apply 'stgit-run "delete" patch-names))
      (stgit-refresh))


-- 
David Kågedal
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux