Subject: bug#21839: closed (Re: bug#21839: 25.0.50; can't use newlines in defaults in cl functions)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 09 May 2016 23:56:02 +0000

Your bug report

#21839: 25.0.50; can't use newlines in defaults in cl functions

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
21839: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21839
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#21839: 25.0.50; can't use newlines in defaults in cl functions
From: Dmitry Gutov <[email-masked]>
To: "Paul M. Rodriguez" <[email-masked]>, [email-masked]
Date: Tue, 10 May 2016 02:54:59 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Paul,

Thanks for the report. I've pushed the attached patch to emacs-25.

Not sure it's the best approach (I don't like seeing the unescaped 
newline in the resulting Help buffer), but it might have to do.

Closing.

diff --git a/lisp/help.el b/lisp/help.el
index 061daac..7289375 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -1395,7 +1395,7 @@ help-add-fundoc-usage
  		(if (< (- (match-end 0) (match-beginning 0)) 2) "\n" "")
  	      "\n\n")
  	    (if (stringp arglist)
-                (if (string-match "\\`[^ ]+\\(.*\\))\\'" arglist)
+                (if (string-match "\\`[^ ]+\\(\\(?:.\\|\n\\)*\\))\\'" 
arglist)
                      (concat "(fn" (match-string 1 arglist) ")")
                    (error "Unrecognized usage format"))
  	      (help--make-usage-docstring 'fn arglist)))))

Subject: 25.0.50; can't use newlines in defaults in cl functions
From: "Paul M. Rodriguez" <[email-masked]>
To: [email-masked]
Date: Thu, 05 Nov 2015 23:08:34 -0006
List-Id: <debbugs-submit.debbugs.gnu.org>

Defining a function using the `cl' package with an optional argument
whose default contains a newline causes an error with the message
"Unrecognized usage format".

Example:

(require 'cl-lib)
(cl-defun example (&optional (separator "\n"))
  ())
;; Unrecognized usage format

The problem appears to be due to a change to `help-add-fundoc-usage'
introduced in this commit:

https://lists.gnu.org/archive/html/emacs-diffs/2015-10/msg00365.html

Paul Rodriguez.

In GNU Emacs 25.0.50.2 (x86_64-pc-linux-gnu, GTK+ Version 3.10.8)
 of 2015-11-03
Windowing system distributor 'The X.Org Foundation', version 
11.0.11600000
System Description:	Ubuntu 14.04.3 LTS

Configured using:
 'configure --build=x86_64-linux-gnu --prefix=/usr
 '--includedir=${prefix}/include' '--mandir=${prefix}/share/man'
 '--infodir=${prefix}/share/info' --sysconfdir=/etc --localstatedir=/var
 '--libdir=${prefix}/lib/x86_64-linux-gnu'
 '--libexecdir=${prefix}/lib/x86_64-linux-gnu' --disable-maintainer-mode
 --disable-dependency-tracking --prefix=/usr --sharedstatedir=/var/lib
 --program-suffix=-snapshot --with-x=yes --with-x-toolkit=gtk3
 'CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat
 -Werror=format-security' CPPFLAGS=-D_FORTIFY_SOURCE=2
 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Type C-x 1 to delete the help window.
Scanning for dabbrevs...done
user-error: No dynamic expansion for ‘user-mail-add’ found

"[email-masked]"
Quit [4 times]

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message dired format-spec
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils cl-extra dabbrev help-fns help-mode
easymenu cl-loaddefs pcase cl-lib time-date mule-util tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
dbusbind inotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 81136 4848)
 (symbols 48 19075 0)
 (miscs 40 48 85)
 (strings 32 12781 5416)
 (string-bytes 1 371247)
 (vectors 16 10746)
 (vector-slots 8 412657 7275)
 (floats 8 136 182)
 (intervals 56 257 16)
 (buffers 976 12)
 (heap 1024 32881 1060))