emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Adam Porter <adam@alphapapa.net>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Add option to automatically align tags in agenda view
Date: Mon, 07 Aug 2017 13:57:15 -0500	[thread overview]
Message-ID: <87k22fnr3o.fsf@alphapapa.net> (raw)
In-Reply-To: 87bmnrthag.fsf@kyleam.com

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

Kyle Meyer <kyle@kyleam.com> writes:

> ... with just one case and a fallthrough, I'd prefer you test with eq
> rather than using pcase.

Hi Kyle,

Ok, I've updated the patch.

Thanks,
Adam

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 2195 bytes --]

From 99a61e09d5267ddaa84e8f93fbab161144aea011 Mon Sep 17 00:00:00 2001
From: Adam Porter <adam@alphapapa.net>
Date: Mon, 7 Aug 2017 08:50:26 -0500
Subject: [PATCH] org-agenda.el: Add option to automatically align tags in
 agenda

(org-agenda-align-tags): Handle automatic alignment
(org-agenda-tags-column): Add 'auto setting

TINYCHANGE
---
 lisp/org-agenda.el | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index c8097de..76282d4 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1886,13 +1886,19 @@ When this is the symbol `prefix', only remove tags when
 (defvaralias 'org-agenda-remove-tags-when-in-prefix
   'org-agenda-remove-tags)
 
-(defcustom org-agenda-tags-column -80
+(defcustom org-agenda-tags-column 'auto
   "Shift tags in agenda items to this column.
-If this number is positive, it specifies the column.  If it is negative,
-it means that the tags should be flushright to that column.  For example,
--80 works well for a normal 80 character screen."
+If set to `auto', tags will be automatically aligned to the right
+edge of the window.
+
+If set to a positive number, tags will be left-aligned to that
+column.  If set to a negative number, tags will be right-aligned
+to that column.  For example, -80 works well for a normal 80
+character screen."
   :group 'org-agenda-line-format
-  :type 'integer)
+  :type '(choice
+	  (const :tag "Automatically align to right edge of window" auto)
+	  (integer :tag "Specific column" -80)))
 
 (defvaralias 'org-agenda-align-tags-to-column 'org-agenda-tags-column)
 
@@ -8959,7 +8965,11 @@ If FORCE-TAGS is non nil, the car of it returns the new tags."
 
 (defun org-agenda-align-tags (&optional line)
   "Align all tags in agenda items to `org-agenda-tags-column'."
-  (let ((inhibit-read-only t) l c)
+  (let ((inhibit-read-only t)
+	(org-agenda-tags-column (if (eq 'auto org-agenda-tags-column)
+				    (- (window-text-width))
+				  org-agenda-tags-column))
+	l c)
     (save-excursion
       (goto-char (if line (point-at-bol) (point-min)))
       (while (re-search-forward "\\([ \t]+\\)\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$"
-- 
2.7.4


  reply	other threads:[~2017-08-07 18:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-07 13:56 [PATCH] Add option to automatically align tags in agenda view Adam Porter
2017-08-07 17:32 ` Kyle Meyer
2017-08-07 18:57   ` Adam Porter [this message]
2017-08-07 22:04     ` Kyle Meyer
2017-08-08 15:52       ` Adam Porter
2017-08-08 18:19         ` Kyle Meyer
2017-08-08 18:23           ` Kyle Meyer
2017-08-08 18:42           ` Adam Porter
2017-08-08 19:26             ` Kyle Meyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k22fnr3o.fsf@alphapapa.net \
    --to=adam@alphapapa.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).