Anonymous avatar Anonymous committed 8ecba19

changed cr-dwim to produce CR-soon/someday instead of CRvYYYYMM

Comments (0)

Files changed (1)

elisp/jane/jane-cr.el

                   (if show-all-dirs (concat " -cwd " (get-hg-root-or-current-dir)) " ")
                   ))))
 
-;; bound to \C-cr in dot-emacs.el
+;; bound to \C-cr
 (defun cr-dwim ()               ; dwim = do what I mean
-  "Add a code review comment starting on current line or cycle CR/CRvYYYYMM/XCR"
+  "Add a code review comment starting on current line or cycle CR/CR-soon/CR-someday/XCR"
   (interactive)
   (comment-dwim nil)
-  (cond ((looking-at "CR ")
-         (replace-match
-          ;; inserts CRvYYYYMM where date will be between today and a year from now
-          (concat "CRv" (format-time-string
-                         "%Y%m" (time-add (current-time)
-                                          (encode-time 0 0 0 0 (+ (random 12) 3)
-                                                       1970)))
-                  " ")
-          t t))
-        ((looking-at "CRv[0-9]+ ")
-         (replace-match "XCR " t t))
-        ((looking-at "XCR ")
-         (replace-match "CR " t t))
-        (t
-         (insert "CR " (user-login-name) ": ")
-         (backward-word)))
-  (forward-word)
-  (forward-char 2))
+  (unless (region-active-p) ; just comment/uncomment the region if active, ignoring CR stuff
+    (cond
+     ((looking-at "CR ")
+      (replace-match "CR-soon " t t))
+     ((looking-at "CR-soon ")
+      (replace-match "CR-someday " t t))
+     ((looking-at "CR-someday ")  
+      (replace-match "XCR " t t))
+     ((looking-at "XCR ")
+      (replace-match "CR " t t))
+     (t
+      (insert "CR " (user-login-name) ": ")
+      (backward-word)))
+    (search-forward ": ")))
 
 (defvar Jane.Cr.dedicated-review-frame
   nil
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.