diff options
author | Stefan Kangas <stefan@marxist.se> | 2021-09-28 13:30:02 +0200 |
---|---|---|
committer | Stefan Kangas <stefan@marxist.se> | 2021-09-28 14:15:00 +0200 |
commit | b27a8f15549f12b363acfde8101849af10e9b401 (patch) | |
tree | 8729a391bb177a8e5ef3763b7e5313e0af8549ae /lisp | |
parent | 73b2b9f67acd82571ed0d250c5ba3282a4f6752a (diff) | |
download | emacs-b27a8f15549f12b363acfde8101849af10e9b401.tar.gz emacs-b27a8f15549f12b363acfde8101849af10e9b401.tar.bz2 emacs-b27a8f15549f12b363acfde8101849af10e9b401.zip |
Signal error on newline in internal--format-docstring-line
* lisp/subr.el (internal--format-docstring-line): Signal error
when trying to fill a line containing a newline.
* lisp/cedet/semantic/decorate/mode.el
(define-semantic-decoration-style):
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
Don't pass newlines to 'internal--format-docstring-line'.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/cedet/semantic/decorate/mode.el | 8 | ||||
-rw-r--r-- | lisp/emacs-lisp/easy-mmode.el | 8 | ||||
-rw-r--r-- | lisp/subr.el | 5 |
3 files changed, 14 insertions, 7 deletions
diff --git a/lisp/cedet/semantic/decorate/mode.el b/lisp/cedet/semantic/decorate/mode.el index 27634102df9..6271fb1ced6 100644 --- a/lisp/cedet/semantic/decorate/mode.el +++ b/lisp/cedet/semantic/decorate/mode.el @@ -409,9 +409,11 @@ decoration API found in this library." ;; Create an override method to specify if a given tag belongs ;; to this type of decoration (define-overloadable-function ,predicate (tag) - ,(internal--format-docstring-line - "Return non-nil to decorate TAG with `%s' style.\n%s" - name doc)) + ,(concat + (internal--format-docstring-line + "Return non-nil to decorate TAG with `%s' style." + name) + "\n" doc)) ;; Create an override method that will perform the highlight ;; operation if the -p method returns non-nil. (define-overloadable-function ,highlighter (tag) diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 0e4d6eeb7bb..d37bca24a0f 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -496,15 +496,17 @@ on if the hook has explicitly disabled it. (define-minor-mode ,global-mode ,(concat (format "Toggle %s in all buffers.\n" pretty-name) (internal--format-docstring-line - "With prefix ARG, enable %s if ARG is positive; otherwise, \ -disable it.\n\n" + (concat "With prefix ARG, enable %s if ARG is positive; " + "otherwise, disable it.") pretty-global-name) + "\n\n" "If called from Lisp, toggle the mode if ARG is `toggle'. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.\n\n" (internal--format-docstring-line - "%s is enabled in all buffers where `%s' would do it.\n\n" + "%s is enabled in all buffers where `%s' would do it." pretty-name turn-on) + "\n\n" (internal--format-docstring-line "See `%s' for more information on %s." mode pretty-name) diff --git a/lisp/subr.el b/lisp/subr.el index 8cb79b290b7..1d2980802e0 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -6435,8 +6435,11 @@ of fill.el (for example `fill-region')." (concat fst (internal--fill-string-single-line lst))))) (defun internal--format-docstring-line (string &rest objects) - "Format a documentation string out of STRING and OBJECTS. + "Format a single line from a documentation string out of STRING and OBJECTS. +Signal an error if STRING contains a newline. This is intended for internal use only." + (when (string-match "\n" string) + (error "Unable to fill string containing newline: %S" string)) (internal--fill-string-single-line (apply #'format string objects))) (defun json-available-p () |