[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 1567c99: * filladapt/filladapt.el (filladapt-token-match-e

From: Stefan Monnier
Subject: [elpa] master 1567c99: * filladapt/filladapt.el (filladapt-token-match-empty): New var
Date: Mon, 9 Jul 2018 17:33:08 -0400 (EDT)

branch: master
commit 1567c99ce06ae6c86a5ae79062e950bff16124d6
Author: Martin Stjernholm <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * 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.
 packages/filladapt/filladapt.el | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/packages/filladapt/filladapt.el b/packages/filladapt/filladapt.el
index 3cdd2c4..42cdd14 100644
--- a/packages/filladapt/filladapt.el
+++ b/packages/filladapt/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))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]