* [PATCH 8/8] ox-taskjuggler.el: allow trimming the task ID from its title
@ 2015-11-08 10:23 Kosyrev Serge
2015-11-12 16:49 ` Rasmus
0 siblings, 1 reply; 2+ messages in thread
From: Kosyrev Serge @ 2015-11-08 10:23 UTC (permalink / raw)
To: emacs-orgmode
* ox-taskjuggler.el (org-taskjuggler-trim-ids-from-titles): new custom
(org-taskjuggler--build-task): trim task ids from titles, when the new
custom variable asks for this (enabled by default).
---
contrib/lisp/ox-taskjuggler.el | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/contrib/lisp/ox-taskjuggler.el b/contrib/lisp/ox-taskjuggler.el
index d49db62..bca3dc1 100644
--- a/contrib/lisp/ox-taskjuggler.el
+++ b/contrib/lisp/ox-taskjuggler.el
@@ -374,6 +374,11 @@ task buckets, while still sharing the same resources pool."
:group 'org-export-taskjuggler
:type 'boolean)
+(defcustom org-taskjuggler-trim-ids-from-titles t
+ "Non-NIL trims the part detected as prefix from resulting task titles."
+ :group 'org-export-taskjuggler
+ :type 'boolean)
+
;;; Hooks
@@ -887,9 +892,16 @@ a unique id will be associated to it."
(- org-lowest-priority org-highest-priority)))))))))
(concat
;; Opening task.
- (format "task %s \"%s\" {\n"
- (org-taskjuggler-get-id task info)
- (org-taskjuggler-get-name task))
+ (let* ((id (org-taskjuggler-get-id task info))
+ (raw-name (org-taskjuggler-get-name task))
+ (id-len (length id))
+ (raw-name-len (length raw-name))
+ (name (if org-taskjuggler-trim-ids-from-titles
+ (if (= raw-name-len id-len)
+ raw-name
+ (subseq raw-name (1+ id-len)))
+ raw-name)))
+ (format "task %s \"%s\" {\n" id name))
;; Add default attributes.
(and depends
(format " depends %s\n"
--
2.5.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 8/8] ox-taskjuggler.el: allow trimming the task ID from its title
2015-11-08 10:23 [PATCH 8/8] ox-taskjuggler.el: allow trimming the task ID from its title Kosyrev Serge
@ 2015-11-12 16:49 ` Rasmus
0 siblings, 0 replies; 2+ messages in thread
From: Rasmus @ 2015-11-12 16:49 UTC (permalink / raw)
To: emacs-orgmode
Kosyrev Serge <_deepfire@feelingofgreen.ru> writes:
> * ox-taskjuggler.el (org-taskjuggler-trim-ids-from-titles): new custom
You should capitalize after the colon and end with a period.
Also, custom → defcustom (IMO).
> (org-taskjuggler--build-task): trim task ids from titles, when the new
> custom variable asks for this (enabled by default).
As above.
> +(defcustom org-taskjuggler-trim-ids-from-titles t
> + "Non-NIL trims the part detected as prefix from resulting task titles."
> + :group 'org-export-taskjuggler
> + :type 'boolean)
I don’t think you need to capitalize nil. Also, why is it plural?
> ;;; Hooks
> @@ -887,9 +892,16 @@ a unique id will be associated to it."
> (- org-lowest-priority org-highest-priority)))))))))
> (concat
> ;; Opening task.
> - (format "task %s \"%s\" {\n"
> - (org-taskjuggler-get-id task info)
> - (org-taskjuggler-get-name task))
> + (let* ((id (org-taskjuggler-get-id task info))
> + (raw-name (org-taskjuggler-get-name task))
> + (id-len (length id))
> + (raw-name-len (length raw-name))
> + (name (if org-taskjuggler-trim-ids-from-titles
> + (if (= raw-name-len id-len)
> + raw-name
> + (subseq raw-name (1+ id-len)))
> + raw-name)))
I would use eq, but I’m not sure it’s important. Why does
org-taskjuggler-get-name potentially return the ID? Isn’t that closer to
the misbehavior here? (Keep in mind I’m not familiar with the codebase in
question).
Rasmus
--
And I faced endless streams of vendor-approved Ikea furniture. . .
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-11-12 16:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-08 10:23 [PATCH 8/8] ox-taskjuggler.el: allow trimming the task ID from its title Kosyrev Serge
2015-11-12 16:49 ` Rasmus
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).