From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Branham Subject: Re: [PATCH] allow users to customize string in org-agenda-time-grid Date: Tue, 11 Jul 2017 08:21:30 +0200 Message-ID: <87wp7f7atx.fsf@utexas.edu> References: <871sps69c7.fsf@utexas.edu> <87shi866so.fsf@nicolasgoaziou.fr> <87a84gir1r.fsf@utexas.edu> <8737a4wgvr.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33101) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUoYE-0004Gz-Kl for emacs-orgmode@gnu.org; Tue, 11 Jul 2017 02:21:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUoYA-0000PV-Je for emacs-orgmode@gnu.org; Tue, 11 Jul 2017 02:21:38 -0400 Received: from mail-lf0-x22a.google.com ([2a00:1450:4010:c07::22a]:36660) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dUoYA-0000Oq-5S for emacs-orgmode@gnu.org; Tue, 11 Jul 2017 02:21:34 -0400 Received: by mail-lf0-x22a.google.com with SMTP id h22so75812084lfk.3 for ; Mon, 10 Jul 2017 23:21:34 -0700 (PDT) In-reply-to: <8737a4wgvr.fsf@nicolasgoaziou.fr> 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" To: Nicolas Goaziou Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hi Nicolas, >> Note that this way, users who have set org-agenda-time-grid to a list >> with three elements will see a slightly different agenda now (the >> default "......" will get dropped). > > I think this is acceptable if we properly announce it in ORG-NEWS. > >> The order of the items in the list is also a bit weird --- they get >> displayed in the order 3, 4, 2. I've updated the docstring to try to >> make this a bit clearer. > > True. While we're at making an incompatible change on the variable, do > you think it makes sense to change the order of the parameters? > > If so, would you want to update your patch accordingly? Sure, I've updated that variable so that the items are in the order that they get displayed in the agenda. > You need to specify the variable being changed, i.e., > > * lisp/org-agenda.el (org-agenda-time-grid): ... > > Could you provide an ORG-NEWS entry, too? Yes, done. Alex >From da08983716a275b745288a25995e6c9d4e3104ca Mon Sep 17 00:00:00 2001 From: Alex Branham Date: Tue, 11 Jul 2017 08:08:58 +0200 Subject: [PATCH] org-agenda: change order of items, support custom time grid string * lisp/org-agenda.el (org-agenda-time-grid): Users may now customize the string to display after the time in the agenda. The order of items was updated to reflect the order that they are displayed in the agenda. TINYCHANGE --- etc/ORG-NEWS | 6 ++++++ lisp/org-agenda.el | 31 +++++++++++++++++++------------ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index b7e2a5fad..936ecc36b 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -87,6 +87,12 @@ See docstring for details. *** Change signature for ~org-time-string-to-time~ See docstring for changes. + +*** Change order of items in ~org-agenda-time-grid~ +~org-agenda-time-grid~ gained an extra item to allow users to customize +the string displayed after times in the agenda. See docstring for +details. + ** New features *** ~org-attach~ can move directory contents When setting a new directory for an entry, org-attach offers to move diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 0ddb8ce1e..9ac4f6583 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -1479,11 +1479,12 @@ the variable `org-agenda-time-grid'." (defcustom org-agenda-time-grid '((daily today require-timed) - "----------------" - (800 1000 1200 1400 1600 1800 2000)) + (800 1000 1200 1400 1600 1800 2000) + "......" + "----------------") "The settings for time grid for agenda display. -This is a list of three items. The first item is again a list. It contains +This is a list of four items. The first item is again a list. It contains symbols specifying conditions when the grid should be displayed: daily if the agenda shows a single day @@ -1492,10 +1493,14 @@ symbols specifying conditions when the grid should be displayed: require-timed show grid only if at least one item has a time specification remove-match skip grid times already present in an entry -The second item is a string which will be placed behind the grid time. +The second item is a list of integers, indicating the times that +should have a grid line. -The third item is a list of integers, indicating the times that should have -a grid line." +The third item is a string which will be placed right after the +times that have a grid line. + +The fourth item is a string placed after the grid times. This +will align with agenda items" :group 'org-agenda-time-grid :type '(list @@ -1507,8 +1512,9 @@ a grid line." require-timed) (const :tag "Skip grid times already present in an entry" remove-match)) - (string :tag "Grid String") - (repeat :tag "Grid Times" (integer :tag "Time")))) + (repeat :tag "Grid Times" (integer :tag "Time")) + (string :tag "Grid String (after agenda times)") + (string :tag "Grid String (aligns with agenda items)"))) (defcustom org-agenda-show-current-time-in-grid t "Non-nil means show the current time in the time grid." @@ -6418,6 +6424,7 @@ Any match of REMOVE-RE will be removed from TXT." (get-text-property 1 'effort txt))) ;; time, tag, effort are needed for the eval of the prefix format (tag (if tags (nth (1- (length tags)) tags) "")) + (time-grid-trailing-characters (nth 2 org-agenda-time-grid)) time (ts (if dotime (concat (if (stringp dotime) dotime "") @@ -6496,8 +6503,8 @@ Any match of REMOVE-RE will be removed from TXT." (s1 (concat (org-agenda-time-of-day-to-ampm-maybe s1) (if org-agenda-timegrid-use-ampm - "........ " - "......"))) + (concat time-grid-trailing-characters " ") + time-grid-trailing-characters))) (t "")) extra (or (and (not habitp) extra) "") category (if (symbolp category) (symbol-name category) category) @@ -6590,8 +6597,8 @@ TODAYP is t when the current agenda view is on today." (let* ((have (delq nil (mapcar (lambda (x) (get-text-property 1 'time-of-day x)) list))) - (string (nth 1 org-agenda-time-grid)) - (gridtimes (nth 2 org-agenda-time-grid)) + (string (nth 3 org-agenda-time-grid)) + (gridtimes (nth 1 org-agenda-time-grid)) (req (car org-agenda-time-grid)) (remove (member 'remove-match req)) new time) -- 2.13.2 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0003-org-agenda-change-order-of-items-support-custom-time.patch >From da08983716a275b745288a25995e6c9d4e3104ca Mon Sep 17 00:00:00 2001 From: Alex Branham Date: Tue, 11 Jul 2017 08:08:58 +0200 Subject: [PATCH] org-agenda: change order of items, support custom time grid string * lisp/org-agenda.el (org-agenda-time-grid): Users may now customize the string to display after the time in the agenda. The order of items was updated to reflect the order that they are displayed in the agenda. TINYCHANGE --- etc/ORG-NEWS | 6 ++++++ lisp/org-agenda.el | 31 +++++++++++++++++++------------ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index b7e2a5fad..936ecc36b 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -87,6 +87,12 @@ See docstring for details. *** Change signature for ~org-time-string-to-time~ See docstring for changes. + +*** Change order of items in ~org-agenda-time-grid~ +~org-agenda-time-grid~ gained an extra item to allow users to customize +the string displayed after times in the agenda. See docstring for +details. + ** New features *** ~org-attach~ can move directory contents When setting a new directory for an entry, org-attach offers to move diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 0ddb8ce1e..9ac4f6583 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -1479,11 +1479,12 @@ the variable `org-agenda-time-grid'." (defcustom org-agenda-time-grid '((daily today require-timed) - "----------------" - (800 1000 1200 1400 1600 1800 2000)) + (800 1000 1200 1400 1600 1800 2000) + "......" + "----------------") "The settings for time grid for agenda display. -This is a list of three items. The first item is again a list. It contains +This is a list of four items. The first item is again a list. It contains symbols specifying conditions when the grid should be displayed: daily if the agenda shows a single day @@ -1492,10 +1493,14 @@ symbols specifying conditions when the grid should be displayed: require-timed show grid only if at least one item has a time specification remove-match skip grid times already present in an entry -The second item is a string which will be placed behind the grid time. +The second item is a list of integers, indicating the times that +should have a grid line. -The third item is a list of integers, indicating the times that should have -a grid line." +The third item is a string which will be placed right after the +times that have a grid line. + +The fourth item is a string placed after the grid times. This +will align with agenda items" :group 'org-agenda-time-grid :type '(list @@ -1507,8 +1512,9 @@ a grid line." require-timed) (const :tag "Skip grid times already present in an entry" remove-match)) - (string :tag "Grid String") - (repeat :tag "Grid Times" (integer :tag "Time")))) + (repeat :tag "Grid Times" (integer :tag "Time")) + (string :tag "Grid String (after agenda times)") + (string :tag "Grid String (aligns with agenda items)"))) (defcustom org-agenda-show-current-time-in-grid t "Non-nil means show the current time in the time grid." @@ -6418,6 +6424,7 @@ Any match of REMOVE-RE will be removed from TXT." (get-text-property 1 'effort txt))) ;; time, tag, effort are needed for the eval of the prefix format (tag (if tags (nth (1- (length tags)) tags) "")) + (time-grid-trailing-characters (nth 2 org-agenda-time-grid)) time (ts (if dotime (concat (if (stringp dotime) dotime "") @@ -6496,8 +6503,8 @@ Any match of REMOVE-RE will be removed from TXT." (s1 (concat (org-agenda-time-of-day-to-ampm-maybe s1) (if org-agenda-timegrid-use-ampm - "........ " - "......"))) + (concat time-grid-trailing-characters " ") + time-grid-trailing-characters))) (t "")) extra (or (and (not habitp) extra) "") category (if (symbolp category) (symbol-name category) category) @@ -6590,8 +6597,8 @@ TODAYP is t when the current agenda view is on today." (let* ((have (delq nil (mapcar (lambda (x) (get-text-property 1 'time-of-day x)) list))) - (string (nth 1 org-agenda-time-grid)) - (gridtimes (nth 2 org-agenda-time-grid)) + (string (nth 3 org-agenda-time-grid)) + (gridtimes (nth 1 org-agenda-time-grid)) (req (car org-agenda-time-grid)) (remove (member 'remove-match req)) new time) -- 2.13.2 --=-=-=--