comparison lisp/prim/help.el @ 110:fe104dbd9147 r20-1b7

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