bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#41130: bug#41198: 27.0.60; [PATCH] heading cycling command for outli


From: Juri Linkov
Subject: bug#41130: bug#41198: 27.0.60; [PATCH] heading cycling command for outline
Date: Sat, 17 Oct 2020 23:30:06 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> +  (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.

Like 'outline-back-to-heading' has an optional argument 'invisible-ok',
maybe a new argument named 'error-ok' or 'outside-ok' could
be added to not error out when point is outside of the outline tree.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]