comparison lisp/help.el @ 5473:ac37a5f7e5be

Merge with trunk.
author Mats Lidell <matsl@xemacs.org>
date Thu, 17 Mar 2011 23:42:59 +0100
parents 308d34e9f07d ed74d2ca7082
children cc8ea7ed4286
comparison
equal deleted inserted replaced
5472:e79980ee5efe 5473:ac37a5f7e5be
346 (let (defn) 346 (let (defn)
347 (and menu-flag (set menu-flag nil)) 347 (and menu-flag (set menu-flag nil))
348 ;; If the key typed was really a menu selection, grab the form out 348 ;; If the key typed was really a menu selection, grab the form out
349 ;; of the event object and intuit the function that would be called, 349 ;; of the event object and intuit the function that would be called,
350 ;; and describe that instead. 350 ;; and describe that instead.
351 (if (and (vectorp key) (= 1 (length key)) 351 (if (and (vectorp key) (eql 1 (length key))
352 (or (misc-user-event-p (aref key 0)) 352 (or (misc-user-event-p (aref key 0))
353 (eq (car-safe (aref key 0)) 'menu-selection))) 353 (eq (car-safe (aref key 0)) 'menu-selection)))
354 (let ((event (aref key 0))) 354 (let ((event (aref key 0)))
355 (setq defn (if (eventp event) 355 (setq defn (if (eventp event)
356 (list (event-function event) (event-object event)) 356 (list (event-function event) (event-object event))
1226 (when (and strip-arglist 1226 (when (and strip-arglist
1227 (string-match "[\n\t ]*\narguments: ?(\\(.*\\))\n?\\'" doc)) 1227 (string-match "[\n\t ]*\narguments: ?(\\(.*\\))\n?\\'" doc))
1228 (setq args (match-string 1 doc)) 1228 (setq args (match-string 1 doc))
1229 (setq doc (substring doc 0 (match-beginning 0))) 1229 (setq doc (substring doc 0 (match-beginning 0)))
1230 (and args (setq args (replace-in-string args "[ ]*\\\\\n[ \t]*" " " t))) 1230 (and args (setq args (replace-in-string args "[ ]*\\\\\n[ \t]*" " " t)))
1231 (and (zerop (length doc)) (setq doc (gettext "not documented")))) 1231 (and (eql 0 (length doc)) (setq doc (gettext "not documented"))))
1232 (cons doc args))) 1232 (cons doc args)))
1233 1233
1234 (defun function-documentation (function &optional strip-arglist) 1234 (defun function-documentation (function &optional strip-arglist)
1235 "Return a string giving the documentation for FUNCTION, if any. 1235 "Return a string giving the documentation for FUNCTION, if any.
1236 If the optional argument STRIP-ARGLIST is non-nil, remove the arglist 1236 If the optional argument STRIP-ARGLIST is non-nil, remove the arglist
1296 (help-symbol-run-function-1 last-popup-menu-event ex fun)))) 1296 (help-symbol-run-function-1 last-popup-menu-event ex fun))))
1297 1297
1298 (defvar help-symbol-function-context-menu 1298 (defvar help-symbol-function-context-menu
1299 '(["View %_Documentation" (help-symbol-run-function 'describe-function)] 1299 '(["View %_Documentation" (help-symbol-run-function 'describe-function)]
1300 ["Find %_Function Source" (help-symbol-run-function 'find-function) 1300 ["Find %_Function Source" (help-symbol-run-function 'find-function)
1301 (fboundp #'find-function)] 1301 (fboundp 'find-function)]
1302 ["Find %_Tag" (help-symbol-run-function 'find-tag)] 1302 ["Find %_Tag" (help-symbol-run-function 'find-tag)]
1303 )) 1303 ))
1304 1304
1305 (defvar help-symbol-variable-context-menu 1305 (defvar help-symbol-variable-context-menu
1306 '(["View %_Documentation" (help-symbol-run-function 'describe-variable)] 1306 '(["View %_Documentation" (help-symbol-run-function 'describe-variable)]
1307 ["Find %_Variable Source" (help-symbol-run-function 'find-variable) 1307 ["Find %_Variable Source" (help-symbol-run-function 'find-variable)
1308 (fboundp #'find-variable)] 1308 (fboundp 'find-variable)]
1309 ["Find %_Tag" (help-symbol-run-function 'find-tag)] 1309 ["Find %_Tag" (help-symbol-run-function 'find-tag)]
1310 )) 1310 ))
1311 1311
1312 (defvar help-symbol-function-and-variable-context-menu 1312 (defvar help-symbol-function-and-variable-context-menu
1313 '(["View Function %_Documentation" (help-symbol-run-function 1313 '(["View Function %_Documentation" (help-symbol-run-function
1314 'describe-function)] 1314 'describe-function)]
1315 ["View Variable D%_ocumentation" (help-symbol-run-function 1315 ["View Variable D%_ocumentation" (help-symbol-run-function
1316 'describe-variable)] 1316 'describe-variable)]
1317 ["Find %_Function Source" (help-symbol-run-function 'find-function) 1317 ["Find %_Function Source" (help-symbol-run-function 'find-function)
1318 (fboundp #'find-function)] 1318 (fboundp 'find-function)]
1319 ["Find %_Variable Source" (help-symbol-run-function 'find-variable) 1319 ["Find %_Variable Source" (help-symbol-run-function 'find-variable)
1320 (fboundp #'find-variable)] 1320 (fboundp 'find-variable)]
1321 ["Find %_Tag" (help-symbol-run-function 'find-tag)] 1321 ["Find %_Tag" (help-symbol-run-function 'find-tag)]
1322 )) 1322 ))
1323 1323
1324 (defun frob-help-extents (buffer) 1324 (defun frob-help-extents (buffer)
1325 ;; Look through BUFFER, starting at the buffer's point and continuing 1325 ;; Look through BUFFER, starting at the buffer's point and continuing
1854 1854
1855 (defun help-find-source-or-scroll-up (&optional pos) 1855 (defun help-find-source-or-scroll-up (&optional pos)
1856 "Follow any cross reference to source code; if none, scroll up. " 1856 "Follow any cross reference to source code; if none, scroll up. "
1857 (interactive "d") 1857 (interactive "d")
1858 (let ((e (extent-at pos nil 'find-function-symbol))) 1858 (let ((e (extent-at pos nil 'find-function-symbol)))
1859 (if (and-fboundp #'find-function e) 1859 (if (and-fboundp 'find-function e)
1860 (with-fboundp #'find-function 1860 (with-fboundp 'find-function
1861 (find-function (extent-property e 'find-function-symbol))) 1861 (find-function (extent-property e 'find-function-symbol)))
1862 (setq e (extent-at pos nil 'find-variable-symbol)) 1862 (setq e (extent-at pos nil 'find-variable-symbol))
1863 (if (and-fboundp #'find-variable e) 1863 (if (and-fboundp 'find-variable e)
1864 (with-fboundp #'find-variable 1864 (with-fboundp 'find-variable
1865 (find-variable (extent-property e 'find-variable-symbol))) 1865 (find-variable (extent-property e 'find-variable-symbol)))
1866 (scroll-up 1))))) 1866 (scroll-up 1)))))
1867 1867
1868 (defun help-mouse-find-source-or-track (event) 1868 (defun help-mouse-find-source-or-track (event)
1869 "Follow any cross reference to source code under the mouse; 1869 "Follow any cross reference to source code under the mouse;
1870 if none, call mouse-track. " 1870 if none, call mouse-track. "
1871 (interactive "e") 1871 (interactive "e")
1872 (mouse-set-point event) 1872 (mouse-set-point event)
1873 (let ((e (extent-at (point) nil 'find-function-symbol))) 1873 (let ((e (extent-at (point) nil 'find-function-symbol)))
1874 (if (and-fboundp #'find-function e) 1874 (if (and-fboundp 'find-function e)
1875 (with-fboundp #'find-function 1875 (with-fboundp 'find-function
1876 (find-function (extent-property e 'find-function-symbol))) 1876 (find-function (extent-property e 'find-function-symbol)))
1877 (setq e (extent-at (point) nil 'find-variable-symbol)) 1877 (setq e (extent-at (point) nil 'find-variable-symbol))
1878 (if (and-fboundp #'find-variable e) 1878 (if (and-fboundp 'find-variable e)
1879 (with-fboundp #'find-variable 1879 (with-fboundp 'find-variable
1880 (find-variable (extent-property e 'find-variable-symbol))) 1880 (find-variable (extent-property e 'find-variable-symbol)))
1881 (mouse-track event))))) 1881 (mouse-track event)))))
1882 1882
1883 (define-minor-mode temp-buffer-resize-mode 1883 (define-minor-mode temp-buffer-resize-mode
1884 "Toggle the mode which makes windows smaller for temporary buffers. 1884 "Toggle the mode which makes windows smaller for temporary buffers.