[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/paredit 896c165 039/224: Implement variable `paredit-space
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/paredit 896c165 039/224: Implement variable `paredit-space-for-delimiter-predicates'. |
Date: |
Sat, 7 Aug 2021 09:22:14 -0400 (EDT) |
branch: elpa/paredit
commit 896c165a67479503df63dc7cf86b2c96cf86c102
Author: Taylor R Campbell <campbell@mumble.net>
Commit: Taylor R Campbell <campbell@mumble.net>
Implement variable `paredit-space-for-delimiter-predicates'.
Ignore-this: 45e159465eb88cd994e493dfccc9e495
darcs-hash:20100917193938-00fcc-8567c43f6d3941b49d5f4d848b292fe35af19d19
---
paredit.el | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/paredit.el b/paredit.el
index 23a9282..c1f3936 100644
--- a/paredit.el
+++ b/paredit.el
@@ -756,6 +756,22 @@ If such a comment exists, delete the comment (including
all leading
(eq (nth 5 beginning-state) ; 5. t if following char
(nth 5 end-state))))))) ; quote
+(defvar paredit-space-for-delimiter-predicates nil
+ "List of predicates for whether to put space by delimiter at point.
+Each predicate is a function that is is applied to two arguments, ENDP
+ and DELIMITER, and that returns a boolean saying whether to put a
+ space next to the delimiter -- before the delimiter if ENDP is false,
+ after the delimiter if ENDP is true.
+If any predicate returns false, no space is inserted: every predicate
+ has veto power.
+Each predicate may assume that the point is not at the beginning of the
+ buffer, if ENDP is false, or at the end of the buffer, if ENDP is
+ true; and that the point is not preceded, if ENDP is false, or
+ followed, if ENDP is true, by a word or symbol constituent, a quote,
+ or the delimiter matching DELIMITER.
+Each predicate should examine only text before the point, if ENDP is
+ false, or only text after the point, if ENDP is true.")
+
(defun paredit-space-for-delimiter-p (endp delimiter)
;; If at the buffer limit, don't insert a space. If there is a word,
;; symbol, other quote, or non-matching parenthesis delimiter (i.e. a
@@ -768,7 +784,12 @@ If such a comment exists, delete the comment (including
all leading
(and matching (char-syntax matching)))
(and (not endp)
(eq ?\" (char-syntax delimiter))
- ?\) )))))
+ ?\) )))
+ (catch 'exit
+ (dolist (predicate paredit-space-for-delimiter-predicates)
+ (if (not (funcall predicate endp delimiter))
+ (throw 'exit nil)))
+ t)))
(defun paredit-move-past-close-and-reindent (close)
(let ((open (paredit-missing-close)))
- [nongnu] elpa/paredit 3889955 212/224: Don't reindent single-line edits in paredit-raise-sexp., (continued)
- [nongnu] elpa/paredit 3889955 212/224: Don't reindent single-line edits in paredit-raise-sexp., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 961b02f 217/224: Ignore unused argument in paredit-override-check-parens-interactively, ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 27548db 220/224: Disable minibuffer message delays in tests., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit b1c332a 218/224: Bump copyright year., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 09658a4 221/224: Trailing newline., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit dc60d93 029/224: Document the effect of a prefix argument to the `paredit-mode' command., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 190797e 030/224: Add warning to documentation of prefix arguments to `paredit-mode'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 41a0a34 033/224: Omit unused variable `orig' in `paredit-move-past-close-and-reindent'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 04e6f50 035/224: Put space between closing delimiters and opening double quotes., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 70d40b5 040/224: Refine scope of reindentation after raise, splice, and insert-comment., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 896c165 039/224: Implement variable `paredit-space-for-delimiter-predicates'.,
ELPA Syncer <=
- [nongnu] elpa/paredit e23adec 036/224: Omit vestigial debug message in `paredit-backward-slurp-into-string'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit c0a9160 041/224: Make `paredit-newline' keep invalid structure inside comments., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 05b2cad 043/224: Generalize `paredit-kill' to work inside any string-like object., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit e380e42 048/224: Implement `paredit-{for, back}ward-{up, down}'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 3ce96a4 050/224: Fix format arguments in `paredit-check-region-state-comment'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 73c481a 061/224: Simplify and clarify implementation of `paredit-backslash'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit b51f220 055/224: In `paredit-newline', ignore parse errors during `indent-sexp'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 0011090 066/224: Fix bounds checking in `paredit-find-next-string-start'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit bd0e5ba 072/224: Don't mask errors during `buffer-string' in `paredit-unescape-string'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit b7f234a 067/224: Preserve column in `paredit-reindent-defun'., ELPA Syncer, 2021/08/07