emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] allow users to customize string in org-agenda-time-grid
@ 2017-07-07  6:37 Alex Branham
  2017-07-07  7:32 ` Nicolas Goaziou
  2017-07-10 20:02 ` Samuel Wales
  0 siblings, 2 replies; 8+ messages in thread
From: Alex Branham @ 2017-07-07  6:37 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1877 bytes --]

Hello,

This small patch allows users to customize the string to display after the time in the agenda view.

I think I formatted the patch correctly, but please let me know if I missed something,
Alex

------------------------------------------------------------

From 3e1a9a4a0cde14e1496c355028c9ef3c8b75b9e2 Mon Sep 17 00:00:00 2001
From: Alex Branham <branham@utexas.edu>
Date: Fri, 7 Jul 2017 08:25:38 +0200
Subject: [PATCH] org-agenda.el: Allow users to customize string after
 time-grid

* org-agenda.el: Users may now customize the string to display after
the time in the agenda with the variable
`org-agenda-time-grid-trailing-characters'.

TINYCHANGE
---
 lisp/org-agenda.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index ddd1b7d11..43b844cc3 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1510,6 +1510,11 @@ a grid line."
     (string :tag "Grid String")
     (repeat :tag "Grid Times" (integer :tag "Time"))))

+(defcustom org-agenda-time-grid-trailing-characters "......"
+  "Characters to show after time when `org-agenda-use-time-grid' is non-nil."
+  :group 'org-agenda-time-grid
+  :type 'string)
+
 (defcustom org-agenda-show-current-time-in-grid t
   "Non-nil means show the current time in the time grid."
   :group 'org-agenda-time-grid
@@ -6478,8 +6483,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 org-agenda-time-grid-trailing-characters " ")
+                                org-agenda-time-grid-trailing-characters)))
 			 (t ""))
 	      extra (or (and (not habitp) extra) "")
 	      category (if (symbolp category) (symbol-name category) category)
--
2.13.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-agenda.el-Allow-users-to-customize-string-after-.patch --]
[-- Type: text/x-diff, Size: 1615 bytes --]

From 3e1a9a4a0cde14e1496c355028c9ef3c8b75b9e2 Mon Sep 17 00:00:00 2001
From: Alex Branham <branham@utexas.edu>
Date: Fri, 7 Jul 2017 08:25:38 +0200
Subject: [PATCH] org-agenda.el: Allow users to customize string after
 time-grid

* org-agenda.el: Users may now customize the string to display after
the time in the agenda with the variable
`org-agenda-time-grid-trailing-characters'.

TINYCHANGE
---
 lisp/org-agenda.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index ddd1b7d11..43b844cc3 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1510,6 +1510,11 @@ a grid line."
     (string :tag "Grid String")
     (repeat :tag "Grid Times" (integer :tag "Time"))))
 
+(defcustom org-agenda-time-grid-trailing-characters "......"
+  "Characters to show after time when `org-agenda-use-time-grid' is non-nil."
+  :group 'org-agenda-time-grid
+  :type 'string)
+
 (defcustom org-agenda-show-current-time-in-grid t
   "Non-nil means show the current time in the time grid."
   :group 'org-agenda-time-grid
@@ -6478,8 +6483,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 org-agenda-time-grid-trailing-characters " ")
+                                org-agenda-time-grid-trailing-characters)))
 			 (t ""))
 	      extra (or (and (not habitp) extra) "")
 	      category (if (symbolp category) (symbol-name category) category)
-- 
2.13.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] allow users to customize string in org-agenda-time-grid
  2017-07-07  6:37 [PATCH] allow users to customize string in org-agenda-time-grid Alex Branham
@ 2017-07-07  7:32 ` Nicolas Goaziou
  2017-07-07  8:34   ` Alex Branham
  2017-07-10 20:02 ` Samuel Wales
  1 sibling, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2017-07-07  7:32 UTC (permalink / raw)
  To: Alex Branham; +Cc: emacs-orgmode

Hello,

Alex Branham <branham@utexas.edu> writes:

> This small patch allows users to customize the string to display after the time in the agenda view.
>
> I think I formatted the patch correctly, but please let me know if
> I missed something,

Thank you.

Would it be better to extend `org-agenda-time-grid' instead? It could,
e.g., support a fourth element in the list.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] allow users to customize string in org-agenda-time-grid
  2017-07-07  7:32 ` Nicolas Goaziou
@ 2017-07-07  8:34   ` Alex Branham
  2017-07-10 13:39     ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Branham @ 2017-07-07  8:34 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 3587 bytes --]

