-
Notifications
You must be signed in to change notification settings - Fork 3
/
org-starless.el
54 lines (45 loc) · 1.66 KB
/
org-starless.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
;;; org-starless.el --- Hide stars in org-mode
;; Copyright (C) 2020 TonCherAmi
;; Author: TonCherAmi
;; URL: https://github.com/TonCherAmi/org-starless
;; Version: 0.0.2
;; Package-Requires: ((emacs "25.1"))
;; This file is NOT part of GNU Emacs.
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 3, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program ; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Commentary:
;; This package hides org-mode heading stars.
;;; Code:
(define-minor-mode org-starless-mode
"Starless org-mode"
nil nil nil
:require 'org
(let* ((keyword
`(("^\\(\\*+ \\)\\s-*\\S-" ; Do not hide empty headings!
(1 (put-text-property (match-beginning 1) (match-end 1) 'invisible t)
nil)))))
(if org-starless-mode
(progn
(font-lock-add-keywords nil keyword)
(font-lock-ensure)
(font-lock-flush))
(save-excursion
(goto-char (point-min))
(font-lock-remove-keywords nil keyword)
(font-lock-ensure)
(font-lock-flush)))))
(provide 'org-starless)
;;; org-starless.el ends here