GNU bug report logs - #41130
outline-mode: Add new commands like org-cycle and org-global-cycle

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefankangas <at> gmail.com>

Date: Thu, 7 May 2020 20:55:02 UTC

Severity: wishlist

Tags: patch

Merged with 41198

Found in version 27.0.60

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Stefan Kangas <stefan <at> marxist.se>, 41130 <at> debbugs.gnu.org, 41198 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: bug#41130: bug#41198: 27.0.60; [PATCH] heading cycling command for outline
Date: Sat, 17 Oct 2020 08:36:47 +0200
Yuan Fu <casouri <at> gmail.com> writes:

> This patch should make outline behaves like org: S-TAB always cycle
> the whole buffer, regardless where is the point. TAB cycles a heading,
> and does nothing if point is before the first heading.

I think the behaviour makes sense, but the implementation isn't ideal:

[...]

> +  (condition-case nil
> +      (pcase (outline--cycle-state)
> +        ('hide-all
> +         (if (outline-has-subheading-p)
> +             (progn (outline-show-children)
> +                    (message "Only headings"))
> +           (outline-show-subtree)
> +           (message "Show all")))
> +        ('headings-only
> +         (outline-show-subtree)
> +         (message "Show all"))
> +        ('show-all
> +         (outline-hide-subtree)
> +         (message "Hide all")))
> +    ;; If error: "Before first heading" occurs, ignore it.
> +    (error nil)))

This is basically an `ignore-errors' around a whole bunch of code, used
as a program flow mechanism, and that's always awkward, because it hides
real errors in the code.

Altering the functions to not error out in these situations would be
better.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 4 years and 155 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.