emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH] allow users to customize string in org-agenda-time-grid


From: Alex Branham
Subject: Re: [O] [PATCH] allow users to customize string in org-agenda-time-grid
Date: Fri, 07 Jul 2017 10:34:24 +0200
User-agent: mu4e 0.9.18; emacs 25.2.1

Hi -

On Fri 07 Jul 2017 at 07:32, Nicolas Goaziou <address@hidden> 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 <address@hidden>
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


Attachment: 0002-org-agenda.el-Allow-users-to-customize-string-after-.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]