emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/doc-show-inline 3a4eee3ef3 05/12: Add doc-show-inline-excl


From: ELPA Syncer
Subject: [nongnu] elpa/doc-show-inline 3a4eee3ef3 05/12: Add doc-show-inline-exclude-regexp
Date: Thu, 7 Jul 2022 11:58:57 -0400 (EDT)

branch: elpa/doc-show-inline
commit 3a4eee3ef3fb3b50252418308f1b45e22a67bc8e
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>

    Add doc-show-inline-exclude-regexp
---
 changelog.rst      |  1 +
 doc-show-inline.el | 23 ++++++++++++++++++++++-
 readme.rst         |  6 ++++++
 3 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/changelog.rst b/changelog.rst
index 3ad207dc3a..f33937fe72 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -6,6 +6,7 @@ Change Log
 
 - 2021-12-10
   - Include leading white-space to properly align indented multi-line 
doc-strings.
+  - Add ``doc-show-inline-exclude-regexp`` to optionally exclude comments 
matching a regular expression.
 
 - 2021-12-08
   - Keep blank space between the symbol and comments.
diff --git a/doc-show-inline.el b/doc-show-inline.el
index 496b6007d3..3af7030352 100644
--- a/doc-show-inline.el
+++ b/doc-show-inline.el
@@ -70,6 +70,10 @@
 Set to 0.0 to highlight immediately (as part of syntax highlighting)."
   :type 'float)
 
+(defcustom doc-show-inline-exclude-regexp nil
+  "Optionally skip comments that match this regular expression."
+  :type '(choice (const nil) (regexp)))
+
 (defcustom doc-show-inline-face-background-highlight -0.04
   "Use to tint the background color for overlay text (between -1.0 and 1.0).
 Ignored when `doc-show-inline-face'
@@ -307,7 +311,24 @@ the point should not be moved by this function."
                 sym
                 (current-buffer)
                 (point))
-              ;; Failure.
+              ;; Skip this comment.
+              nil)
+            ;; Optionally exclude a regexp.
+            (
+              (and
+                doc-show-inline-exclude-regexp
+                (save-match-data
+                  (goto-char pos-beg)
+                  (search-forward-regexp doc-show-inline-exclude-regexp 
pos-end t)))
+
+              (doc-show-inline--log-info
+                "comment \"%s\" in %S at point %d was skipped because of regex 
match with %S"
+                sym
+                (current-buffer)
+                pos-beg
+                doc-show-inline-exclude-regexp)
+
+              ;; Skip this comment.
               nil)
 
             (t
diff --git a/readme.rst b/readme.rst
index 810ab2bf03..e52a653d96 100644
--- a/readme.rst
+++ b/readme.rst
@@ -38,6 +38,12 @@ Customization
 ``doc-show-inline-idle-delay`` (float ``0.75``)
    The idle delay to use before updating doc-strings.
 
+``doc-show-inline-exclude-regexp`` (regexp / nil ``nil``)
+   Optionally exclude comments that contain text matching this regular 
expression.
+
+   This can be useful for excluding comments which define function grouping or 
other kinds of file sections,
+   which aren't intended to represent documentation for the following symbol.
+
 ``doc-show-inline-face-background-highlight`` (float ``-0.04``)
    The tint to use when generating the background color for the background of 
doc-string overlays.
    The value is between -1.0 and 1.0 where negative numbers darken, positive 
numbers brighten.



reply via email to

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