comparison lisp/prim/help.el @ 32:e04119814345 r19-15b99

Import from CVS: tag r19-15b99
author cvs
date Mon, 13 Aug 2007 08:52:56 +0200
parents ec9a17fef872
children c53a95d3c46d
comparison
equal deleted inserted replaced
31:b9328a10c56c 32:e04119814345
906 (setq file-name (describe-function-find-file function))) 906 (setq file-name (describe-function-find-file function)))
907 (if file-name 907 (if file-name
908 (princ (format ".\n -- loads from \"%s\"" file-name) stream)) 908 (princ (format ".\n -- loads from \"%s\"" file-name) stream))
909 (if home 909 (if home
910 (princ (format ".\n -- loaded from %s" home))) 910 (princ (format ".\n -- loaded from %s" home)))
911 (princ ".") 911 (princ "." stream)
912 (terpri) 912 (terpri stream)
913 (cond (kbd-macro-p 913 (cond (kbd-macro-p
914 (princ "These characters are executed:\n\n\t" stream) 914 (princ "These characters are executed:\n\n\t" stream)
915 (princ (key-description def) stream) 915 (princ (key-description def) stream)
916 (cond ((setq def (key-binding def)) 916 (cond ((setq def (key-binding def))
917 (princ (format "\n\nwhich executes the command %s.\n\n" def) stream) 917 (princ (format "\n\nwhich executes the command %s.\n\n" def) stream)
936 (terpri stream))) 936 (terpri stream)))
937 (if (not (and obsolete aliases)) 937 (if (not (and obsolete aliases))
938 (progn 938 (progn
939 (princ doc stream) 939 (princ doc stream)
940 (or (eq ?\n (aref doc (1- (length doc)))) 940 (or (eq ?\n (aref doc (1- (length doc))))
941 (terpri))))))))) 941 (terpri stream)))))))))
942 942
943 943
944 (defun describe-function-arglist (function) 944 (defun describe-function-arglist (function)
945 (interactive (list (or (function-called-at-point) 945 (interactive (list (or (function-called-at-point)
946 (error "no function call at point")))) 946 (error "no function call at point"))))
1138 (< (length x) (length y)))) 1138 (< (length x) (length y))))
1139 ", ")) 1139 ", "))
1140 (message "%s is not on any keys" definition))) 1140 (message "%s is not on any keys" definition)))
1141 nil) 1141 nil)
1142 1142
1143 (defun locate-library (library &optional nosuffix) 1143 ;; Synched with Emacs 19.35
1144 "Show the full path name of XEmacs library LIBRARY. 1144 (defun locate-library (library &optional nosuffix path interactive-call)
1145 "Show the precise file name of Emacs library LIBRARY.
1145 This command searches the directories in `load-path' like `M-x load-library' 1146 This command searches the directories in `load-path' like `M-x load-library'
1146 to find the file that `M-x load-library RET LIBRARY RET' would load. 1147 to find the file that `M-x load-library RET LIBRARY RET' would load.
1147 Optional second arg NOSUFFIX non-nil means don't add suffixes `.elc' or `.el' 1148 Optional second arg NOSUFFIX non-nil means don't add suffixes `.elc' or `.el'
1148 to the specified name LIBRARY (a la calling `load' instead of `load-library')." 1149 to the specified name LIBRARY.
1149 (interactive "sLocate library: \nP") 1150
1150 ;; XEmacs: We have the nifty `locate-file' so we use it. 1151 If the optional third arg PATH is specified, that list of directories
1151 (let ((file (locate-file library load-path (if nosuffix nil ".elc:.el:")))) 1152 is used instead of `load-path'."
1152 (when (interactive-p) 1153 (interactive (list (read-string "Locate library: ")
1153 (if file 1154 nil nil
1154 (message "Library is file %s" file) 1155 t))
1155 (message "No library %s in search path" library))) 1156 (let (result)
1156 file)) 1157 (catch 'answer
1158 (mapcar
1159 (lambda (dir)
1160 (mapcar
1161 (lambda (suf)
1162 (let ((try (expand-file-name (concat library suf) dir)))
1163 (and (file-readable-p try)
1164 (null (file-directory-p try))
1165 (progn
1166 (setq result try)
1167 (throw 'answer try)))))
1168 (if nosuffix
1169 '("")
1170 (let ((basic '(".elc" ".el" ""))
1171 (compressed '(".Z" ".gz" "")))
1172 ;; If autocompression mode is on,
1173 ;; consider all combinations of library suffixes
1174 ;; and compression suffixes.
1175 (if (rassq 'jka-compr-handler file-name-handler-alist)
1176 (apply 'nconc
1177 (mapcar (lambda (compelt)
1178 (mapcar (lambda (baselt)
1179 (concat baselt compelt))
1180 basic))
1181 compressed))
1182 basic)))))
1183 (or path load-path)))
1184 (and interactive-call
1185 (if result
1186 (message "Library is file %s" result)
1187 (message "No library %s in search path" library)))
1188 result))
1157 1189
1158 ;; Functions ported from C into Lisp in XEmacs 1190 ;; Functions ported from C into Lisp in XEmacs
1159 1191
1160 (defun describe-syntax () 1192 (defun describe-syntax ()
1161 "Describe the syntax specifications in the syntax table. 1193 "Describe the syntax specifications in the syntax table.