comparison lisp/subr.el @ 59124:f38536b30f3a

(messages-buffer-max-lines): Alias for message-log-max. (symbol-file): Rewritten to handle new load-history format. Now takes an arg TYPE to specify looking for a particular type of definition only.
author Richard M. Stallman <rms@gnu.org>
date Mon, 27 Dec 2004 16:23:34 +0000
parents ee02b41be7da
children 0d5e992b6c18 223c12363c0c
comparison
equal deleted inserted replaced
59123:f9293296e0cb 59124:f38536b30f3a
821 821
822 (defalias 'focus-frame 'ignore "") 822 (defalias 'focus-frame 'ignore "")
823 (defalias 'unfocus-frame 'ignore "") 823 (defalias 'unfocus-frame 'ignore "")
824 824
825 825
826 ;;;; Obsolescence declarations for variables. 826 ;;;; Obsolescence declarations for variables, and aliases.
827 827
828 (make-obsolete-variable 'directory-sep-char "do not use it." "21.1") 828 (make-obsolete-variable 'directory-sep-char "do not use it." "21.1")
829 (make-obsolete-variable 'mode-line-inverse-video "use the appropriate faces instead." "21.1") 829 (make-obsolete-variable 'mode-line-inverse-video "use the appropriate faces instead." "21.1")
830 (make-obsolete-variable 'unread-command-char 830 (make-obsolete-variable 'unread-command-char
831 "use `unread-command-events' instead. That variable is a list of events to reread, so it now uses nil to mean `no event', instead of -1." 831 "use `unread-command-events' instead. That variable is a list of events to reread, so it now uses nil to mean `no event', instead of -1."
838 838
839 (defvaralias 'x-lost-selection-hooks 'x-lost-selection-functions) 839 (defvaralias 'x-lost-selection-hooks 'x-lost-selection-functions)
840 (make-obsolete-variable 'x-lost-selection-hooks 'x-lost-selection-functions "21.4") 840 (make-obsolete-variable 'x-lost-selection-hooks 'x-lost-selection-functions "21.4")
841 (defvaralias 'x-sent-selection-hooks 'x-sent-selection-functions) 841 (defvaralias 'x-sent-selection-hooks 'x-sent-selection-functions)
842 (make-obsolete-variable 'x-sent-selection-hooks 'x-sent-selection-functions "21.4") 842 (make-obsolete-variable 'x-sent-selection-hooks 'x-sent-selection-functions "21.4")
843
844 (defvaralias 'messages-buffer-max-lines 'message-log-max)
843 845
844 ;;;; Alternate names for functions - these are not being phased out. 846 ;;;; Alternate names for functions - these are not being phased out.
845 847
846 (defalias 'string= 'string-equal) 848 (defalias 'string= 'string-equal)
847 (defalias 'string< 'string-lessp) 849 (defalias 'string< 'string-lessp)
1010 ;;; exec-directory) 1012 ;;; exec-directory)
1011 ;;; ;; The file name fns-%s.el already has a .el extension. 1013 ;;; ;; The file name fns-%s.el already has a .el extension.
1012 ;;; nil nil t) 1014 ;;; nil nil t)
1013 ;;; (setq symbol-file-load-history-loaded t))) 1015 ;;; (setq symbol-file-load-history-loaded t)))
1014 1016
1015 (defun symbol-file (function) 1017 (defun symbol-file (symbol &optional type)
1016 "Return the input source from which FUNCTION was loaded. 1018 "Return the input source in which SYMBOL was defined.
1017 The value is normally a string that was passed to `load': 1019 The value is normally a string that was passed to `load':
1018 either an absolute file name, or a library name 1020 either an absolute file name, or a library name
1019 \(with no directory name and no `.el' or `.elc' at the end). 1021 \(with no directory name and no `.el' or `.elc' at the end).
1020 It can also be nil, if the definition is not associated with any file." 1022 It can also be nil, if the definition is not associated with any file.
1021 (if (and (symbolp function) (fboundp function) 1023
1022 (eq 'autoload (car-safe (symbol-function function)))) 1024 If TYPE is nil, then any kind of definition is acceptable.
1023 (nth 1 (symbol-function function)) 1025 If type is `defun' or `defvar', that specifies function
1026 definition only or variable definition only."
1027 (if (and (or (null type) (eq type 'defun))
1028 (symbolp symbol) (fboundp symbol)
1029 (eq 'autoload (car-safe (symbol-function symbol))))
1030 (nth 1 (symbol-function symbol))
1024 (let ((files load-history) 1031 (let ((files load-history)
1025 file) 1032 file)
1026 (while files 1033 (while files
1027 (if (member function (cdr (car files))) 1034 (if (if type
1035 (if (eq type 'defvar)
1036 ;; Variables are present just as their names.
1037 (member symbol (cdr (car files)))
1038 ;; Other types are represented as (TYPE . NAME).
1039 (member (cons type symbol) (cdr (car files))))
1040 ;; We accept all types, so look for variable def
1041 ;; and then for any other kind.
1042 (or (member symbol (cdr (car files)))
1043 (rassq symbol (cdr (car files)))))
1028 (setq file (car (car files)) files nil)) 1044 (setq file (car (car files)) files nil))
1029 (setq files (cdr files))) 1045 (setq files (cdr files)))
1030 file))) 1046 file)))
1031 1047
1032 1048