From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: Cycling first N heading levels in outline Date: Sun, 23 May 2021 21:06:53 +0200 Message-ID: <87mtsl8duq.fsf@gnu.org> References: <87wnrqt5re.fsf@localhost> <875yz9bjrf.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28527"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.5.13; emacs 28.0.50 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun May 23 21:12:04 2021 Return-path: Envelope-to: ged-emacs-devel@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 1lktW8-0007Eq-9p for ged-emacs-devel@m.gmane-mx.org; Sun, 23 May 2021 21:12:04 +0200 Original-Received: from localhost ([::1]:48638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lktW6-0007bD-Es for ged-emacs-devel@m.gmane-mx.org; Sun, 23 May 2021 15:12:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37650) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lktVY-0006qx-Rr for emacs-devel@gnu.org; Sun, 23 May 2021 15:11:29 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:40732) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lktVY-0006ZF-LD for emacs-devel@gnu.org; Sun, 23 May 2021 15:11:28 -0400 Original-Received: from auth1-smtp.messagingengine.com ([66.111.4.227]:60747) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lktVY-0005eu-EB for emacs-devel@gnu.org; Sun, 23 May 2021 15:11:28 -0400 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id BEDE127C0054 for ; Sun, 23 May 2021 15:11:27 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sun, 23 May 2021 15:11:27 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdejjedgkeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpehffgfhvffuffgjkfggtgesthdtre dttdertdenucfhrhhomhepvfgrshhsihhlohcujfhorhhnuceothhsughhsehgnhhurdho rhhgqeenucggtffrrghtthgvrhhnpeevveeikeetkeeviefgfeffiedvteeguddvffeuue duveegtddthedvhfeuveffhfenucfkphepkeejrdduieefrdefuddrudehgeenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhorhhnodhmvg hsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdekieejfeekjeekgedqieefhedvleek qdhtshguhheppehgnhhurdhorhhgsehfrghsthhmrghilhdrfhhm X-ME-Proxy: Original-Received: from thinkpad-t440p (p57a31f9a.dip0.t-ipconnect.de [87.163.31.154]) by mail.messagingengine.com (Postfix) with ESMTPA for ; Sun, 23 May 2021 15:11:27 -0400 (EDT) In-reply-to: X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:269692 Archived-At: Christopher Dimech writes: > Hi Jean, do you know how to have subheadings for elisp using outline-minor-mode? FWIW, I use these outline settings which gives me 8 levels of outlines in any programming mode where the outline headings start with the comment started of the mode followed by one or more asterisks. --8<---------------cut here---------------start------------->8--- (defun th/outline-minor-mode-prefix-init () "Set `outline-minor-mode-prefix' for the current mode." (let ((comment-starter (if comment-start (replace-regexp-in-string "[[:space:]]+" "" comment-start) ""))) (setq comment-starter (replace-regexp-in-string "*" "[*]" comment-starter)) ;; Just because ;;* looks better than ;* and won't be indented. (when (string= comment-starter ";") (setq comment-starter ";;")) (when (eq major-mode 'bibtex-mode) (setq comment-starter (if (eq bibtex-dialect 'biblatex) "%" ""))) (setq-local outline-minor-mode-prefix (concat "^\\(?:" (regexp-quote comment-starter) "\\)")))) (defun th/outline-minor-mode-init () (th/outline-minor-mode-prefix-init) (setq-local outline-regexp (concat outline-minor-mode-prefix "[*]+")) (font-lock-add-keywords nil `((,(concat outline-minor-mode-prefix "[*] .*$") 0 'org-level-1 t) (,(concat outline-minor-mode-prefix "[*][*] .*$") 0 'org-level-2 t) (,(concat outline-minor-mode-prefix "[*][*][*] .*$") 0 'org-level-3 t) (,(concat outline-minor-mode-prefix "[*][*][*][*] .*$") 0 'org-level-4 t) (,(concat outline-minor-mode-prefix "[*][*][*][*][*] .*$") 0 'org-level-5 t) (,(concat outline-minor-mode-prefix "[*][*][*][*][*][*] .*$") 0 'org-level-6 t) (,(concat outline-minor-mode-prefix "[*][*][*][*][*][*][*] .*$") 0 'org-level-7 t) (,(concat outline-minor-mode-prefix "[*][*][*][*][*][*][*][*] .*$") 0 'org-level-8 t)))) (add-hook 'outline-minor-mode-hook #'th/outline-minor-mode-init) (defvar th/outline-minor-mode-modes '(c-mode c++-mode java-mode emacs-lisp-mode lisp-mode ruby-mode haskell-mode lua-mode clojure-mode python-mode sh-mode bibtex-mode restclient-mode TeX-mode LaTeX-mode)) (dolist (mode th/outline-minor-mode-modes) (add-hook (intern (concat (symbol-name mode) "-hook")) #'outline-minor-mode)) --8<---------------cut here---------------end--------------->8--- So in elisp I write: ;;* Top Level Heading ;;** 2nd Level Heading ;;*** 3rd Level Heading Bye, Tassilo