emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Fix C-u C-c C-q (align all tags in visible buffer)
@ 2019-01-03 22:30 Kaushal Modi
  2019-01-04 13:17 ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Kaushal Modi @ 2019-01-03 22:30 UTC (permalink / raw)
  To: emacs-org list

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

Hello,

This minor bug had been bothering me for a while and I eventually got to
looking into the source code for it.

As of current master, C-u C-c C-q doesn't work as in the doc-string i.e.
"When optional argument ALL is non-nil, align all tags in the visible part
of the buffer.".

Here's an example Org buffer:

=====
* Foo :abc:
** Bar :def:
=====

- With point on Foo heading, C-u C-c C-q aligns only :def: tag (tags from
*next* heading onwards).
- So when point is on Bar, no tags get aligned.

Though I remember that C-u C-c C-q worked quite some time back.

A commit in Apr 28, 2018 broke that behavior in
https://code.orgmode.org/bzg/org-mode/commit/1615261cdc5da6dbe50176d7958c775d6d54411e#diff-f9a90d66b3053f60bd4e8d63f214273067d0d28L14288
.

While I don't understand that entire commit, this simple fix brings back
the true C-u C-c C-q behavior:

diff --git a/lisp/org.el b/lisp/org.el
index db3c11b5f..b8daa3bfc 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14203,8 +14203,10 @@ visible part of the buffer."
     (org--align-tags-here (funcall get-indent-column))
       (save-excursion
     (if all
+            (progn
+              (goto-char (point-min))
           (while (re-search-forward org-tag-line-re nil t)
-          (org--align-tags-here (funcall get-indent-column)))
+            (org--align-tags-here (funcall get-indent-column))))
       (org-back-to-heading t)
       (org--align-tags-here (funcall get-indent-column)))))))


If this looks good, I can commit this to maint and master.

Thanks.


--
Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 2377 bytes --]

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

* Re: Fix C-u C-c C-q (align all tags in visible buffer)
  2019-01-03 22:30 Fix C-u C-c C-q (align all tags in visible buffer) Kaushal Modi
@ 2019-01-04 13:17 ` Nicolas Goaziou
  2019-01-04 14:01   ` Kaushal Modi
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2019-01-04 13:17 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: emacs-org list

Hello,

Kaushal Modi <kaushal.modi@gmail.com> writes:

> This minor bug had been bothering me for a while and I eventually got to
> looking into the source code for it.
>
> As of current master, C-u C-c C-q doesn't work as in the doc-string i.e.
> "When optional argument ALL is non-nil, align all tags in the visible part
> of the buffer.".
>
> Here's an example Org buffer:
>
> =====
> * Foo :abc:
> ** Bar :def:
> =====
>
> - With point on Foo heading, C-u C-c C-q aligns only :def: tag (tags from
> *next* heading onwards).
> - So when point is on Bar, no tags get aligned.
>
> Though I remember that C-u C-c C-q worked quite some time back.
>
> A commit in Apr 28, 2018 broke that behavior in
> https://code.orgmode.org/bzg/org-mode/commit/1615261cdc5da6dbe50176d7958c775d6d54411e#diff-f9a90d66b3053f60bd4e8d63f214273067d0d28L14288
> .
>
> While I don't understand that entire commit, this simple fix brings back
> the true C-u C-c C-q behavior:
>
> diff --git a/lisp/org.el b/lisp/org.el
> index db3c11b5f..b8daa3bfc 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -14203,8 +14203,10 @@ visible part of the buffer."
>      (org--align-tags-here (funcall get-indent-column))
>        (save-excursion
>      (if all
> +            (progn
> +              (goto-char (point-min))
>            (while (re-search-forward org-tag-line-re nil t)
> -          (org--align-tags-here (funcall get-indent-column)))
> +            (org--align-tags-here (funcall get-indent-column))))
>        (org-back-to-heading t)
>        (org--align-tags-here (funcall get-indent-column)))))))
>
>
> If this looks good, I can commit this to maint and master.

Sure. Please also provide a regression test for it.

Thank you.

Regards,

-- 
Nicolas Goaziou

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

* Re: Fix C-u C-c C-q (align all tags in visible buffer)
  2019-01-04 13:17 ` Nicolas Goaziou
@ 2019-01-04 14:01   ` Kaushal Modi
  2019-01-04 14:17     ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Kaushal Modi @ 2019-01-04 14:01 UTC (permalink / raw)
  To: Kaushal Modi, emacs-org list

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

Hello Nicolas,

On Fri, Jan 4, 2019 at 8:17 AM Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Hello,
>
>
> > If this looks good, I can commit this to maint and master.
>
> Sure. Please also provide a regression test for it.
>

Thank you.

Commited to maint, merged to master, with a test.

https://code.orgmode.org/bzg/org-mode/commit/539091799b370a1c452fe4952e8074d7dfe8656f

[-- Attachment #2: Type: text/html, Size: 884 bytes --]

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

* Re: Fix C-u C-c C-q (align all tags in visible buffer)
  2019-01-04 14:01   ` Kaushal Modi
@ 2019-01-04 14:17     ` Nicolas Goaziou
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2019-01-04 14:17 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: emacs-org list

Kaushal Modi <kaushal.modi@gmail.com> writes:

> Commited to maint, merged to master, with a test.

Great. Thank you!

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

end of thread, other threads:[~2019-01-04 14:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-03 22:30 Fix C-u C-c C-q (align all tags in visible buffer) Kaushal Modi
2019-01-04 13:17 ` Nicolas Goaziou
2019-01-04 14:01   ` Kaushal Modi
2019-01-04 14:17     ` Nicolas Goaziou

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