-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Major refactoring? #53
Comments
As far as I know, Outline-minor-mode does not do cycling, only the various showing and hiding commands that are much less friendly to remember than simply hitting I agree about removing unnecessary features - for example there are quite a few orphan functions that aren't referenced by anything else, and "hidden line cookies" seems to be quite buggy and a much better case for overlays. About the use-outorg family of commands, perhaps it's better for someone who regularly uses those features to comment on them - my personal use is limited to |
Also, I think the current method of piecing together and mutating a dozen global variables in For reference here's some of the inline notes I took of the minor mode activation : ;; Compute basic outline regular expressions.
;; The following function calls initialize buffer-local variables which are
;; used in subsequent outshine-calc-* functions.
(outshine-set-outline-regexp-base)
;; Initializes the variables:
;; - outshine--enforce-no-comment-padding-p
;; - outshine--regexp-base
(outshine-normalize-regexps)
;; Initializes the variables:
;; - outshine--normalized-comment-start
;; - outshine--normalized-comment-end
;; - outshine--normalized-outline-regexp-base
;; - outshine--normalized-regexp-prefix
;; outshine-calc-outline-regexp is dependent on:
;; - outshine-regexp-outcommented-p - customizable defvar, should depend on prog-mode (Emacs 24)
;; - outshine--normalized-comment-start (thru -calc-comment-region-starter)
;; - outshine--enforce-no-comment-padding-p
;; - outshine--normalized-outline-regexp-base
(let ((out-regexp (outshine-calc-outline-regexp)))
...
|
You may be right. What I'm trying to get at is, Outshine seems to do many things, and I don't even understand them all, and some of it seems to depend on |
See the most recent PR #55, which should help a little in the way of grouping independent functionality. |
@thblt Looking at alphapapa/outorg#9, and considering how closely these packages are interrelated, I'm wondering if we should make a GitHub "organization" to hold these repos. What do you think? |
I've been postponing asking this exact question for some time now. I only use Outshine to manage Org-like headings in code, but it does a lot more, especially when combined with outorg and navi. From what I understand:
A minor potential issue with Outshine, IMO, is that we still hijack Outshine somehow. Programming major modes configure it to consider classes, functions, etc, as structure; Outshine modifies this config to use its heading system instead. I've been wondering about the possibility of making Outshine an autonomous, generic, structural editor for various text formats. It could then:
This could be done by taking inspiration from Origami, which already has pluggable parsers (but no concept of (1) having more than one parser per buffer or (2) parsers being of different "types). (Or even by actually extending Origami, which seems unmaintained) From this, (In this perspective, Outshine becomes a complete replacement of Outline and whichever code folding system people use) |
I just set out to make something on top of outline which will fold/show/unfold just by hitting tab like in org-mode. The default outline UX is horrendous... and one of the reasons org exists in the first place. If you want to implement that I can maybe volunteer to try to hack on it if we can make it fit nicely with the rest of the package. |
Here some historical remarks (as far as I remember): all those outline extensions that went into outshine did things outline-(minor-mode) could not do, but maybe it improved in the maintime and some of these functions are obsolete duplicates now? hidden line cookies use outorg By script I created templates for almost all org command, implemented a few, and left the others for users interested in that functionality. If all org commands that make sense in programming mode would Its all prepared, but somebody would need to do the work. WRT dependency, oushines works without outorg (when outshine-use-outorg is omitted), but outorg needs outshine. Both libraries are a bit complex, so merging is maybe not such a good idea? imenu other ideas @thblt Cheers |
I've been giving this a bit of thought too - what do you all think of refactoring the current system of generating the outline-regexp into a single Here's the proposed API: (defcustom outshine-default-spec-alist
'((base-char . ?*)
(commented . t)
(padding . 1))
"Variables used to calculate the outline-regexp. To override
these settings for particular major modes, see `outshine-custom-spec-alist'.")
(defcustom outshine-custom-spec-alist
'((markdown-mode (commented . nil)
(base-char . ?#))
(emacs-lisp-mode (base-char . ?\;)
(padding . nil))
(haskell-mode (padding . nil))
(text-mode (commented . nil)))
"The first matching key in the list that the current major mode derives from
will be used to override default settings") This would address issues like #57 in general, the user simply adds their custom mode settings to the list (add-to-list 'outshine-custom-spec-alist
'(lean-mode (base-char . ?-)
(padding . nil))) And it would construct a outline regexp with the repeated base-char portion in a capture group, simplifying the logic of functions like e.g. in python-mode: ;; commented max-level
;; | |
;; | padding | base-char
;; | | | |
(rx "#" " " (group (repeat 1 8 ?*)) " ") ;; => "# \\(\\*\\{1,8\\}\\) "
;; in a Python buffer:
# *** heading
(length (match-string 1)) ;; => 3 |
@thblt that sounds like an interesting idea, but for a completely different package as it would probably require a complete ground-up rewrite of the existing Outshine code. I think outshine's method of "hijacking" |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Thanks for thinking about this. 3 years later, count me in favour of any such cleanup. Straightforward tab-cycling of document sections with easily customizable headings is still a valuable feature and nothing seems to do it well. (I have had it working most with outshine but it's rather difficult, eg #77.) |
@thblt @yuhan0
I wonder if we should do a survey of Outshine's features and consider which ones are still necessary to implement in this package.
For example, outline cycling in non-Org, non-outline buffers is already handled by outline-minor-mode, so I'm not sure that we need to implement it again in Outshine. ISTM that, at most, we might need to implement some convenience functions on top of outline-minor-mode.
For issuing Org commands in non-Org buffers, maybe we could move to something like the
not-org
prototype library, which would relieve us of having to reimplement Outshine versions of Org commands (if not all, then at least some of them).The bottom line, of course, is that Emacs and Org have changed a lot since Outshine was first written. I don't have a good grasp of where its functionality fits and overlaps now, so I'm not sure where we need to go from here.
What do you think? Thanks.
The text was updated successfully, but these errors were encountered: