[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/org-superstar 026c54f1bf 100/162: Version bump: Add new op
From: |
Stefan Kangas |
Subject: |
[nongnu] elpa/org-superstar 026c54f1bf 100/162: Version bump: Add new option allowing a more efficient (but sloppy) display of list items |
Date: |
Fri, 31 Dec 2021 19:35:31 -0500 (EST) |
branch: elpa/org-superstar
commit 026c54f1bfcb39b0d6ed1f99db0bb384ec10443c
Merge: 7a33a131a2 092de74fb9
Author: D. Williams <d.williams@posteo.net>
Commit: GitHub <noreply@github.com>
Version bump: Add new option allowing a more efficient (but sloppy) display
of list items
Add a new feature, allowing Org Superstar to remain handy for Org files
with many list items.
This merge also addresses #8, lowering the minimum version of Emacs a wee
bit.
---
README.org | 40 ++++++++++++++++++++++++++++++++++++----
org-superstar.el | 39 +++++++++++++++++++++++++++++++--------
2 files changed, 67 insertions(+), 12 deletions(-)
diff --git a/README.org b/README.org
index 30bb446cb0..e3cce0a99d 100644
--- a/README.org
+++ b/README.org
@@ -46,10 +46,8 @@ used, allowing the user to inherit the level-dependent
default look.
package, being too interactive. This would require a lot of
font-lock related boilerplate which I am currently
in the process of dedicating it's own package to.
- * optional display of two leading bullets for inline tasks :: This
- feature is perfectly within the scope of this package.
- However, I will not add it unless asked, to avoid preemptive
- accumulation of features no one asked for.
+ * optionally display a leading bullet for inline tasks :: Please see
+ [[https://github.com/integral-dw/org-superstar-mode/issues/5][this
issue]].
* Installation
@@ -145,6 +143,31 @@ used, allowing the user to inherit the level-dependent
default look.
Exactly as it says on the tin. Set this variable to ~nil~ to stop
~org-superstar-mode~ from prettifying lists.
+*** Fast Plain List Items
+ The default syntax-checking done to ensure only actual plain list
+ items are prettified is rather expensive, but usually not
+ expensive enough to cause significant slowdown. This can change
+ when dealing with Org files containing hundreds or even thousands
+ 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.
+ 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
prettified bullets.
@@ -178,6 +201,15 @@ used, allowing the user to inherit the level-dependent
default look.
problem. If this should not fix the problem, please consider
opening an issue or sending me a mail!
+*** "I experience lag when working with long plain lists!"
+ By default, Org Superstar does expensive syntax checking to ensure
+ plain lists are actual plain lists. This is usually not an issue
+ for small files. However, this may pose a problem when your file
+ contains hundreds or thousands of items! You can deal with this
+ interactively using the command
+ =org-superstar-toggle-lightweight-lists=. See also the subsection
+ "*Fast Plain List Items*" above.
+
* NEWS
** =2020-04-01=
diff --git a/org-superstar.el b/org-superstar.el
index 4b5fb97690..935249605b 100644
--- a/org-superstar.el
+++ b/org-superstar.el
@@ -5,9 +5,9 @@
;; Author: D. Williams <d.williams@posteo.net>
;; Maintainer: D. Williams <d.williams@posteo.net>
;; Keywords: faces, outlines
-;; Version: 1.0.3
+;; Version: 1.1.0
;; Homepage: https://github.com/integral-dw/org-superstar-mode
-;; Package-Requires: ((org "9.1.9") (emacs "26.2"))
+;; Package-Requires: ((org "9.1.9") (emacs "26.1"))
;; This file is NOT part of GNU Emacs.
@@ -272,6 +272,12 @@ keyword)."
:group 'org-superstar
:type 'boolean)
+(defvar-local org-superstar-lightweight-lists nil
+ "Non-nil means circumvent expensive calls to ‘org-superstar-plain-list-p’.
+
+There is usually no need to use this variable directly; instead,
+use the command ‘org-superstar-toggle-lightweight-lists’.")
+
;;; Faces
@@ -348,6 +354,18 @@ variable for your changes to take effect."
(setq org-superstar-special-todo-items nil)
nil)
+;;;###autoload
+(defun org-superstar-toggle-lightweight-lists ()
+ "Toggle syntax checking for plain list items.
+
+Disabling syntax checking will cause Org Superstar to display
+lines looking like plain lists (for example in code) like plain
+lists. However, this may cause significant speedup for org files
+containing several hundred list items."
+ (interactive)
+ (setq org-superstar-lightweight-lists
+ (not org-superstar-lightweight-lists)))
+
;;; Accessor Functions
@@ -425,11 +443,16 @@ replaced by their corresponding entry in
‘org-superstar-item-bullet-alist’."
;; Explicitly returning t is redundant, but does not leak information
;; about how the predicate is implemented.
(defun org-superstar-plain-list-p ()
- "Return t if the current match is a proper plain list."
- (save-match-data
- (when (org-element-lineage (org-element-at-point)
- '(plain-list) t)
- t)))
+ "Return t if the current match is a proper plain list.
+
+This function may be expensive for files with very large plain
+lists; consider using ‘org-superstar-toggle-lightweight-lists’ in
+such cases to avoid slowdown."
+ (or org-superstar-lightweight-lists
+ (save-match-data
+ (org-element-lineage (org-element-at-point)
+ '(plain-list) t))
+ t))
(defun org-superstar-headline-or-inlinetask-p ()
"Return t if the current match is a proper headline or inlinetask."
@@ -623,7 +646,7 @@ cleanup routines."
(org-superstar--fontify-buffer))))
(defun org-superstar-restart ()
- "Re-enable ‘org-superstar-mode’, if the mode is enabled."
+ "Re-enable Org Superstar mode, if the mode is enabled."
(interactive)
(when org-superstar-mode
(org-superstar-mode 0)
- [nongnu] elpa/org-superstar d17d10c443 044/162: updated README, (continued)
- [nongnu] elpa/org-superstar d17d10c443 044/162: updated README, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar c6b8bd604f 023/162: marked update in roadmap, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar c0dacd8562 052/162: updated README to reflect new version, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar d94e141c36 069/162: Added a REVIEW marker., Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 8a6215a10f 084/162: Merge pull request #6 from progfolio/fix-org-superstar-restart-docstring, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 092de74fb9 099/162: Fixed typo in README., Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar f75220cd2d 089/162: Downgrade version requirements, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 3fbfc0a47e 092/162: Merge pull request #11 from integral-dw/issue-10, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar a995899117 115/162: Merge branch 'master' of github.com:integral-dw/org-superstar-mode, Stefan Kangas, 2021/12/31
- [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 <=
- [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, 2021/12/31
- [nongnu] elpa/org-superstar e225b78a5c 113/162: Updating README to reflect version change., Stefan Kangas, 2021/12/31