From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: Paragraph styles in doc strings Date: Mon, 20 Jun 2016 15:11:50 -0400 Message-ID: <57683FF6.9020100@gmail.com> References: <878tzjjn3w.fsf@gnus.org> <9503e7e0-4402-554d-7533-9c3a6d2c5f77@yandex.ru> <87vb2jxbb9.fsf@gnus.org> <574F6944.800@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Gebql4CFv7VpHVinWWw17ehb91iiuxHf4" X-Trace: ger.gmane.org 1466449981 9275 80.91.229.3 (20 Jun 2016 19:13:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 20 Jun 2016 19:13:01 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 20 21:12:45 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bF4cg-000052-5r for ged-emacs-devel@m.gmane.org; Mon, 20 Jun 2016 21:12:38 +0200 Original-Received: from localhost ([::1]:45829 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF4cb-0006NF-Vc for ged-emacs-devel@m.gmane.org; Mon, 20 Jun 2016 15:12:34 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF4c3-0006N2-4C for emacs-devel@gnu.org; Mon, 20 Jun 2016 15:12:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bF4bx-0006Qi-1T for emacs-devel@gnu.org; Mon, 20 Jun 2016 15:11:57 -0400 Original-Received: from mout.kundenserver.de ([212.227.126.187]:52099) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF4bw-0006QQ-Lc for emacs-devel@gnu.org; Mon, 20 Jun 2016 15:11:52 -0400 Original-Received: from [18.26.2.123] ([18.26.2.123]) by mrelayeu.kundenserver.de (mreue005) with ESMTPSA (Nemesis) id 0Ly95N-1bTnOc2IRp-015XQe for ; Mon, 20 Jun 2016 21:11:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 In-Reply-To: X-Provags-ID: V03:K0:GLsvIjqW3v53LUtbhzYHNyKCOtNvRsyiJV7ra8r7RHw073LGQVI 3Nild4iXw7E1U58FSZIFZq3GnRVrwsTTxgMtUAFqeQk4xUIuR3A4gHCGooqY2BS11LoHBpr rU1PrEgmseNqqiE4E1oSXVXI4NDf3bVqMoIUcPH7uNUYTzjAFGcZuM45avbv/S+3Hu8QvT3 xTuqZvgmN3fYizz354w1g== X-UI-Out-Filterresults: notjunk:1;V01:K0:BMQ+FIJEREI=:KoFUX40dZNnUUScdhEqPvZ wl59CW8HnR+bXwLHemdMrfDf08OmwCZJnVcNdi3LQJEANfrv5wyzoprXUKaJtBT2dZTPKLjIk Q9tEgAmdNMRdZJh4W3eRH2EbpGPvSxXO8dPw8/ypJAnu53oap3gSX8QzcWz6fB5SHtYuP+pD9 OFO7+rmYrXQWIZDyOuZ7WynC6DgV+AT2MrfWuT2gukBO4hDvDRIZz0Wc0TJzPopRxBuGJ65j0 lpVstbR1vmJkbUrPNsLp5j8+Wl6TKF21fhNU9PxiWV+p1+Ha2uw8MsmhdTw0stJvDduQJCxCq n9TCc+y48lbuXC9NHkjASQUkI3P+RsGZ0Q7PcHzcemq9HOItR4RZKAHnhYg8bEEiriCFtkUg+ VaKomiytmNYyWZd5+HNR97ihNAL9iX+zalZXxIB5rPi5ffQ2DFowmZcq2wS0gih3SS1p/IF0t MCqpKU3YBI38jDp73T4crD1f2aKi1lApW8m8rBrQmhQC9YMQuabsBqfyRY3wXyG4cwnGK+ToA XzfxvDcLjSMFjw9TYLttjXawx0YpxeZGKNDcKUAyOyQGjjJxrN0mjelNXHhZKpBhsqnfhfzJ7 icedBfCDss1iQYg2WvAoE8fpdwvzQ68B+gmZDE28WDC7fmTEJsrk/Sbn6VUNoKijTejvAuzh3 TOx1MXlpwHk9PUAYwmwBHKfWuwYR3QJAoTtbft6/4p2Xfr15aOfssE6bbkxHmP9Rklho= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.187 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:204607 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Gebql4CFv7VpHVinWWw17ehb91iiuxHf4 Content-Type: multipart/mixed; boundary="9vgfq7lFHCWHxshBWkqHfI5xNRvg3kPFA" From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= To: emacs-devel@gnu.org Message-ID: <57683FF6.9020100@gmail.com> Subject: Re: Paragraph styles in doc strings References: <878tzjjn3w.fsf@gnus.org> <9503e7e0-4402-554d-7533-9c3a6d2c5f77@yandex.ru> <87vb2jxbb9.fsf@gnus.org> <574F6944.800@gmail.com> In-Reply-To: --9vgfq7lFHCWHxshBWkqHfI5xNRvg3kPFA Content-Type: multipart/mixed; boundary="------------090500050802060106090206" This is a multi-part message in MIME format. --------------090500050802060106090206 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 2016-06-01 21:18, Stefan Monnier wrote: >> I'm not sure font-lock will work nicely for this. Blank lines are >> a multi-line pattern. >=20 > Actually, no, "^\n" is not a multi-line pattern (yes, it's right there > on the border, but it's on the right side of the fence). Thanks, that's neat! > Oh, I'm not so concerned about the *Help* buffers, it's the source code= > that annoys me (that's where I work and where I don't want to waste > screen real-estate). Ok, I understand the purpose more clearly now :) What do you think of th= e attached package? If it works, I can push it to ELPA. Cl=E9ment. --------------090500050802060106090206 Content-Type: text/x-emacs-lisp; name="compact-docstrings.el" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="compact-docstrings.el" ;;; compact-docstrings.el --- Shrink blank lines in docstrings and doc co= mments ;; Copyright (C) 2016 Cl=C3=A9ment Pit-Claudel ;; Author: Cl=C3=A9ment Pit-Claudel ;; URL: https://github.com/cpitclaudel/compact-docstrings ;; Package-Version: 0.1 ;; Keywords: convenience, faces, lisp, maint, c ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;; Shrink blank lines in docstrings and doc comments ;; ;; Enable locally with `compact-docstrings-mode': ;; (add-hook 'some-mode-hook #'compact-docstrings-mode) ;; ;; Enable globally (in all programming modes) with ;; (add-hook 'after-init-hook #'global-compact-docstrings--mode) ;;; Code: (defgroup compact-docstrings nil "Shrink empty lines in docstrings and doc comments." :group 'faces) (defface compact-docstrings-face '((t :height 0.5)) "Face applied to blank lines in docstrings." :group 'compact-docstrings) (defcustom compact-docstrings-only-doc-blocks t "When nil, also shrink blank lines in regular strings and comments." :group 'compact-docstrings :type 'boolean) (defun compact-docstrings--matcher (bound) "Find blank line in docstring, looking in point .. BOUND." (let ((found nil)) (while (and (not found) (re-search-forward "^\\s-*\n" bound t)) (let ((syntax (syntax-ppss))) (when (and (or (nth 3 syntax) ;; In string (nth 4 syntax)) ;; In comment (or (not compact-docstrings-only-doc-blocks) (let ((face (get-text-property (point) 'face))) (or (eq face 'font-lock-doc-face) (and (listp face) (memq 'font-lock-doc-face = face)))))) (setq found t)))) found)) (defconst compact-docstrings--keywords '((compact-docstrings--matcher 0 'compact-docstrings-face prepend)) 'ap= pend) ;;;###autoload (define-minor-mode compact-docstrings-mode "Shrink empty lines in docstrings and doc comments." :lighter " compact" (if compact-docstrings-mode (font-lock-add-keywords nil compact-docstrings--keywords 'append) (font-lock-remove-keywords nil compact-docstrings--keywords)) (if (fboundp #'font-lock-flush) (font-lock-flush) (with-no-warnings (font-lock-fontify-buffer)))) (defun compact-docstrings--mode-on () "Turn on `compact-docstrings-mode', if appropriate." (when (derived-mode-p major-mode #'prog-mode) (compact-docstrings-mode))) ;;;###autoload (defalias 'shrink-docstrings #'compact-docstrings--mode-on) ;;;###autoload (define-globalized-minor-mode global-compact-docstrings-mode compact-docs= trings-mode compact-docstrings--mode-on :init-value nil) (provide 'compact-docstrings) ;;; compact-docstrings.el ends here --------------090500050802060106090206-- --9vgfq7lFHCWHxshBWkqHfI5xNRvg3kPFA-- --Gebql4CFv7VpHVinWWw17ehb91iiuxHf4 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJXaD/2AAoJEPqg+cTm90wjbGkP/iKMqo2yi1JFcY2GcaqTGcm+ U8RX3gdm3zjminZW/L7QK1jyy98ULTPTJvHxS1gjRdVBPRTTfuKkkNvcaNxwQc/N 7652XMr95WDWcnC8KywN7BpamjgoyJlbLR9i6v2yNivZQpZPXjwhI4i3Fe9E9xHy TQhQ1RbJSD3THji1zRPM7WmgpxEj7n/3UNBhJtXVBkB/AuzoZ58axUf8rqTcBBki wLJWvwvMONagGIYXnHBZOT4FkYQGwyTch8VoxWurbrCd08LT2SlKQtN7+mUgPD89 8jkmi/S1eEICur6If1/pRTg/vnCyWUTBCD2ePnViLSMHzxGJMvnxaYtRK6KOeH8t kPQpvOYmKO3Rb4bE1WQKhG6kvT1ezNDDF+V7w4iVIXBXWxXNockMYLWdzr+ObEvC xXn3QZfiQAvYdA8y3EZqH08DUEpOdSNF9rWtdw6IK4weAstIAWFJ0rUcZbf2uhbK sEY5etWHYuvAfzHZnQMrjQtAIMqojhDz/Z4HRjvglRT8PWH2Fq5OG/E7L3tFmOt0 wd4bi4OnX1rfNhQfRZPW8BrefH71lIKMFu4qoT98rVYbBYRUUOAevSscKc8BEvF2 VYMzPkwcU9+gpNGztwoX6jtYpxwbT6TDqSR3uBB9NOti8PUjzsX8BilvTK9BbHv4 YsCJUxvfXQJeJIFcqRD5 =Y9uR -----END PGP SIGNATURE----- --Gebql4CFv7VpHVinWWw17ehb91iiuxHf4--