Skip to content

Commit

Permalink
Show prompt to set issue dir after failing to find dir in auto-findin…
Browse files Browse the repository at this point in the history
…g mode.
  • Loading branch information
kentaro committed Apr 11, 2008
1 parent 032e202 commit d63f9d1
Show file tree
Hide file tree
Showing 8 changed files with 268 additions and 25 deletions.
4 changes: 2 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ system. You can get Ditz from http://ditz.rubyforge.org/.
;; Issue directory name (default: "bugs")
(setq ditz-issue-directory "issues")

;; Enable automatic finding functionality.
(setq ditz-find-issue-directory-automatically-flag t))
;; Enable automatic finding functionality (default: nil)
(setq ditz-find-issue-directory-automatically-flag t)

(5) Run M-x ditz-init to initialize your ditz issues.

Expand Down
49 changes: 26 additions & 23 deletions ditz.el
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,7 @@ must set it from minibuffer."
(defun ditz-call-process (command &optional arg popup-flag)
"Call ditz process asynchronously according with sub-commands."
(let* ((buffer (get-buffer-create (concat "*ditz-" command "*")))
(proc (get-buffer-process buffer))
(current-directory))

;; Reserve current directory to come back later It's needed when
;; automatically finding directory.
(when buffer-file-name
(setq current-directory (file-name-directory (buffer-file-name))))
(proc (get-buffer-process buffer)))

(if (and proc (eq (process-status proc) 'run))
(when (y-or-n-p (format "A %s process is running; kill it?"
Expand All @@ -182,9 +176,6 @@ must set it from minibuffer."
buffer shell-file-name nil shell-command-switch
(ditz-build-command command arg))

(when current-directory
(setq default-directory current-directory))

(cond ((or (eq major-mode 'ditz-mode)
(string= popup-flag "switch"))
(switch-to-buffer buffer))
Expand All @@ -204,30 +195,42 @@ must set it from minibuffer."
(goto-char (point-min)))))))))

(defvar ditz-last-visited-issue-directory nil)

(defun ditz-build-command (command arg)
(let (issue-directory)
(let (issue-directory current-directory)

;; Reserve current directory to come back later It's needed when
;; automatically finding directory.
(when buffer-file-name
(setq current-directory (file-name-directory (buffer-file-name))))

(cond ((eq major-mode 'ditz-mode)
(setq issue-directory ditz-last-visited-issue-directory))
((and (not (string= command "init"))
ditz-find-issue-directory-automatically-flag)
(catch 'loop
(while t
(cond ((file-exists-p ditz-issue-directory)
(setq issue-directory
(concat default-directory ditz-issue-directory))
(throw 'loop t))
((string= "/" default-directory)
(throw 'loop nil))
(t
(cd ".."))))))
ditz-find-issue-directory-automatically-flag
(catch 'loop
(while t
(cond ((file-exists-p ditz-issue-directory)
(throw 'loop t))
((string= "/" default-directory)
(throw 'loop nil))
(t
(cd ".."))))))
(setq issue-directory
(concat default-directory ditz-issue-directory)))
(t
(setq issue-directory
(read-file-name "Issue dir: "
(or ditz-last-visited-issue-directory
default-directory)))))

;; Restore default directory if needed.
(when current-directory
(setq default-directory current-directory))

(setq ditz-last-visited-issue-directory issue-directory)
(mapconcat 'identity (list ditz-program command arg "-i" issue-directory) " ")))
(mapconcat 'identity
(list ditz-program command arg "-i" issue-directory) " ")))

;; Hooks
(defvar ditz-mode-hook nil
Expand Down
20 changes: 20 additions & 0 deletions html/component-emacs-ditz.html
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,26 @@ <h1>emacs-ditz component: emacs-ditz</h1>

</tr>

<tr>
<td class="issuestatus_closed">
closed: fixed
</td>
<td class="issuename">
<a href="issue-89b4dd9e965eeceef261869d99a6a0f138668e3d.html">Show prompt to set issue dir after failing to find dir in auto-finding mode.</a>
(bug)
</td>

<td class="issuerelease">


in <a href="release-0.4.html">release 0.4</a>
(released)

</td>


</tr>

</table>


Expand Down
2 changes: 2 additions & 0 deletions html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ <h2>Past Releases</h2>

<ul>

<li><a href="release-0.4.html">Release 0.4</a>, released 2008-04-11. </li>

<li><a href="release-0.3.html">Release 0.3</a>, released 2008-04-11. </li>

<li><a href="release-0.2.html">Release 0.2</a>, released 2008-04-10. </li>
Expand Down
96 changes: 96 additions & 0 deletions html/issue-89b4dd9e965eeceef261869d99a6a0f138668e3d.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Show prompt to set issue dir after failing to find dir in auto-finding mode.</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
<link rel="stylesheet" href="style.css" type="text/css" />
</head>

<body>

<a href="index.html">&laquo; emacs-ditz project page</a>

<h1>Show prompt to set issue dir after failing to find dir in auto-finding mode.</h1>

<p></p>

<table>
<tr>
<td class="attrname">Id:</td>
<td class="attrval">89b4dd9e965eeceef261869d99a6a0f138668e3d</td>
</tr>

<tr>
<td class="attrname">Type:</td>
<td class="attrval">bugfix</td>
</tr>

<tr>
<td class="attrname">Creation time:</td>
<td class="attrval">Fri Apr 11 13:02:26 UTC 2008</td>
</tr>

<tr>
<td class="attrname">Creator:</td>
<td class="attrval">Kentaro Kuribayashi &lt;kentarok@...&gt;</td>
</tr>



<tr>
<td class="attrname">Release:</td>
<td class="attrval">

<a href="release-0.4.html">0.4</a>

(released 2008-04-11)


</td>
</tr>

<tr>
<td class="attrname">Component:</td>
<td class="attrval"><a href="component-emacs-ditz.html">emacs-ditz</a></td>
</tr>

<tr>
<td class="attrname">Status:</td>
<td class="attrval">
closed: fixed
</td>
</tr>
</table>

<h2>Issue log</h2>

<table>


<tr class="logentryeven">

<td class="logtime">Fri Apr 11 13:02:27 UTC 2008</td>
<td class="logwho">Kentaro Kuribayashi &lt;kentarok@...&gt;</td>
<td class="logwhat">created</td>
</tr>
<tr><td colspan="3" class="logcomment">


</td></tr>


<tr class="logentryodd">

<td class="logtime">Fri Apr 11 13:18:41 UTC 2008</td>
<td class="logwho">Kentaro Kuribayashi &lt;kentarok@...&gt;</td>
<td class="logwhat">closed issue with disposition fixed</td>
</tr>
<tr><td colspan="3" class="logcomment">


</td></tr>

</table>

<p class="footer">Generated by <a href="http://ditz.rubyforge.org/">ditz</a>.
</body>
</html>
87 changes: 87 additions & 0 deletions html/release-0.4.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>emacs-ditz release 0.4</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>

<a href="index.html">&laquo; emacs-ditz project page</a>

<h1>emacs-ditz release 0.4</h1>

<p>
<table>
<tr>
<td class="attrname">Status:</td>
<td class="attrval">released</td>
</tr>

<tr>
<td class="attrname">Release time:</td>
<td class="attrval">Fri Apr 11 13:18:54 UTC 2008</td>
</tr>

<tr>

<td class="attrname">Completion:</td>
<td class="attrval">100%</td>
</tr>
</table>
</p>

<h2>Issues</h2>

<table>

<tr>
<td class="issuestatus_closed">
closed: fixed
</td>
<td class="issuename">
<a href="issue-89b4dd9e965eeceef261869d99a6a0f138668e3d.html">Show prompt to set issue dir after failing to find dir in auto-finding mode.</a>
(bug)
</td>


</tr>

</table>




<h2>Release log</h2>
<table>


<tr class="logentryeven">

<td class="logtime">Fri Apr 11 12:12:15 UTC 2008</td>
<td class="logwho">Kentaro Kuribayashi &lt;kentarok@...&gt;</td>
<td class="logwhat">created</td>
</tr>
<tr><td colspan="3" class="logcomment">


</td></tr>


<tr class="logentryodd">

<td class="logtime">Fri Apr 11 13:18:54 UTC 2008</td>
<td class="logwho">Kentaro Kuribayashi &lt;kentarok@...&gt;</td>
<td class="logwhat">released</td>
</tr>
<tr><td colspan="3" class="logcomment">

<p>release 0.4</p>

</td></tr>

</table>

<p class="footer">Generated by <a href="http://ditz.rubyforge.org/">ditz</a>.

</body>
</html>
22 changes: 22 additions & 0 deletions issues/issue-89b4dd9e965eeceef261869d99a6a0f138668e3d.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--- !ditz.rubyforge.org,2008-03-06/issue
title: Show prompt to set issue dir after failing to find dir in auto-finding mode.
desc: ""
type: :bugfix
component: emacs-ditz
release: "0.4"
reporter: Kentaro Kuribayashi <kentarok@gmail.com>
status: :closed
disposition: :fixed
creation_time: 2008-04-11 13:02:26.380822 Z
references: []

id: 89b4dd9e965eeceef261869d99a6a0f138668e3d
log_events:
- - 2008-04-11 13:02:27.630145 Z
- Kentaro Kuribayashi <kentarok@gmail.com>
- created
- ""
- - 2008-04-11 13:18:41.958849 Z
- Kentaro Kuribayashi <kentarok@gmail.com>
- closed issue with disposition fixed
- ""
13 changes: 13 additions & 0 deletions issues/project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,16 @@ releases:
- Kentaro Kuribayashi <kentarok@gmail.com>
- released
- release 0.3
- !ditz.rubyforge.org,2008-03-06/release
name: "0.4"
status: :released
release_time: 2008-04-11 13:18:54.902624 Z
log_events:
- - 2008-04-11 12:12:15.794477 Z
- Kentaro Kuribayashi <kentarok@gmail.com>
- created
- ""
- - 2008-04-11 13:18:54.902658 Z
- Kentaro Kuribayashi <kentarok@gmail.com>
- released
- release 0.4

0 comments on commit d63f9d1

Please sign in to comment.