Mercurial > hg > xemacs-beta
changeset 4368:1740095ec116
Automated merge with file:/Sources/xemacs-21.5-checked-out
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 30 Dec 2007 15:34:02 +0100 |
parents | 69e6352406f0 (diff) 7b628daa39d4 (current diff) |
children | b94710365f92 |
files | |
diffstat | 4 files changed, 62 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Sat Dec 29 20:22:04 2007 -0800 +++ b/lisp/ChangeLog Sun Dec 30 15:34:02 2007 +0100 @@ -1,3 +1,14 @@ +2007-12-30 Aidan Kehoe <kehoea@parhasard.net> + + * loadhist.el (symbol-file): + Accept a new TYPE argument, compatible with GNU, saying + whether function or variable definitions should be searched for. + Implement the functionality for autoloads, handling TYPE + correctly. + Pass the TYPE argument to built-in-symbol-file correctly. + Document that TYPE is not implemented for non-autoloaded Lisp + definitions. Our load-history doesn't have the relevant metadata. + 2007-12-25 Aidan Kehoe <kehoea@parhasard.net> * glyphs.el (init-glyphs):
--- a/lisp/loadhist.el Sat Dec 29 20:22:04 2007 -0800 +++ b/lisp/loadhist.el Sun Dec 30 15:34:02 2007 +0100 @@ -25,6 +25,8 @@ ;;; Synched up with: FSF 20.2. +;; #### Sync this file! + ;;; Commentary: ;; This file is dumped with XEmacs. @@ -37,19 +39,36 @@ ;; load-history is a list of entries that look like this: ;; ("outline" outline-regexp ... (require . wid-edit) ... (provide . outline) ...) -(defun symbol-file (sym) +(defun symbol-file (sym &optional type) "Return the input source from which SYM was loaded. -This is a file name, or nil if the source was a buffer with no associated file." +This is a file name, or nil if the source was a buffer with no associated file. + +If TYPE is nil or omitted, any kind of definition is acceptable. +If TYPE is `defun', then function, subr, special form or macro definitions +are acceptable. +If TYPE is `defvar', then variable definitions are acceptable. + +#### For the moment the difference is not implemented for non-autoloaded +Lisp symbols." (interactive "SFind source file for symbol: ") ; XEmacs (block look-up-symbol-file - (dolist (entry load-history) - (when (memq sym (cdr entry)) - (return-from look-up-symbol-file (car entry)))) - (when (or (and (boundp sym) (built-in-variable-type sym)) - (and (fboundp sym) (subrp (symbol-function sym)))) - (let ((built-in-file (built-in-symbol-file sym))) - (if built-in-file - (concat source-directory "/src/" built-in-file)))))) + (let (built-in-file autoload-cons) + (when (and + (eq 'autoload + (car-safe (setq autoload-cons + (and (fboundp sym) + (symbol-function sym))))) + (or (and (or (null type) (eq 'defvar type)) + (eq (fifth autoload-cons) 'keymap)) + (and (or (null type) (eq 'defvar type)) + (memq (fifth autoload-cons) '(nil macro))))) + (return-from look-up-symbol-file + (locate-library (second autoload-cons)))) + (dolist (entry load-history) + (when (memq sym (cdr entry)) + (return-from look-up-symbol-file (car entry)))) + (setq built-in-file (built-in-symbol-file sym type)) + (if built-in-file (concat source-directory "/src/" built-in-file))))) (defun feature-symbols (feature) "Return the file and list of symbols associated with a given FEATURE."
--- a/src/ChangeLog Sat Dec 29 20:22:04 2007 -0800 +++ b/src/ChangeLog Sun Dec 30 15:34:02 2007 +0100 @@ -1,3 +1,10 @@ +2007-12-30 Aidan Kehoe <kehoea@parhasard.net> + + * doc.c (Fbuilt_in_symbol_file): + Take a new TYPE argument, specifying whether the function or + variable definition of the symbol should be searched for. + Handle built-in macros correctly. + 2007-12-24 Aidan Kehoe <kehoea@parhasard.net> * event-xlike-inc.c (x_keysym_to_character):
--- a/src/doc.c Sat Dec 29 20:22:04 2007 -0800 +++ b/src/doc.c Sun Dec 30 15:34:02 2007 +0100 @@ -37,7 +37,7 @@ Lisp_Object Vinternal_doc_file_name; -Lisp_Object QSsubstitute; +Lisp_Object QSsubstitute, Qdefvar; /* Work out what source file a function or variable came from, taking the information from the documentation file. */ @@ -499,21 +499,28 @@ weirdness, type, XSTRING_DATA (XSYMBOL (sym)->name), pos); } -DEFUN ("built-in-symbol-file", Fbuilt_in_symbol_file, 1, 1, 0, /* +DEFUN ("built-in-symbol-file", Fbuilt_in_symbol_file, 1, 2, 0, /* Return the C source file built-in symbol SYM comes from. Don't use this. Use the more general `symbol-file' (q.v.) instead. + +If TYPE is nil or omitted, any kind of definition is acceptable. +If TYPE is `defun', then function, subr, special form or macro definitions +are acceptable. +If TYPE is `defvar', then variable definitions are acceptable. */ - (symbol)) + (symbol, type)) { /* This function can GC */ Lisp_Object fun; Lisp_Object filename = Qnil; - if (EQ(Ffboundp(symbol), Qt)) + if (EQ(Ffboundp(symbol), Qt) && (EQ(type, Qnil) || EQ(type, Qdefun))) { fun = Findirect_function (symbol); - if (SUBRP (fun)) + if (SUBRP (fun) || (CONSP(fun) && (EQ (Qmacro, Fcar_safe (fun))) + && (fun = Fcdr_safe (fun)) + && (SUBRP (fun)))) { if (XSUBR (fun)->doc == 0) return Qnil; @@ -529,7 +536,7 @@ (make_int (- (EMACS_INT) XSUBR (fun)->doc)); } } - else if (EQ(Fboundp(symbol), Qt)) + else if (EQ(Fboundp(symbol), Qt) && (EQ(type, Qnil) || EQ(type, Qdefvar))) { Lisp_Object doc_offset = Fget (symbol, Qvariable_documentation, Qnil); @@ -1273,6 +1280,8 @@ DEFSUBR (Fsnarf_documentation); DEFSUBR (Fverify_documentation); DEFSUBR (Fsubstitute_command_keys); + + DEFSYMBOL (Qdefvar); } void