stgit.el: Add some missing help texts
[stgit] / contrib / stgit.el
index 6bb0928..b66a1ca 100644 (file)
@@ -230,11 +230,15 @@ flag, which reduces performance."
   "Alist of names of file types")
 
 (defun stgit-file-type-string (type)
+  "Return string describing file type TYPE (the high bits of file permission).
+Cf. `stgit-file-type-strings' and `stgit-file-type-change-string'."
   (let ((type-str (assoc type stgit-file-type-strings)))
     (or (and type-str (cdr type-str))
        (format "unknown type %o" type))))
 
 (defun stgit-file-type-change-string (old-perm new-perm)
+  "Return string describing file type change from OLD-PERM to NEW-PERM.
+Cf. `stgit-file-type-string'."
   (let ((old-type (lsh old-perm -9))
         (new-type (lsh new-perm -9)))
     (cond ((= old-type new-type) "")
@@ -248,6 +252,8 @@ flag, which reduces performance."
                      (stgit-file-type-string new-type))))))
 
 (defun stgit-file-mode-change-string (old-perm new-perm)
+  "Return string describing file mode change from OLD-PERM to NEW-PERM.
+Cf. `stgit-file-type-change-string'."
   (setq old-perm (logand old-perm #o777)
         new-perm (logand new-perm #o777))
   (if (or (= old-perm new-perm)
@@ -271,6 +277,10 @@ flag, which reduces performance."
                                    'face 'stgit-file-permission-face)))))))
 
 (defun stgit-expand-patch (patchsym)
+  "Expand (show modification of) the patch with name PATCHSYM (a
+symbol) at point.
+`stgit-expand-find-copies-harder' controls how hard to try to
+find copied files."
   (save-excursion
     (forward-line)
     (let* ((start (point))
@@ -501,14 +511,17 @@ Commands:
   (run-hooks 'stgit-mode-hook))
 
 (defun stgit-add-mark (patch)
+  "Mark the patch named PATCH."
   (let ((patchsym (intern patch)))
     (setq stgit-marked-patches (cons patchsym stgit-marked-patches))))
 
 (defun stgit-remove-mark (patch)
+  "Unmark the patch named PATCH."
   (let ((patchsym (intern patch)))
     (setq stgit-marked-patches (delq patchsym stgit-marked-patches))))
 
 (defun stgit-clear-marks ()
+  "Unmark all patches."
   (setq stgit-marked-patches '()))
 
 (defun stgit-marked-patches ()
@@ -568,7 +581,8 @@ the new file names instead of just one name."
   "Move point to the line containing PATCH."
   (let ((p (point)))
     (goto-char (point-min))
-    (if (re-search-forward (concat "^[>+-][ *]" (regexp-quote patch) " ") nil t)
+    (if (re-search-forward (concat "^[>+-][ *]" (regexp-quote patch) " ")
+                           nil t)
         (progn (move-to-column goal-column)
                t)
       (goto-char p)
@@ -600,8 +614,8 @@ the new file names instead of just one name."
   "Remove mark from the patch on the current line."
   (interactive)
   (stgit-remove-mark (stgit-patch-at-point t))
-  (stgit-next-patch)
-  (stgit-reload))
+  (stgit-reload)
+  (stgit-next-patch))
 
 (defun stgit-rename (name)
   "Rename the patch under point to NAME."
@@ -733,13 +747,19 @@ With numeric prefix argument, pop that many patches."
     (with-current-buffer log-edit-parent-buffer
       (stgit-reload))))
 
-(defun stgit-new ()
-  "Create a new patch."
-  (interactive)
+(defun stgit-new (add-sign)
+  "Create a new patch.
+With a prefix argument, include a \"Signed-off-by:\" line at the
+end of the patch."
+  (interactive "P")
   (let ((edit-buf (get-buffer-create "*StGit edit*"))
         (dir default-directory))
     (log-edit 'stgit-confirm-new t nil edit-buf)
-    (setq default-directory dir)))
+    (setq default-directory dir)
+    (when add-sign
+      (save-excursion
+        (let ((standard-output (current-buffer)))
+          (stgit-run-silent "new" "--sign" "--save-template=-"))))))
 
 (defun stgit-confirm-new ()
   (interactive)
@@ -755,7 +775,8 @@ With numeric prefix argument, pop that many patches."
   (let ((patch ""))
     (while (> (length description) 0)
       (cond ((string-match "\\`[a-zA-Z_-]+" description)
-             (setq patch (downcase (concat patch (match-string 0 description))))
+             (setq patch (downcase (concat patch
+                                           (match-string 0 description))))
              (setq description (substring description (match-end 0))))
             ((string-match "\\` +" description)
              (setq patch (concat patch "-"))