From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Fix C-u C-c C-q (align all tags in visible buffer) Date: Thu, 3 Jan 2019 17:30:04 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000021a1a057e9550fd" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:47611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gfBVk-0006Mr-Qh for emacs-orgmode@gnu.org; Thu, 03 Jan 2019 17:30:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gfBVj-0004P6-P3 for emacs-orgmode@gnu.org; Thu, 03 Jan 2019 17:30:44 -0500 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]:36015) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gfBVj-0004Lh-Gp for emacs-orgmode@gnu.org; Thu, 03 Jan 2019 17:30:43 -0500 Received: by mail-lj1-x231.google.com with SMTP id g11-v6so30978019ljk.3 for ; Thu, 03 Jan 2019 14:30:42 -0800 (PST) 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-org list --000000000000021a1a057e9550fd Content-Type: text/plain; charset="UTF-8" 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 --000000000000021a1a057e9550fd Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

This minor bug had been both= ering me for a while and I eventually got to looking into the source code f= or 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-n= il, align all tags in the visible part of the buffer.".

=
Here's an example Org buffer:

=3D= =3D=3D=3D=3D
* Foo :abc:
** Bar :def:
=3D=3D=3D= =3D=3D

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

Though I re= member 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-f9a90d66b= 3053f60bd4e8d63f214273067d0d28L14288.

While I = don't understand that entire commit, this simple fix brings back the tr= ue 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.&q= uot;
=C2=A0=C2=A0=C2=A0=C2=A0 (org--align-tags-here (funcall get-indent-= column))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (save-excursion
=C2=A0= =C2=A0=C2=A0=C2=A0 (if all
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 (progn
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (goto-char (point-min))
=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (while (re-search-forward= org-tag-line-re nil t)
-=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 (org--align-tags-here (funcall get-indent-column)))
+=C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (org--align-tags-here (funca= ll get-indent-column))))
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0 (org-back-to-he= ading t)
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0 (org--align-tags-here (funcall = get-indent-column)))))))
=C2=A0

If this loo= ks good, I can commit this to maint and master.

Th= anks.


--
Kaushal Modi
--000000000000021a1a057e9550fd--