[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/doc-show-inline 4295439062 10/12: Add doc-show-inline-excl
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/doc-show-inline 4295439062 10/12: Add doc-show-inline-exclude-blank-lines option |
Date: |
Thu, 7 Jul 2022 11:58:57 -0400 (EDT) |
branch: elpa/doc-show-inline
commit 42954390621f281930a70104162db1bb70532a1b
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>
Add doc-show-inline-exclude-blank-lines option
---
changelog.rst | 4 ++++
doc-show-inline.el | 35 +++++++++++++++++++++++++++++++++++
readme.rst | 4 ++++
3 files changed, 43 insertions(+)
diff --git a/changelog.rst b/changelog.rst
index fc7fb07572..7da0963dc1 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -3,6 +3,10 @@
Change Log
##########
+- 2022-03-14
+ - Add option ``doc-show-inline-exclude-blank-lines`` to exclude doc-strings
with blank lines
+ between the declarations and the doc-strings.
+
- 2021-12-15
- Fix error with C/C++ range checking causing an error in font locking.
diff --git a/doc-show-inline.el b/doc-show-inline.el
index 9eab0ef53c..139e2c8187 100644
--- a/doc-show-inline.el
+++ b/doc-show-inline.el
@@ -62,6 +62,12 @@ Set to 0.0 to highlight immediately (as part of syntax
highlighting)."
"Optionally skip comments that match this regular expression."
:type '(choice (const nil) (regexp)))
+(defcustom doc-show-inline-exclude-blank-lines 0
+ "Optionally skip comments which have blank lines above the declaration.
+Ignore comments that have at least this many blank lines after the doc-string.
+Zero disables."
+ :type 'integer)
+
(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'
@@ -301,6 +307,35 @@ the point should not be moved by this function."
(point))
;; Skip this comment.
nil)
+
+ ;; Optionally exclude blank lines between the comment and the
function definition.
+ (
+ (and
+ ;; Checking blank lines?
+ (not (zerop doc-show-inline-exclude-blank-lines))
+ (let ((blank-lines 0))
+ (save-excursion
+ (goto-char pos-end)
+ ;; It's important the point is at the beginning of the line
+ ;; so `looking-at-p' works as expected.
+ (beginning-of-line)
+ (while
+ (and
+ (looking-at-p "[[:blank:]]*$")
+ (< (setq blank-lines (1+ blank-lines))
doc-show-inline-exclude-blank-lines)
+ (zerop (forward-line -1)))))
+ (eq blank-lines doc-show-inline-exclude-blank-lines)))
+
+ (doc-show-inline--log-info
+ "comment \"%s\" in %S at point %d was skipped because of at
least %d blank lines"
+ sym
+ (current-buffer)
+ pos-beg
+ doc-show-inline-exclude-blank-lines)
+
+ ;; Found at least `doc-show-inline-exclude-blank-lines'
blank-lines, skipping.
+ nil)
+
;; Optionally exclude a regexp.
(
(and
diff --git a/readme.rst b/readme.rst
index e52a653d96..2fd9408e93 100644
--- a/readme.rst
+++ b/readme.rst
@@ -38,6 +38,10 @@ Customization
``doc-show-inline-idle-delay`` (float ``0.75``)
The idle delay to use before updating doc-strings.
+``doc-show-inline-exclude-blank-lines`` (integer ``0``)
+ Exclude doc-strings when there are at least this many blank lines between
the declaration
+ and the doc-string (zero disables).
+
``doc-show-inline-exclude-regexp`` (regexp / nil ``nil``)
Optionally exclude comments that contain text matching this regular
expression.
- [nongnu] elpa/doc-show-inline 2ddb1c70f9 02/12: Display blank space between the symbol and the comment, (continued)
- [nongnu] elpa/doc-show-inline 2ddb1c70f9 02/12: Display blank space between the symbol and the comment, ELPA Syncer, 2022/07/07
- [nongnu] elpa/doc-show-inline 8b457d565d 06/12: Fix an error with C/C++ raising an error during syntax highlighting, ELPA Syncer, 2022/07/07
- [nongnu] elpa/doc-show-inline 5705f8d6f5 09/12: Cleanup: use brief SPDX license, ELPA Syncer, 2022/07/07
- [nongnu] elpa/doc-show-inline 0cceb39df3 12/12: Change URL to codeberg, ELPA Syncer, 2022/07/07
- [nongnu] elpa/doc-show-inline 2757164831 04/12: Fix for displaying indented doc-strings, ELPA Syncer, 2022/07/07
- [nongnu] elpa/doc-show-inline 6bfea44e0b 08/12: Cleanup: minor improvement to error message, ELPA Syncer, 2022/07/07
- [nongnu] elpa/doc-show-inline 11fc50a13c 03/12: Demote errors, ELPA Syncer, 2022/07/07
- [nongnu] elpa/doc-show-inline daa99f0773 07/12: Fix repeat not being set for the initial timer, ELPA Syncer, 2022/07/07
- [nongnu] elpa/doc-show-inline 1c5837d2a6 01/12: Initial working version., ELPA Syncer, 2022/07/07
- [nongnu] elpa/doc-show-inline 3a4eee3ef3 05/12: Add doc-show-inline-exclude-regexp, ELPA Syncer, 2022/07/07
- [nongnu] elpa/doc-show-inline 4295439062 10/12: Add doc-show-inline-exclude-blank-lines option,
ELPA Syncer <=
- [nongnu] elpa/doc-show-inline 11a29ebfd7 11/12: Fix use of marker-position on an integer, ELPA Syncer, 2022/07/07