[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/filladapt f2e45b0 3/5: * filladapt/filladapt.el (fillad
From: |
Stefan Monnier |
Subject: |
[elpa] externals/filladapt f2e45b0 3/5: * filladapt/filladapt.el (filladapt-token-match-empty): New var |
Date: |
Tue, 1 Dec 2020 15:54:36 -0500 (EST) |
branch: externals/filladapt
commit f2e45b0dcb3d886baa7e6656a5cbd6a4ecda4a55
Author: Martin Stjernholm <bug-cc-mode@gnu.org>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
* filladapt/filladapt.el (filladapt-token-match-empty): New var
"As of version 2.12, [filladapt] does however lack a feature that makes it
work suboptimally when ‘c-comment-prefix-regexp’ matches the empty string
(which it does by default)."
This patch comes from http://cc-mode.sourceforge.net/filladapt.el.diff.
(filladapt-parse-prefixes): Use it.
---
filladapt.el | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/filladapt.el b/filladapt.el
index 3cdd2c4..42cdd14 100644
--- a/filladapt.el
+++ b/filladapt.el
@@ -291,6 +291,12 @@ HOWTO specifies how to do the conversion.
:type '(repeat (cons symbol (choice (const exact)
(const spaces)))))
+(defcustom filladapt-token-match-empty '(beginning-of-line end-of-line)
+ "List of tokens that may match the empty string.
+Normally a token is ignored if it matches the empty string. This list
+contains the tokens that should be excluded from that rule."
+ :type '(repeat symbol))
+
(defcustom filladapt-fill-paragraph-post-hook nil
"Hooks run after filladapt runs fill-paragraph."
:type 'hook)
@@ -540,7 +546,10 @@ STRING is the token's text."
(setq token-table filladapt-token-table
done t)
(while token-table
- (if (null (looking-at (car (car token-table))))
+ (if (or (null (looking-at (car (car token-table))))
+ (and (not (memq (car (cdr (car token-table)))
+ filladapt-token-match-empty))
+ (eq (match-beginning 0) (match-end 0))))
(setq token-table (cdr token-table))
(goto-char (match-end 0))
(setq token-list (cons (list (nth 1 (car token-table))