[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/orgalist 93609f9 2/7: orgalist: Simplify auto fill
From: |
Nicolas Goaziou |
Subject: |
[elpa] externals/orgalist 93609f9 2/7: orgalist: Simplify auto fill |
Date: |
Tue, 1 May 2018 09:31:00 -0400 (EDT) |
branch: externals/orgalist
commit 93609f9de9a3bee685c37072669d3fefae5b4785
Author: Nicolas Goaziou <address@hidden>
Commit: Nicolas Goaziou <address@hidden>
orgalist: Simplify auto fill
* orgalist.el (orgalist--last-advised-function): Remove variable.
(orgalist--set-auto-fill): Remove function.
(orgalist-mode): Directly advise `auto-fill-function' instead of
relying on a post command hook.
---
orgalist.el | 26 ++++----------------------
1 file changed, 4 insertions(+), 22 deletions(-)
diff --git a/orgalist.el b/orgalist.el
index a304184..d936eb3 100644
--- a/orgalist.el
+++ b/orgalist.el
@@ -188,9 +188,6 @@ group 4: description tag")
(defvar-local orgalist--cycling-state nil
"Current cycling state when cycling indentation.")
-(defvar-local orgalist--last-advised-function nil
- "Function currently advised for Auto fill mode.")
-
;;; Internal functions
@@ -499,20 +496,6 @@ as a piece of advice on `fill-paragraph-function'."
(orgalist--call-in-item #'fill-paragraph item? justify)
t)))
-(defun orgalist--set-auto-fill ()
- "Add advice to current Auto fill function.
-This function is meant to be used as a post command hook so it
-can periodically check changes to variable ‘auto-fill-function’."
- (when (and auto-fill-function
- (not (advice-function-member-p #'orgalist--auto-fill
- auto-fill-function)))
- (when orgalist--last-advised-function
- (remove-function orgalist--last-advised-function #'orgalist--auto-fill))
- (setq orgalist--last-advised-function auto-fill-function)
- (add-function :before-until
- (local 'auto-fill-function)
- #'orgalist--auto-fill)))
-
(defun orgalist--while-at-item (cmd)
"Return CMD when point is at a list item."
(when (orgalist--at-item-p) cmd))
@@ -650,14 +633,13 @@ TAB `orgalist-cycle-indentation'"
(setq-local org-list-automatic-rules nil)
(setq-local org-list-demote-modify-bullet nil)
(setq-local org-list-two-spaces-after-bullet-regexp nil)
- (add-hook 'post-command-hook #'orgalist--set-auto-fill nil t)
+ (add-function :before-until (local 'auto-fill-function)
+ #'orgalist--auto-fill)
(add-function :before-until
(local 'fill-paragraph-function)
- #'orgalist--fill-item)
- (orgalist--set-auto-fill))
+ #'orgalist--fill-item))
(t
- (remove-hook 'post-command-hook #'orgalist--set-auto-fill t)
- (remove-function orgalist--last-advised-function #'orgalist--auto-fill)
+ (remove-function (local 'auto-fill-function) #'orgalist--auto-fill)
(remove-function (local 'fill-paragraph-function) #'orgalist--fill-item))))
- [elpa] externals/orgalist updated (17653db -> 857d3d5), Nicolas Goaziou, 2018/05/01
- [elpa] externals/orgalist 857d3d5 7/7: orgalist: Bump to version 1.2, Nicolas Goaziou, 2018/05/01
- [elpa] externals/orgalist 93609f9 2/7: orgalist: Simplify auto fill,
Nicolas Goaziou <=
- [elpa] externals/orgalist 34d6322 4/7: orgalist: Replace `orgalist--indentation' with `current-indentation', Nicolas Goaziou, 2018/05/01
- [elpa] externals/orgalist 8ac38b2 6/7: orgalist: Add non-nil `sentence-end-double-space' file local variable, Nicolas Goaziou, 2018/05/01
- [elpa] externals/orgalist 63e90b5 1/7: orgalist: Fix filling items, Nicolas Goaziou, 2018/05/01
- [elpa] externals/orgalist 470ab82 3/7: orgalist: Improve indentation cycling, Nicolas Goaziou, 2018/05/01
- [elpa] externals/orgalist 5659da7 5/7: orgalist: Improve documentation, Nicolas Goaziou, 2018/05/01