all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Bug: Bad alignment of grouped tags in fast selection dialog [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]
@ 2019-02-12 20:12 Carlos Pita
  2019-02-12 21:02 ` Carlos Pita
  0 siblings, 1 reply; 4+ messages in thread
From: Carlos Pita @ 2019-02-12 20:12 UTC (permalink / raw)
  To: emacs-orgmode


For example, with:

#+tags: { @casa(c) @oficina(o) @viaje(v) @gimnasio(g) @xxx(x) }

I get:

{ [c] @casa       [o] @oficina    [v] @viaje      [g] @gimnasio
 [x] @xxx        }

where [c] and [x] are clearly misaligned.



If I remove the last tag:

#+tags: { @casa(c) @oficina(o) @viaje(v) @gimnasio(g) }

I get:

{ [c] @casa       [o] @oficina    [v] @viaje      [g] @gimnasio
 }

where the closing brace should be in the line before.



org-last-tag-selection-key is a bit overwhelming in size but I might try
my luck and see what I can get.

Regards
--
Carlos

-------

Emacs  : GNU Emacs 26.1.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
 of 2019-02-10
Package: Org mode version 9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)

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

* Re: Bug: Bad alignment of grouped tags in fast selection dialog [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]
  2019-02-12 20:12 Bug: Bad alignment of grouped tags in fast selection dialog [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)] Carlos Pita
@ 2019-02-12 21:02 ` Carlos Pita
  2019-02-12 21:24   ` Carlos Pita
  0 siblings, 1 reply; 4+ messages in thread
From: Carlos Pita @ 2019-02-12 21:02 UTC (permalink / raw)
  To: emacs-orgmode

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

Ok, this was easier than I initially thought.

Here is a patch. I've tested it with a number of configurations: a few
grouped tags, many grouped tags, grouped tags that fill the last line
entirely, grouped and ungrouped tags. Notice that even ungrouped tags
are indented by two spaces. This is done because some tags may be
grouped while other not. In case no tag is grouped this is adding an
extra initial space but I think removing it is not worth the check "is
everything ungrouped?".

Best regards
--
Carlos

[-- Attachment #2: 0001-org-Fix-fast-tag-selection-menu-alignment.patch --]
[-- Type: text/x-patch, Size: 1343 bytes --]

From 4a79d1355ec35c711bddd06be0d99b0af287c182 Mon Sep 17 00:00:00 2001
From: memeplex <carlosjosepita@gmail.com>
Date: Tue, 12 Feb 2019 17:49:40 -0300
Subject: [PATCH] org: Fix fast tag selection menu alignment

* lisp/org.el (org-fast-tag-selection):
  - Avoid lines with just a closing delimiter.
  - Correctly align grouped and ungrouped tags.
---
 lisp/org.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index e2258749b..7f04cee18 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14502,13 +14502,13 @@ Returns the new tags string, or nil to not change the current settings."
 	  			   ((member tg inherited) i-face))))
 	  (when (equal (caar tbl) :grouptags)
 	    (org-add-props tg nil 'face 'org-tag-group))
-	  (when (and (zerop cnt) (not ingroup) (not intaggroup)) (insert " "))
+	  (when (and (zerop cnt) (not ingroup) (not intaggroup)) (insert "  "))
 	  (insert "[" c "] " tg (make-string
 				 (- fwidth 4 (length tg)) ?\ ))
 	  (push (cons tg c) ntable)
 	  (when (= (cl-incf cnt) ncol)
-	    (insert "\n")
-	    (when (or ingroup intaggroup) (insert " "))
+	    (unless (memq (caar tbl) '(:endgroup :endgrouptag)) (insert "\n"))
+	    (when (or ingroup intaggroup) (insert "  "))
 	    (setq cnt 0)))))
       (setq ntable (nreverse ntable))
       (insert "\n")
-- 
2.20.1


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

* Re: Bug: Bad alignment of grouped tags in fast selection dialog [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]
  2019-02-12 21:02 ` Carlos Pita
@ 2019-02-12 21:24   ` Carlos Pita
  2019-02-13 12:06     ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Carlos Pita @ 2019-02-12 21:24 UTC (permalink / raw)
  To: emacs-orgmode

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

Not a big deal, but here is a slightly better fix that avoids adding
some spaces before the closing }.

The difference wrt to the previous one is just:

-           (unless (memq (caar tbl) '(:endgroup :endgrouptag)) (insert "\n"))
-           (when (or ingroup intaggroup) (insert "  "))
+           (unless (memq (caar tbl) '(:endgroup :endgrouptag))
+             (insert "\n")
+             (when (or ingroup intaggroup) (insert "  ")))

That is, the when clause is inside the unless clause.

[-- Attachment #2: 0001-org-Fix-fast-tag-selection-menu-alignment.patch --]
[-- Type: text/x-patch, Size: 1354 bytes --]

From 49775847f6db729dfb726ac098cc8039fceb9346 Mon Sep 17 00:00:00 2001
From: memeplex <carlosjosepita@gmail.com>
Date: Tue, 12 Feb 2019 17:49:40 -0300
Subject: [PATCH] org: Fix fast tag selection menu alignment

* lisp/org.el (org-fast-tag-selection):
  - Avoid lines with just a closing delimiter.
  - Correctly align grouped and ungrouped tags.
---
 lisp/org.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index e2258749b..003058434 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14502,13 +14502,14 @@ Returns the new tags string, or nil to not change the current settings."
 	  			   ((member tg inherited) i-face))))
 	  (when (equal (caar tbl) :grouptags)
 	    (org-add-props tg nil 'face 'org-tag-group))
-	  (when (and (zerop cnt) (not ingroup) (not intaggroup)) (insert " "))
+	  (when (and (zerop cnt) (not ingroup) (not intaggroup)) (insert "  "))
 	  (insert "[" c "] " tg (make-string
 				 (- fwidth 4 (length tg)) ?\ ))
 	  (push (cons tg c) ntable)
 	  (when (= (cl-incf cnt) ncol)
-	    (insert "\n")
-	    (when (or ingroup intaggroup) (insert " "))
+	    (unless (memq (caar tbl) '(:endgroup :endgrouptag))
+	      (insert "\n")
+	      (when (or ingroup intaggroup) (insert "  ")))
 	    (setq cnt 0)))))
       (setq ntable (nreverse ntable))
       (insert "\n")
-- 
2.20.1


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

* Re: Bug: Bad alignment of grouped tags in fast selection dialog [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]
  2019-02-12 21:24   ` Carlos Pita
@ 2019-02-13 12:06     ` Nicolas Goaziou
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2019-02-13 12:06 UTC (permalink / raw)
  To: Carlos Pita; +Cc: emacs-orgmode

Hello,

Carlos Pita <carlosjosepita@gmail.com> writes:

> Not a big deal, but here is a slightly better fix that avoids adding
> some spaces before the closing }.
>
> The difference wrt to the previous one is just:
>
> -           (unless (memq (caar tbl) '(:endgroup :endgrouptag)) (insert "\n"))
> -           (when (or ingroup intaggroup) (insert "  "))
> +           (unless (memq (caar tbl) '(:endgroup :endgrouptag))
> +             (insert "\n")
> +             (when (or ingroup intaggroup) (insert "  ")))
>
> That is, the when clause is inside the unless clause.

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2019-02-13 12:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-12 20:12 Bug: Bad alignment of grouped tags in fast selection dialog [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)] Carlos Pita
2019-02-12 21:02 ` Carlos Pita
2019-02-12 21:24   ` Carlos Pita
2019-02-13 12:06     ` Nicolas Goaziou

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.