From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Fix C-u C-c C-q (align all tags in visible buffer) Date: Fri, 04 Jan 2019 14:17:53 +0100 Message-ID: <87bm4wv9xa.fsf@nicolasgoaziou.fr> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:51757) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gfPMN-00006L-LG for emacs-orgmode@gnu.org; Fri, 04 Jan 2019 08:18:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gfPMK-0004tU-IU for emacs-orgmode@gnu.org; Fri, 04 Jan 2019 08:17:59 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:46779) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gfPMK-0004t6-CI for emacs-orgmode@gnu.org; Fri, 04 Jan 2019 08:17:56 -0500 In-Reply-To: (Kaushal Modi's message of "Thu, 3 Jan 2019 17:30:04 -0500") 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: Kaushal Modi Cc: emacs-org list Hello, Kaushal Modi 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