From 2168fe4f2ad6ea4320a0da7976294b0cdade1a20 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 12 Sep 2012 22:41:46 -0400 Subject: byte-compile-warning-prefix tweak * lisp/emacs-lisp/bytecomp.el (byte-compile-warning-prefix): If not compiling a file, try using load-file-name. --- lisp/emacs-lisp/bytecomp.el | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lisp/emacs-lisp/bytecomp.el') diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 10bc37c6dcd..c42ae21aae5 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1016,6 +1016,10 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." ((bufferp byte-compile-current-file) (format "Buffer %s:" (buffer-name byte-compile-current-file))) + ;; We might be simply loading a file that + ;; contains explicit calls to byte-compile functions. + ((stringp load-file-name) + (format "%s:" (file-relative-name load-file-name dir))) (t ""))) (pos (if (and byte-compile-current-file (integerp byte-compile-read-position)) -- cgit v1.2.3 From 95b9712e9e3e8df09ad07423012bfbd978239014 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 20 Sep 2012 09:46:36 -0400 Subject: * lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning): New function. (macroexp--expand-all): Use it. (macroexp--funcall-and-return): Remove by folding it into its sole caller (macroexp--warn-and-return). * lisp/emacs-lisp/bytecomp.el (byte-compile-warn-obsolete): Use macroexp--obsolete-warning. --- lisp/ChangeLog | 7 +++++++ lisp/emacs-lisp/bytecomp.el | 16 +++++----------- lisp/emacs-lisp/macroexp.el | 46 ++++++++++++++++++++++++++------------------- 3 files changed, 39 insertions(+), 30 deletions(-) (limited to 'lisp/emacs-lisp/bytecomp.el') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7f9a15d9dfc..8b99fc29252 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,12 @@ 2012-09-20 Stefan Monnier + * emacs-lisp/macroexp.el (macroexp--obsolete-warning): New function. + (macroexp--expand-all): Use it. + (macroexp--funcall-and-return): Remove by folding it into its sole + caller (macroexp--warn-and-return). + * emacs-lisp/bytecomp.el (byte-compile-warn-obsolete): + Use macroexp--obsolete-warning. + * calc/calc.el: Fix last change by removing the whole chunk, since it was only needed back when Calc was not bundled. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index c42ae21aae5..7a229750178 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1115,18 +1115,12 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." "Warn that SYMBOL (a variable or function) is obsolete." (when (byte-compile-warning-enabled-p 'obsolete) (let* ((funcp (get symbol 'byte-obsolete-info)) - (obsolete (or funcp (get symbol 'byte-obsolete-variable))) - (instead (car obsolete)) - (asof (nth 2 obsolete))) + (msg (macroexp--obsolete-warning + symbol + (or funcp (get symbol 'byte-obsolete-variable)) + (if funcp "function" "variable")))) (unless (and funcp (memq symbol byte-compile-not-obsolete-funcs)) - (byte-compile-warn "`%s' is an obsolete %s%s%s" symbol - (if funcp "function" "variable") - (if asof (concat " (as of " asof ")") "") - (cond ((stringp instead) - (concat "; " instead)) - (instead - (format "; use `%s' instead." instead)) - (t "."))))))) + (byte-compile-warn "%s" msg))))) (defun byte-compile-report-error (error-info) "Report Lisp error in compilation. ERROR-INFO is the error data." diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index f9be3e4fcc4..cab693fecac 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -111,23 +111,30 @@ and also to avoid outputting the warning during normal execution." (funcall (eval (cadr form))) (byte-compile-constant nil))) -(defun macroexp--funcall-and-return (when-compiled when-interpreted form) - ;; FIXME: ¡¡Major Ugly Hack!! To determine whether the output of this - ;; macro-expansion will be processed by the byte-compiler, we check - ;; circumstantial evidence. - (if (member '(declare-function . byte-compile-macroexpand-declare-function) - macroexpand-all-environment) +(defun macroexp--warn-and-return (msg form) + (let ((when-compiled (lambda () (byte-compile-log-warning msg t)))) + (cond + ((null msg) form) + ;; FIXME: ¡¡Major Ugly Hack!! To determine whether the output of this + ;; macro-expansion will be processed by the byte-compiler, we check + ;; circumstantial evidence. + ((member '(declare-function . byte-compile-macroexpand-declare-function) + macroexpand-all-environment) `(progn (macroexp--funcall-if-compiled ',when-compiled) - ,form) - (funcall when-interpreted) - form)) - -(defun macroexp--warn-and-return (msg form) - (macroexp--funcall-and-return - (lambda () (byte-compile-log-warning msg t)) - (lambda () (message "%s" msg)) - form)) + ,form)) + (t + (message "%s" msg) + form)))) + +(defun macroexp--obsolete-warning (fun obsolescence-data type) + (let ((instead (car obsolescence-data)) + (asof (nth 2 obsolescence-data))) + (format "`%s' is an obsolete %s%s%s" fun type + (if asof (concat " (as of " asof ")") "") + (cond ((stringp instead) (concat "; " instead)) + (instead (format "; use `%s' instead." instead)) + (t "."))))) (defun macroexp--expand-all (form) "Expand all macros in FORM. @@ -148,10 +155,11 @@ Assumes the caller has bound `macroexpand-all-environment'." (car-safe form) (symbolp (car form)) (get (car form) 'byte-obsolete-info)) - (macroexp--funcall-and-return - (lambda () (byte-compile-warn-obsolete (car form))) - #'ignore ;FIXME: We should `message' something. - new-form) + (let* ((fun (car form)) + (obsolete (get fun 'byte-obsolete-info))) + (macroexp--warn-and-return + (macroexp--obsolete-warning fun obsolete "macro") + new-form)) new-form))) (pcase form (`(cond . ,clauses) -- cgit v1.2.3 From e60b51abaa74fa15cc97de18f90b1ee967ae62ab Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 28 Sep 2012 19:30:52 -0400 Subject: * bytecomp.el (byte-compile-cl-file-p): Only "cl.el" counts as cl these days. Remove no longer appropriate file-local suppression of CL warnings in lisp/emacs-lisp/cl-*.el files. --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/bytecomp.el | 2 +- lisp/emacs-lisp/cl-extra.el | 1 - lisp/emacs-lisp/cl-lib.el | 1 - lisp/emacs-lisp/cl-macs.el | 1 - lisp/emacs-lisp/cl-seq.el | 1 - 6 files changed, 6 insertions(+), 5 deletions(-) (limited to 'lisp/emacs-lisp/bytecomp.el') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b923b6aac58..3ed9069acf2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-09-28 Glenn Morris + + * emacs-lisp/bytecomp.el (byte-compile-cl-file-p): + Only "cl.el" counts as cl these days. + 2012-09-28 Juri Linkov Display archive errors in the echo area instead of inserting diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 7a229750178..d49e56bd2ba 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -846,7 +846,7 @@ CONST2 may be evaluated multiple times." (defun byte-compile-cl-file-p (file) "Return non-nil if FILE is one of the CL files." (and (stringp file) - (string-match "^cl\\>" (file-name-nondirectory file)))) + (string-match "^cl\\.el" (file-name-nondirectory file)))) (defun byte-compile-eval (form) "Eval FORM and mark the functions defined therein. diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el index ea5e1cf9beb..913ebf2015f 100644 --- a/lisp/emacs-lisp/cl-extra.el +++ b/lisp/emacs-lisp/cl-extra.el @@ -689,7 +689,6 @@ PROPLIST is a list of the sort returned by `symbol-plist'. ;; Local variables: ;; byte-compile-dynamic: t -;; byte-compile-warnings: (not cl-functions) ;; generated-autoload-file: "cl-loaddefs.el" ;; End: diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el index 5749ff91b40..2eda628e262 100644 --- a/lisp/emacs-lisp/cl-lib.el +++ b/lisp/emacs-lisp/cl-lib.el @@ -745,7 +745,6 @@ If ALIST is non-nil, the new pairs are prepended to it." ;; Local variables: ;; byte-compile-dynamic: t -;; byte-compile-warnings: (not cl-functions) ;; End: ;;; cl-lib.el ends here diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 16ac14f8fe9..56e698bec0a 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -2686,7 +2686,6 @@ surrounded by (cl-block NAME ...). ;; Local variables: ;; byte-compile-dynamic: t -;; byte-compile-warnings: (not cl-functions) ;; generated-autoload-file: "cl-loaddefs.el" ;; End: diff --git a/lisp/emacs-lisp/cl-seq.el b/lisp/emacs-lisp/cl-seq.el index b55f1df5ba5..1fa562e328a 100644 --- a/lisp/emacs-lisp/cl-seq.el +++ b/lisp/emacs-lisp/cl-seq.el @@ -1010,7 +1010,6 @@ Atoms are compared by `eql'; cons cells are compared recursively. ;; Local variables: ;; byte-compile-dynamic: t -;; byte-compile-warnings: (not cl-functions) ;; generated-autoload-file: "cl-loaddefs.el" ;; End: -- cgit v1.2.3 From 375e49d4d18ff9e5d6d523618aee043768c8ac90 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 1 Oct 2012 00:45:32 -0400 Subject: * lisp/emacs-lisp/bytecomp.el (byte-compiler-abbreviate-file): New function. (byte-compile-warning-prefix, byte-compile-file): Use it. Fixes: debbugs:12508 --- lisp/ChangeLog | 81 ++++++++++++++++++++++++--------------------- lisp/emacs-lisp/bytecomp.el | 16 ++++++--- 2 files changed, 55 insertions(+), 42 deletions(-) (limited to 'lisp/emacs-lisp/bytecomp.el') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0e515c2a7b4..b5ccfcfcc7c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-10-01 Stefan Monnier + + * emacs-lisp/bytecomp.el (byte-compiler-abbreviate-file): New function. + (byte-compile-warning-prefix, byte-compile-file): Use it (bug#12508). + 2012-10-01 Karl Fogel * bookmark.el (bookmark-version-control): Give tags in the @@ -19,8 +24,8 @@ Shell output catching a la gud-gdb. * progmodes/python.el (python-shell-fetch-lines-in-progress) - (python-shell-fetch-lines-string, python-shell-fetched-lines): New - Vars. + (python-shell-fetch-lines-string, python-shell-fetched-lines): + New Vars. (python-shell-fetch-lines-filter): New function. (python-shell-send-string-no-output): Use them. @@ -51,12 +56,12 @@ version of the original ChangeLog can be found in the commit log. * textmodes/reftex-auc.el: Move `provide' call to bottom of file. - (reftex-arg-cite): Use `reftex-cite-key-separator'. Correctly - handle new value type returned by `reftex-citation'. + (reftex-arg-cite): Use `reftex-cite-key-separator'. + Correctly handle new value type returned by `reftex-citation'. * textmodes/reftex-cite.el (reftex-create-bibtex-file): Make sure - that entries with whitespace at various places are found. Doc - fix. Include entries that are cross-referenced from cited entries. + that entries with whitespace at various places are found. + Doc fix. Include entries that are cross-referenced from cited entries. Include @String definitions in the resulting bib file. Add header and footer defined in `reftex-create-bibtex-header' and `reftex-create-bibtex-footer'. @@ -75,10 +80,10 @@ (reftex-extract-bib-entries-from-thebibliography): Match \bibitem entries with spaces or tabs in front of arguments. (reftex-pop-to-bibtex-entry, reftex-extract-bib-entries) - (reftex-parse-bibtex-entry, reftex-create-bibtex-file): Match - entries containing numbers and symbol constituents. - (reftex-do-citation, reftex-figure-out-cite-format): Use - `reftex-cite-key-separator'. + (reftex-parse-bibtex-entry, reftex-create-bibtex-file): + Match entries containing numbers and symbol constituents. + (reftex-do-citation, reftex-figure-out-cite-format): + Use `reftex-cite-key-separator'. * textmodes/reftex-dcr.el: Move provide statement to end of file. (reftex-mouse-view-crossref): Explain why point is set. @@ -98,21 +103,21 @@ prevents fontification of quoted content. (reftex-index-phrases-mode): Use it. - * textmodes/reftex-parse.el (reftex-parse-from-file): Move - backward one char if a `\' was matched after a section macro. + * textmodes/reftex-parse.el (reftex-parse-from-file): + Move backward one char if a `\' was matched after a section macro. (reftex-parse-from-file): Use beginning of match instead of end as bound. * textmodes/reftex-ref.el: Adapt creation of `reftex--' functions to new structure of `reftex-ref-style-alist'. - (reftex-reference): Use `reftex-ref-style-list' function. Adapt - to new structure of `reftex-ref-style-alist'. Prompt for a + (reftex-reference): Use `reftex-ref-style-list' function. + Adapt to new structure of `reftex-ref-style-alist'. Prompt for a reference macro if `reftex-ref-macro-prompt' is non-nil. (reftex-reference): Pass refstyle to `reftex-format-special'. Determine reference macro by looking at - `reftex-ref-style-default-list' and `reftex-ref-style-alist'. Use - only one special format function. + `reftex-ref-style-default-list' and `reftex-ref-style-alist'. + Use only one special format function. (reftex-varioref-vref, reftex-fancyref-fref) (reftex-fancyref-Fref): Remove definitions. The functions are now generated from `reftex-ref-style-alist'. @@ -132,8 +137,8 @@ through reference styles. Add `p' for switching between number and page reference types. - * textmodes/reftex-toc.el (reftex-re-enlarge): Call - `enlarge-window' only if there is something to do because in Emacs + * textmodes/reftex-toc.el (reftex-re-enlarge): + Call `enlarge-window' only if there is something to do because in Emacs the horizontal version throws an error even if the parameter is 0. * textmodes/reftex-vars.el (reftex-label-alist): Doc fix. @@ -142,21 +147,21 @@ string. Adapt to new name. (reftex-ref-style-alist): Change structure so that it is not possible to use multiple different package names within a style. - Remove the symbols for symbols for macro type distinction. Add - characters for macro selection. + Remove the symbols for symbols for macro type distinction. + Add characters for macro selection. (reftex-ref-macro-prompt, reftex-create-bibtex-header) (reftex-create-bibtex-footer): New variables. (reftex-format-ref-function): Mention third argument of special format function. - (reftex-ref-style-alist, reftex-ref-style-default-list): New - variables. + (reftex-ref-style-alist, reftex-ref-style-default-list): + New variables. (reftex-vref-is-default, reftex-fref-is-default): Adapt doc string to new implementation. Mark as obsolete. Add compatibility code for honoring the variable values in case they are set. - (reftex-cite-format-builtin, reftex-bibliography-commands): Add - support for ConTeXt. - (reftex-format-ref-function, reftex-format-cite-function): Fix - custom type. + (reftex-cite-format-builtin, reftex-bibliography-commands): + Add support for ConTeXt. + (reftex-format-ref-function, reftex-format-cite-function): + Fix custom type. (reftex-cite-key-separator): New variable. * textmodes/reftex.el (reftex-syntax-table-for-bib) @@ -166,8 +171,8 @@ work. (reftex-in-comment): Do not error out if `comment-start-skip' is not set. Deal correctly with escaped comment characters. - (reftex-tie-multifile-symbols): Add doc string. Initialize - `reftex-ref-style-list'. + (reftex-tie-multifile-symbols): Add doc string. + Initialize `reftex-ref-style-list'. (reftex-untie-multifile-symbols): Add doc string. (reftex-add-index-macros): Doc fix. (reftex-ref-style-activate, reftex-ref-style-toggle) @@ -188,8 +193,8 @@ 2012-09-30 Fabián Ezequiel Gallina Enhancements for triple-quote string syntax. - * progmodes/python.el (python-syntax-propertize-function): Match - both quote cases in one regexp. + * progmodes/python.el (python-syntax-propertize-function): + Match both quote cases in one regexp. (python-syntax-stringify): Handle matches properly. 2012-09-30 Juri Linkov @@ -223,10 +228,10 @@ In buffer display functions handle window-height/window-width alist entries. Suggested by Juri Linkov as fix for Bug#1806. - * window.el (window--display-buffer): New argument ALIST. Obey - window-height and window-width alist entries. - (window--try-to-split-window): New argument ALIST. Bind - window-combination-limit to t when the window's size shall be + * window.el (window--display-buffer): New argument ALIST. + Obey window-height and window-width alist entries. + (window--try-to-split-window): New argument ALIST. + Bind window-combination-limit to t when the window's size shall be changed and window-combination-limit equals `window-size'. (display-buffer-in-atom-window) (display-buffer-in-major-side-window) @@ -249,8 +254,8 @@ temp-buffer-resize-regexps. Use fit-frame-to-buffer instead of temp-buffer-resize-frames. - * dired.el (dired-mark-pop-up): Call - display-buffer-below-selected with a fit-window-to-buffer alist + * dired.el (dired-mark-pop-up): + Call display-buffer-below-selected with a fit-window-to-buffer alist entry. 2012-09-30 Chong Yidong @@ -348,8 +353,8 @@ 2012-09-28 Leo Liu - * pcomplete.el (pcomplete-show-completions): Use - minibuffer-message to make pcomplete usable in minibuffer. + * pcomplete.el (pcomplete-show-completions): + Use minibuffer-message to make pcomplete usable in minibuffer. * ido.el (ido-set-matches-1): Fix 2012-09-11 change. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index d49e56bd2ba..4dd44bb6f22 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1005,13 +1005,20 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." (defvar byte-compile-root-dir nil "Directory relative to which file names in error messages are written.") +;; FIXME: We should maybe extend abbreviate-file-name with an optional DIR +;; argument to try and use a relative file-name. +(defun byte-compile-abbreviate-file (file &optional dir) + (let ((f1 (abbreviate-file-name file)) + (f2 (file-relative-name file dir))) + (if (< (length f2) (length f1)) f2 f1))) + ;; This is used as warning-prefix for the compiler. ;; It is always called with the warnings buffer current. (defun byte-compile-warning-prefix (level entry) (let* ((inhibit-read-only t) (dir (or byte-compile-root-dir default-directory)) (file (cond ((stringp byte-compile-current-file) - (format "%s:" (file-relative-name + (format "%s:" (byte-compile-abbreviate-file byte-compile-current-file dir))) ((bufferp byte-compile-current-file) (format "Buffer %s:" @@ -1019,7 +1026,8 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." ;; We might be simply loading a file that ;; contains explicit calls to byte-compile functions. ((stringp load-file-name) - (format "%s:" (file-relative-name load-file-name dir))) + (format "%s:" (byte-compile-abbreviate-file + load-file-name dir))) (t ""))) (pos (if (and byte-compile-current-file (integerp byte-compile-read-position)) @@ -1746,11 +1754,11 @@ The value is non-nil if there were no errors, nil if errors." (if (with-current-buffer input-buffer no-byte-compile) (progn ;; (message "%s not compiled because of `no-byte-compile: %s'" - ;; (file-relative-name filename) + ;; (byte-compile-abbreviate-file filename) ;; (with-current-buffer input-buffer no-byte-compile)) (when (file-exists-p target-file) (message "%s deleted because of `no-byte-compile: %s'" - (file-relative-name target-file) + (byte-compile-abbreviate-file target-file) (buffer-local-value 'no-byte-compile input-buffer)) (condition-case nil (delete-file target-file) (error nil))) ;; We successfully didn't compile this file. -- cgit v1.2.3 From 5253a5fd755a26e30c73653bc49066f0649ec0eb Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 11 Oct 2012 16:08:38 -0400 Subject: Fix spurious "cl--defsubst-expand might not be defined at runtime" * lisp/emacs-lisp/bytecomp.el (byte-compile-eval): Adjust to long-ago changes to the format of load-history. * src/eval.c (Fautoload): Remember previous autoload status in load-history. --- lisp/ChangeLog | 3 +++ lisp/emacs-lisp/bytecomp.el | 8 +++----- src/ChangeLog | 4 ++++ src/eval.c | 8 +++++--- 4 files changed, 15 insertions(+), 8 deletions(-) (limited to 'lisp/emacs-lisp/bytecomp.el') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ba105ce4716..8d9c85c1326 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2012-10-11 Stefan Monnier + * emacs-lisp/bytecomp.el (byte-compile-eval): Adjust to long-ago + changes to the format of load-history. + * international/mule-cmds.el (read-char-by-name): Move let-binding of completion-ignore-case in case that var is buffer-local (bug#12615). diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 4dd44bb6f22..7534ce5eaca 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -875,13 +875,11 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." (byte-compile-cl-file-p (car xs)))) (dolist (s xs) (cond - ((symbolp s) - (unless (memq s old-autoloads) - (push s byte-compile-noruntime-functions))) ((and (consp s) (eq t (car s))) (push (cdr s) old-autoloads)) - ((and (consp s) (eq 'autoload (car s))) - (push (cdr s) byte-compile-noruntime-functions))))))) + ((and (consp s) (memq (car s) '(autoload defun))) + (unless (memq (cdr s) old-autoloads) + (push (cdr s) byte-compile-noruntime-functions)))))))) ;; Go through current-load-list for the locally defined funs. (let (old-autoloads) (while (and hist-nil-new (not (eq hist-nil-new hist-nil-orig))) diff --git a/src/ChangeLog b/src/ChangeLog index c238af65d2d..839e7e52e00 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2012-10-11 Stefan Monnier + + * eval.c (Fautoload): Remember previous autoload status in load-history. + 2012-10-11 Paul Eggert lread.c, macros.c, marker.c, menu.c, minibuf.c: Use bool for booleans. diff --git a/src/eval.c b/src/eval.c index 4d200fbc2bd..975204da017 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1876,9 +1876,11 @@ this does nothing and returns nil. */) CHECK_STRING (file); /* If function is defined and not as an autoload, don't override. */ - if (!EQ (XSYMBOL (function)->function, Qunbound) - && !(CONSP (XSYMBOL (function)->function) - && EQ (XCAR (XSYMBOL (function)->function), Qautoload))) + if ((CONSP (XSYMBOL (function)->function) + && EQ (XCAR (XSYMBOL (function)->function), Qautoload))) + /* Remember that the function was already an autoload. */ + LOADHIST_ATTACH (Fcons (Qt, function)); + else if (!EQ (XSYMBOL (function)->function, Qunbound)) return Qnil; if (NILP (Vpurify_flag)) -- cgit v1.2.3 From 3a6851d9b459836e1a72af13f44a17d02d9fccc9 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 2 Nov 2012 18:35:01 -0400 Subject: Decouple "noruntime" and "cl-functions" bytecomp warnings * lisp/emacs-lisp/bytecomp.el (byte-compile-eval): Decouple "noruntime" and "cl-functions" warnings. --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/bytecomp.el | 11 +---------- 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'lisp/emacs-lisp/bytecomp.el') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ab73a61d9e6..747bbba97c4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-11-02 Glenn Morris + + * emacs-lisp/bytecomp.el (byte-compile-eval): + Decouple "noruntime" and "cl-functions" warnings. + 2012-11-01 Stephen Berman * play/gomoku.el (gomoku-display-statistics): Update mode line diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 7534ce5eaca..e776df4ef37 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -863,16 +863,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." (let ((xs (pop hist-new)) old-autoloads) ;; Make sure the file was not already loaded before. - (unless (or (assoc (car xs) hist-orig) - ;; Don't give both the "noruntime" and - ;; "cl-functions" warning for the same function. - ;; FIXME This seems incorrect - these are two - ;; independent warnings. For example, you may be - ;; choosing to see the cl warnings but ignore them. - ;; You probably don't want to ignore noruntime in the - ;; same way. - (and (byte-compile-warning-enabled-p 'cl-functions) - (byte-compile-cl-file-p (car xs)))) + (unless (assoc (car xs) hist-orig) (dolist (s xs) (cond ((and (consp s) (eq t (car s))) -- cgit v1.2.3 From e703069f9c23dd94b65e1d81ce57758c7f905bb2 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 8 Nov 2012 09:58:15 -0500 Subject: * lisp/emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment): Byte-compile *before* eval in eval-and-compile. (byte-compile-log-warning): Remove redundant inhibit-read-only. (byte-compile-file-form-autoload): Don't hide actual definition. (byte-compile-maybe-guarded): Accept `functionp' as well. --- lisp/emacs-lisp/bytecomp.el | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'lisp/emacs-lisp/bytecomp.el') diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index e776df4ef37..9baa95dffaa 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -419,8 +419,8 @@ This list lives partly on the stack.") (defconst byte-compile-initial-macro-environment '( -;; (byte-compiler-options . (lambda (&rest forms) -;; (apply 'byte-compiler-options-handler forms))) + ;; (byte-compiler-options . (lambda (&rest forms) + ;; (apply 'byte-compiler-options-handler forms))) (declare-function . byte-compile-macroexpand-declare-function) (eval-when-compile . (lambda (&rest body) (list @@ -429,8 +429,19 @@ This list lives partly on the stack.") (byte-compile-top-level (byte-compile-preprocess (cons 'progn body))))))) (eval-and-compile . (lambda (&rest body) - (byte-compile-eval-before-compile (cons 'progn body)) - (cons 'progn body)))) + ;; Byte compile before running it. Do it piece by + ;; piece, in case further expressions need earlier + ;; ones to be evaluated already, as is the case in + ;; eieio.el. + `(progn + ,@(mapcar (lambda (exp) + (let ((cexp + (byte-compile-top-level + (byte-compile-preprocess + exp)))) + (eval cexp) + cexp)) + body))))) "The default macro-environment passed to macroexpand by the compiler. Placing a macro here will cause a macro to have different semantics when expanded by the compiler as when expanded by the interpreter.") @@ -731,9 +742,11 @@ otherwise pop it") ;; Also, this lets us notice references to free variables. (defmacro byte-compile-push-bytecodes (&rest args) - "Push BYTE... onto BYTES, and increment PC by the number of bytes pushed. -ARGS is of the form (BYTE... BYTES PC), where BYTES and PC are variable names. -BYTES and PC are updated after evaluating all the arguments." + "Push bytes onto BVAR, and increment CVAR by the number of bytes pushed. +BVAR and CVAR are variables which are updated after evaluating +all the arguments. + +\(fn BYTE1 BYTE2 ... BYTEn BVAR CVAR)" (let ((byte-exprs (butlast args 2)) (bytes-var (car (last args 2))) (pc-var (car (last args)))) @@ -1097,8 +1110,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." (defun byte-compile-log-warning (string &optional fill level) (let ((warning-prefix-function 'byte-compile-warning-prefix) (warning-type-format "") - (warning-fill-prefix (if fill " ")) - (inhibit-read-only t)) + (warning-fill-prefix (if fill " "))) (display-warning 'bytecomp string level byte-compile-log-buffer))) (defun byte-compile-warn (format &rest args) @@ -2189,7 +2201,10 @@ list that represents a doc string reference. (when (and (consp (nth 1 form)) (eq (car (nth 1 form)) 'quote) (consp (cdr (nth 1 form))) - (symbolp (nth 1 (nth 1 form)))) + (symbolp (nth 1 (nth 1 form))) + ;; Don't add it if it's already defined. Otherwise, it might + ;; hide the actual definition. + (not (fboundp (nth 1 (nth 1 form))))) (push (cons (nth 1 (nth 1 form)) (cons 'autoload (cdr (cdr form)))) byte-compile-function-environment) @@ -3689,10 +3704,10 @@ If CONDITION's value is (not (featurep 'emacs)) or (featurep 'xemacs), that suppresses all warnings during execution of BODY." (declare (indent 1) (debug t)) `(let* ((fbound-list (byte-compile-find-bound-condition - ,condition (list 'fboundp) + ,condition '(fboundp functionp) byte-compile-unresolved-functions)) (bound-list (byte-compile-find-bound-condition - ,condition (list 'boundp 'default-boundp))) + ,condition '(boundp default-boundp))) ;; Maybe add to the bound list. (byte-compile-bound-variables (append bound-list byte-compile-bound-variables))) -- cgit v1.2.3 From f5925cd9f5e525c1e023c163338ccbf6c19e9ef0 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 9 Nov 2012 10:56:51 -0500 Subject: * lisp/emacs-lisp/bytecomp.el (byte-compile-out-toplevel): Don't turn (funcall '(lambda ..) ..) into ((lambda ..) ..). --- lisp/ChangeLog | 23 ++++++++++++++--------- lisp/emacs-lisp/bytecomp.el | 3 ++- 2 files changed, 16 insertions(+), 10 deletions(-) (limited to 'lisp/emacs-lisp/bytecomp.el') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d7cb2143d36..a7f6d1befb5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,15 +1,20 @@ +2012-11-09 Stefan Monnier + + * emacs-lisp/bytecomp.el (byte-compile-out-toplevel): Don't turn + (funcall '(lambda ..) ..) into ((lambda ..) ..). + 2012-11-09 Vincent Belaïche * ses.el: symbol to coordinate mapping is made by symbol property - `ses-cell'. This means that the same mapping is done for all SES - sheets. That is good enough for cells with standard A1 names, but - not for named cell. So a hash map is added for those - latter. - (defconst ses-localvars): added local variable ses--named-cell-hashmap + `ses-cell'. This means that the same mapping is done for all SES + sheets. That is good enough for cells with standard A1 names, but + not for named cell. So a hash map is added for the latter. + (defconst ses-localvars): Add local variable ses--named-cell-hashmap (ses-sym-rowcol): Use hashmap for named cell. (ses-is-cell-sym-p): New defun. (ses-decode-cell-symbol): New defun. - (ses-create-cell-variable): Add cell to hashmap when name is not A1-like. + (ses-create-cell-variable): Add cell to hashmap when name is not + A1-like. (ses-rename-cell): Check that cell new name is not already in spreadsheet with the use of ses-is-cell-sym-p (ses-rename-cell): Use hash map for named cells, but accept also @@ -120,8 +125,8 @@ 2012-11-05 Agustín Martín Domingo - * textmodes/ispell.el (ispell-program-name): Update - spellchecker parameters when customized. + * textmodes/ispell.el (ispell-program-name): + Update spellchecker parameters when customized. 2012-11-04 Glenn Morris @@ -515,7 +520,7 @@ 2012-10-19 Stefan Monnier * minibuffer.el (minibuffer-force-complete): Make the next completion use - the same completion-field (bug@12221). + the same completion-field (bug#12221). 2012-10-19 Martin Rudalics diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 9baa95dffaa..a325e0f3e44 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2823,7 +2823,8 @@ for symbols generated by the byte compiler itself." (setq body (nreverse body)) (setq body (list (if (and (eq tmp 'funcall) - (eq (car-safe (car body)) 'quote)) + (eq (car-safe (car body)) 'quote) + (symbolp (nth 1 (car body)))) (cons (nth 1 (car body)) (cdr body)) (cons tmp body)))) (or (eq output-type 'file) -- cgit v1.2.3 From 5d0ccd9509a21ef18e60004a4d46e60a916e4a36 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 20 Nov 2012 14:05:20 -0500 Subject: * lisp/emacs-lisp/bytecomp.el (byte-compile): Fix handling of closures. --- lisp/ChangeLog | 2 ++ lisp/emacs-lisp/bytecomp.el | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp/bytecomp.el') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index edb1a65266e..910cc3522bd 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2012-11-20 Stefan Monnier + * emacs-lisp/bytecomp.el (byte-compile): Fix handling of closures. + * emacs-lisp/byte-run.el (defun-declarations-alist): Fix last change. * subr.el (called-interactively-p-functions): New var. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index a325e0f3e44..60036c86dc0 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2509,8 +2509,8 @@ If FORM is a lambda or a macro, byte-compile it as a function." (when (symbolp form) (unless (memq (car-safe fun) '(closure lambda)) (error "Don't know how to compile %S" fun)) - (setq fun (byte-compile--reify-function fun)) - (setq lexical-binding (eq (car fun) 'closure))) + (setq lexical-binding (eq (car fun) 'closure)) + (setq fun (byte-compile--reify-function fun))) (unless (eq (car-safe fun) 'lambda) (error "Don't know how to compile %S" fun)) ;; Expand macros. -- cgit v1.2.3 From 002c019c34eeb1cad4ce8f5ae721b1cdf22f0946 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 23 Nov 2012 16:49:13 -0500 Subject: * lisp/emacs-lisp/bytecomp.el (byte-compile-file): Setup default value for lexical-binding. Fixes: debbugs:12938 --- lisp/ChangeLog | 13 +++++++++---- lisp/emacs-lisp/bytecomp.el | 3 +++ 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'lisp/emacs-lisp/bytecomp.el') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index be04ad733f0..431f45c3695 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-11-23 Stefan Monnier + + * emacs-lisp/bytecomp.el (byte-compile-file): Setup default value for + lexical-binding (bug#12938). + 2012-11-23 Wolfgang Jenkner * image-mode.el (image-transform-check-size): Use assertions only @@ -43,14 +48,14 @@ (c-debug-parse-state): Call the above new function. (c-toggle-parse-state-debug): Output a confirmatory message. - * progmodes/cc-mode.el (c-before-change, c-after-change): Call - c-invalidate-state-cache from `c-before-change' instead of + * progmodes/cc-mode.el (c-before-change, c-after-change): + Call c-invalidate-state-cache from `c-before-change' instead of `c-after-change'. 2012-11-20 Daniel Colascione - * term/w32-win.el (cygwin-convert-path-from-windows): Accomodate - rename of cygwin_convert_path* to cygwin_convert_file_name*. + * term/w32-win.el (cygwin-convert-path-from-windows): + Accomodate rename of cygwin_convert_path* to cygwin_convert_file_name*. This change is a backport from trunk. 2012-11-20 Eli Zaretskii diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 7534ce5eaca..df6a79d5196 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1745,6 +1745,9 @@ The value is non-nil if there were no errors, nil if errors." ;; There may be a file local variable setting (bug#10419). (setq buffer-read-only nil filename buffer-file-name)) + ;; Don't inherit lexical-binding from caller (bug#12938). + (unless (local-variable-p 'lexical-binding) + (setq-local lexical-binding nil)) ;; Set the default directory, in case an eval-when-compile uses it. (setq default-directory (file-name-directory filename))) ;; Check if the file's local variables explicitly specify not to -- cgit v1.2.3