From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: [PATCH 8/8] ox-taskjuggler.el: allow trimming the task ID from its title Date: Thu, 12 Nov 2015 17:49:16 +0100 Message-ID: <87vb97jh83.fsf@gmx.us> References: <87ziymkd0j.fsf@feelingofgreen.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37737) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zwv45-0002SE-Te for emacs-orgmode@gnu.org; Thu, 12 Nov 2015 11:49:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zwv41-0005F8-Sq for emacs-orgmode@gnu.org; Thu, 12 Nov 2015 11:49:37 -0500 Received: from plane.gmane.org ([80.91.229.3]:57073) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zwv41-0005EC-M2 for emacs-orgmode@gnu.org; Thu, 12 Nov 2015 11:49:33 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Zwv3r-0005LU-AT for emacs-orgmode@gnu.org; Thu, 12 Nov 2015 17:49:23 +0100 Received: from 62.80.108.11 ([62.80.108.11]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 12 Nov 2015 17:49:23 +0100 Received: from rasmus by 62.80.108.11 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 12 Nov 2015 17:49:23 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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. . .