Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 8 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 50 additions and 26 deletions.
  1. +4 −1 README.md
  2. +46 −25 pivotal-tracker.el
View
5 README.md
@@ -4,6 +4,10 @@ Pivotal Tracker Mode provides a mode and functions for interacting with Pivotal
It is designed to give most of the functionality that is important to a developer.
It is not an attempt to replace every feature of the web interface.
+## Installation
+
+You can install via [marmalade](http://marmalade-repo.org/packages/pivotal-tracker) or by cloning the repo.
+
## Initial Setup
Before using the tracker you must customize your pivotal API key.
@@ -53,4 +57,3 @@ General Public License for more details.
For a copy of the GNU General Public License, search the Internet,
or write to the Free Software Foundation, Inc., 59 Temple Place,
Suite 330, Boston, MA 02111-1307 USA
-
View
71 pivotal-tracker.el
@@ -3,7 +3,7 @@
;; Author: John Andrews
;; URL: http://github.com/jxa/pivotal-tracker
;; Created: 2010.11.14
-;; Version: 1.0.1
+;; Version: 1.1.0
;; This file is not part of GNU Emacs.
@@ -167,7 +167,7 @@
"POST"
'pivotal-add-task-callback
(format "<task><description>%s</description></task>" (xml-escape-string task))))
-
+
(defun pivotal-check-task ()
"marks current task as done"
(interactive)
@@ -185,7 +185,15 @@
(pivotal-mode)
(delete-region (point-min) (point-max))
(switch-to-buffer (current-buffer))
- (pivotal-insert-iteration xml))))
+
+ ;; for some reason trying to load an iteration that doesn't
+ ;; exist returns the following xml
+ ;; ((nil-classes ((type . array)))
+ ;; - Peer has closed the GnuTLS connection
+ ;; )
+ (if (eq 'nil-classes (first (first xml)))
+ (insert "No stories in this iteration yet")
+ (pivotal-insert-iteration xml)))))
(defun pivotal-projects-callback (status)
(let ((xml (pivotal-get-xml-from-current-buffer)))
@@ -229,7 +237,7 @@
(let* ((task (car xml))
(task-id (pivotal-element-value task 'id)))
(save-excursion
- (beginning-of-buffer)
+ (goto-char (point-min))
(re-search-forward (concat "ID:#" task-id))
(beginning-of-line)
;; Looking at [ ]
@@ -237,7 +245,6 @@
(delete-char 1)
(insert "X")))))))
-
(defun pivotal-parse-errors (xml)
(mapconcat (lambda (error)
(car (last error)))
@@ -248,11 +255,20 @@
;;;;;;;; MODE DEFINITIONS
+(defface pivotal-title-face
+ '((t :height 1.2 :underline t))
+ "Face for iteration heading"
+ :group 'pivotal)
+(defface pivotal-section-face
+ '((t :underline t))
+ "Face for iteration heading"
+ :group 'pivotal)
(defconst pivotal-font-lock-keywords
`(("^\\(\\[.*?\\]\\)+" 0 font-lock-doc-face)
- ("^\\!\\(.*?\\)\\!$") 0 font-lock-keyword-face))
+ ("^-.*-$" . 'pivotal-title-face)
+ ("^--- [a-zA-Z]+$" . 'pivotal-section-face)))
(define-derived-mode pivotal-mode fundamental-mode "Pivotal"
(suppress-keymap pivotal-mode-map)
@@ -273,7 +289,7 @@
(define-key pivotal-mode-map (kbd "L") 'pivotal)
(define-key pivotal-mode-map (kbd "T") 'pivotal-add-task)
(define-key pivotal-mode-map (kbd "F") 'pivotal-check-task)
- (setq font-lock-defaults '((pivotal-font-lock-keywords) nil t))
+ (setq font-lock-defaults '(pivotal-font-lock-keywords))
(font-lock-mode))
(define-derived-mode pivotal-project-mode fundamental-mode "PivotalProjects"
@@ -329,8 +345,10 @@
(defun pivotal-insert-iteration (iteration-xml)
"extract story information from xml and insert it into current buffer"
(insert (if (= pivotal-current-iteration-number *pivotal-iteration*)
- "! CURRENT ITERATION !\n"
- (format "! ITERATION %s !\n" *pivotal-iteration*)))
+ (format "- Current Iteration - Ending %s -\n"
+ (pivotal-iteration-date iteration-xml 'finish))
+ (format "- Iteration Starting %s -\n"
+ (pivotal-iteration-date iteration-xml 'start))))
(mapc 'pivotal-insert-story
(pivotal-extract-stories-from-iteration-xml iteration-xml)))
@@ -370,8 +388,8 @@
(insert task)
;; Mark this new line has belonging to the story
(pivotal-mark-story begin-of-task (point) story-id)))))
-
-
+
+
(defun pivotal-invisibility-id (story-id)
(intern (concat "pivotal-" story-id)))
@@ -413,22 +431,21 @@
(message "%s" "Could not find task at point")))))
(defun pivotal-format-story (story)
- (format "
-%s
----
-%s #%s
+ (format "%s #%s
Status: %s
Requested By: %s
Owned By: %s
Labels: %s
+
--- Description
%s
+
--- Tasks
%s
+
--- Comments
%s
"
- (pivotal-story-attribute story 'name)
(pivotal-story-attribute story 'story_type)
(pivotal-story-attribute story 'id)
(pivotal-story-attribute story 'current_state)
@@ -499,6 +516,11 @@ Labels: %s
structure)
results))
+(defun pivotal-iteration-date (xml attr)
+ (first (split-string
+ (third (first (pivotal-xml-collection (car xml) `(iteration ,attr))))
+ " ")))
+
(defun pivotal-comments (story)
(let ((notes (pivotal-xml-collection story `(notes note)))
(comments ""))
@@ -508,10 +530,12 @@ Labels: %s
comments))
(defun pivotal-format-comment (note)
- (format "%s -- %s at %s\n"
- (pivotal-element-value note 'text)
- (pivotal-element-value note 'author)
- (pivotal-element-value note 'noted_at)))
+ (let ((text (pivotal-element-value note 'text))
+ (author (pivotal-element-value note 'author))
+ (created-at (pivotal-element-value note 'noted_at)))
+ (if created-at
+ (setq created-at (substring created-at 5 10)))
+ (format "%s -- %s on %s\n" text author created-at)))
(defun pivotal-tasks (story)
(let ((tasks (pivotal-xml-collection story `(tasks task)))
@@ -521,17 +545,14 @@ Labels: %s
tasks)
tasks-string))
-
-
(defun pivotal-format-task (task)
- (format "[%s] Task %s (ID:#%s) -- %s created at %s\n"
+ (format "[%s] Task %s (ID:#%s) -- %s\n"
(if (string= (pivotal-element-value task 'complete) "true")
"X"
" ")
(pivotal-element-value task 'position)
(pivotal-element-value task 'id)
- (pivotal-element-value task 'description)
- (pivotal-element-value task 'created_at)))
+ (pivotal-element-value task 'description)))
(provide 'pivotal-tracker)

No commit comments for this range

Something went wrong with that request. Please try again.