From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Porter Subject: Re: [PATCH] Add option to automatically align tags in agenda view Date: Mon, 07 Aug 2017 13:57:15 -0500 Message-ID: <87k22fnr3o.fsf@alphapapa.net> References: <87poc7o50r.fsf@alphapapa.net> <87bmnrthag.fsf@kyleam.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57513) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1denDd-0006b2-NH for emacs-orgmode@gnu.org; Mon, 07 Aug 2017 14:57:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1denDY-0003sT-PD for emacs-orgmode@gnu.org; Mon, 07 Aug 2017 14:57:37 -0400 Received: from [195.159.176.226] (port=39099 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1denDY-0003ro-Hf for emacs-orgmode@gnu.org; Mon, 07 Aug 2017 14:57:32 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1denDP-0003Cu-He for emacs-orgmode@gnu.org; Mon, 07 Aug 2017 20:57:23 +0200 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: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Kyle Meyer 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 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-org-agenda.el-Add-option-to-automatically-align-tags.patch Content-Description: patch >From 99a61e09d5267ddaa84e8f93fbab161144aea011 Mon Sep 17 00:00:00 2001 From: Adam Porter 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 --=-=-=--