From 6bdd920482e75a47062ebec76c022baa4259530d Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 6 Jan 2014 18:34:05 -0500 Subject: [PATCH] * lisp/abbrev.el (define-abbrev): Beware new meaning of fboundp. * lisp/emacs-lisp/elint.el (elint-find-builtins): * lisp/emacs-lisp/eldoc.el (eldoc-symbol-function): * lisp/emacs-lisp/bytecomp.el (byte-compile-callargs-warn) (byte-compile-file-form-defmumble, byte-compile, byte-compile-form): * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand): * lisp/apropos.el (apropos-safe-documentation): * lisp/subr.el (symbol-file): Remove redundant fboundp. * lisp/progmodes/idlw-shell.el (idlwave-shell-comint-filter): Use defalias. --- lisp/ChangeLog | 12 ++++++++++++ lisp/abbrev.el | 2 +- lisp/apropos.el | 3 +-- lisp/emacs-lisp/byte-opt.el | 4 ++-- lisp/emacs-lisp/bytecomp.el | 13 +++++-------- lisp/emacs-lisp/eldoc.el | 3 +-- lisp/emacs-lisp/elint.el | 4 ++-- lisp/progmodes/idlw-shell.el | 8 ++++---- lisp/subr.el | 2 +- 9 files changed, 29 insertions(+), 22 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ed858741160..8b6462b2d6b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,15 @@ +2014-01-06 Stefan Monnier + + * abbrev.el (define-abbrev): Beware new meaning of fboundp. + * emacs-lisp/elint.el (elint-find-builtins): + * emacs-lisp/eldoc.el (eldoc-symbol-function): + * emacs-lisp/bytecomp.el (byte-compile-callargs-warn) + (byte-compile-file-form-defmumble, byte-compile, byte-compile-form): + * emacs-lisp/byte-opt.el (byte-compile-inline-expand): + * apropos.el (apropos-safe-documentation): + * subr.el (symbol-file): Remove redundant fboundp. + * progmodes/idlw-shell.el (idlwave-shell-comint-filter): Use defalias. + 2014-01-06 Bastien Guerry * hl-line.el (global-hl-line-overlay): Make a local variable. diff --git a/lisp/abbrev.el b/lisp/abbrev.el index 0fd4dc6fd38..8c59d2919ab 100644 --- a/lisp/abbrev.el +++ b/lisp/abbrev.el @@ -588,7 +588,7 @@ An obsolete but still supported calling form is: (boundp sym) (symbol-value sym) (not (abbrev-get sym :system))) (unless (or system-flag - (and (boundp sym) (fboundp sym) + (and (boundp sym) ;; load-file-name (equal (symbol-value sym) expansion) (equal (symbol-function sym) hook))) diff --git a/lisp/apropos.el b/lisp/apropos.el index 1d09ded0820..f24871d5d20 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el @@ -1006,8 +1006,7 @@ Returns list of symbols and documentation found." "Like `documentation', except it avoids calling `get_doc_string'. Will return nil instead." (while (and function (symbolp function)) - (setq function (if (fboundp function) - (symbol-function function)))) + (setq function (symbol-function function))) (if (eq (car-safe function) 'macro) (setq function (cdr function))) (setq function (if (byte-code-function-p function) diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index f6ba8af9177..60203da9da6 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -248,10 +248,10 @@ (defun byte-compile-inline-expand (form) (let* ((name (car form)) (localfn (cdr (assq name byte-compile-function-environment))) - (fn (or localfn (and (fboundp name) (symbol-function name))))) + (fn (or localfn (symbol-function name)))) (when (autoloadp fn) (autoload-do-load fn) - (setq fn (or (and (fboundp name) (symbol-function name)) + (setq fn (or (symbol-function name) (cdr (assq name byte-compile-function-environment))))) (pcase fn (`nil diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 1f2a69ccf59..1e21a222149 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1265,8 +1265,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." (if (byte-code-function-p def) (aref def 0) '(&rest def))))) - (if (and (fboundp (car form)) - (subrp (symbol-function (car form)))) + (if (subrp (symbol-function (car form))) (subr-arity (symbol-function (car form)))))) (ncall (length (cdr form)))) ;; Check many or unevalled from subr-arity. @@ -2396,9 +2395,8 @@ not to take responsibility for the actual compilation of the code." (byte-compile-warn "%s `%s' defined multiple times in this file" (if macro "macro" "function") name))) - ((and (fboundp name) - (eq (car-safe (symbol-function name)) - (if macro 'lambda 'macro))) + ((eq (car-safe (symbol-function name)) + (if macro 'lambda 'macro)) (when (byte-compile-warning-enabled-p 'redefine) (byte-compile-warn "%s `%s' being redefined as a %s" (if macro "function" "macro") @@ -2532,7 +2530,7 @@ If FORM is a lambda or a macro, byte-compile it as a function." (byte-compile-close-variables (let* ((lexical-binding lexical-binding) (fun (if (symbolp form) - (and (fboundp form) (symbol-function form)) + (symbol-function form) form)) (macro (eq (car-safe fun) 'macro))) (if macro @@ -2946,8 +2944,7 @@ for symbols generated by the byte compiler itself." (format "; use `%s' instead." interactive-only)) (t ".")))) - (if (and (fboundp (car form)) - (eq (car-safe (symbol-function (car form))) 'macro)) + (if (eq (car-safe (symbol-function (car form))) 'macro) (byte-compile-log-warning (format "Forgot to expand macro %s" (car form)) nil :error)) (if (and handler diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index 759bd0b642d..8bd9ebc1e63 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el @@ -512,8 +512,7 @@ In the absence of INDEX, just call `eldoc-docstring-format-sym-doc'." ;; Do indirect function resolution if possible. (defun eldoc-symbol-function (fsym) - (let ((defn (and (fboundp fsym) - (symbol-function fsym)))) + (let ((defn (symbol-function fsym))) (and (symbolp defn) (condition-case _ (setq defn (indirect-function fsym)) diff --git a/lisp/emacs-lisp/elint.el b/lisp/emacs-lisp/elint.el index 63c19e6e6da..77da42450e9 100644 --- a/lisp/emacs-lisp/elint.el +++ b/lisp/emacs-lisp/elint.el @@ -1145,8 +1145,8 @@ Marks the function with their arguments, and returns a list of variables." (defun elint-find-builtins () "Return a list of all built-in functions." (let (subrs) - (mapatoms (lambda (s) (and (fboundp s) (subrp (symbol-function s)) - (setq subrs (cons s subrs))))) + (mapatoms (lambda (s) (and (subrp (symbol-function s)) + (push s subrs)))) subrs)) (defun elint-find-builtin-args (&optional list) diff --git a/lisp/progmodes/idlw-shell.el b/lisp/progmodes/idlw-shell.el index 0be81c3904f..e7bf3792e5f 100644 --- a/lisp/progmodes/idlw-shell.el +++ b/lisp/progmodes/idlw-shell.el @@ -1446,10 +1446,10 @@ Otherwise just move the line. Move down unless UP is non-nil." ;; Newer versions of comint.el changed the name of comint-filter to ;; comint-output-filter. -(defun idlwave-shell-comint-filter (process string) nil) -(if (fboundp 'comint-output-filter) - (fset 'idlwave-shell-comint-filter (symbol-function 'comint-output-filter)) - (fset 'idlwave-shell-comint-filter (symbol-function 'comint-filter))) +(defalias 'idlwave-shell-comint-filter + (if (fboundp 'comint-output-filter) + #'comint-output-filter + #'comint-filter)) (defun idlwave-shell-is-running () "Return t if the shell process is running." diff --git a/lisp/subr.el b/lisp/subr.el index 5d945047da6..40465556531 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1810,7 +1810,7 @@ If TYPE is nil, then any kind of definition is acceptable. If TYPE is `defun', `defvar', or `defface', that specifies function definition, variable definition, or face definition only." (if (and (or (null type) (eq type 'defun)) - (symbolp symbol) (fboundp symbol) + (symbolp symbol) (autoloadp (symbol-function symbol))) (nth 1 (symbol-function symbol)) (let ((files load-history) -- 2.39.2