GNU bug report logs - #18039
24.3; Broken docstring in cl-style functions

Previous Next

Package: emacs;

Reported by: Thorsten Jolitz <tjolitz <at> gmail.com>

Date: Wed, 16 Jul 2014 23:25:02 UTC

Severity: normal

Merged with 21839

Found in versions 24.3, 25.0.50, 24.5

Fixed in version 25.0.94

Done: Noam Postavsky <npostavs <at> users.sourceforge.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18039 in the body.
You can then email your comments to 18039 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#18039; Package emacs. (Wed, 16 Jul 2014 23:25:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Thorsten Jolitz <tjolitz <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 16 Jul 2014 23:25:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Thorsten Jolitz <tjolitz <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; Broken docstring in cl-style functions
Date: Thu, 17 Jul 2014 01:24:17 +0200
Certain combinations of normal function args with &key args result in
broken docstrings for functions defined with `defun*'.

Recipe:
0. emacs -Q
1. download and load
   https://raw.githubusercontent.com/tj64/puml/master/puml.el
2. 
   
,----[ C-h f puml-key-val RET ]
| puml-key-val is a Lisp function in `puml.el'.
| 
| (puml-key-val KEY VAL &key CRLF INS)
| 
| Return or insert PlantUML key-val pair.
`----

OK

3. 

,----[ C-h f puml-arrow RET ]
| puml-arrow is a Lisp function in `puml.el'.
| 
| (puml-arrow &key (LEN 2) DIR (SHAFT "-") (LHEAD "") (RHEAD ">") LEXTRA
| REXTRA INS)
| 
| Return or insert PlantUML arrow.
`----

OK

4.  

,----[ C-h f puml-skinparam RET ]
| puml-skinparam is a Lisp function in `puml.el'.
| 
| (puml-skinparam 40 102 110 32 75 69 89 45 86 65 76 45 83 84 82 71 32
| 38 107 101 121 32 69 76 69 77 32 40 67 82 76 70 32 34 10 34 41 32 73
| 78 83 41)
| 
| Return or insert PlantUML skinparam.
`----

BUG

signature looks like this:

(defun* puml-skinparam (key-val-strg &key elem (crlf "\n") ins)

thus the bug seems to be in the combination of normal args
'key-val-strg and &key args with default values '(crlf "\n"). 



In GNU Emacs 24.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.12.2)
 of 2014-06-11 on var-lib-archbuild-staging-x86_64-jgc
Configured using:
 `configure '--prefix=/usr' '--sysconfdir=/etc' '--libexecdir=/usr/lib'
 '--localstatedir=/var' '--with-x-toolkit=gtk3' '--with-xft'
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong
 --param=ssp-buffer-size=4'
 'LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'
 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LANG: de_DE.UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  tooltip-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
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-x d g i t / p u m TAB RET n n n L y C-x 3 C-h f p 
u m l - a c t TAB i TAB RET f C-v C-v C-v C-v C-v C-v 
C-v C-v C-v C-h f p u m l - s k i TAB RET C-v C-h f 
p u m l - a r r o w RET C-g C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-h f p u m l - k e TAB RET 
C-h f p u m l - n o t e RET ESC x e m a DEL DEL DEL 
b u TAB g TAB TAB ESC b C-k C-b C-g ESC x r e p TAB 
o TAB r TAB RET

Recent messages:
Load: 1 file.
Making completion list...
Type "q" in help window to restore its previous buffer.
Loading vc-git...done
 [2 times]
Quit
 [2 times]
Making completion list... [2 times]
Quit
Making completion list... [2 times]

Load-path shadows:
/usr/share/emacs/24.3/lisp/org/.dir-locals hides /usr/share/emacs/24.3/lisp/gnus/.dir-locals

Features:
(shadow sort gnus-util mail-extr emacsbug message 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 vc-git help-mode easymenu puml help-fns cl-macs gv
cl cl-lib dired-aux dired time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

-- 
cheers,
Thorsten





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18039; Package emacs. (Thu, 17 Jul 2014 00:32:02 GMT) Full text and rfc822 format available.

Message #8 received at 18039 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Thorsten Jolitz <tjolitz <at> gmail.com>
Cc: 18039 <at> debbugs.gnu.org
Subject: Re: bug#18039: 24.3; Broken docstring in cl-style functions
Date: Thu, 17 Jul 2014 02:31:17 +0200
Thorsten Jolitz <tjolitz <at> gmail.com> writes:

> thus the bug seems to be in the combination of normal args
> 'key-val-strg and &key args with default values '(crlf "\n"). 

Indeed. Eval this in emacs -Q:

M-: (require 'cl)
M-: (cl-defun test (&key (c "\n")) "Test" nil)
M-: (symbol-function 'test)

==>

(lambda (&rest --cl-rest--) "Test

(fn 40 102 110 32 38 107 101 121 32 40 67 32 34 10 34 41 41) ...)

The newline character in the (printed) argument list makes a
difference in this expression in help-add-fundoc-usage:

    (if (and (stringp arglist)
	     (string-match "\\`([^ ]+\\(.*\\))\\'" arglist))
	(concat "(fn" (match-string 1 arglist) ")")
      (format "%S" (help-make-usage 'fn arglist)))

(help-make-usage doesn't seem to expect a stringp arglist).  Should the
regexp given to string-match be changed?


Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18039; Package emacs. (Sat, 19 Jul 2014 16:51:02 GMT) Full text and rfc822 format available.

Message #11 received at 18039 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: Thorsten Jolitz <tjolitz <at> gmail.com>, 18039 <at> debbugs.gnu.org
Subject: Re: bug#18039: 24.3; Broken docstring in cl-style functions
Date: Sat, 19 Jul 2014 12:50:23 -0400
> The newline character in the (printed) argument list makes a
> difference in this expression in help-add-fundoc-usage:

>     (if (and (stringp arglist)
> 	     (string-match "\\`([^ ]+\\(.*\\))\\'" arglist))
> 	(concat "(fn" (match-string 1 arglist) ")")
>       (format "%S" (help-make-usage 'fn arglist)))

> (help-make-usage doesn't seem to expect a stringp arglist).  Should the
> regexp given to string-match be changed?

Indeed, we have a bug there.  We should/could probably arrange for
arglist to be on a single line (quote newlines as \n), but we should
also make the code more robust such that when the regexp fails to match
we signal an error rather than fallback to the non-string case which
then burps.


        Stefan




bug Marked as found in versions 24.5. Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Thu, 02 Jun 2016 18:05:01 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 18039 <at> debbugs.gnu.org and Thorsten Jolitz <tjolitz <at> gmail.com> Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Thu, 02 Jun 2016 18:05:01 GMT) Full text and rfc822 format available.

Merged 18039 21839. Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Thu, 02 Jun 2016 18:05:01 GMT) Full text and rfc822 format available.

bug Marked as fixed in versions 25.0.94. Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Sun, 26 Jun 2016 05:41:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 24 Jul 2016 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 335 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.