Hi -

On Fri 07 Jul 2017 at 07:32, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:

> Would it be better to extend `org-agenda-time-grid' instead? It could,
> e.g., support a fourth element in the list.

Sure, that's possible. Patch attached. 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). 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.

Alex

From 12e5561b1df1d86a45e7c418dd7dd44763e52423 Mon Sep 17 00:00:00 2001
From: Alex Branham <branham@utexas.edu>
Date: Fri, 7 Jul 2017 10:29:28 +0200
Subject: [PATCH] org-agenda.el: Allow users to customize string after
 time-grid

* org-agenda.el: Users may now customize the string to display after
the time in the agenda by using the fourth element of org-agenda-time-grid.

TINYCHANGE
---
 lisp/org-agenda.el | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index ddd1b7d11..d479a7f61 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1480,7 +1480,8 @@ 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
@@ -1492,10 +1493,12 @@ 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 string which will be placed where agenda items are displayed.

 The third item is a list of integers, indicating the times that should have
-a grid line."
+a grid line.
+
+The fourth item is a string placed after the grid times and before agenda items."
   :group 'org-agenda-time-grid
   :type
   '(list
@@ -1507,8 +1510,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"))))
+    (string :tag "Grid String (after)")
+    (repeat :tag "Grid Times" (integer :tag "Time"))
+    (string :tag "Grid String (before)")))

 (defcustom org-agenda-show-current-time-in-grid t
   "Non-nil means show the current time in the time grid."
@@ -6400,6 +6404,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 3 org-agenda-time-grid))
 	     time
 	     (ts (if dotime (concat
 			     (if (stringp dotime) dotime "")
@@ -6478,8 +6483,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)
--
2.13.2



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-org-agenda.el-Allow-users-to-customize-string-after-.patch --]
[-- Type: text/x-diff, Size: 3007 bytes --]

From 12e5561b1df1d86a45e7c418dd7dd44763e52423 Mon Sep 17 00:00:00 2001
From: Alex Branham <branham@utexas.edu>
Date: Fri, 7 Jul 2017 10:29:28 +0200
Subject: [PATCH] org-agenda.el: Allow users to customize string after
 time-grid

* org-agenda.el: Users may now customize the string to display after
the time in the agenda by using the fourth element of org-agenda-time-grid.

TINYCHANGE
---
 lisp/org-agenda.el | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index ddd1b7d11..d479a7f61 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1480,7 +1480,8 @@ 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
@@ -1492,10 +1493,12 @@ 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 string which will be placed where agenda items are displayed.
 
 The third item is a list of integers, indicating the times that should have
-a grid line."
+a grid line.
+
+The fourth item is a string placed after the grid times and before agenda items."
   :group 'org-agenda-time-grid
   :type
   '(list
@@ -1507,8 +1510,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"))))
+    (string :tag "Grid String (after)")
+    (repeat :tag "Grid Times" (integer :tag "Time"))
+    (string :tag "Grid String (before)")))
 
 (defcustom org-agenda-show-current-time-in-grid t
   "Non-nil means show the current time in the time grid."
@@ -6400,6 +6404,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 3 org-agenda-time-grid))
 	     time
 	     (ts (if dotime (concat
 			     (if (stringp dotime) dotime "")
@@ -6478,8 +6483,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)
-- 
2.13.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] allow users to customize string in org-agenda-time-grid
  2017-07-07  8:34   ` Alex Branham
@ 2017-07-10 13:39     ` Nicolas Goaziou
  2017-07-11  6:21       ` Alex Branham
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2017-07-10 13:39 UTC (permalink / raw)
  To: Alex Branham; +Cc: emacs-orgmode

Hello,

Alex Branham <branham@utexas.edu> writes:

> Sure, that's possible. Patch attached. 

Thank you.

> 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?

