summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/lisp-mnt.el
diff options
context:
space:
mode:
authorBruno Félix Rezende Ribeiro <oitofelix@gnu.org>2019-10-08 04:32:18 -0300
committerStefan Kangas <stefankangas@gmail.com>2020-01-23 22:57:23 +0100
commit963a9ffd66cb29f0370e9a4b854dddda242c54a6 (patch)
treeffd9b49f7c97d33d8f2a909785654bd28220bd8f /lisp/emacs-lisp/lisp-mnt.el
parentcd2d812ec1745a7e6de2b29db1a9bf9f1125b501 (diff)
downloademacs-963a9ffd66cb29f0370e9a4b854dddda242c54a6.tar.gz
emacs-963a9ffd66cb29f0370e9a4b854dddda242c54a6.tar.bz2
emacs-963a9ffd66cb29f0370e9a4b854dddda242c54a6.zip
Globally sanitize single-file package long descriptions (Bug#37548)
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.
Diffstat (limited to 'lisp/emacs-lisp/lisp-mnt.el')
-rw-r--r--lisp/emacs-lisp/lisp-mnt.el13
1 files changed, 12 insertions, 1 deletions
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."