From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexey Lebedeff Subject: [PATCH] Tag visibility fixup after setting them Date: Tue, 27 Dec 2016 13:30:55 +0300 Message-ID: <87shp9r7ds.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47228) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cLp2B-0005Gc-Fl for emacs-orgmode@gnu.org; Tue, 27 Dec 2016 05:31:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cLp28-0007OL-BH for emacs-orgmode@gnu.org; Tue, 27 Dec 2016 05:31:07 -0500 Received: from mail-lf0-x235.google.com ([2a00:1450:4010:c07::235]:35085) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cLp28-0007NP-4E for emacs-orgmode@gnu.org; Tue, 27 Dec 2016 05:31:04 -0500 Received: by mail-lf0-x235.google.com with SMTP id b14so185259380lfg.2 for ; Tue, 27 Dec 2016 02:31:02 -0800 (PST) Received: from demandred ([91.218.144.129]) by smtp.gmail.com with ESMTPSA id 10sm11422328ljh.11.2016.12.27.02.30.59 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Dec 2016 02:30:59 -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: Orgmode Mailing List --=-=-= Content-Type: text/plain Hi folks, This fixes bug where you sometimes can't immediately see tags that were just set. And to reveal them you need to go through global visibility cycle. Best, Alexey --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Reveal-tags-after-setting-them.patch >From d81f5be08c83fb31adfd36dc97dcf92268c898ed Mon Sep 17 00:00:00 2001 From: Alexey Lebedeff Date: Sun, 25 Dec 2016 13:24:04 +0300 Subject: [PATCH] Reveal tags after setting them Sometimes freshly added tags can be sucked into invisible outline region (denoted by ellipsis) - and to see them you need to do the full global visibilty cycle. --- lisp/org.el | 11 ++++++++++- testing/lisp/test-org.el | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 3ddd80b..4d6ba75 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8003,6 +8003,15 @@ unconditionally." (org-N-empty-lines-before-current (if blank? 1 0)))))) (run-hooks 'org-insert-heading-hook)) +(defun org-insert-visible-text (&rest args) + "Inserts arguments at point and makes them visible in outline. + +When text is being inserted on the invisible region boundary, it +can be inadvertently sucked into invisibility." + (let* ((before-point (point))) + (apply #'insert args) + (outline-flag-region before-point (point) nil))) + (defun org-N-empty-lines-before-current (N) "Make the number of empty lines before current exactly N. So this will delete or add empty lines." @@ -15096,7 +15105,7 @@ When JUST-ALIGN is non-nil, only align tags." ;; white spaces. (end-of-line) (if (not (equal tags "")) - (insert " " tags) + (org-insert-visible-text " " tags) (skip-chars-backward " \t") (delete-region (point) (line-end-position))))) ;; Align tags, if any. Fix tags column if `org-indent-mode' diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index bbd0c0b..d60364a 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -5130,6 +5130,24 @@ Paragraph" (should-not (org-test-with-temp-text "Paragraph" (org-hide-block-toggle-maybe)))) +(ert-deftest test-org/fast-tag-selection () + "Test `org-fast-tag-selection'." + ;; Tags set via fast-tag-selection should be visible afterwards + (should + (let ((org-tag-alist '(("NEXT" . ?n))) + (org-fast-tag-selection-single-key t)) + (cl-letf (((symbol-function 'read-char-exclusive) (lambda () ?n)) + ((symbol-function 'window-width) (lambda (&rest args) 100))) + (org-test-with-temp-text "* Headline\nAnd its content\n* And another headline\n\nWith some content" + ;; Show only headlines + (org-content) + ;; Set NEXT tag on current entry + (org-set-tags nil nil) + ;; Move point to that NEXT tag + (search-forward "NEXT") (backward-word) + ;; And it should be visible (i.e. no overlays) + (not (overlays-at (point)))))))) + (ert-deftest test-org/show-set-visibility () "Test `org-show-set-visibility' specifications." ;; Do not throw an error before first heading. -- 2.10.0 --=-=-=--