From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Dimech Newsgroups: gmane.emacs.help Subject: Re: outline-minor-mode and org-mode capabilities for programming languages Date: Mon, 10 May 2021 11:29:27 +0200 Message-ID: References: <87zgx3zu6e.fsf@zoho.eu> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24727"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org, Jean Louis To: Christopher Dimech Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 10 11:30:37 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lg2FI-00063m-Sr for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 10 May 2021 11:30:36 +0200 Original-Received: from localhost ([::1]:47288 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lg2FG-0006TU-VI for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 10 May 2021 05:30:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lg2Eq-0006TM-Uo for help-gnu-emacs@gnu.org; Mon, 10 May 2021 05:30:09 -0400 Original-Received: from mout.gmx.net ([212.227.15.15]:52227) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lg2Ek-0006P9-Bs for help-gnu-emacs@gnu.org; Mon, 10 May 2021 05:30:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1620638967; bh=op8fLe2YozHxYj24PyhFqTCtF2rgDOo6NpLCkqpcXKA=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=C2gGLaWaYy/yGOlKt5I5IkLfdRHRSHf9Kpf3+ZzHoCoPNMr3hl+63K1dBqv828otn NhswwEA9as7PpIlrwTDsNVNhgCPYciBwsCt2piz26AEPPcV1bLN9WDIuGL6m1yGulJ E7//xH+YKQ69eDjmtslkfu6LllzPWMG/tmREhAGg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs04.server.lan [172.19.170.170]) (via HTTP); Mon, 10 May 2021 11:29:27 +0200 Importance: normal Sensitivity: Normal In-Reply-To: X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:6CeK5+y24K5pCmXMcsL45SmRe+ybhsUntxxtBWPZT06Q6nSEUNRWBaFGsuzstM4FXpPS9 uhuO8/QaypjZNQOW7jN301fl4NLNS/vEXj9zmKMwFUuagf9sveP7mZDaWt76kxQcbGj/B4DHu/In q/hMlSiyDNO9cJY5o6tV1Lv/ufKHs5jjjbjz3XYo8XTqLGTuJywUDAxnyk2uxw+Q191Vlz33WQ7R i8Usi6tjGLIYGoYKIZLIVl1Jt9wUTFJdi3miwW2kIrmvMXHBq+N13OziDwaIJPQJJT/FvwcVTWYO 84= X-UI-Out-Filterresults: notjunk:1;V03:K0:vwAHtXV9JQY=:GjlIB4I06/124HdNxJZLJG XI1R/E97NdRUTF4muuV2P2xMFxjsUrwhym54xVRChE4BgcjZgtoUAxjIEWMwCdl5pTHUft44U jlEPRhH/4MKI1fzvNLJ2YUJaVKBzfj5ttmm6oPwcXL7oiHz8Clqw0l5cEIBNPzkJWR+k4L89I LWh0lP+/d3JAnalVP1QM+Ai+5dhNPyfSRnaonxpOoH03EvO6oCueoPBVNvk5BmBm1crJoXrZO n5pVA3Dmtaz5XqI5pT0J45KpiaeXXvrP4zopwRqNgra5mP4qZaskD2IFElzNM8fpZFJxvRY7L tzNRa8PmORWzBmomIrSzpd0hcCea3rNlXJDfYzguwYELTgEeHGm84xBJCrmFS9UggxvLzBkf1 h9O0M0pD8iAQQrSxLnU7mUuHWaVJ1T+ag4UU86ldY1tr6RzpUwft4TWGWW8sO205Et1AJdUCM jup5RhSbZbx091vL0JZBwNW9mdHKm3nf/CCsbVSMUS7aEJnVHpeYVjQCa4f6unLuWdlIx6yaf 3FbmRflTssU1JuPVS3fp4dQ2VR1NDe9X36Ug0MW3xUNvB/Jaj5p+M/P626UMXbW7w8PSbqvqB 8PWmTOEYn/Bsem0wUN9bcU76TdoTMr80UmzZRQ/sqhaXNHrApg7D+ucUylZpVmet8aiddR+ZA e28LD10TZUZ2W1fJEfe3Ps7GTrkLLrV3jAmZM4bISTu/o5jOdYIsiSIyrxiSF9I108uk5A4fI ltjkMns1E+5rV4E/9ndQa2pP9O7FUHdTxR0NgGCRqzFXNz/UcwIYzGmp4MwyizEke19CVQWl Received-SPF: pass client-ip=212.227.15.15; envelope-from=dimech@gmx.com; helo=mout.gmx.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:129656 Archived-At: Ok, I have done (add-hook 'emacs-lisp-mode-hook #'outline-minor-mode) (add-hook 'emacs-lisp-mode-hook (lambda () (outline-minor-mode 1))) > Sent: Monday, May 10, 2021 at 8:32 PM > From: "Christopher Dimech" > To: "Jean Louis" > Cc: help-gnu-emacs@gnu=2Eorg > Subject: Re: outline-minor-mode and org-mode capabilities for programmin= g languages > >=20 > > Sent: Monday, May 10, 2021 at 7:32 PM > > From: "Jean Louis" > > To: "Christopher Dimech" > > Cc: help-gnu-emacs@gnu=2Eorg > > Subject: Re: outline-minor-mode and org-mode capabilities for programm= ing languages > > > > * Christopher Dimech [2021-05-10 09:53]: > > > Mainly catering for highligting, headlines and folding to start > > > with=2E > >=20 > > Isn't that what outline-minor-mode is for? > >=20 > > There are already other packages, I have been testing it, and they > > worked similar to outline-minor-mode and could fold things=2E >=20 > Folding of functions is good, folding by headings not so good=2E =20 > =20 > > How you want to designate headlines? It has to have some key > > string=2E Maybe with 5 ;;;;; on beginning? > >=20 > > ;;;;; Headline >=20 > How about extending it to subheadings like org-mode=2E It is a good ide= a > to use the comment declaration for defining headings, and also use * for > heading levels as in org-mode=2E For languages with multiline comments > I simply used *, then changed to org-mode=2E In elisp I made a multilin= e > comment function=2E >=20 > For texinfo, which has multi-line comment capability I have been doing >=20 > @ignore > * Heading > @end ignore >=20 > @ignore > ** Subheading > @end ignore >=20 > > Evaluate this, and you get highlighting of headlines: > > (highlight-regexp "^;;;;;=2E*$" 'hi-yellow) > >=20 > > But I think you have to first play with:=20 > > {M-x customize-group RET outline RET} > >=20 > > as there is highlighting already included=2E > >=20 > > For headings, I think each mode need different definition on what is > > heading=2E=20 >=20 > They should always go with the comment declaration for the language=2E = Most likely > good, but then one cannot easily switch to org-mode=2E Then again, if t= he topics > of discussion are resolved, there wauld not me much need to change to or= g-mode for > certain org-mode operations=2E >=20 > > So you can define heading with `outline-heading-alist' > >=20 > > outline-heading-alist is a variable defined in =E2=80=98outline=2Eel= =E2=80=99=2E > >=20 > > Its value is nil > >=20 > > Automatically becomes buffer-local when set=2E > >=20 > > Alist associating a heading for every possible level=2E > > Each entry is of the form (HEADING =2E LEVEL)=2E > > This alist is used two ways: to find the heading corresponding to > > a given level and to find the level of a given heading=2E > > If a mode or document needs several sets of outline headings (for exam= ple > > numbered and unnumbered sections), list them set by set and sorted by = level > > within each set=2E For example in texinfo mode: > >=20 > > (setq outline-heading-alist > > '(("@chapter" =2E 2) ("@section" =2E 3) ("@subsection" =2E 4) > > ("@subsubsection" =2E 5) > > ("@unnumbered" =2E 2) ("@unnumberedsec" =2E 3) > > ("@unnumberedsubsec" =2E 4) ("@unnumberedsubsubsec" =2E 5) > > ("@appendix" =2E 2) ("@appendixsec" =2E 3)=2E=2E=2E > > ("@appendixsubsec" =2E 4) ("@appendixsubsubsec" =2E 5) =2E= =2E)) > >=20 > > Instead of sorting the entries in each set, you can also separate the > > sets with nil=2E > >=20 > > You asked for: > >=20 > > - highligting,=20 > > - headlines; and=20 > > - folding > >=20 > > And I have demonstrated that more or less, that already exists in > > outline-minor-mode, play with highlighting options, folding already > > exists, and headings you may define yourself=2E >=20 > I am suggesting to clean things up and put all the capabilities into a s= ingle > minor mode=2E We can keep it to outline-minor-mode=2E > =20 > > Let us say I have this comment and I keep just one space after ;;;; > >=20 > > ;;;; =E2=9F=A6=E2=9F=A6 LIST FUNCTIONS =E2=9F=A7=E2=9F=A7 > >=20 > > Folded text > >=20 > > ;;;; =E2=9F=A6=E2=9F=A6=E2=9F=A6 MORE LIST FUNCTIONS =E2=9F=A7=E2=9F= =A7=E2=9F=A7 > >=20 > > (setq outline-heading-alist > > '((";;;; =E2=9F=A6" =2E 1) (";;;; =E2=9F=A6=E2=9F=A6" =2E 2) (";;;; = =E2=9F=A6=E2=9F=A6=E2=9F=A6" =2E 3))) > >=20 > > this appears to work on my side in Emacs Lisp mode, but not in > > fundamental=2E I can fold those headings and they remain visible=2E > >=20 > > > > Like should I mark functions with TODO/DONE? > > >=20 > > > No > >=20 > > Those mentioned meta level features can look abstract to you, but they > > are very real to me so far=2E It leans to subject of literate > > programming, similar to programming by using Org Babel and embedded > > functions that are described and later interpolated into the > > script=2E Just that I can do that on the higher level rich attributes > > and references and relations to other functions=2E As humans we are s= o > > late with literate programming=2E That would help so many other people= =2E >=20 > I agree with you up to a point=2E For starters let's just clean things = up > with the capabilities that are already implemented=2E Literate schemes = are > good for organisational purposes, but for programming, literate schemes > make everything much more cumbersome, and ultimately yield to total disa= ster=20 > in terms of efficiency in going through the code base=2E One thing that= does help > is self documuntation if kept brief within the code file=2E > =20 > > > I suggest that outline-minor-mode be also refactored and revamped, a= s I have > > > seen much additional code on top of it (outline-magic, orgstruct, > > > outshine)=2E > >=20 > > For now, those features which you asked for, already exist, you may > > try customizations, you are just few minutes away from having > > highlighting, folding is already there, and defining headlines=2E >=20 > Opening-closing headings with the mouse would be good=2E Will spend the= few minutes > and get back to you, as per your advice=2E Then see what capabilities f= rom the other > add-ons are redundant=2E=20 >=20 > =20 > > --=20 > > Jean > >=20 > > Take action in Free Software Foundation campaigns: > > https://www=2Efsf=2Eorg/campaigns > >=20 > > Sign an open letter in support of Richard M=2E Stallman > > https://stallmansupport=2Eorg/ > > https://rms-support-letter=2Egithub=2Eio/ > >=20 > >=20 > > >=20 >