>
> From 12e5561b1df1d86a45e7c418dd7dd44763e52423 Mon Sep 17 00:00:00 2001
> From: Alex Branham <branham@utexas.edu>
> Date: Fri, 7 Jul 2017 10:29:28 +0200
> Subject: [PATCH] org-agenda.el: Allow users to customize string after
>  time-grid
>
> * org-agenda.el: Users may now customize the string to display after

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?


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] allow users to customize string in org-agenda-time-grid
  2017-07-07  6:37 [PATCH] allow users to customize string in org-agenda-time-grid Alex Branham
  2017-07-07  7:32 ` Nicolas Goaziou
@ 2017-07-10 20:02 ` Samuel Wales
  2017-07-11  6:16   ` Alex Branham
  1 sibling, 1 reply; 8+ messages in thread
From: Samuel Wales @ 2017-07-10 20:02 UTC (permalink / raw)
  To: Alex Branham; +Cc: emacs-orgmode

i am confused

org-agenda-current-time-string seems similar

org-agenda-time-grid says "The second item is a string which will be
placed behind the grid time."


On 7/6/17, Alex Branham <branham@utexas.edu> wrote:
> Hello,
>
> This small patch allows users to customize the string to display after the
> time in the agenda view.

-- 
The Kafka Pandemic: <http://thekafkapandemic.blogspot.com>

The disease DOES progress. MANY people have died from it. And ANYBODY
can get it at any time.

"You’ve really gotta quit this and get moving, because this is murder
by neglect." ---
<http://www.meaction.net/2017/02/03/pwme-people-with-me-are-being-murdered-by-neglect>.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] allow users to customize string in org-agenda-time-grid
  2017-07-10 20:02 ` Samuel Wales
@ 2017-07-11  6:16   ` Alex Branham
  0 siblings, 0 replies; 8+ messages in thread
From: Alex Branham @ 2017-07-11  6:16 UTC (permalink / raw)
  To: Samuel Wales; +Cc: emacs-orgmode

Hi Samuel,

`org-agenda-current-time-string' allows users to customize the string associated with the current time. It's currently something like, "--- now --------". The patch I'm submitting allows users to customize the string that comes after the times displayed in the time-grid (assuming that it displays at all). Currently that's hard coded as six periods "......".

Alex

On Mon 10 Jul 2017 at 20:02, Samuel Wales <samologist@gmail.com> wrote:

> i am confused
>
> org-agenda-current-time-string seems similar
>
> org-agenda-time-grid says "The second item is a string which will be
> placed behind the grid time."
>
>
> On 7/6/17, Alex Branham <branham@utexas.edu> wrote:
>> Hello,
>>
>> This small patch allows users to customize the string to display after the
>> time in the agenda view.


--
J. Alexander Branham
PhD Candidate
Department of Government
University of Texas at Austin
https://www.jabranham.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] allow users to customize string in org-agenda-time-grid
  2017-07-10 13:39     ` Nicolas Goaziou
@ 2017-07-11  6:21       ` Alex Branham
  2017-07-11  8:05         ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Branham @ 2017-07-11  6:21 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 5436 bytes --]

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 <branham@utexas.edu>
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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0003-org-agenda-change-order-of-items-support-custom-time.patch --]
[-- Type: text/x-diff, Size: 4520 bytes --]

From da08983716a275b745288a25995e6c9d4e3104ca Mon Sep 17 00:00:00 2001
From: Alex Branham <branham@utexas.edu>
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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] allow users to customize string in org-agenda-time-grid
  2017-07-11  6:21       ` Alex Branham
@ 2017-07-11  8:05         ` Nicolas Goaziou
  0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Goaziou @ 2017-07-11  8:05 UTC (permalink / raw)
  To: Alex Branham; +Cc: emacs-orgmode

Hello,

Alex Branham <branham@utexas.edu> writes:

> From: Alex Branham <branham@utexas.edu>
> 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

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-07-11  8:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-07  6:37 [PATCH] allow users to customize string in org-agenda-time-grid Alex Branham
2017-07-07  7:32 ` Nicolas Goaziou
2017-07-07  8:34   ` Alex Branham
2017-07-10 13:39     ` Nicolas Goaziou
2017-07-11  6:21       ` Alex Branham
2017-07-11  8:05         ` Nicolas Goaziou
2017-07-10 20:02 ` Samuel Wales
2017-07-11  6:16   ` Alex Branham

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).