From: "Clément Pit--Claudel" <clement.pit@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: Paragraph styles in doc strings
Date: Wed, 1 Jun 2016 19:01:24 -0400 [thread overview]
Message-ID: <574F6944.800@gmail.com> (raw)
In-Reply-To: <jwvmvnpu3pm.fsf-monnier+gmane.emacs.devel@gnu.org>
[-- Attachment #1.1: Type: text/plain, Size: 1296 bytes --]
On 2016-05-16 16:53, Stefan Monnier wrote:
> If we ever want to refill docstrings automatically (ideally when
> displaying them), then we'll need some stronger hint than a newline.
> So I guess an empty line is not a bad idea, but I would indeed welcome
> some font-lock hack that make those empty lines shorter.
I'm not sure font-lock will work nicely for this. Blank lines are a multi-line pattern.
On the other hand, this seems to work OK:
(defvar help-blank-line-height 0.5)
(defvar help-blank-line-regexp "\n\n+")
(with-current-buffer "*Help*"
(let ((inhibit-read-only t))
(save-excursion
(goto-char (point-min))
(while (re-search-forward help-blank-line-regexp nil t)
(font-lock-append-text-property
(match-beginning 0) (match-end 0)
'font-lock-face `(:height ,help-blank-line-height))))))
Of course, you could use that loop instead to add a font-lock-multiline property to the newlines, and then use this:
(with-current-buffer "*Help*"
(font-lock-add-keywords nil '(("\n\n+" 0 `(face (:height 0.5))))))
But that sounds like more code for no added benefit. The simplest solution is probably to change the function that inserts the docstring to insert a string with the right properties applied.
Clément.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2016-06-01 23:01 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-09 14:57 Paragraph styles in doc strings Lars Ingebrigtsen
2016-05-09 15:01 ` Dmitry Gutov
2016-05-09 15:07 ` Kaushal Modi
2016-05-11 1:52 ` John Wiegley
2016-05-12 20:37 ` Lars Ingebrigtsen
2016-05-16 20:53 ` Stefan Monnier
2016-06-01 23:01 ` Clément Pit--Claudel [this message]
2016-06-02 1:18 ` Stefan Monnier
2016-06-20 19:11 ` Clément Pit--Claudel
2016-06-21 1:18 ` Stefan Monnier
2016-06-21 3:24 ` Clément Pit--Claudel
2016-05-18 6:05 ` John Wiegley
2016-05-09 16:05 ` Drew Adams
2016-05-09 15:10 ` Paul Eggert
2016-05-09 15:48 ` Marcin Borkowski
2016-05-09 16:12 ` Paul Eggert
2016-05-09 15:22 ` Andreas Schwab
2016-05-09 15:42 ` Lars Ingebrigtsen
2016-05-09 15:45 ` Marcin Borkowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=574F6944.800@gmail.com \
--to=clement.pit@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.