comparison lisp/help.el @ 4671:e9b88e997479

Deal with arglist newlines better, #'function-arglist, #'function-documentation lisp/ChangeLog addition: 2009-08-10 Aidan Kehoe <kehoea@parhasard.net> * help.el (function-arglist, function-documentation): Deal more gracefully with tabs in the function arglist; in function-documentation, when stripping the arglist, pay attention to the fact that they may span multiple lines.
author Aidan Kehoe <kehoea@parhasard.net>
date Mon, 10 Aug 2009 16:22:09 +0100
parents 48b45a606961
children 2ac296807b88
comparison
equal deleted inserted replaced
4670:5a54ce6dc945 4671:e9b88e997479
1194 (string-match 1194 (string-match
1195 "[\n\t ]*\narguments: ?(\\([^)]*\\))\n?\\'" 1195 "[\n\t ]*\narguments: ?(\\([^)]*\\))\n?\\'"
1196 doc) 1196 doc)
1197 (match-string 1 doc))) 1197 (match-string 1 doc)))
1198 (args (and args (replace-in-string args 1198 (args (and args (replace-in-string args
1199 "[ ]*\\\\\n[ ]*" 1199 "[ ]*\\\\\n[ \t]*"
1200 " " t)))) 1200 " " t))))
1201 ;; If there are no arguments documented for the 1201 ;; If there are no arguments documented for the
1202 ;; subr, rather don't print anything. 1202 ;; subr, rather don't print anything.
1203 (cond ((null args) t) 1203 (cond ((null args) t)
1204 ((equal args "") nil) 1204 ((equal args "") nil)
1223 (or (documentation function) 1223 (or (documentation function)
1224 (gettext "not documented")) 1224 (gettext "not documented"))
1225 (void-function "(alias for undefined function)") 1225 (void-function "(alias for undefined function)")
1226 (error "(unexpected error from `documention')")))) 1226 (error "(unexpected error from `documention')"))))
1227 (if (and strip-arglist 1227 (if (and strip-arglist
1228 (string-match "[\n\t ]*\narguments: ?(\\(.*\\))\n?\\'" doc)) 1228 (string-match "[\n\t ]*\narguments: ?(\\([^)]*\\))\n?\\'" doc))
1229 (setq doc (substring doc 0 (match-beginning 0)))) 1229 (setq doc (substring doc 0 (match-beginning 0))))
1230 doc)) 1230 doc))
1231 1231
1232 ;; replacement for `princ' that puts the text in the specified face, 1232 ;; replacement for `princ' that puts the text in the specified face,
1233 ;; if possible 1233 ;; if possible