From 963a9ffd66cb29f0370e9a4b854dddda242c54a6 Mon Sep 17 00:00:00 2001 From: Bruno Félix Rezende Ribeiro Date: Tue, 8 Oct 2019 04:32:18 -0300 Subject: Globally sanitize single-file package long descriptions (Bug#37548) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Consistent with multi-file package descriptions which don’t have commentary sections nor double semicolon prefixes. * lisp/emacs-lisp/lisp-mnt.el (lm-commentary): Remove commentary header, double semicolon prefixes of each line, trailing new-lines and trailing white-space from commentary. * lisp/emacs-lisp/package.el (package--get-description) (describe-package-1): * lisp/finder.el (finder-commentary): * lisp/info.el (Info-finder-find-node): Remove ad-hoc sanitation. --- lisp/emacs-lisp/lisp-mnt.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/lisp-mnt.el') diff --git a/lisp/emacs-lisp/lisp-mnt.el b/lisp/emacs-lisp/lisp-mnt.el index ceb9b6bea5f..0d57bc16a3a 100644 --- a/lisp/emacs-lisp/lisp-mnt.el +++ b/lisp/emacs-lisp/lisp-mnt.el @@ -485,7 +485,18 @@ absent, return nil." (lm-with-file file (let ((start (lm-commentary-start))) (when start - (buffer-substring-no-properties start (lm-commentary-end)))))) + (replace-regexp-in-string ; Get rid of... + "[[:blank:]]*$" "" ; trailing white-space + (replace-regexp-in-string + (format "%s\\|%s\\|%s" + ;; commentary header + (concat "^;;;[[:blank:]]*\\(" + lm-commentary-header + "\\):[[:blank:]\n]*") + "^;;[[:blank:]]*" ; double semicolon prefix + "[[:blank:]\n]*\\'") ; trailing new-lines + "" (buffer-substring-no-properties + start (lm-commentary-end)))))))) (defun lm-homepage (&optional file) "Return the homepage in file FILE, or current buffer if FILE is nil." -- cgit v1.2.3