[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/org-superstar 9c9c13280d 097/162: Added (tested) example f
From: |
Stefan Kangas |
Subject: |
[nongnu] elpa/org-superstar 9c9c13280d 097/162: Added (tested) example for programmatically toggling lightweight-mode on startup. |
Date: |
Fri, 31 Dec 2021 19:35:31 -0500 (EST) |
branch: elpa/org-superstar
commit 9c9c13280df6591ff736b00f386a728460edc757
Author: D. Williams <d.williams@posteo.net>
Commit: D. Williams <d.williams@posteo.net>
Added (tested) example for programmatically toggling lightweight-mode on
startup.
---
README.org | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/README.org b/README.org
index 9260887e76..a94df2da78 100644
--- a/README.org
+++ b/README.org
@@ -151,7 +151,23 @@ used, allowing the user to inherit the level-dependent
default look.
of plain list items. The command
=org-superstar-toggle-lightweight-lists= allows the user to disable
syntax checking for plain lists both interactively and in code.
-**** TODO Give an elisp example for automated toggling!
+ This can even be done programmatically. For example, if you
+ experience issues for files with more than 100 list items, you
+ could simply add the following to ~org-mode-hook~ instead of a
+ direct call to ~org-superstar-mode~:
+
+ #+BEGIN_SRC emacs-lisp
+ (defun my-auto-lightweight-mode ()
+ "Start Org Superstar differently depending on the number of lists
items."
+ (let ((list-items
+ (count-matches "^[ \t]*?\\([+-]\\|[ \t]\\*\\)"
+ (point-min) (point-max))))
+ (unless (< list-items 100)
+ (org-superstar-toggle-lightweight-lists)))
+ (org-superstar))
+
+ (add-hook 'org-mode-hook #'my-auto-lightweight-mode)
+ #+END_SRC
** Custom faces
These faces allow you to further manipulate the look and feel of
- [nongnu] elpa/org-superstar 4897c333a8 105/162: Version bump: Update documentation and README accordingly to reflect new feature., (continued)
- [nongnu] elpa/org-superstar 4897c333a8 105/162: Version bump: Update documentation and README accordingly to reflect new feature., Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 026c54f1bf 100/162: Version bump: Add new option allowing a more efficient (but sloppy) display of list items, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 15b9c32eae 112/162: Version Bump., Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 4b4ddd7c39 122/162: Honor ‘org-inlinetask-show-first-star’., Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 7657a777fb 129/162: Adding inlinetask demos., Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 94f35c20f8 135/162: Final cleanup before tagging, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 979d2dd199 161/162: Merge pull request #34 from taquangtrung/master, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 715a9681d3 087/162: Removing inconsistent use of apostrophe from README., Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar da5c2208e9 085/162: Adding MELPA Stable badge, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 0d18d5ab99 090/162: Updating README to address issue #5., Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 9c9c13280d 097/162: Added (tested) example for programmatically toggling lightweight-mode on startup.,
Stefan Kangas <=
- [nongnu] elpa/org-superstar e225b78a5c 113/162: Updating README to reflect version change., Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar abb8e863a1 109/162: Fix: Make org-superstar-headline-p non-interactive, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 2eed7bd4fe 098/162: Removed redundant sentence., Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 09ddc28383 108/162: Fixed an unescaped paren in docstring., Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 9ee98125bf 121/162: Working around GitHub README strangeness, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 9c85b9eace 117/162: Create issue template: bug report, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 61896d5bcd 125/162: Updating README on volatile., Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar c3955469d5 134/162: Updating feature list., Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 8bfe6354d9 138/162: Updated documentation to address Issue #21., Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar d0cb2f4b9f 150/162: Merge branch 'hide-all-todo-keywords' of andersjohansson, Stefan Kangas, 2021/12/31